/* ============================================================
   THE GARDEN HOUSE — Gallery component
   Used on: photos.html, history.html, house.html, garden.html,
            neighborhood.html
   Loaded after style.css so it can use the same CSS variables
   ============================================================ */

.gallery-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: clamp(20px, 3vw, 32px);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.gallery-toolbar .filter {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 6px 14px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.gallery-toolbar .filter:hover { color: var(--ink); border-color: var(--ink-faint); }
.gallery-toolbar .filter.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.gallery-toolbar .count {
  margin-left: auto;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.gallery-section-label {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-style: italic;
  margin: clamp(28px, 4vw, 48px) 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.gallery-section-label:first-of-type { margin-top: 0; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.gallery-item {
  margin: 0;
  position: relative;
  background: var(--bg-soft);
  overflow: hidden;
  aspect-ratio: 1;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform .25s ease;
}
.gallery-item:hover img { transform: scale(1.03); }
.gallery-item .gallery-meta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.gallery-item:hover .gallery-meta { opacity: 1; }
.gallery-item .gallery-date {
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.08em;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
}
.gallery-item .gallery-download {
  pointer-events: auto;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  font-size: 16px;
  border-radius: 0;
  transition: background .15s;
}
.gallery-item .gallery-download:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.gallery-item .gallery-cat {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(255,255,255,0.85);
  color: var(--ink);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.gallery-item:hover .gallery-cat { opacity: 1; }

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 16, 0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  display: block;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.lightbox-video {
  max-width: 92vw;
  max-height: 80vh;
  background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

/* Video item — play overlay */
.gallery-item.is-video .gallery-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  background: rgba(20, 18, 16, 0.7);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  border-radius: 50%;
  pointer-events: none;
  transition: background .15s, transform .15s;
  text-indent: 4px; /* visually center the play triangle */
}
.gallery-item.is-video:hover .gallery-play {
  background: var(--accent);
  transform: translate(-50%, -50%) scale(1.06);
}
.gallery-item.is-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.05);
  pointer-events: none;
}
.lightbox-controls {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: rgba(255,255,255,0.85);
  font-family: "Cormorant Garamond", Georgia, serif;
}
.lightbox-info { font-size: 14px; letter-spacing: 0.08em; font-style: italic; }
.lightbox-info .lb-cat {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  margin-right: 12px;
  color: var(--accent-l);
  font-style: normal;
}
.lightbox-actions { display: flex; gap: 14px; align-items: center; }
.lightbox-btn {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.1); color: #fff; text-decoration: none; }
.lightbox-close { font-size: 22px; padding: 4px 12px; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: none;
  width: 48px; height: 80px;
  font-size: 28px;
  cursor: pointer;
  transition: background .15s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gallery-loading,
.gallery-empty {
  padding: 40px 0;
  text-align: center;
  color: var(--ink-faint);
  font-style: italic;
  font-size: 15px;
}

@media (max-width: 700px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .lightbox-controls { padding: 14px; }
  .lightbox-nav { width: 36px; height: 60px; font-size: 22px; }
}
