/* Gallery page — extends style.css ─────────────────────────────────── */

.gallery-hero {
  padding: calc(var(--header-h) + 4rem) var(--gutter) 3rem;
  background: var(--c-bg-alt);
  text-align: center;
}
.gallery-hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  letter-spacing: 0.32em;
  margin-bottom: 0.6rem;
}
.gallery-hero p {
  color: var(--c-ink-muted);
  max-width: 56ch;
  margin: 0 auto;
}

/* Full-bleed shell with sticky sidebar + masonry grid ───────────────── */
.gallery-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 3rem);
  width: 100%;
  max-width: none;
  padding: clamp(2rem, 4vw, 3.5rem) clamp(1rem, 2.5vw, 2rem) 5rem;
  background: var(--c-bg);
}

.gallery-side {
  position: sticky;
  top: calc(var(--header-h) + 1.6rem);
  align-self: start;
}
.gallery-side .filters {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  margin: 0;
}
.gallery-side .filter {
  position: relative;
  width: 100%;
  text-align: left;
  margin: 0;
  padding: 0.7rem 0 0.7rem 1.2rem;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  font-size: 0.78rem;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--c-ink-muted);
  cursor: pointer;
  transition:
    color var(--transition),
    border-color var(--transition),
    padding-left var(--transition);
}
.gallery-side .filter:hover {
  color: var(--c-ink);
  padding-left: 1.6rem;
}
.gallery-side .filter.is-active {
  color: var(--c-accent-deep);
  border-left-color: var(--c-accent);
  padding-left: 1.6rem;
}

/* Mobile — sidebar collapses to a horizontal bar above the grid */
@media (max-width: 860px) {
  .gallery-shell { grid-template-columns: 1fr; }
  .gallery-side {
    position: static;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * clamp(1rem, 2.5vw, 2rem));
    padding: 0 clamp(1rem, 2.5vw, 2rem);
  }
  .gallery-side .filters {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.25rem;
  }
  .gallery-side .filter {
    width: auto;
    flex-shrink: 0;
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 0.6rem;
  }
  .gallery-side .filter:hover { padding-left: 0.6rem; }
  .gallery-side .filter.is-active {
    padding-left: 0.6rem;
    border-left: 0;
    border-bottom-color: var(--c-accent);
  }
}

/* Masonry grid via CSS columns — minimalist, varied heights ───────── */
.gallery {
  column-count: 3;
  column-gap: 0.6rem;
}
@media (max-width: 1200px) { .gallery { column-count: 3; } }
@media (max-width: 900px)  { .gallery { column-count: 2; } }
@media (max-width: 540px)  { .gallery { column-count: 1; } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 0.6rem;
  break-inside: avoid;
  overflow: hidden;
  background: var(--c-bg-alt);
  cursor: zoom-in;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}
.tile.is-hidden { display: none; }

.tile img,
.tile video {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 700ms ease, opacity var(--transition);
}
.tile video {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.tile.is-playing video { opacity: 1; }
.tile.is-playing img   { opacity: 0; }
.tile:hover img        { transform: scale(1.03); }

/* Subtle hover overlay so the tile feels interactive */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 60%, rgba(0,0,0,0.32) 100%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.tile:hover::after { opacity: 1; }

.tile__label {
  position: absolute;
  left: 0.9rem; bottom: 0.9rem;
  z-index: 2;
  color: #fff;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
  pointer-events: none;
}
.tile:hover .tile__label,
.tile:focus-visible .tile__label { opacity: 1; transform: translateY(0); }

.tile__sound {
  position: absolute;
  right: 0.7rem; bottom: 0.7rem;
  z-index: 3;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 0;
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background var(--transition);
}
.tile__sound:hover { background: rgba(0,0,0,0.8); }
.tile__sound svg   { width: 16px; height: 16px; }
.tile.is-video .tile__sound { display: inline-flex; }

.tile__playicon {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}
.tile.is-video .tile__playicon { display: flex; }
.tile.is-playing .tile__playicon { display: none; }
.tile__playicon svg {
  width: 54px; height: 54px;
  color: #fff;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  opacity: 0.92;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--c-ink-muted);
  column-span: all;
}

/* ── Lightbox ──────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 16, 12, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  transition: opacity var(--transition);
}
.lightbox.is-open {
  display: flex;
  opacity: 1;
}
body.lightbox-open { overflow: hidden; }

.lightbox__stage {
  position: relative;
  width: 100%;
  max-width: 1400px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__media {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.lightbox__btn {
  position: absolute;
  z-index: 2;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background var(--transition), border-color var(--transition);
}
.lightbox__btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.85);
}
.lightbox__btn svg { width: 22px; height: 22px; }

.lightbox__prev  { left: clamp(0.5rem, 2vw, 2rem); top: 50%; transform: translateY(-50%); }
.lightbox__next  { right: clamp(0.5rem, 2vw, 2rem); top: 50%; transform: translateY(-50%); }
.lightbox__close { right: clamp(0.5rem, 2vw, 2rem); top: clamp(0.8rem, 2vw, 1.5rem); }

.lightbox__counter {
  position: absolute;
  left: 50%;
  bottom: clamp(0.8rem, 2vw, 1.5rem);
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.7);
  font-size: 0.74rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

@media (max-width: 540px) {
  .lightbox__prev,
  .lightbox__next {
    width: 44px; height: 44px;
    bottom: clamp(0.8rem, 2vw, 1.5rem);
    top: auto;
    transform: none;
  }
  .lightbox__prev { left: clamp(0.5rem, 2vw, 1rem); }
  .lightbox__next { right: clamp(0.5rem, 2vw, 1rem); }
}
