/**
 * Caldera Films 2026 — Stills Gallery CSS
 * Loaded only on /stills/ via functions.php (is_page('stills')).
 *
 * @package caldera-films
 */

/* ─── DESIGN TOKENS ──────────────────────────────────────────────────────────
   Redeclared here because homepage-2026.css only loads on the front page.
─────────────────────────────────────────────────────────────────────────── */
:root {
  --bg:     #0e0e0e;
  --fg:     #f0ede6;
  --brand:  #ea3c25;
  --rule:   rgba(240, 237, 230, 0.07);
  --serif:  'Playfair Display', Georgia, serif;
  --sans:   'Inter', system-ui, sans-serif;
  --depth:  0;   /* 0 → 1, driven by stills-2026.js scroll listener */
}

/* ─── COLOUR SCOPE ───────────────────────────────────────────────────────── */
.st-tagline,
.st-wall,
.st-empty {
  color: var(--fg);
}

/* ─── TAGLINE BOOKENDS ───────────────────────────────────────────────────── */
/* Matches the homepage eyebrow "DIRECTOR-LED VIDEO PRODUCTION" style */
.st-tagline {
  font-family: var(--sans);
  font-size:   10px;
  font-weight: 400;
  letter-spacing: 0.30em;
  text-transform: uppercase;
  color:    var(--fg);
  opacity:  0.28;
  text-align: center;
  padding:  60px clamp(24px, 6vw, 80px) 44px;
  display:  block;
  user-select: none;
}
.st-tagline--exit {
  padding-top:    52px;
  padding-bottom: 80px;
}

/* ─── MASONRY WALL ───────────────────────────────────────────────────────── */
.st-wall {
  column-count: 4;
  column-gap:   calc(12px + (1 - var(--depth)) * 10px);  /* 22px → 12px */
  padding:      0 clamp(16px, 4vw, 48px) 48px;
  max-width:    1600px;
  margin:       0 auto;
}

@media (max-width: 1200px) { .st-wall { column-count: 3; } }
@media (max-width: 768px)  { .st-wall { column-count: 2; } }

/* ─── MASONRY ITEMS ──────────────────────────────────────────────────────── */
.st-item {
  break-inside:  avoid;
  display:       block;
  margin-bottom: calc(12px + (1 - var(--depth)) * 10px);  /* mirrors column-gap */
  border-radius: 10px;
  overflow:      hidden;
  cursor:        pointer;
  position:      relative;

  /* ── focus-in reveal: start hidden, slightly below ── */
  opacity:   0;
  transform: translateY(18px);
  transition: opacity 0.55s ease-out, transform 0.55s ease-out;
}

/* Revealed state — added by IntersectionObserver */
.st-item.st-in {
  opacity:   1;
  transform: none;
}

/* ─── IMAGE INSIDE ITEM ──────────────────────────────────────────────────── */
.st-item img {
  width:   100%;
  height:  auto;
  display: block;

  /* hover zoom — transform only */
  transition: transform 0.4s ease;

  /* depth filter: calmer/dimmer at top of page → fuller/richer at bottom */
  /* only applies once .st-in is set (parent has opacity 1) */
}

/* Filter driven by scroll depth — only on revealed images */
.st-item.st-in img {
  filter:
    brightness(calc(0.80 + var(--depth) * 0.20))
    saturate(calc(0.82 + var(--depth) * 0.18));
}

/* Hover zoom: image scales inside its clipped container */
.st-item:hover img,
.st-item:focus-visible img {
  transform: scale(1.06);
}

/* ─── FOCUS STATES ───────────────────────────────────────────────────────── */
.st-item:focus-visible {
  outline:        2px solid var(--brand);
  outline-offset: 3px;
}

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.st-empty {
  font-family:     var(--sans);
  font-size:       11px;
  letter-spacing:  0.18em;
  text-transform:  uppercase;
  opacity:         0.35;
  text-align:      center;
  padding:         100px 0;
  column-span:     all;
}

/* ─── LIGHTBOX ───────────────────────────────────────────────────────────── */
#st-lightbox {
  display:         none;
  position:        fixed;
  inset:           0;
  z-index:         9999;
  background:      rgba(8, 8, 8, 0.97);
  align-items:     center;
  justify-content: center;
  padding:         64px 80px;
  box-sizing:      border-box;
}
#st-lightbox.open {
  display: flex;
}

#st-lb-img {
  max-width:   90vw;
  max-height:  90vh;
  width:       auto;
  height:      auto;
  object-fit:  contain;
  border-radius: 6px;
  box-shadow:  0 40px 120px rgba(0, 0, 0, 0.65);
  display:     block;
  transition:  opacity 0.18s ease;
}
#st-lb-img.lb-loading {
  opacity: 0.15;
}

/* Buttons: close · prev · next */
.st-lb-btn {
  position:    fixed;
  background:  none;
  border:      none;
  color:       var(--fg);
  cursor:      pointer;
  opacity:     0.45;
  transition:  opacity 0.2s;
  line-height: 1;
  z-index:     10;
  font-family: var(--sans);
  padding:     16px 20px;
}
.st-lb-btn:hover,
.st-lb-btn:focus-visible {
  opacity: 1;
}
.st-lb-btn:focus-visible {
  outline:        2px solid var(--brand);
  outline-offset: 4px;
}

.st-lb-close {
  top:       28px;
  right:     32px;
  font-size: 14px;
  letter-spacing: 0.14em;
}
.st-lb-prev,
.st-lb-next {
  top:       50%;
  transform: translateY(-50%);
  font-size: 44px;
  font-weight: 100;
}
.st-lb-prev { left:  12px; }
.st-lb-next { right: 12px; }

/* Position counter — "12 / 48" */
.st-lb-counter {
  position:   fixed;
  bottom:     28px;
  left:       50%;
  transform:  translateX(-50%);
  font-family: var(--sans);
  font-size:  10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color:      var(--fg);
  opacity:    0.30;
  pointer-events: none;
  z-index:    10;
  white-space: nowrap;
}

/* ─── PREFERS-REDUCED-MOTION ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .st-item {
    opacity:   1;
    transform: none;
    transition: none;
  }
  .st-item img,
  .st-item.st-in img {
    filter:     none;
    transition: none;
  }
  #st-lb-img {
    transition: none;
  }
  :root { --depth: 1; }
}
