/* =============================================================================
   CSS Variables — change these to restyle the entire site
   ============================================================================= */
:root {
  /* Brand accent (chartreuse green) */
  --accent:         rgb(199, 245, 4);
  --accent-muted:   rgba(199, 245, 4, 0.2);

  /* Background + foreground */
  --bg:             #090909;
  --bg-elevated:    #131313;
  --fg:             #f2f2f2;
  --fg-dim:         rgba(242, 242, 242, 0.45);
  --fg-faint:       rgba(242, 242, 242, 0.12);

  /* Typography */
  --font-heading:   'Anybody', sans-serif;
  --font-body:      'Be Vietnam Pro', sans-serif;

  /* Court background texture */
  --court-opacity:  0.05;          /* 0 = invisible, 0.15 = quite visible */
  --court-color:    rgba(199, 245, 4, 0.55);  /* muted accent tint */

  /* Layout */
  --line-y:         28vh;          /* vertical position of the timeline line */
  --stop-w:         67vw;           /* width of each deliverable stop */
  --content-pad:    80px;          /* horizontal padding inside stops */

  /* Animation */
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
}


/* =============================================================================
   Reset
   ============================================================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Let GSAP own scroll behavior */
  scroll-behavior: auto;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  min-width: 1200px; /* Prevent layout collapse on smaller screens */
  -webkit-font-smoothing: antialiased;

img, video {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
}


/* =============================================================================
   Court Background Texture
   ============================================================================= */
.court-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.court-svg {
  width: 100%;
  height: 90%;
  opacity: var(--court-opacity);
  color: var(--court-color);
}


/* =============================================================================
   Timeline Wrapper (pinned by GSAP)
   ============================================================================= */
#timeline-wrapper {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
}


/* =============================================================================
   Timeline Track (translated horizontally by GSAP)
   ============================================================================= */
#timeline-track {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 100vh;
  will-change: transform;
}


/* =============================================================================
   Timeline Line (fixed across viewport; stops scroll behind it)
   ============================================================================= */
.timeline-line {
  position: absolute;
  top: var(--line-y);
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    var(--fg-faint) 4%,
    rgba(255, 255, 255, 0.14) 20%,
    rgba(255, 255, 255, 0.14) 80%,
    var(--fg-faint) 96%,
    transparent 100%
  );
  z-index: 5;
  pointer-events: none;
}


/* =============================================================================
   Generic Stop
   ============================================================================= */
.stop {
  flex-shrink: 0;
  width: var(--stop-w);
  height: 100vh;
  position: relative;
}


/* =============================================================================
   Landing Stop
   ============================================================================= */
.landing-stop {
  width: 100vw;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 0 var(--content-pad) 72px var(--content-pad);
}

/* Hero photo */
.hero-photo-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  /* Darken slightly so text stays legible */
  opacity: 1;
  filter: brightness(0.85) contrast(1.05);
}

.hero-placeholder {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #151515 0%, #0a0a0a 100%);
  border-right: 1px dashed rgba(255,255,255,0.06);
  color: var(--fg-dim);
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

/* Gradient overlay so text reads over the photo */
.landing-stop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(9, 9, 9, 0.72) 0%,
    rgba(9, 9, 9, 0.35) 60%,
    rgba(9, 9, 9, 0.05) 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* Landing text content */
.landing-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* ── Wordmark ─────────────────────────────────────────────────────────── */
.wordmark-wrap {
  margin-bottom: 6px;
}

.wordmark-img {
  max-height: 410px;
  max-width: 640px;
  height: auto;
  width: 640px;
  /*
    Inverts dark logos to white. If your real logo is already white/light,
    remove or comment out this filter line.
  */
  filter: brightness(0) invert(1);
  object-fit: contain;
}

.wordmark-fallback {
  /* Shown only when wordmark.svg fails to load */
  display: none;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: clamp(3.5rem, 7vw, 8rem);
  line-height: 0.88;
  letter-spacing: -0.025em;
  color: var(--fg);
  text-transform: uppercase;
}

/* ── Landing subtitle + credits ───────────────────────────────────────── */
.landing-subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 23px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-dim);
}

.landing-credits {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 32px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Scroll hint ──────────────────────────────────────────────────────── */
.scroll-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  color: var(--fg-dim);
  animation: hint-pulse 2.4s var(--ease-out) infinite;
}

.scroll-hint-label {
  font-family: var(--font-body);
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.scroll-hint-arrow {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
  flex-shrink: 0;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.4; transform: translateX(0); }
  50%       { opacity: 0.85; transform: translateX(10px); }
}


/* =============================================================================
   Deliverable Stops
   ============================================================================= */
.deliverable-stop {
  position: relative;
  display: flex;
  align-items: stretch;
}

/* ── Stop dot on the timeline line ───────────────────────────────────── */
.stop-dot {
  position: absolute;
  left: 50%;
  top: var(--line-y);
  transform: translate(-50%, -50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  border: 1.5px solid rgba(255,255,255,0.5);
  z-index: 6;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out);
}

.deliverable-stop.is-active .stop-dot {
  background: var(--accent);
  border-color: var(--accent);
  transform: translate(-50%, -50%) scale(1.6);
  box-shadow: 0 0 12px rgba(199, 245, 4, 0.5);
}

/* ── Meta block (above the timeline line) ────────────────────────────── */
.stop-meta {
  position: absolute;
  /* Align bottom of meta 24px above the timeline line */
  bottom: calc(100vh - var(--line-y) + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, calc(var(--stop-w) - 2 * var(--content-pad)));
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.stop-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin-bottom: 2px;
}

.badge-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.stop-date {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.stop-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(2rem, 3vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--fg);
}

.stop-description {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--fg-dim);
  margin-top: 4px;
}

/* ── Media area (below the timeline line) ────────────────────────────── */
.stop-media {
  position: absolute;
  top: calc(var(--line-y) + 26px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}



/* =============================================================================
   Reel Display
   ============================================================================= */
.reel-wrap {
  position: relative;
  /* 9:16 — width scales down on short screens so height never overflows */
  width: min(360px, calc((100vh - var(--line-y) - 60px) * 9 / 16));
  aspect-ratio: 9 / 16;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  border: 1px solid var(--fg-faint);
  flex-shrink: 0;
}

/* 16:9 horizontal video — overrides the 9:16 portrait sizing */
.reel-wrap--landscape {
  width: min(860px, calc(var(--stop-w) - 2 * var(--content-pad)));
  aspect-ratio: 16 / 9;
}

.reel-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder shown when reel.mp4 is missing */
.reel-placeholder {
  display: none; /* toggled by onerror */
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(175deg, #191919 0%, #101010 100%);
  border: 1px dashed rgba(255,255,255,0.08);
  color: var(--fg-dim);
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 24px;
}

.reel-placeholder-icon {
  width: 36px;
  height: 36px;
  opacity: 0.35;
  color: var(--accent);
}

.reel-placeholder-path {
  font-size: 0.6rem;
  opacity: 0.5;
  line-height: 1.6;
}

/* "REEL" type label badge */
.reel-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 20px;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.1);
}

/* Mute/unmute button */
.reel-sound-btn {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--fg);
  cursor: pointer;
  padding: 9px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  line-height: 0;
}

.reel-wrap:hover .reel-sound-btn {
  opacity: 1;
}

.reel-sound-btn:hover {
  background: rgba(0,0,0,0.8);
}

.reel-sound-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Click-to-unmute nudge overlay (fades after first interaction) */
.reel-tap-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.reel-wrap.show-tap-hint .reel-tap-hint {
  opacity: 1;
}

.reel-tap-hint-inner {
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
}


/* =============================================================================
   Post / Carousel Grid
   ============================================================================= */
.post-grid {
  display: grid;
  gap: 3px;
  border-radius: 6px;
  overflow: hidden;
  /* Fill available height below the timeline line, clearing the nav bar */
  height: calc(100vh - var(--line-y) - 100px);
  /* Each row gets an equal share of that height */
  grid-auto-rows: 1fr;
}

/* 1 image */
.post-grid[data-count="1"]  { grid-template-columns: 1fr; width: 560px; }
/* 2 images (side by side, 1 row) */
.post-grid[data-count="2"]  { grid-template-columns: 1fr 1fr; width: 860px; }
/* 3 images (1 row of 3) */
.post-grid[data-count="3"]  { grid-template-columns: 1fr 1fr 1fr; width: 960px; }
/* 4 images (2×2) */
.post-grid[data-count="4"]  { grid-template-columns: 1fr 1fr; width: 860px; }
/* 5–9 images (3-column grid) */
.post-grid[data-count="5"],
.post-grid[data-count="6"],
.post-grid[data-count="7"],
.post-grid[data-count="8"],
.post-grid[data-count="9"]  { grid-template-columns: 1fr 1fr 1fr; width: 960px; }

.post-grid-cell {
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
  min-height: 0;
}

.post-grid-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Placeholder cell (when image file is missing) */
.post-placeholder-cell {
  display: none; /* shown on onerror */
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #1a1a1a 0%, #111 100%);
  border: 1px dashed rgba(255,255,255,0.07);
  color: var(--fg-dim);
  font-family: var(--font-body);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 8px;
}


/* =============================================================================
   Gallery Stop — full-width two-panel layout with masonry scroll
   ============================================================================= */

/* Gallery stop occupies full viewport width */
.type-gallery.deliverable-stop {
  width: 100vw;
}

/* Timeline dot repositioned to center of the left sidebar */
.type-gallery .stop-dot {
  left: 16.666%;
}

/* Two-panel flex wrapper: sidebar | masonry */
.gallery-layout {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* ── Left sidebar: title, date, description (pinned) ─────────────────────── */
.gallery-sidebar {
  width: 33.333%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  /* Bottom padding lifts content to just above the timeline line */
  padding: 60px var(--content-pad) calc(100vh - var(--line-y) + 28px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  gap: 8px;
  position: relative;
  z-index: 4;
}

/* ── Right side: masonry grid (JS drives scrollTop; overflow hidden hides native scroll) ── */
.gallery-masonry-outer {
  flex: 1;
  min-height: 0;
  overflow-y: hidden;       /* scroll is driven entirely by JS wheel intercept */
  position: relative;       /* anchor for the progress bar pseudo-elements */
}

/* Scroll track — faint background bar on the right edge */
.gallery-masonry-outer::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  z-index: 10;
}

/* Scroll thumb — accent fill driven by --gallery-progress (set from JS) */
.gallery-masonry-outer::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: var(--gallery-progress, 0%);
  background: rgba(199, 245, 4, 0.5);
  border-radius: 0 0 2px 0;
  pointer-events: none;
  z-index: 11;
  transition: height 0.06s linear;
}

/* Flex-column masonry — 3 vertical columns that grow downward, making
   scrollHeight reflect the real content height for JS scroll intercept */
.gallery-masonry-inner {
  display: flex;
  gap: 6px;
  padding: 16px 20px 80px;
  align-items: flex-start;  /* columns don't stretch to match each other's height */
  will-change: transform;   /* keeps this layer GPU-composited for smooth translateY */
}

.masonry-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.masonry-col img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
}

/* Placeholder when no images are present */
.gallery-masonry-placeholder {
  padding: 60px 40px;
  color: var(--fg-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.6;
  letter-spacing: 0.04em;
}


/* =============================================================================
   End Stop
   ============================================================================= */
.end-stop {
  width: 35vw;
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-label {
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(4rem, 8vw, 10rem);
  color: rgba(255,255,255,0.04);
  letter-spacing: -0.03em;
  user-select: none;
}


/* =============================================================================
   Progress Navigation (pickleball dots)
   ============================================================================= */
#progress-nav {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(9, 9, 9, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 100px;
  padding: 9px 16px;
}

.progress-dot {
  width: 20px;
  height: 20px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  opacity: 0.25;
  transition: opacity 0.25s ease, transform 0.25s var(--ease-out), color 0.25s ease;
  flex-shrink: 0;
}

.progress-dot:hover {
  opacity: 0.55;
  transform: scale(1.15);
}

.progress-dot.is-active {
  opacity: 1;
  color: var(--accent);
  transform: scale(1.25);
}

.progress-dot svg {
  width: 100%;
  height: 100%;
}
}