/* ============================================================
   BIAK PACIFIC HALF MARATHON 2026
   Theme variables + modular section styles
============================================================ */

:root {
  /* --- Color system (from logo identity) --- */
  --c-green:      #00C875;   /* tropical green */
  --c-teal:       #00A896;   /* teal mid */
  --c-aqua:       #00B4D8;   /* aqua */
  --c-ocean:      #0077B6;   /* ocean blue */
  --c-deep:       #023E8A;   /* deep sea */
  --c-navy:       #0B3D5C;   /* logo navy */
  --c-abyss:      #032b46;   /* darkest */
  --c-white:      #FFFFFF;
  --c-foam:       #E6FBFF;
  --c-orange:     #FFAB40;   /* logo highlight */
  --c-orange-hot: #FF8F00;

  /* --- Divider fills (each matches the section BELOW it) --- */
  --divider-fill-1: rgba(255,255,255,0.10);
  --divider-fill-2: rgba(3,43,70,0.35);
  --divider-fill-3: rgba(255,255,255,0.12);
  --divider-fill-4: rgba(2,62,138,0.45);
  --divider-fill-5: rgba(230,251,255,0.20);

  /* --- Type --- */
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* --- Rhythm --- */
  --pad-x: clamp(1.25rem, 5vw, 5rem);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: auto; } /* Lenis owns smoothing */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: var(--font-body);
  color: var(--c-white);
  background: var(--c-teal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
/* width/height ATTRIBUTES on <img> reserve layout space (no CLS) while
   height:auto keeps the rendered size driven by CSS width */
img { height: auto; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.02; }

/* ============================================================
   LOADER
============================================================ */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--c-green), var(--c-teal));
  color: var(--c-white);
}
.loader__wave { width: 120px; }
.loader__path {
  stroke-dasharray: 220;
  stroke-dashoffset: 220;
  animation: loader-draw 1.1s ease-in-out infinite alternate;
}
@keyframes loader-draw { to { stroke-dashoffset: 0; } }

/* ============================================================
   FIXED OCEAN BACKDROP — gradient driven by JS on scroll
============================================================ */
.ocean-backdrop {
  position: fixed; inset: 0; z-index: -2;
  /* JS overwrites this via CSS vars --grad-a/--grad-b/--grad-c */
  --grad-a: #00C875; --grad-b: #00A896; --grad-c: #0091ad;
  background: linear-gradient(168deg, var(--grad-a) 0%, var(--grad-b) 52%, var(--grad-c) 100%);
  will-change: background;
}

/* Subtle repeating wave ornament, two drifting layers —
   official asset from the event's brand kit (pattern_layer.png) */
.ocean-backdrop__pattern {
  position: absolute; inset: -20%;
  background-image: url('../assets/pattern_layer.png');
  background-size: 340px auto;
  background-repeat: repeat;
  opacity: .07;
}
.ocean-backdrop__pattern--b {
  background-size: 520px auto;
  background-position: 170px 130px;
  opacity: .05;
}

/* ============================================================
   TRIBAL BORDERS (top strip is fixed, bottom lives in footer)
============================================================ */
.tribal-border { color: rgba(255,255,255,.55); }
.tribal-border svg { width: 100%; height: clamp(20px, 3.4vw, 44px); }
.tribal-border--top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  padding-top: .4rem;
  pointer-events: none;
}
.tribal-border--bottom { color: rgba(255,255,255,.5); margin-bottom: .8rem; transform: scaleY(-1); }

/* ============================================================
   GOV BADGE — regional government logos, pinned top left
============================================================ */
.gov-badge {
  position: absolute;
  top: clamp(.9rem, 2.5vh, 1.6rem);
  left: clamp(.9rem, 2.5vw, 2rem);
  z-index: 20;
  filter: drop-shadow(0 4px 14px rgba(3,43,70,.3));
}
.gov-badge img { height: clamp(44px, 7.5vh, 68px); width: auto; }

/* ============================================================
   SHARED LAYOUT
============================================================ */
.panel {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(4rem, 10vh, 7rem) var(--pad-x);
  text-align: center;
  overflow: hidden;
}

/* Wave dividers between sections — the morph targets.
   SEAMLESS RULE: the divider's own background continues the PREVIOUS
   section's overlay; the wave path's fill IS the NEXT section's overlay.
   The wave shape therefore reads as the next scene flooding in,
   never as a floating decorative band. */
.wave-divider {
  position: relative;
  height: clamp(90px, 14vw, 200px);
  /* NO negative margins and NO z-index: adjacent flow elements share the
     exact same layout edge, and the neighbouring sections use the exact
     same overlay colors as the wave fills — any overlap would composite
     the translucent color twice and print a visible 1px stripe */
}
.wave-divider svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
/* Section overlays — each matches the fill of the divider above it,
   so wave crest and section body are one continuous surface */
.run-begins { background: var(--divider-fill-1); }
.course     { background: var(--divider-fill-2); }
.energy     { background: var(--divider-fill-3); }
.final-push { background: var(--divider-fill-4); }
.finish     { background: var(--divider-fill-5); }

/* ============================================================
   SECTION 1 — HERO
============================================================ */
.hero__layers { position: absolute; inset: 0; pointer-events: none; }
.hero-wave {
  position: absolute; left: -10%; right: -10%; width: 120%; max-width: none;
  bottom: 0; height: 46vh;
}
.hero-wave--far  { bottom: 6vh; }
.hero-wave--mid  { bottom: 2vh; }
.hero-wave--near { bottom: -2vh; }

/* Sizes are height-driven (vh) with vw guards, so on wide-but-short
   desktop viewports the stack (logo + title + sub + CTA) always fits
   above the partner logos instead of piling over them */
.hero { padding-bottom: clamp(5rem, 11vh, 7rem); } /* indicator zone */
.hero__content { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: clamp(.6rem, 1.8vh, 1.2rem); }

.hero__logo { width: clamp(100px, 21vh, 200px); filter: drop-shadow(0 12px 40px rgba(3,43,70,.35)); }
.hero__logo img, .hero__logo-fallback { width: 100%; }

.hero__title {
  font-weight: 900;
  font-size: min(clamp(2.2rem, 8.8vh, 6rem), 8.5vw);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 0 8px 40px rgba(3,43,70,.35);
}
.hero__title .line { display: block; overflow: hidden; }
.hero__title .line > span { display: inline-block; }
.hero__title .line--accent { color: var(--c-orange); }

.hero__sub {
  font-size: clamp(.85rem, 1.6vw, 1.1rem);
  font-weight: 500;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--c-foam);
  opacity: .9;
}

/* Partner logos — in the hero flow, right below the CTA, so the
   composition stays compact at every viewport size */
.hero__partners {
  position: relative;
  margin-top: clamp(1.2rem, 3.5vh, 2.2rem);
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  z-index: 2;
}
.hero__partners-label {
  font-size: .75rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--c-foam); opacity: .75; font-weight: 500;
}
.hero__partners-row { display: flex; align-items: stretch; gap: .7rem; flex-wrap: wrap; justify-content: center; }
.partner-chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92);
  border-radius: 12px;
  padding: .45rem .9rem;
  box-shadow: 0 6px 20px rgba(3,43,70,.18);
}
.partner-chip img { height: clamp(22px, 3.2vh, 30px); width: auto; }
/* ANOA mark is near-square — needs ~1.6× the height of the wide
   TokoTix wordmark to carry the same visual weight */
.partner-chip--anoa img { height: clamp(34px, 5vh, 46px); }

/* Hero CTA — compact variant of the main button */
.cta--hero {
  margin-top: clamp(.2rem, 1vh, .6rem);
  padding: clamp(.6rem, 1.6vh, .85rem) 2.4rem;
  font-size: clamp(.85rem, 2vh, 1.05rem);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute; bottom: clamp(1.4rem, 4vh, 2.6rem); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
  z-index: 2;
}
.scroll-indicator__label { font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; opacity: .8; }
.scroll-indicator__track {
  width: 26px; height: 44px;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 999px;
  display: flex; justify-content: center; padding-top: 7px;
}
.scroll-indicator__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-orange); }

/* ============================================================
   SECTION 2 — THE RUN BEGINS
============================================================ */
.run-begins__stage {
  position: relative;
  width: min(900px, 92vw);
  height: clamp(160px, 30vh, 260px);
  margin-bottom: clamp(1rem, 4vh, 2.5rem);
}
.runner-trail { position: absolute; inset: 0; width: 100%; height: 100%; }

.runner {
  position: absolute; bottom: 8%; left: 0;
  width: clamp(70px, 10vw, 120px);
  color: var(--c-navy);
  filter: drop-shadow(0 10px 24px rgba(3,43,70,.4));
}
.runner__wake {
  position: absolute; right: 78%; top: 55%;
  width: 130%;
  opacity: .8;
}

.run-begins__title {
  font-size: clamp(1.9rem, 5.4vw, 4rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  max-width: 16ch;
}
.reveal-words .word { display: inline-block; overflow: hidden; vertical-align: top; }
.reveal-words .word > span { display: inline-block; }

.run-begins__body {
  margin-top: 1.2rem;
  max-width: 46ch;
  font-size: clamp(.95rem, 1.7vw, 1.15rem);
  line-height: 1.7;
  color: var(--c-foam);
  opacity: .92;
}

/* ============================================================
   SECTION 3 — COURSE (PINNED, HORIZONTAL ILLUSION)
============================================================ */
.course { position: relative; }
.course__pin {
  height: 100vh; height: 100svh;
  display: flex; flex-direction: column;
  padding: clamp(3.5rem, 8vh, 5.5rem) 0 clamp(2rem, 5vh, 3rem);
  overflow: hidden;
}
.course__header { text-align: center; padding: 0 var(--pad-x); margin-bottom: clamp(1rem, 3vh, 2rem); }
.course__eyebrow {
  font-size: .75rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--c-orange); font-weight: 600;
}
.course__title {
  font-size: clamp(1.8rem, 4.6vw, 3.4rem);
  font-weight: 900; text-transform: uppercase;
  margin-top: .5rem;
}

.course__viewport { flex: 1; overflow: hidden; }
.course__track {
  display: flex; height: 100%;
  will-change: transform;
}

.scene {
  position: relative;
  flex: 0 0 100vw;
  height: 100%;
  display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 0 var(--pad-x) clamp(1.5rem, 5vh, 3rem);
  overflow: hidden;
}
.scene__art {
  position: absolute; inset: 0; pointer-events: none;
  /* fade the artwork out toward the scene's side edges so neighbouring
     scenes blend through the shared ocean gradient — no hard vertical
     seam while the track slides */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%);
}
/* generous side bleed: the parallax counter-drift must never expose a
   layer's own edge inside the viewport. max-width:none overrides the
   global svg reset, which would otherwise clamp these back to 100%. */
.scene__layer { position: absolute; inset: -5% -30%; width: 160%; max-width: none; height: 110%; will-change: transform; }

.scene__copy {
  position: relative; z-index: 2;
  text-align: left;
  max-width: 34ch;
  background: rgba(3,43,70,.35);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  padding: clamp(1.1rem, 2.5vw, 1.8rem);
}
.scene__num {
  font-family: var(--font-display);
  font-weight: 900; font-size: .9rem;
  color: var(--c-orange); letter-spacing: .2em;
}
.scene__copy h3 {
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  text-transform: uppercase; font-weight: 800;
  margin: .3rem 0 .6rem;
}
.scene__copy p { font-size: clamp(.9rem, 1.5vw, 1.05rem); line-height: 1.65; color: var(--c-foam); }

.course__progress {
  margin: clamp(1rem, 3vh, 1.6rem) auto 0;
  width: min(320px, 60vw); height: 4px;
  background: rgba(255,255,255,.25);
  border-radius: 999px; overflow: hidden;
}
.course__progress-bar {
  display: block; width: 100%; height: 100%;
  background: var(--c-orange);
  transform: scaleX(0); transform-origin: left center;
}

/* ============================================================
   SECTION 4 — ENERGY BUILD-UP
============================================================ */
.energy { gap: clamp(2rem, 6vh, 4rem); }
.energy__stack { display: flex; flex-direction: column; gap: clamp(.4rem, 1.5vh, 1rem); }

.energy__line {
  font-size: clamp(3rem, 11vw, 9rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: .95;
}
.energy__line--outline {
  color: transparent;
  -webkit-text-stroke: 2px rgba(255,255,255,.85);
  font-size: clamp(1.9rem, 6.5vw, 5rem);
}
.energy__line--accent { color: var(--c-orange); }
.split-chars .char { display: inline-block; white-space: pre; will-change: transform; }
.split-chars .char-word { display: inline-block; white-space: nowrap; }

.energy__ticker {
  position: absolute; bottom: clamp(1rem, 4vh, 2.4rem); left: 0; right: 0;
  overflow: hidden; white-space: nowrap;
  opacity: .35;
}
.energy__ticker-inner { display: inline-flex; }
.energy__ticker span {
  font-family: var(--font-display);
  font-weight: 900; font-size: clamp(1.2rem, 3vw, 2.2rem);
  letter-spacing: .12em;
}

/* ============================================================
   SECTION 5 — FINAL PUSH
============================================================ */
.final-push__waves {
  position: absolute; inset: 0; pointer-events: none;
  /* fade the decorative swell out before the section edge so it can
     never be cut off in a straight line at the boundary */
  -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 96%);
  mask-image: linear-gradient(to bottom, black 55%, transparent 96%);
}
.final-wave { position: absolute; left: -10%; width: 120%; max-width: none; height: 55vh; bottom: -6vh; }
.final-wave--1 { bottom: -2vh; }

.final-push__stage {
  position: relative;
  width: min(1000px, 94vw);
  height: clamp(140px, 26vh, 240px);
}
.runner--sprint {
  position: absolute; bottom: 10%; left: 0;
  width: clamp(90px, 12vw, 150px);
  color: var(--c-abyss);
}
.runner__ghost {
  position: absolute; inset: 0;
  color: var(--c-abyss);
}
.runner__ghost--1 { opacity: .35; transform: translateX(-14%); }
.runner__ghost--2 { opacity: .16; transform: translateX(-28%); }

.runner__speedlines { position: absolute; top: 30%; right: 92%; width: 120%; }
.runner__speedlines span {
  display: block; height: 3px; border-radius: 999px;
  background: linear-gradient(to left, rgba(255,255,255,.85), transparent);
  margin-bottom: 12px;
}
.runner__speedlines span:nth-child(1) { width: 90%; }
.runner__speedlines span:nth-child(2) { width: 70%; margin-left: 8%; }
.runner__speedlines span:nth-child(3) { width: 95%; margin-left: 2%; }
.runner__speedlines span:nth-child(4) { width: 55%; margin-left: 14%; }

.final-push__title {
  position: relative; z-index: 2;
  font-size: clamp(2.2rem, 6.5vw, 5.2rem);
  font-weight: 900; text-transform: uppercase;
  max-width: 14ch;
  text-shadow: 0 10px 50px rgba(2,20,35,.6);
}
.final-push__sub {
  position: relative; z-index: 2;
  margin-top: 1rem;
  font-size: clamp(.95rem, 1.8vw, 1.25rem);
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--c-orange); font-weight: 600;
}

/* ============================================================
   SECTION 6 — FINISH LINE (CTA)
============================================================ */
.finish { justify-content: space-between; padding-bottom: 0; }
.finish__particles { position: absolute; inset: 0; pointer-events: none; }
.finish__particles .particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
}

.finish__content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(.7rem, 1.8vh, 1.1rem);
  margin: auto 0;
  padding-top: clamp(.5rem, 2vh, 1.5rem);
}
/* sized so logo + title + date + CTA + note + footer always fit a short
   desktop viewport without colliding */
.finish__logo { width: clamp(100px, 12vh, 150px); filter: drop-shadow(0 10px 30px rgba(3,43,70,.3)); }
.finish__title {
  font-size: clamp(1.7rem, 4.6vh, 3rem);
  font-weight: 900; text-transform: uppercase;
}
.finish__date {
  font-size: clamp(.8rem, 1.4vw, 1rem);
  letter-spacing: .26em; text-transform: uppercase;
  color: var(--c-foam); opacity: .9;
}

.cta {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: .6rem;
  padding: 1.05rem 3.2rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--c-orange), var(--c-orange-hot));
  color: var(--c-abyss);
  font-family: var(--font-display);
  font-weight: 800; font-size: clamp(1rem, 1.8vw, 1.2rem);
  letter-spacing: .08em; text-transform: uppercase;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 14px 40px rgba(255,143,0,.35);
  transition: transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s ease;
}
.cta:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 20px 55px rgba(255,143,0,.5); }
.cta__label { position: relative; z-index: 1; }
.cta__wave {
  position: absolute; left: -20%; bottom: -60%;
  width: 140%; height: 100%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.45), transparent 65%);
  transform: translateY(100%);
  transition: transform .5s cubic-bezier(.22,1,.36,1);
}
.cta:hover .cta__wave { transform: translateY(20%); }

.finish__note { font-size: .8rem; opacity: .75; letter-spacing: .06em; margin-top: clamp(.4rem, 1.4vh, .9rem); }

.site-footer {
  width: 100%;
  margin-top: clamp(2rem, 6vh, 4rem);
  padding-bottom: 1.2rem;
}
.site-footer p { font-size: .75rem; opacity: .7; letter-spacing: .08em; }

/* ============================================================
   RESPONSIVE + MOTION PREFERENCES
============================================================ */
@media (max-width: 767px) {
  /* --- Layout tuning --- */
  .gov-badge img { height: 38px; } /* stays visible on mobile, just smaller */
  .hero { padding-bottom: 6.5rem; } /* room for the scroll indicator only */
  .hero__partners { margin-top: 1.4rem; width: max-content; max-width: 92vw; }
  .partner-chip { padding: .35rem .7rem; }
  .partner-chip img { height: 19px; }
  .partner-chip--anoa img { height: 31px; }
  .scroll-indicator__label { display: none; } /* keep the bottom zone clean */
  .scene { align-items: center; justify-content: center; }
  .scene__copy { text-align: center; }
  .runner__speedlines { display: none; }
  .hero__title { letter-spacing: 0; }
  .hero-wave { height: 32vh; }
  .wave-divider { height: clamp(60px, 16vw, 110px); }
  .run-begins__stage { height: clamp(120px, 22vh, 180px); }
  .final-push__stage { height: clamp(110px, 20vh, 180px); }
  .course__pin { padding-top: clamp(2.6rem, 7vh, 4rem); }
  .scene__copy { max-width: min(34ch, 86vw); }
  .energy__line { letter-spacing: -0.02em; }

  /* --- Performance: one lighter pattern layer, smaller tile --- */
  .ocean-backdrop__pattern { background-size: 220px auto; }
  .ocean-backdrop__pattern--b { display: none; }
  .cta { padding: .95rem 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .loader { display: none; }
  *, *::before, *::after {
    animation-duration: .001s !important;
    transition-duration: .001s !important;
  }
}
