/* AI Racecraft, one page.
   Palette measured from the Higgsfield film archive, see ASSETS.md. One accent colour, no gradients,
   one radius. Nothing moves on scroll and nothing animates on load: the only motion is the film
   loading ring and the four figures counting once (digits only, no element changes position).

   Rhythm: every section uses --section-y. Running text uses --measure. One statement size,
   one key-line style, one ruled-card style. */

@font-face {
  font-family: "Archivo";
  src: url("assets/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FAF0E2;
  --paper-2: #F4E7D6;
  --ink: #2A2625;
  --ink-soft: #57504d;
  --accent: #B24C1C;
  --accent-text: #9C3B16;
  --on-accent: #FFF6EC;
  --band-ink: #1A1817;
  --on-band: #F3E9DC;
  --band-key: #F0A070;
  --rule: rgba(42, 38, 37, 0.18);
  --radius: 2px;
  --measure: 62ch;
  --container: 1240px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --section-y: clamp(4rem, 8vw, 6.5rem);
  --gap: clamp(1.75rem, 3.5vw, 2.75rem);
  --shadow: 0 14px 38px rgba(42, 38, 37, 0.16);
  --sans: "Archivo", ui-sans-serif, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}

/* Night rule from the archive: the same work on dark anthracite paper. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1C1A19;
    --paper-2: #2A2624;
    --ink: #F3E9DC;
    --ink-soft: #bdb2a6;
    --accent: #D2662F;
    --accent-text: #E07A45;
    --on-accent: #17120F;
    --band-ink: #131110;
    --rule: rgba(243, 233, 220, 0.2);
    --shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  }
  /* Near-black on near-black: the bands need an edge to keep the section rhythm. */
  .band-dark, .outcomes { border-block: 1px solid var(--rule); }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 clamp(1.04rem, 0.3vw + 1rem, 1.18rem)/1.62 var(--sans);
  overflow-x: clip;
}

::selection { background: var(--accent); color: var(--on-accent); }
:root { accent-color: var(--accent); caret-color: var(--accent); scrollbar-color: var(--accent) var(--paper-2); }
a { color: var(--accent-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--radius); }

/* Halftone register, the one texture kept from the films. */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.26;
  background-image: radial-gradient(circle at 50% 50%, rgba(42, 38, 37, 0.05) 0.5px, transparent 0.6px);
  background-size: 3px 3px;
}

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

h1, h2, h3, h4 {
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.6rem, 5.6vw, 4.6rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.15rem, 1.6vw, 1.35rem); letter-spacing: -0.02em; }
h4 { font-size: 1.05rem; letter-spacing: -0.015em; line-height: 1.25; }

p { margin: 0 0 1rem; max-width: var(--measure); }

.skip {
  position: absolute;
  top: 0.75rem;
  left: 1rem;
  z-index: 70;
  background: var(--paper);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  transform: translateY(calc(-100% - 1.5rem));
}
.skip:focus { transform: none; }

/* ---------- layout ---------- */

main, .site-footer, .band-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section { padding-block: var(--section-y); position: relative; }
section[id] { scroll-margin-top: 80px; }

.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--gap); }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* The one card style: a hairline on top, nothing else. */
.ruled { border-top: 1px solid var(--rule); padding-top: 1.25rem; }
.ruled p:last-child { margin-bottom: 0; }

/* The one statement size, used by the quote and the dark section. */
.statement {
  font-size: clamp(1.3rem, 2.3vw, 1.85rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
  max-width: 40ch;
}

/* The one key-line style: a short bold line in the accent. */
.key-line {
  font-weight: 800;
  font-size: clamp(1.5rem, 2.8vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--accent-text);
  margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
}

.intro { font-size: clamp(1.1rem, 1.4vw, 1.3rem); color: var(--ink-soft); margin-bottom: clamp(1.75rem, 3.5vw, 2.75rem); }
.note { color: var(--ink-soft); margin: var(--gap) 0 0; }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}
.nav.is-stuck {
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  box-shadow: 0 6px 24px rgba(42, 38, 37, 0.08);
}

/* Logo rules, Brand-AI-Racecraft.md § 14: lockup at least 160px wide, below that the mark alone. */
.brand { display: inline-flex; align-items: center; line-height: 0; min-height: 44px; min-width: 44px; }
.brand-lockup { width: 200px; }
.brand-mark { display: none; width: 36px; height: 36px; }
@media (max-width: 559px) {
  .brand-lockup { display: none; }
  .brand-mark { display: block; }
}

.nav-links { display: none; gap: clamp(1rem, 1.8vw, 1.6rem); margin-left: auto; margin-right: clamp(0.5rem, 1.5vw, 1.5rem); }
.nav-links a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding-block: 0.6rem;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 2px; }
@media (min-width: 1180px) { .nav-links { display: flex; } }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 700;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius);
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: background-color 0.2s, box-shadow 0.2s;
}
.btn:hover { background: var(--accent-text); }
.btn-small { padding: 0.55rem 1rem; font-size: 0.92rem; box-shadow: none; min-height: 44px; display: inline-flex; align-items: center; }
.btn-large { padding: 1.05rem 1.9rem; font-size: 1.08rem; }
/* On the accent band an accent button would vanish, so it inverts. */
.btn-onaccent { background: #FAF0E2; color: #2A2625; }
.btn-onaccent:hover { background: #FFFDF9; color: #2A2625; }
@media (max-width: 420px) { .btn-small { padding-inline: 0.75rem; font-size: 0.85rem; } }

/* ---------- hero ---------- */

.hero { padding-top: clamp(2rem, 7vw, 5.5rem); text-align: center; }
.hero p { margin-inline: auto; text-wrap: balance; }
/* The lockup is the headline. Logo rules, § 14: well above the 160px minimum, clear space from the margin. */
.hero-logo { margin: 0 0 clamp(1.75rem, 3.5vw, 2.75rem); line-height: 0; }
.hero-logo img { width: min(100%, 860px); margin-inline: auto; }
.slogan {
  font-size: clamp(1.35rem, 2.6vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.32;
  color: var(--accent-text);
  max-width: 26ch;
  margin-bottom: 1rem;
}
.lead { font-size: clamp(1.08rem, 1.3vw, 1.25rem); color: var(--ink-soft); max-width: 46ch; }
.hero-cta { margin: 2.25rem 0 0; }

/* ---------- Racecraft quote ---------- */

/* Centred under the centred hero; sits close to it. */
.racecraft { padding-top: clamp(1rem, 3vw, 2rem); }
.racecraft blockquote { margin: 0 auto; max-width: 52rem; text-align: center; }
.racecraft .statement { max-width: none; }
.racecraft footer { margin-top: 1.25rem; font-size: 0.95rem; color: var(--ink-soft); }
.racecraft cite { font-style: normal; }
/* Attribution link: a 44px tap area without moving the text. */
.racecraft footer a { display: inline-block; padding: 0.75rem 0.3rem; margin: -0.75rem -0.3rem; }

/* ---------- films ---------- */

.case-row { display: grid; gap: var(--gap); }
@media (min-width: 760px) { .case-row { grid-template-columns: repeat(3, 1fr); align-items: start; } }
.player {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 1.1rem;
  background: var(--band-ink);
}
.player video { width: 100%; }
.case h3 { margin-bottom: 0.35rem; text-wrap: pretty; }
.case p { color: var(--ink-soft); font-size: 0.98rem; }
.film-title { font-size: 0.86rem; margin-bottom: 0; }

/* Custom play disc over the poster; native controls take over once the film runs.
   Without JavaScript the button stays hidden and the native controls show. */
.play { display: none; }
.has-play .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.play-disc {
  width: clamp(56px, 5vw, 72px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(26, 24, 23, 0.35);
  display: grid;
  place-items: center;
  transition: background-color 0.2s;
}
.play-disc::after {
  content: "";
  width: 30%;
  aspect-ratio: 1;
  margin-left: 8%;
  background: #FFF6EC;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.play:hover .play-disc,
.play:focus-visible .play-disc { background: var(--accent-text); }
.play-time {
  position: absolute;
  right: 0.75rem;
  bottom: 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #FFF6EC;
  background: rgba(26, 24, 23, 0.72);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius);
}
.has-play.is-playing .play { display: none; }
.has-play.is-loading .play { display: grid; cursor: progress; }
.has-play.is-loading .play-disc::after { display: none; }
.has-play.is-loading .play-disc {
  background: transparent;
  border: 4px solid rgba(255, 246, 236, 0.35);
  border-top-color: var(--accent);
  box-shadow: none;
}
@media (prefers-reduced-motion: no-preference) {
  .has-play.is-loading .play-disc { animation: spin 0.9s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

/* ---------- bands ---------- */

.band {
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  padding-inline: 0;
}
.band-dark {
  background-color: var(--band-ink);
  background-image: linear-gradient(rgba(26, 24, 23, 0.86), rgba(26, 24, 23, 0.86));
  background-size: cover;
  background-position: center;
  color: var(--on-band);
}
/* Night desk: loaded only when the band is near (main.js adds .has-bg); applied directly without JS. */
html:not(.js) .band-dark,
.band-dark.has-bg {
  background-image: linear-gradient(rgba(26, 24, 23, 0.86), rgba(26, 24, 23, 0.86)), url("assets/web/night-desk.webp");
}
.band-dark .key-line { color: var(--band-key); }

.band-accent { background: var(--accent); color: var(--on-accent); }
.band-accent h2 { color: var(--on-accent); }

/* ---------- examples ---------- */

.outcomes {
  background: var(--paper-2);
  width: 100vw;
  margin-inline: calc(50% - 50vw);
  padding-inline: var(--gutter);
}
.outcomes > * { max-width: calc(var(--container) - 2 * var(--gutter)); margin-inline: auto; }
.outcome-figure {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  color: var(--accent-text);
  line-height: 0.95;
  margin-bottom: 0.75rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- How a session runs ---------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap); }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(2, 1fr); } }
.steps strong { display: block; }
.steps li { margin: 0; }
.sub-head { margin-top: var(--section-y); margin-bottom: var(--gap); font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.grid-4 p { font-size: 0.98rem; color: var(--ink-soft); }

/* ---------- Beyond your range ---------- */

.beyond { border-top: 1px solid var(--rule); }
.beyond .intro { color: var(--ink); margin-bottom: 0; }

/* ---------- close ---------- */

.close { text-align: center; }
.close h2 { max-width: 18ch; margin-inline: auto; font-size: clamp(2.2rem, 5vw, 3.6rem); }
.close p { margin-inline: auto; max-width: 52ch; }
.close .btn { margin-top: 1.5rem; }

/* ---------- subpages (contact, thanks, topics) and the contact form ---------- */

.page { max-width: 46rem; padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 8vw, 6rem); }
.page h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.page h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 2.75rem 0 1rem; }
.page h3 { margin: 2rem 0 0.75rem; }
.topic-list { margin: 0; padding-left: 1.4rem; display: grid; gap: 0.75rem; }
.topic-list li::marker { color: var(--accent-text); font-weight: 700; }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-weight: 700; padding: 0; margin-bottom: 0.35rem; }
.choices { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.choices label { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px; font-weight: 400; cursor: pointer; }
.choices input { width: 1.2rem; height: 1.2rem; margin: 0; }
.thanks-alt { margin-top: 1.5rem; color: var(--ink-soft); font-size: 0.95rem; }
.contact-form { display: grid; gap: 1.5rem; margin-top: var(--gap); }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 700; }
.hint { color: var(--ink-soft); font-size: 0.95rem; }
.field input,
.field textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  width: 100%;
  min-height: 44px;
}
.field textarea { resize: vertical; }
.field input:focus-visible,
.field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.privacy-note { color: var(--ink-soft); font-size: 0.95rem; margin: 0; }
.contact-form button { border: 0; cursor: pointer; font-family: inherit; }
.form-error { border-left: 4px solid var(--accent); background: var(--paper-2); padding: 0.9rem 1rem; font-weight: 600; }
/* Honeypot: off-screen for people, still in the form for bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- footer and legal pages ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 2.5rem 3.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
.site-footer p { max-width: none; }
.legal-links { display: flex; gap: 1.5rem; }
.legal-links a { color: var(--ink-soft); padding-block: 0.75rem; }
.legal-links a:hover { color: var(--accent-text); }

.legal { max-width: 46rem; padding-block: clamp(2rem, 6vw, 4rem) clamp(3rem, 8vw, 6rem); }
.legal h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.legal h2 { font-size: clamp(1.25rem, 2vw, 1.5rem); margin-top: 2.5rem; margin-bottom: 0.5em; }
.legal address { font-style: normal; margin-bottom: 1rem; }
.legal .stand { color: var(--ink-soft); font-size: 0.92rem; margin-top: 3rem; }
/* Unfilled fields stay loud so the page cannot launch with them unnoticed. */
.todo { background: #FFE08A; color: #2A2625; padding: 0.05em 0.3em; border-radius: var(--radius); font-weight: 700; }
