/* ─────────────────────────────────────────
   GALLERY — Page-specific Styles
   EEST NJT Racing Circuit
   Uses the shared gallery + section-header + button systems from
   components.css / layout.css. Everything here is scoped under
   .page-gallery so nothing leaks to pages that also load this sheet.
───────────────────────────────────────── */

/* Operator (2026-08-22): unify the two darks below the hero seam to the DARKER one.
   The hero clip-path reveals the body plum (--bg-dark #2A0018) through the transparent
   #main-content + transparent content sections. Painting #main-content #050505 turns that
   wedge — and the content backdrop — the same near-black as the section below, so the
   diagonal seam reads against one uniform dark (mirrors the homepage fix). */
.page-gallery #main-content { background-color: #050505; }

/* ═══════════════════════════════════════
   0. HERO — utility/archive scale (55vh) + centred content
   (V3 §3.1: scoped under .page-gallery so the centring overrides
    can no longer restyle any other page that loads gallery.css)
═══════════════════════════════════════ */
/* V4 §G8 — the hero CTA measured 0% visible at ≥768 and hit-tested to the next
   section. Three causes compounded: a 55vh box shorter than its own content, the
   shared 15% bottom clip-path, and `overflow:hidden` on the section. The box now
   sizes to its content with a real floor, the header gutter is reserved at the
   top so the breadcrumb clears the fixed bar, and the CTA sits well above the
   clipped corner. */
.page-gallery .njt-hero {
  height: auto;
  min-height: max(55vh, 620px);
  padding-top: calc(var(--header-h) + 24px);
  padding-bottom: 96px;
}
.page-gallery .njt-hero__content {
  height: auto;
}
/* breadcrumb rides in normal flow at the top of the hero stack */
.page-gallery .njt-hero .njt-breadcrumb {
  position: relative;
  top: auto;
}
.page-gallery .njt-hero__ctas {
  position: relative;
  z-index: 5;
}
@media (max-width: 767px) {
  .page-gallery .njt-hero {
    min-height: max(55vh, 540px);
    padding-bottom: 80px;
  }
}
/* Hero LCP: real <img> inside the Ken-Burns .njt-hero__bg container (R3 perf —
   CSS background-image was low-priority and queued behind the payload on mobile,
   LCP 20.6s). The <img fetchpriority="high"> + head preload makes the hero paint
   the LCP immediately. */
.page-gallery .njt-hero__bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.page-gallery .njt-hero__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
}
.page-gallery .njt-hero__overline {
  font-family: var(--font-heading, 'Prompt', sans-serif);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}
.page-gallery .njt-hero__title {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.page-gallery .njt-hero__subtitle {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  margin-bottom: 28px;
}
/* Breadcrumb sits above the overline, centred to match the hero */
.page-gallery .njt-hero .njt-breadcrumb {
  justify-content: center;
  margin-bottom: 20px;
}
.page-gallery .njt-hero__ctas {
  justify-content: center;
}

/* ═══════════════════════════════════════
   1. SECTION SUBTITLE (headers now use the canonical
      .njt-section__header / __overline / __title--display system)
═══════════════════════════════════════ */
.gl-section__lead {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-white-60);
  max-width: 600px;
  margin: 12px auto 0;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   1B. CONTAINER WIDTH — match header (1400px, 32px gutter)
   HOUSE-RULES §9 width normalization (container--wide markup)
═══════════════════════════════════════ */
.page-gallery .gl-featured .container.container--wide,
.page-gallery .gl-gallery .container.container--wide,
.page-gallery .gl-videos .container.container--wide,
.page-gallery .gl-cta .container.container--wide {
  padding-left: 32px;
  padding-right: 32px;
}
.page-gallery .gl-gallery .njt-gallery__grid {
  max-width: var(--max-w);
}
/* V4 §G8: the 2.75:1 aerial was letterboxed into a 1-up square cell and read as a
   crop error. Panoramic frames take the width their aspect ratio asks for. */
.page-gallery .njt-gallery__item--pano {
  grid-column: span 2;
  aspect-ratio: 2.4 / 1;
}
@media (max-width: 767px) {
  /* the shared grid drops to 2 columns here, so span 2 is the full row */
  .page-gallery .njt-gallery__item--pano { aspect-ratio: 2 / 1; }
}

/* ═══════════════════════════════════════
   2. FEATURED MOMENTS — Masonry Hero Grid
═══════════════════════════════════════ */
.gl-featured {
  position: relative;
  padding: var(--section-pad) 0;
  background: var(--section-gradient);
  overflow: hidden;
}

.gl-featured__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
}

.gl-featured__item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
}

.gl-featured__item--large {
  grid-column: span 2;
  grid-row: span 2;
}

.gl-featured__item--wide {
  grid-column: span 2;
}

.gl-featured__img {
  width: 100%;
  height: 100%;
  min-height: 200px;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.gl-featured__item--large .gl-featured__img {
  min-height: 420px;
}

.gl-featured__item:hover .gl-featured__img {
  transform: scale(1.06);
}

/* Persistent caption at rest (V3 §3.2) — always-on bottom gradient,
   caption + category shown; hover deepens the gradient */
.gl-featured__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, rgba(0,0,0,0.78));
  opacity: 1;
  transition: background 0.4s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  pointer-events: none;
}

.gl-featured__item:hover .gl-featured__overlay {
  background: linear-gradient(transparent 30%, rgba(0,0,0,0.86));
}

.gl-featured__caption {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-white);
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.gl-featured__category {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.gl-featured__badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.7);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════
   3. GALLERY FILTER + GRID OVERRIDES
═══════════════════════════════════════ */
.gl-gallery {
  position: relative;
  padding: var(--section-pad) 0;
  overflow: hidden;
}

.gl-gallery .njt-gallery__filters {
  margin-bottom: 40px;
}

/* Gallery item caption overlay — persistent title + gradient at rest;
   category revealed on hover (V3 §3.3 craft). Touch devices keep the
   category visible (no hover state). */
.gl-gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 14px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  z-index: 2;
  pointer-events: none;
}

.gl-gallery__caption-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-white);
  margin-bottom: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.gl-gallery__caption-cat {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.35s ease;
}

.njt-gallery__item:hover .gl-gallery__caption-cat {
  max-height: 1.4em;
  opacity: 1;
}

/* Touch / no-hover devices: keep the category label persistent */
@media (hover: none) {
  .gl-gallery__caption-cat { max-height: 1.4em; opacity: 1; }
}

/* Category badge on gallery items */
.gl-gallery__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.5);
  font-family: var(--font-heading);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Filter animation for items */
.njt-gallery__item[data-category] {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.njt-gallery__item.is-hidden {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  position: absolute;
  visibility: hidden;
}

/* Expand icon overlay */
.gl-gallery__expand {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.njt-gallery__item:hover .gl-gallery__expand {
  opacity: 1;
  transform: scale(1);
}

/* ═══════════════════════════════════════
   4. LIGHTBOX MODAL (image + video share the shell)
═══════════════════════════════════════ */
.gl-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gl-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.gl-lightbox__img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gl-lightbox__img,
.gl-lightbox__video {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transition: opacity 0.3s ease;
}

.gl-lightbox__video {
  width: min(90vw, 1280px);
  background: #000;
}

.gl-lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-white);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.gl-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.gl-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-white);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 10;
}

.gl-lightbox__nav:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.4);
  color: var(--gold);
}

.gl-lightbox__nav--prev { left: 20px; }
.gl-lightbox__nav--next { right: 20px; }

.gl-lightbox__info {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
}

.gl-lightbox__caption {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-white);
}

.gl-lightbox__counter {
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--gold);
}

/* ═══════════════════════════════════════
   5. VIDEO GALLERY
═══════════════════════════════════════ */
.gl-videos {
  position: relative;
  padding: var(--section-pad) 0;
  background: var(--section-gradient);
  overflow: hidden;
}

.gl-videos__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.gl-video-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.gl-video-card:hover,
.gl-video-card:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 215, 0, 0.2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.05);
  outline: none;
}

.gl-video-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.gl-video-card__thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
}

.gl-video-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gl-video-card:hover .gl-video-card__thumb img {
  transform: scale(1.05);
}

.gl-video-card__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.9);
  color: var(--black-true);
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
  transition: all 0.3s ease;
}

.gl-video-card:hover .gl-video-card__play {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 6px 30px rgba(255, 215, 0, 0.6);
}

.gl-video-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0,0,0,0.6));
  pointer-events: none;
}

.gl-video-card__duration {
  position: absolute;
  bottom: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.75);
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  color: var(--text-white);
}

/* Duration chip stays hidden until JS fills it from real metadata */
.gl-video-card__duration:empty { display: none; }

.gl-video-card__content {
  padding: 20px;
}

.gl-video-card__title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-white);
  margin-bottom: 6px;
  line-height: 1.4;
}

.gl-video-card__meta {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--text-white-40);
  display: flex;
  align-items: center;
  gap: 12px;
}

.gl-video-card__tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.15);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════
   6. CTA SECTION — photo-backed .njt-final-cta pattern
   (component ships an external Unsplash bg; scope a LOCAL,
    self-hosted photo here to keep the page offline/CSP-clean)
═══════════════════════════════════════ */
.gl-cta {
  position: relative;
  overflow: hidden;
}

.page-gallery .gl-cta .njt-final-cta__bg {
  background: url('../assets/01-hero/HERO-001_golden-hour-track-panorama.jpg') center/cover no-repeat;
}

.page-gallery .gl-cta .njt-final-cta__content {
  max-width: 820px;
  margin: 0 auto;
}

/* ═══════════════════════════════════════
   7. RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1024px) {
  .gl-featured__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
  }
  .gl-featured__item--large {
    grid-column: span 2;
    grid-row: span 1;
  }
  .gl-featured__item--large .gl-featured__img {
    min-height: 300px;
  }
  .gl-videos__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .gl-featured__grid {
    grid-template-columns: 1fr;
  }
  .gl-featured__item--large {
    grid-column: span 1;
  }
  .gl-featured__item--large .gl-featured__img {
    min-height: 260px;
  }
  .gl-featured__item--wide {
    grid-column: span 1;
  }
  .gl-videos__grid {
    grid-template-columns: 1fr;
  }
  .gl-lightbox__nav--prev { left: 10px; }
  .gl-lightbox__nav--next { right: 10px; }
  .gl-lightbox__info {
    flex-direction: column;
    gap: 4px;
    padding: 8px 16px;
  }
}

@media (max-width: 480px) {
  .gl-featured__item--large .gl-featured__img {
    min-height: 220px;
  }
  .gl-featured__img {
    min-height: 160px;
  }
}
