/* ============================================
   GALLERY PAGE
   Builds on global.css tokens + parallax.css shell
   Chapters: Red Carpet · Press · Behind the Scenes
   ============================================ */

/* Break out of the centred parallax column */
.gl {
  align-self: stretch;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  text-align: left;
}

/* ── Intro + stats ─────────────────────────── */
.gl-intro {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  padding: 1rem 0 4rem;
}

.gl-intro-lead {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: -0.02em;
  max-width: 36ch;
}

.gl-intro-lead em {
  font-style: normal;
  color: var(--color-text-muted);
}

.gl-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.gl-stat {
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
}

.gl-stat-num {
  display: block;
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
}

.gl-stat-label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* ── Sticky chapter nav ────────────────────── */
.gl-nav {
  position: sticky;
  top: var(--nav-height);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 1rem 0;
  background: rgba(252, 251, 246, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.gl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-width: 0;
  max-width: 100%;
}

.gl-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--color-text-primary);
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out), border-color 0.25s;
}

.gl-pill sup {
  font-size: 0.55rem;
  letter-spacing: 0.05em;
  opacity: 0.55;
  top: 0;
}

.gl-pill:hover { border-color: #000; }

.gl-pill[aria-current="true"] {
  background: #000;
  border-color: #000;
  color: #fff;
}

.gl-nav-hint {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ── Chapters ──────────────────────────────── */
.gl-chapter {
  position: relative;
  padding: clamp(4rem, 8vw, 6.5rem) 0;
  scroll-margin-top: calc(var(--nav-height) + 70px);
}

.gl-chapter[hidden] {
  display: none !important;
}

.gl-chapter--dark {
  margin: 4rem calc(-1 * clamp(1rem, 4vw, 4rem));
  padding: clamp(3.5rem, 6vw, 5.5rem) clamp(1.5rem, 5vw, 5rem);
  background: var(--color-black);
  color: #fff;
  border-radius: 40px;
}

.gl-chapter-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.5rem clamp(1.25rem, 3vw, 2.5rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}

.gl-chapter-num {
  font-size: clamp(4rem, 11vw, 9rem);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: -0.06em;
  color: transparent;
  -webkit-text-stroke: 1.5px currentColor;
  opacity: 0.9;
  will-change: transform;
}

.gl-chapter--dark .gl-chapter-num { -webkit-text-stroke-color: rgba(255, 255, 255, 0.85); }
.gl-chapter:not(.gl-chapter--dark) .gl-chapter-num { -webkit-text-stroke-color: #000; }

.gl-chapter-title h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.gl-chapter-title p {
  margin-top: 0.75rem;
  max-width: 48ch;
  font-size: 0.9rem;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--color-text-secondary);
}

.gl-chapter--dark .gl-chapter-title p { color: var(--color-text-on-dark-muted); }

.gl-chapter-count {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.gl-chapter--dark .gl-chapter-count { color: var(--color-text-on-dark-muted); }

/* ── Red Carpet: sticky cover + bento ──────── */
.gl-rc {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: clamp(1rem, 2vw, 1.5rem);
  align-items: start;
}

.gl-tile.gl-cover {
  position: sticky;
  top: calc(var(--nav-height) + 90px);
  height: auto;
  aspect-ratio: 4 / 5;
  max-height: calc(100vh - var(--nav-height) - 120px);
  border-radius: 24px;
}

.gl-cover .gl-tile-meta {
  opacity: 1;
  transform: none;
}

.gl-cover img {
  object-position: center top;
}

.gl-cover-label {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  z-index: 2;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #fff;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(0, 0, 0, 0.2);
}

/* ── Bento grid ────────────────────────────── */
.gl-bento {
  --cols: 4;
  --gap: clamp(0.5rem, 1.2vw, 1rem);
  --row: 240px; /* replaced by JS with the exact column width → square cells */
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: var(--row);
  grid-auto-flow: dense;
  gap: var(--gap);
}

.gl-rc .gl-bento { --cols: 3; }

/* ── Tiles ─────────────────────────────────── */
.gl-tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: var(--color-cream-dark);
  color: #fff;
  isolation: isolate;
  cursor: zoom-in;
}

.gl-chapter--dark .gl-tile { background: #1a1a1a; }

.gl-tile--tall { grid-row: span 2; }
.gl-tile--wide { grid-column: span 2; }
.gl-tile--big  { grid-column: span 2; grid-row: span 2; }

.gl-tile img,
.gl-tile video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.5s var(--ease-out);
}

.gl-tile img { opacity: 0; }
.gl-tile img.is-loaded { opacity: 1; }

.gl-tile video {
  z-index: 1;
  opacity: 0;
}

.gl-tile.is-playing video { opacity: 1; }

.gl-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 45%);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  pointer-events: none;
}

.gl-tile-meta {
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.8rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

.gl-tile-meta em {
  font-style: normal;
  letter-spacing: 0.12em;
  opacity: 0.75;
}

.gl-play {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem 0.35rem 0.45rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  transition: opacity 0.3s;
}

.gl-play svg { flex: none; }

@media (hover: hover) {
  .gl-tile:hover img,
  .gl-tile:hover video { transform: scale(1.045); }
  .gl-tile:hover::after { opacity: 1; }
  .gl-tile:hover .gl-tile-meta { opacity: 1; transform: none; }
}

.gl-tile:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.gl-chapter:not(.gl-chapter--dark) .gl-tile:focus-visible { outline-color: #000; }

/* ── Year groups ───────────────────────────── */
.gl-year + .gl-year { margin-top: clamp(2.5rem, 5vw, 4rem); }

.gl-year-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.gl-year-head h3 {
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.gl-year-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
  align-self: center;
}

.gl-chapter--dark .gl-year-head::after { background: var(--color-border-light); }

.gl-year-head span {
  order: 2;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* ── Show more ─────────────────────────────── */
.gl-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.gl-more {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: transform 0.3s var(--ease-out), background 0.3s;
}

.gl-more:hover { transform: translateY(-2px); }

.gl-chapter--dark .gl-more {
  background: #fff;
  color: #000;
}

.gl-more-count {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.gl-chapter--dark .gl-more-count { color: var(--color-text-on-dark-muted); }

/* ── BTS film strip ────────────────────────── */
.gl-strip-wrap {
  position: relative;
  margin: 0 calc(-1 * clamp(1.5rem, 5vw, 5rem)) clamp(3rem, 6vw, 4.5rem);
}

.gl-strip {
  display: flex;
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 clamp(1.5rem, 5vw, 5rem);
  padding: 0.5rem clamp(1.5rem, 5vw, 5rem) 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  cursor: grab;
}

.gl-strip.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.gl-strip.is-dragging .gl-tile { pointer-events: none; }

.gl-strip .gl-tile {
  flex: none;
  height: clamp(280px, 42vw, 460px);
  width: auto;
  aspect-ratio: var(--ar, 1);
  scroll-snap-align: start;
  border-radius: 18px;
}

.gl-strip-index {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #fff;
  mix-blend-mode: difference;
}

.gl-strip-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(1.5rem, 5vw, 5rem);
}

.gl-strip-controls p {
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--color-text-on-dark-muted);
}

.gl-strip-btns { display: flex; gap: 0.5rem; }

.gl-round-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.gl-round-btn:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.gl-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
}

.gl-subhead h3 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

/* ── Credits ───────────────────────────────── */
.gl-credit {
  margin-top: 2.5rem;
  font-size: 0.7rem;
  line-height: 1.6;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--color-text-muted);
  text-align: center;
}

/* ══════════════════════════════════════════════
   Lightbox
   ══════════════════════════════════════════════ */
.gl-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.96);
  color: #fff;
  overflow: hidden;
}

.gl-lightbox::backdrop { background: rgba(0, 0, 0, 0.6); }

.gl-lightbox[open] { animation: gl-fade 0.35s var(--ease-out); }

@keyframes gl-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gl-lb-inner {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
}

.gl-lb-top,
.gl-lb-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.gl-lb-counter { font-variant-numeric: tabular-nums; color: var(--color-text-on-dark-muted); }

.gl-lb-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, color 0.25s, transform 0.3s var(--ease-out);
}

.gl-lb-close:hover {
  background: #fff;
  color: #000;
  transform: rotate(90deg);
}

.gl-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 clamp(3.5rem, 8vw, 6rem);
  touch-action: pan-y;
}

.gl-lb-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.gl-lb-media img,
.gl-lb-media video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  user-select: none;
  -webkit-user-drag: none;
}

.gl-lb-media img.is-swap { animation: gl-fade 0.3s var(--ease-out); }

.gl-lb-media.is-enter-next { animation: gl-in-next 0.45s var(--ease-out); }
.gl-lb-media.is-enter-prev { animation: gl-in-prev 0.45s var(--ease-out); }

@keyframes gl-in-next { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes gl-in-prev { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }

.gl-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.gl-lb-nav:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.gl-lb-prev { left: clamp(0.5rem, 2vw, 1.5rem); }
.gl-lb-next { right: clamp(0.5rem, 2vw, 1.5rem); }

.gl-lb-caption { color: #fff; }
.gl-lb-caption em {
  font-style: normal;
  color: var(--color-text-on-dark-muted);
  margin-left: 0.75rem;
}

.gl-lb-open {
  color: var(--color-text-on-dark-muted);
  transition: color 0.2s;
}

.gl-lb-open:hover { color: #fff; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .gl-bento { --cols: 3; }
  .gl-rc { grid-template-columns: 1fr; }
  .gl-tile.gl-cover { position: relative; top: 0; aspect-ratio: 4 / 5; max-height: 80vh; }
  .gl-rc .gl-bento { --cols: 3; }
}

@media (max-width: 768px) {
  .gl-intro { grid-template-columns: 1fr; padding-bottom: 3rem; }
  .gl-bento,
  .gl-rc .gl-bento { --cols: 2; }
  .gl-chapter-head { grid-template-columns: 1fr; gap: 0.75rem; }
  .gl-chapter-num { font-size: 4.5rem; }
  .gl-chapter--dark { border-radius: 28px; }
  .gl-nav { display: block; width: 100%; max-width: 100%; overflow: hidden; }
  .gl-nav-hint { display: none; }
  .gl-pills {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .gl-pills::-webkit-scrollbar { display: none; }
  .gl-pill { flex: 0 0 auto; white-space: nowrap; }
  .gl-lb-stage { padding: 0 0.75rem; }
  .gl-lb-nav { display: none; }
  .gl-tile-meta { opacity: 1; transform: none; font-size: 0.5rem; }
  .gl-tile::after { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .gl-tile img,
  .gl-tile video,
  .gl-lightbox[open],
  .gl-lb-media.is-enter-next,
  .gl-lb-media.is-enter-prev { transition: none; animation: none; }
}
