/* ============================================================
   TOUR DE FORE — Sierra Golf 2026
   Mobile first. Phone is the primary surface: this is read
   one-handed, on a course, on LTE.

   Motion rule for the whole file: animate transform and opacity
   only. Nothing on a hot path touches top/left/width/height.
   ============================================================ */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --px: max(1.1rem, env(safe-area-inset-left, 0px));
  --bar-h: calc(60px + var(--safe-bottom));
  --radius: 16px;
  --scroll: 0;
}

/* ---------- themes ---------- */
.theme-birds {
  --bg: #1B1206;
  --bg-2: #2A1B08;
  --ink: #FFF3DE;
  --ink-dim: #D9BE96;
  --accent: #FF9F1C;
  --accent-2: #FF6B35;
  --gold: #FFD166;
  --line: rgba(255,209,102,.22);
  --card: rgba(58,37,10,.62);
  --stripe-a: rgba(255,159,28,.10);
  --stripe-b: rgba(255,107,53,.03);
}
.theme-main {
  --bg: #12060E;
  --bg-2: #24091A;
  --ink: #FFF1E0;
  --ink-dim: #C9A3AE;
  --accent: #E03E52;
  --accent-2: #F5C542;
  --gold: #F5C542;
  --line: rgba(245,197,66,.22);
  --card: rgba(48,12,28,.66);
  --stripe-a: rgba(224,62,82,.14);
  --stripe-b: rgba(255,241,224,.03);
}
.theme-hurrah {
  --bg: #0B0820;
  --bg-2: #150F38;
  --ink: #F0ECFF;
  --ink-dim: #A79CD6;
  --accent: #7B4DFF;
  --accent-2: #FF4FA3;
  --gold: #FFD166;
  --line: rgba(123,77,255,.28);
  --card: rgba(26,18,64,.66);
  --stripe-a: rgba(123,77,255,.14);
  --stripe-b: rgba(255,79,163,.05);
}

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

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (min-width: 681px) { html { font-size: 18px; } }
@media (min-width: 981px) { html { font-size: 19px; } }

body {
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  padding-bottom: var(--bar-h);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* Not `color`: that inherits, so a theme swap would repaint every
     text node on the page for the length of the transition. */
  transition: background-color .6s ease;
}
body.tdf-loading { overflow: hidden; height: 100vh; height: 100svh; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
/* every interactive thing is thumb-sized and never waits 300ms */
button, a { touch-action: manipulation; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================================================
   BACKDROP — pure CSS on phones. No canvas, no WebGL, no
   per-frame JS. The spotlights are compositor-only transforms.
   ============================================================ */
.backdrop { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.bd-sky {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-2), transparent 60%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 55%);
}
.bd-stripes {
  position: absolute; inset: -20% -20% auto -20%; height: 130%;
  background: repeating-linear-gradient(100deg,
    var(--stripe-a) 0 42px, var(--stripe-b) 42px 84px);
  transform: rotate(-4deg);
  opacity: .8;
  mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 78%);
}
/* A radial gradient that fades to transparent is already soft, so the
   blur bought almost nothing while a screen blend forced the whole
   backdrop to recomposite every frame of the sway. */
.bd-spot {
  position: absolute; width: 70vw; height: 70vw; border-radius: 50%;
  opacity: .4;
}
.bd-spot-1 { top: -10%; left: -15%; background: radial-gradient(circle, var(--accent), transparent 65%); }
.bd-spot-2 { bottom: 5%; right: -20%; background: radial-gradient(circle, var(--accent-2), transparent 65%); }

/* Motion is opt-in: only the high budget keeps layers alive for it. */
body.fx-high .bd-spot { will-change: transform; }
body.fx-high .bd-spot-1 { animation: sway 19s ease-in-out infinite; }
body.fx-high .bd-spot-2 { animation: sway 27s ease-in-out infinite reverse; }
@keyframes sway {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(6vw, -4vh, 0) scale(1.18); }
}
.bd-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 40%, rgba(0,0,0,.55) 85%, rgba(0,0,0,.85) 100%);
}

.fx-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 60; pointer-events: none; }

.progress-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70;
  background: rgba(255,255,255,.06);
}
.progress-bar span {
  display: block; height: 100%; width: 100%;
  transform: scaleX(var(--scroll)); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent-2));
}

/* ============================================================
   GATE
   ============================================================ */
.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: calc(2rem + var(--safe-top)) var(--px) calc(2rem + var(--safe-bottom));
  background: radial-gradient(circle at 50% 40%, var(--bg-2), var(--bg) 70%);
  transition: opacity .6s ease, transform .7s cubic-bezier(.7,0,.2,1);
}
body.gate-open .gate { opacity: 0; transform: scale(1.15); pointer-events: none; }
.gate[hidden] { display: none; }

.gate-tent { position: absolute; inset: 0; overflow: hidden; }
.gate-flap {
  position: absolute; top: -10%; width: 60%; height: 120%;
  background: repeating-linear-gradient(94deg, var(--stripe-a) 0 36px, transparent 36px 72px);
  transition: transform .8s cubic-bezier(.7,0,.2,1);
}
.gate-flap-l { left: -8%; transform-origin: left center; }
.gate-flap-r { right: -8%; transform-origin: right center; }
body.gate-charging .gate-flap-l { transform: translateX(-40%) rotate(-8deg); }
body.gate-charging .gate-flap-r { transform: translateX(40%) rotate(8deg); }
.gate-bulbs {
  position: absolute; left: 0; right: 0; top: 12%; height: 12px;
  background: radial-gradient(circle at 12px 50%, var(--gold) 0 3px, transparent 4px);
  background-size: 34px 12px;
  opacity: .8;
  animation: bulbs 1.4s steps(2) infinite;
}
@keyframes bulbs { 0%, 100% { opacity: .8; } 50% { opacity: .35; } }

.gate-content { position: relative; z-index: 2; text-align: center; max-width: 22rem; }
.gate-kicker {
  font-size: .74rem; letter-spacing: .34em; text-transform: uppercase;
  color: var(--gold); margin-bottom: .9rem; text-indent: .34em;
}
.gate-title {
  font-family: 'Alfa Slab One', Georgia, serif;
  font-size: clamp(2.4rem, 15vw, 5rem); line-height: .92; letter-spacing: .01em;
  color: var(--ink);
  text-shadow: 0 0 30px rgba(0,0,0,.6), 0 4px 0 var(--accent);
}
.gate-title span { display: block; font-size: .42em; color: var(--accent-2); letter-spacing: .3em; }
.gate-sub { margin: 1rem 0 2rem; color: var(--ink-dim); font-size: 1rem; }
.gate-enter {
  display: block; width: 100%; min-height: 56px;
  border-radius: 100px; padding: 1rem 2rem;
  font-weight: 700; font-size: 1rem; letter-spacing: .1em; text-transform: uppercase;
  color: #1a0a06;
  background: linear-gradient(120deg, var(--gold), var(--accent));
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  transition: transform .2s ease;
}
.gate-enter:active { transform: scale(.97); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: calc(3rem + var(--safe-top)) var(--px) 5rem;
  position: relative;
}
.kicker {
  font-size: .72rem; letter-spacing: .3em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1rem; text-indent: .3em;
}
.hero-title {
  font-family: 'Alfa Slab One', Georgia, serif;
  font-size: clamp(2.3rem, 13vw, 5.5rem); line-height: .95;
  color: var(--ink);
  text-shadow: 0 3px 0 var(--accent), 0 6px 24px rgba(0,0,0,.55);
}
.hero-tag { margin: 1.2rem auto 2rem; max-width: 24ch; color: var(--ink-dim); }
.hero-stats { display: flex; gap: 1.6rem; justify-content: center; }
.hstat { display: flex; flex-direction: column; }
.hstat-num {
  font-family: 'Alfa Slab One', Georgia, serif;
  font-size: clamp(1.8rem, 9vw, 3rem); color: var(--gold); line-height: 1;
}
.hstat-lbl { font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-dim); margin-top: .35rem; }

.scroll-cue {
  position: absolute; bottom: calc(1.2rem + var(--safe-bottom)); left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .45rem;
  font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-dim);
}
.scroll-cue span {
  width: 22px; height: 34px; border: 1.5px solid var(--line); border-radius: 12px; position: relative;
}
.scroll-cue span::before {
  content: ''; position: absolute; top: 6px; left: 50%; width: 3px; height: 7px;
  border-radius: 2px; background: var(--gold);
  animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue {
  0%   { opacity: 0; transform: translate(-50%, 0); }
  30%  { opacity: 1; }
  80%  { opacity: 0; transform: translate(-50%, 12px); }
  100% { opacity: 0; }
}

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 3.2rem 0; position: relative; }
.inner { max-width: 1080px; margin: 0 auto; padding: 0 var(--px); }
.section-label {
  font-size: .68rem; letter-spacing: .26em; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: .5rem;
}
.section-title {
  font-family: 'Alfa Slab One', Georgia, serif;
  font-size: clamp(1.6rem, 7vw, 2.6rem); line-height: 1.08; margin-bottom: 1.4rem;
  color: var(--ink);
}

.reveal {
  opacity: 0; transform: translate3d(0, 24px, 0);
  transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1);
}
.reveal.visible { opacity: 1; transform: none; }

/* ============================================================
   TENT CARDS
   ============================================================ */
.tent-grid { display: grid; gap: .9rem; }
.tent-card {
  position: relative; text-align: left; display: grid; gap: .35rem;
  padding: 1.2rem; border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  transition: transform .25s cubic-bezier(.22,1,.36,1), border-color .25s ease;
}
.tent-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.tent-card:active { transform: scale(.985); }
.tent-card.is-active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.tent-num { font-size: .64rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.tent-name { font-family: 'Alfa Slab One', Georgia, serif; font-size: 1.35rem; line-height: 1.1; }
.tent-dates { font-size: .82rem; color: var(--accent-2); font-weight: 600; }
.tent-blurb { font-size: .88rem; color: var(--ink-dim); line-height: 1.5; margin-top: .2rem; }
.tent-foot {
  display: flex; gap: .8rem; margin-top: .5rem;
  font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.tent-leader:not(:empty) {
  margin-top: .4rem; font-size: .78rem; font-weight: 600; color: var(--gold);
}

/* ============================================================
   BOARD
   ============================================================ */
.board-section { padding-top: 1rem; }
.board-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.board-sub { font-size: .86rem; color: var(--ink-dim); line-height: 1.5; max-width: 46ch; margin-bottom: 1.2rem; }
.board-meta { font-size: .74rem; color: var(--ink-dim); margin-bottom: 1.2rem; }
.board-state {
  padding: 1.4rem; border-radius: var(--radius);
  border: 1px dashed var(--line); color: var(--ink-dim);
  font-size: .9rem; text-align: center;
}
.board-state[hidden] { display: none; }

.board-list { display: grid; gap: .5rem; }
.row {
  display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .8rem; align-items: center;
  padding: .85rem .9rem; border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 56px;
}
.row.gold   { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.row.silver { box-shadow: inset 3px 0 0 rgba(255,255,255,.55); }
.row.bronze { box-shadow: inset 3px 0 0 #CD7F32; }
.row.idle { opacity: .55; }
.row-pos {
  font-family: 'Alfa Slab One', Georgia, serif; font-size: 1.25rem;
  color: var(--ink-dim); text-align: center;
}
.row.gold .row-pos { color: var(--gold); }
.row-main { min-width: 0; }
.row-name { font-weight: 600; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: .74rem; color: var(--ink-dim); margin-top: .15rem; }
.row-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.chip {
  font-size: .68rem; padding: .16rem .4rem; border-radius: 5px;
  background: rgba(255,255,255,.07); color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.chip-empty { opacity: .45; }
.row-score { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.row-num {
  font-family: 'Alfa Slab One', Georgia, serif; font-size: 1.5rem; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.row.gold .row-num { color: var(--gold); }
.row-unit { font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim); margin-top: .15rem; }

.row.moved-up   { border-color: #4ADE80; }
.row.moved-down { border-color: #F87171; }

.footnote { font-size: .76rem; color: var(--ink-dim); margin-top: 1rem; line-height: 1.5; }

/* ---------- rounds ---------- */
.rounds { display: grid; gap: .8rem; margin-top: 2rem; }
.round-card {
  padding: 1rem; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  opacity: .72;
}
.round-card.is-played { opacity: 1; border-color: var(--gold); }
.round-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.round-n { font-family: 'Alfa Slab One', Georgia, serif; font-size: 1rem; color: var(--gold); }
.round-when { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); }
.round-what { font-size: .88rem; color: var(--ink); margin-top: .25rem; }
.round-pending { font-size: .78rem; color: var(--ink-dim); margin-top: .5rem; font-style: italic; }
.round-block { margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.round-block-h { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-2); }
.round-top { list-style: none; margin-top: .4rem; display: grid; gap: .22rem; }
.round-top li { font-size: .84rem; color: var(--ink-dim); }
.round-top b { color: var(--ink); font-weight: 600; }

/* ============================================================
   SCHEDULE
   ============================================================ */
.sched { display: grid; gap: .35rem; }
.sched-row {
  display: grid; grid-template-columns: 6.6rem 1fr; gap: .8rem; align-items: baseline;
  padding: .6rem .8rem; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
}
.sched-row.is-break { opacity: .6; border-style: dashed; }
.sched-when { font-size: .74rem; letter-spacing: .06em; color: var(--gold); font-variant-numeric: tabular-nums; }
.sched-what { font-size: .84rem; color: var(--ink-dim); }
.sched-what b { display: block; color: var(--ink); font-size: .78rem; font-weight: 600; }

/* ============================================================
   FOOTER + TENT BAR
   ============================================================ */
footer { text-align: center; padding: 3rem var(--px) 2.5rem; }
.footer-brand { font-family: 'Alfa Slab One', Georgia, serif; font-size: 1.4rem; color: var(--ink); }
footer p { font-size: .82rem; color: var(--ink-dim); margin-top: .4rem; }

.tentbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding-bottom: var(--safe-bottom);
  /* Opaque on purpose. This bar is phone-only, and a backdrop-filter
     here re-blurred the page behind it on every scroll frame. */
  background: #0B0509;
  border-top: 1px solid var(--line);
}
.tentbar-btn {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .12rem;
  color: var(--ink-dim);
  transition: color .2s ease;
}
.tentbar-btn.is-active { color: var(--gold); }
.tentbar-btn.is-active .tentbar-n { background: var(--gold); color: #14060a; }
.tentbar-n {
  font-family: 'Alfa Slab One', Georgia, serif; font-size: .7rem;
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.1);
}
.tentbar-name { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 681px) {
  :root { --px: 2rem; --bar-h: 0px; }
  .tentbar { display: none; }
  .tent-grid { grid-template-columns: repeat(3, 1fr); }
  .rounds { grid-template-columns: repeat(2, 1fr); }
  .section { padding: 4.5rem 0; }
  .row { grid-template-columns: 2.6rem 1fr auto; padding: 1rem 1.1rem; }
  .gate-enter { display: inline-block; width: auto; }
}
@media (min-width: 981px) {
  :root { --px: 3rem; }
  .rounds { grid-template-columns: repeat(4, 1fr); }
  .tent-card:hover { transform: translateY(-4px); border-color: var(--gold); }
}

/* ============================================================
   FX BUDGET
   Phones and low-core machines never get the canvas layer.
   portal-fx.js sets .fx-low / .fx-high on <body>.
   ============================================================ */
body.fx-low .fx-canvas { display: none; }
body.fx-low .bd-spot { opacity: .3; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .gate { display: none; }
  .fx-canvas { display: none; }
  body.tdf-loading { overflow: auto; height: auto; }
}
