@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* The app's own tokens (ThemeContext.tsx): night ground, rainbow-band yellow, UCI bands */
:root {
  color-scheme: dark;
  --ground: #0b0c0f;
  --ground-2: #13100f;
  --ink: #f4f3ef;
  --ink-soft: rgba(244, 243, 239, 0.72);
  --ink-faint: rgba(244, 243, 239, 0.5);
  --yellow: #ffcc00;
  --yellow-ink: #1a1a1a;
  --line: rgba(255, 255, 255, 0.14);
  --surface: rgba(22, 22, 24, 0.92);
  --band-blue: #0066cc;
  --band-red: #e2231a;
  --band-black: #0a0a0a;
  --band-green: #00a04a;
  --display: 'Archivo', 'Arial Narrow', sans-serif;
  --text: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bar-h: 64px;
  --pager-h: 76px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scroll-snap-type: y proximity; scroll-padding-top: var(--bar-h); scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(180deg, var(--ground), var(--ground-2));
  background-attachment: fixed;
  color: var(--ink);
  font: 400 1.1875rem/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--yellow); }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }

/* RainbowBackdrop: the five UCI bands, barely there, like the app's ground */
.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.05;
  background: linear-gradient(90deg,
    var(--band-blue) 0 20%, var(--band-red) 20% 40%, var(--band-black) 40% 60%,
    var(--yellow) 60% 80%, var(--band-green) 80% 100%);
  background-size: 100% 100%;
}

/* Top bar: wordmark, the wheel riding to the flag, store state */
.bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; height: calc(var(--bar-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) clamp(16px, 4vw, 40px) 0;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: clamp(16px, 3vw, 40px);
  background: rgba(8, 8, 10, 0.86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-mark img { width: clamp(150px, 18vw, 230px); height: auto; }
.track { position: relative; height: 22px; display: flex; align-items: center; gap: 10px; }
.track-line { position: relative; flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.track-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 2px; background: var(--yellow); }
.track-wheel {
  position: absolute; left: 0; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  fill: var(--surface); stroke: var(--yellow); stroke-width: 2; stroke-linecap: round;
  border-radius: 50%; background: var(--surface);
}
.track-wheel .spokes { stroke-width: 1; }
.track-flag { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-faint); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; transition: stroke 0.3s; }
.track.done .track-flag { stroke: var(--yellow); }
.bar-store {
  font: 600 0.8125rem/1 var(--text); color: var(--ink); text-decoration: none; white-space: nowrap;
  padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06);
  transition: background 0.2s, border-color 0.2s;
}
.bar-store:hover { background: rgba(255, 204, 0, 0.14); border-color: rgba(255, 204, 0, 0.5); }

/* A slide: one idea, one screen */
.slide {
  min-height: 100svh; scroll-snap-align: start;
  padding: calc(var(--bar-h) + 6vh) clamp(16px, 6vw, 96px) calc(var(--pager-h) + 6vh);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); align-items: center; gap: clamp(32px, 6vw, 110px);
  max-width: 1320px; margin: 0 auto;
}
.slide:nth-of-type(odd):not(.slide-cover):not(.slide-finish) .slide-text { order: 2; }
.slide > * { min-width: 0; }
.slide-text { max-width: 36rem; }
.slide-text p { margin: 0 0 1em; color: var(--ink-soft); }

.title {
  font-family: var(--display); font-weight: 800; font-stretch: 72%; text-transform: uppercase;
  font-size: clamp(2.6rem, 6.2vw, 5.6rem); line-height: 0.92; letter-spacing: -0.01em;
  margin: 0 0 0.45em; text-wrap: balance;
}
.slide-cover .title { font-size: clamp(3rem, 7.6vw, 6rem); }
.lede { font-size: clamp(1.2rem, 1.6vw, 1.4rem); line-height: 1.5; color: var(--ink) !important; }

.countdown {
  position: relative; padding-left: 30px; margin: 0.4em 0 1.6em !important; max-width: 30rem;
  font-weight: 600; color: var(--ink) !important; font-size: 1rem;
}
.countdown svg { position: absolute; left: 0; top: 0.1em; width: 20px; height: 20px; fill: none; stroke: var(--yellow); stroke-width: 2; stroke-linecap: round; }
.countdown svg path { stroke-width: 1; }
.countdown strong { color: var(--yellow); font-variant-numeric: tabular-nums; }

/* Store buttons: honest "coming soon" until the listings exist */
.stores { display: flex; flex-wrap: wrap; gap: 12px; }
.store {
  display: inline-flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 20px 10px 16px;
  border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); color: var(--ink); text-decoration: none;
}
.store svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.store span { display: grid; line-height: 1.15; }
.store small { font: 500 0.75rem/1.2 var(--text); color: var(--ink-faint); }
.store b { font: 700 1.125rem/1.2 var(--text); white-space: nowrap; }
.store small { white-space: nowrap; }
a.store { background: var(--yellow); color: var(--yellow-ink); border-color: var(--yellow); transition: transform 0.2s var(--ease); }
a.store small { color: rgba(26, 26, 26, 0.7); }
a.store:hover { transform: translateY(-2px); }
.store[aria-disabled='true'] { cursor: default; }
.stores-large .store { min-height: 64px; padding-inline: 22px 26px; }

/* Phones: real screens in a frame */
.phone {
  margin: 0; justify-self: center; aspect-ratio: 720 / 1565;
  height: min(calc(100svh - var(--bar-h) - var(--pager-h) - 16vh), 780px); width: auto; max-width: 78vw;
  border-radius: 52px; padding: 11px; background: #050506;
  box-shadow: 0 0 0 1.5px #2b2d32, 0 40px 80px -20px rgba(0, 0, 0, 0.75), 0 12px 30px rgba(0, 0, 0, 0.45);
  position: relative;
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 42px; }
.phone-tilt { transform: rotate(3deg); }
/* Screens that carry the app's own Previous/Next fade out before it, so two pagers never stack */
.phone.no-pager::after { content: ''; position: absolute; left: 11px; right: 11px; bottom: 11px; height: 17%; border-radius: 0 0 42px 42px; background: linear-gradient(180deg, rgba(11, 12, 15, 0), #0b0c0f 45%); }
.phones { display: grid; justify-items: center; position: relative; }
.phones .phone { grid-area: 1 / 1; }
.phones .phone-back { transform: translateX(-30%) rotate(-6deg) scale(0.86); filter: brightness(0.72); }
.phones .phone-front { transform: translateX(16%) rotate(3deg); }

/* The archive: three photo slides fanned like prints on a table */
.fan { display: grid; justify-items: center; }
.fan .phone { grid-area: 1 / 1; height: min(calc(100svh - var(--bar-h) - var(--pager-h) - 14vh), 720px); }
.fan .phone:nth-child(1) { transform: translateX(-42%) rotate(-9deg) scale(0.84); filter: brightness(0.78); }
.fan .phone:nth-child(2) { transform: translateX(42%) rotate(8deg) scale(0.84); filter: brightness(0.78); }
.fan .phone:nth-child(3) { z-index: 1; }

/* Photo grounds: the race itself behind the slide, darkened so the type stays readable */
.slide-cover, .slide-archive { position: relative; isolation: isolate; max-width: none; padding-inline: max(clamp(16px, 6vw, 96px), calc((100vw - 1320px) / 2 + 96px)); }
.slide-cover::before, .slide-archive::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(11, 12, 15, 0.96) 0%, rgba(11, 12, 15, 0.82) 45%, rgba(11, 12, 15, 0.55) 100%), var(--bg) center / cover no-repeat;
}
.slide-cover::after, .slide-archive::after { content: ''; position: absolute; inset: auto 0 0; height: 30%; z-index: -1; background: linear-gradient(180deg, rgba(11, 12, 15, 0), var(--ground)); }
.slide-cover { --bg: url('img/bg-arenberg.webp'); }
.slide-archive { --bg: url('img/bg-faema.webp'); }
.slide-archive::before { background: linear-gradient(270deg, rgba(11, 12, 15, 0.96) 0%, rgba(11, 12, 15, 0.8) 45%, rgba(11, 12, 15, 0.5) 100%), var(--bg) center / cover no-repeat; filter: grayscale(1); }

/* Race week: the seven dots, read days filled */
.days { list-style: none; margin: 1.6em 0 0; padding: 0; display: grid; gap: 8px; }
.days li { display: grid; grid-template-columns: 34px 1fr; align-items: center; font: 600 0.95rem/1.2 var(--text); color: var(--ink-faint); }
.days span { font: 800 1.35rem/1 var(--display); font-stretch: 80%; color: var(--ink-faint); text-align: center; }
.days li.read, .days li.read span { color: var(--ink); }
.days li.read span { color: var(--yellow); }
.days li.today { color: var(--ink); }
.days li.today span { color: var(--yellow-ink); background: var(--yellow); border-radius: 6px; padding: 4px 0; margin-right: 6px; }


/* Calendar: the 2027 race weeks, plain type */
.calendar { list-style: none; margin: 1.4em 0 0; padding: 0; border-top: 1px solid var(--line); }
.calendar li { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 1rem; color: var(--ink-soft); }
.calendar b { font: 800 1.15rem/1.2 var(--display); font-stretch: 80%; text-transform: uppercase; color: var(--ink); letter-spacing: 0.01em; }
.calendar li span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.calendar li.next b, .calendar li.next span { color: var(--yellow); }

/* Finish: the app's Race ready stamp presses in, then the rainbow bands at full strength */
.slide-finish { grid-template-columns: 1fr; justify-items: center; text-align: center; align-content: center; }
.finish { max-width: 44rem; display: grid; justify-items: center; }
.stamp {
  width: 128px; height: 128px; border-radius: 50%; border: 3px solid var(--yellow); color: var(--yellow);
  display: grid; place-content: center; text-align: center; margin-bottom: 20px; transform: rotate(-8deg) scale(1.6); opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.3s var(--ease);
}
.stamp span { font: 800 0.85rem/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.stamp b { font: 900 1.9rem/1.05 var(--display); font-stretch: 85%; }
.slide-finish.seen .stamp, html:not(.js) .stamp { transform: rotate(-8deg) scale(1); opacity: 1; }
.finish-line { position: relative; width: 100%; height: 10px; margin-top: 5vh; }
.finish-line::before {
  content: ''; position: absolute; top: 0; left: 50%; width: 100vw; height: 10px; transform: translateX(-50%);
  background: linear-gradient(90deg, var(--band-blue) 0 20%, var(--band-red) 20% 40%, #000 40% 60%, var(--yellow) 60% 80%, var(--band-green) 80% 100%);
}
.finish .stores { justify-content: center; margin: 0.6em 0 2em; }
.facts { list-style: none; padding: 0; margin: 0; color: var(--ink-soft); display: grid; gap: 6px; font-size: 1rem; }
.footer { margin-top: 3vh; font-size: 0.875rem; color: var(--ink-faint); max-width: 44rem; }
.footer p { margin: 0.3em 0; }

/* Questions: plain answers, open one at a time */
.slide-faq { grid-template-columns: 1fr; justify-items: center; }
.faq { width: min(760px, 100%); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 2px; font: 700 1.15rem/1.35 var(--text); color: var(--ink);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font: 400 1.6rem/1 var(--text); color: var(--yellow); transition: transform 0.25s var(--ease); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin: -4px 2px 20px; color: var(--ink-soft); max-width: 62ch; }

/* Pager: the app's Previous / count / Next */
.pager {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 10; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 999px;
  background: rgba(8, 8, 10, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 0 1px var(--line), 0 16px 40px -10px rgba(0, 0, 0, 0.7);
}
.pager button {
  display: inline-flex; align-items: center; gap: 4px; min-height: 46px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer;
  font: 700 1rem/1 var(--text); color: var(--ink); background: rgba(255, 255, 255, 0.08); transition: background 0.2s, opacity 0.2s;
}
.pager button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pager .pager-next { background: var(--yellow); color: var(--yellow-ink); }
.pager button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.pager .pager-next:hover:not(:disabled) { background: #ffd633; }
.pager button:disabled { opacity: 0.35; cursor: default; }
.pager.at-finish { opacity: 0; pointer-events: none; transform: translate(-50%, 12px); }
.pager { transition: opacity 0.3s var(--ease), transform 0.3s var(--ease); }
.pager-count { min-width: 52px; text-align: center; font: 600 0.9rem/1 var(--text); color: var(--ink-faint); font-variant-numeric: tabular-nums; }


@media (max-width: 860px) {
  :root { --bar-h: 58px; }
  .bar { grid-template-columns: auto 1fr; }
  .bar-store { display: none; }
  .slide { grid-template-columns: 1fr; gap: 40px; padding-top: calc(var(--bar-h) + 40px); }
  .slide:nth-of-type(odd):not(.slide-cover):not(.slide-finish) .slide-text { order: 0; }
  .phone { height: auto; width: min(300px, 76vw); max-width: none; }
  .pager { display: none; }
  .slide { min-height: auto; padding-bottom: 72px; }
  .slide-cover { display: flex; flex-direction: column; align-items: stretch; padding-top: calc(var(--bar-h) + 24px); gap: 0; }
  .slide-cover .slide-text { display: contents; }
  .slide-cover .title { order: 1; font-size: clamp(2.4rem, 11vw, 3.2rem); }
  .slide-cover .phones-cover { order: 2; display: block; margin: 4px 0 20px; }
  .slide-cover .phones-cover .phone-back { display: none; }
  .slide-cover .phones-cover .phone-front { width: 100%; height: 30svh; aspect-ratio: auto; transform: none !important; border-radius: 34px 34px 0 0; padding: 9px 9px 0; overflow: hidden; box-shadow: 0 0 0 1.5px #2b2d32; }
  .slide-cover .phones-cover .phone-front img { object-fit: cover; object-position: 50% 14%; border-radius: 26px 26px 0 0; }
  .slide-cover .lede { font-size: 1.05rem; margin-bottom: 0.6em; }
  .slide-cover .countdown { margin: 0.2em 0 1em !important; font-size: 0.95rem; }
  .fan .phone { height: auto; width: min(220px, 52vw); }
  .fan .phone:nth-child(1) { transform: translateX(-46%) rotate(-9deg) scale(0.86); }
  .fan .phone:nth-child(2) { transform: translateX(46%) rotate(8deg) scale(0.86); }
  .slide-cover, .slide-archive { padding-inline: 16px; }
  .slide-cover .lede { order: 3; }
  .slide-cover .countdown { order: 4; }
  .slide-cover .stores { order: 5; }
  .phones .phone-back { transform: translateX(-28%) rotate(-6deg) scale(0.86); }
  .phones .phone:not(.phone-back) { transform: translateX(14%) rotate(3deg); }
  .pager button { padding: 0 14px; }
  .stores { flex-wrap: nowrap; }
  .store { flex: 1 1 0; min-width: 0; padding: 8px 12px; gap: 8px; }
  .store b { font-size: 1rem; }
  .store svg { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stamp { opacity: 1 !important; transform: rotate(-8deg) !important; }
}
