:root {
  /* Fixed brand colours, the same in both themes */
  --black: #0a0a0b;
  --cream: #f3eee2;
  --hot: #ff4a0d;
  --amber: #ffb000;
  --display: "Segoe UI Black", "Arial Black", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hazard: repeating-linear-gradient(-55deg, var(--amber) 0 22px, var(--black) 22px 44px);

  /* Dark theme (default) */
  color-scheme: dark;
  --bg: #0a0a0b;
  --fg: #f3eee2;
  --muted: #b1aca1;
  --panel: #17171a;
  --panel-hover: #222226;
  --line: #34343a;
  --accent: #ffb000;
  --hot-text: #ff4a0d;
  --road-color: #ffb000;
  --car-wing: #ffb000;
  --car-shadow: .9;
  --inv-card: #ffffff;
  --inv-muted: #4c4a44;
  --inv-accent: #c23400;

  /* Animated by site.js */
  --split: 1;
  --intro: 0px;
  --car-x: 0px;
  --bar-x: 0px;
  --wheel: 0deg;
  --road: 0px;
  --motion: 0;
  --needle: -108deg;
  --needle-speed: -135deg;

  /* Layout */
  --car-w: clamp(290px, 44vw, 600px);
  --stage-h: calc(var(--car-w) * .288 + 20px);
  --rail: 110px;
  --dial: 92px;
  --start-size: 64px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee2;
  --fg: #0a0a0b;
  --muted: #56534c;
  --panel: #ffffff;
  --panel-hover: #ffffff;
  --line: #cfc9bb;
  --accent: #a84300;
  --hot-text: #d63a00;
  --road-color: #0a0a0b;
  --car-wing: #17171a;
  --car-shadow: .25;
  --inv-card: #1b1b1f;
  --inv-muted: #b1aca1;
  --inv-accent: #ff8a4a;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f3eee2;
    --fg: #0a0a0b;
    --muted: #56534c;
    --panel: #ffffff;
    --panel-hover: #ffffff;
    --line: #cfc9bb;
    --accent: #a84300;
    --hot-text: #d63a00;
    --road-color: #0a0a0b;
    --car-wing: #17171a;
    --car-shadow: .25;
    --inv-card: #1b1b1f;
    --inv-muted: #b1aca1;
    --inv-accent: #ff8a4a;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--sans);
  overflow-x: clip;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.wrap { width: min(1240px, 100%); margin-inline: auto; padding-inline: 16px; }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 30;
  background: var(--amber); color: var(--black); padding: 8px 12px;
}
.skip:focus { left: 8px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); position: relative; z-index: 2; }
.site-head .wrap {
  display: flex; align-items: center;
  gap: 8px 20px; min-height: 64px; flex-wrap: wrap; padding-block: 10px;
}
.brand {
  color: var(--fg); text-decoration: none; font-weight: 800;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand-logo { width: 44px; height: 44px; display: block; flex: none; }
.site-nav { display: flex; gap: 4px 18px; flex-wrap: wrap; margin-left: auto; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: var(--fg); }

/* Theme switch */
.theme-toggle {
  position: relative; flex: none; width: 66px; height: 34px; padding: 0 8px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--panel); border: 2px solid var(--line); border-radius: 999px;
  color: var(--muted); cursor: pointer; transform: skewX(-8deg);
}
.theme-toggle[hidden] { display: none; }
.theme-toggle svg {
  position: relative; z-index: 1; width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.theme-toggle .moon { fill: currentColor; stroke: none; }
.toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 26px; height: 26px;
  background: var(--hot); border-radius: 50%;
  transform: translateX(32px); transition: transform .18s ease;
}
.theme-toggle[aria-pressed="true"] .toggle-knob { transform: none; }
.theme-toggle svg:nth-of-type(1) { color: var(--muted); }
.theme-toggle[aria-pressed="true"] svg:nth-of-type(1) { color: var(--black); }
.theme-toggle[aria-pressed="false"] svg:nth-of-type(2) { color: var(--black); }

/* Hero */
.hero { position: relative; padding-block: clamp(28px, 4vw, 48px) clamp(32px, 5vw, 56px); overflow: clip; }
.headline {
  font: italic 900 clamp(2.6rem, 7vw, 6rem)/.96 var(--display);
  text-transform: uppercase; letter-spacing: -.03em; margin: 0 0 22px;
}
.line { display: block; position: relative; will-change: transform; }
.line-a { transform: translateY(calc((1 - var(--split)) * var(--stage-h) / 2)); }
.line-b {
  color: var(--hot-text);
  transform: translateY(calc((var(--split) - 1) * var(--stage-h) / 2));
}
.lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--muted); margin: 0 0 26px; max-width: 58ch; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.btn {
  display: inline-block; background: var(--hot); color: var(--black);
  font: italic 900 1.05rem/1.2 var(--display); text-transform: uppercase; text-decoration: none;
  padding: 17px 26px; transform: skewX(-8deg); transition: transform .15s, background .15s;
}
.btn:hover { background: var(--amber); transform: skewX(-8deg) translateX(5px); }

/* Supercar between the two phrases */
.stage {
  display: flex; flex-direction: column; justify-content: flex-end;
  height: var(--stage-h); position: relative; z-index: 2; font-size: 1rem;
}
.hero-car {
  display: block; width: var(--car-w); margin-left: auto;
  transform: translateX(calc(var(--intro) + var(--car-x))); will-change: transform;
}
.car { display: block; width: 100%; height: auto; overflow: visible; }
.car-shadow { fill: #000; opacity: var(--car-shadow); }
.car-wing { fill: var(--car-wing); }
.car-glass { fill: #0d1114; }
.car-pillar { fill: #a82a00; }
.car-vent { fill: rgba(10, 5, 2, .78); }
.car-seam { fill: none; stroke: rgba(10, 5, 2, .45); stroke-width: 2; }
.car-skirt { fill: #17171a; }
.car-head { fill: #fff3c4; }
.car-tail { fill: #ff1a1a; }
.car-beam { opacity: calc(.35 + var(--motion) * .65); }
.car-tire { fill: #050506; stroke: #2a2a2e; stroke-width: 2; }
.car-rim { fill: #1b1b1f; stroke: var(--amber); stroke-width: 2.5; }
.car-spokes line { stroke: var(--cream); stroke-width: 5; stroke-linecap: round; }
.car-hubcap { fill: var(--amber); }
.wheel { transform: rotate(var(--wheel)); transform-box: fill-box; transform-origin: center; }
.car-lines { opacity: var(--motion); }
.car-lines line { stroke: var(--road-color); stroke-width: 3; stroke-linecap: round; }
.road {
  display: block; flex: none; height: 4px; margin-top: 4px;
  opacity: var(--split); /* Fades out as the phrases close, so it never crosses the text */
  background: linear-gradient(90deg, var(--road-color) 50%, transparent 0) var(--road) 0 / 80px 4px repeat-x;
}

/* Symptom picker */
.symptoms-title {
  font: 700 .85rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: clamp(24px, 4vw, 40px) 0 12px;
}
.symptoms {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
}
.symptoms a {
  display: block; height: 100%; padding: 16px 18px; text-decoration: none; color: var(--fg);
  background: var(--panel); border-left: 5px solid var(--amber); transition: background .15s, color .15s;
}
.symptoms strong { display: block; line-height: 1.25; font-size: 1.08rem; }
.symptoms span { display: block; margin-top: 8px; color: var(--accent); font: 700 .85rem var(--mono); }
.symptoms span::after { content: " →"; }
.symptoms a:hover { background: var(--amber); color: var(--black); }
.symptoms a:hover span { color: var(--black); }

/* Code ticker */
.ticker { background: var(--hazard); padding-block: 12px; overflow: hidden; }
.ticker-track { display: flex; width: max-content; background: var(--black); animation: ticker 44s linear infinite; }
.ticker-track span {
  white-space: nowrap; padding: 8px 26px; color: var(--amber);
  font: 700 .95rem var(--mono); text-transform: uppercase;
}
@keyframes ticker { to { transform: translateX(-50%); } }

/* Sections. Right padding keeps content clear of the instrument column. */
.gear .wrap, .contact .wrap, .site-foot .wrap {
  padding-right: max(16px, calc(var(--rail) + 12px - max(0px, (100vw - 1240px) / 2)));
}
.gear { padding-block: clamp(56px, 9vw, 112px); position: relative; }
.gear-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end;
  gap: clamp(14px, 3vw, 36px); margin-bottom: clamp(28px, 4vw, 48px);
}
.gear-num {
  font: italic 900 clamp(6.5rem, 21vw, 16rem)/.74 var(--display);
  color: transparent; -webkit-text-stroke: 3px var(--gear-accent);
  user-select: none;
}
.kicker { font: 700 .85rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 6px; color: var(--gear-accent); }
.gear h2 {
  font: italic 900 clamp(2.3rem, 7vw, 5.4rem)/.96 var(--display);
  text-transform: uppercase; letter-spacing: -.025em; margin: 0 0 12px;
}
.section-note { margin: 0; max-width: 60ch; font-size: 1.05rem; color: var(--gear-note); }

.gear-dark { background: var(--bg); --gear-accent: var(--accent); --gear-note: var(--muted); }
.gear-hot {
  background: var(--hot); color: var(--black); --gear-accent: var(--black); --gear-note: var(--black);
}
.gear-bone {
  background: var(--fg); color: var(--bg); --gear-accent: var(--inv-accent); --gear-note: var(--inv-muted);
}
/* Slanted seams: each wedge is painted in the colour of the section above it */
.gear-hot::before, .gear-bone::before {
  content: ""; position: absolute; inset: -1px 0 auto; height: clamp(18px, 4vw, 56px);
}
.gear-hot::before { background: var(--bg); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.gear-bone::before { background: var(--hot); clip-path: polygon(0 0, 100% 0, 0 100%); }

.app-grid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.app {
  display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 14px; align-items: start;
  height: 100%; padding: 16px; background: var(--panel); color: var(--fg); text-decoration: none;
  border-bottom: 4px solid transparent;
  transition: transform .16s ease, background .16s, border-color .16s;
}
.app:hover, .app:focus-visible {
  transform: translate(-4px, -4px) rotate(-1deg); background: var(--panel-hover); border-bottom-color: var(--amber);
}
.app img { width: 60px; height: 60px; border-radius: 13px; display: block; }
.app strong { display: block; line-height: 1.25; margin-bottom: 4px; font-size: 1.05rem; }
.app span { display: block; color: var(--muted); font-size: .93rem; line-height: 1.45; }
.gear-hot .app { background: var(--black); color: var(--cream); }
.gear-hot .app span { color: #b1aca1; }
.gear-hot .app:hover { background: #000; }
.gear-bone .app { background: var(--inv-card); color: var(--bg); box-shadow: 0 0 0 2px var(--bg); }
.gear-bone .app span { color: var(--inv-muted); }
.gear-bone .app:hover { background: var(--inv-card); border-bottom-color: var(--hot); box-shadow: 8px 8px 0 var(--hot), 0 0 0 2px var(--bg); }

.steps {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); counter-reset: s;
}
.steps li { counter-increment: s; border-top: 5px solid var(--hot); padding-top: 12px; }
.steps li::before { content: "0" counter(s); font: italic 900 2.2rem/1 var(--display); color: var(--hot-text); }
.steps h3 { margin: 8px 0 4px; font-size: 1.2rem; }
.steps p { margin: 0; color: var(--muted); }

/* Contact */
.contact { background: var(--amber); color: var(--black); padding-block: clamp(48px, 8vw, 96px); border-top: 14px solid; border-image: var(--hazard) 14; }
.contact h2 {
  font: italic 900 clamp(2.3rem, 7vw, 5.4rem)/.96 var(--display);
  text-transform: uppercase; letter-spacing: -.025em; margin: 0 0 10px;
}
.contact p { margin: 0 0 20px; font-size: 1.1rem; }
.contact-mail {
  color: var(--black); font: 900 clamp(1.15rem, 4.6vw, 3.2rem)/1.15 var(--display);
  overflow-wrap: anywhere; text-decoration-thickness: 4px;
}
.contact-mail:hover { color: #7a1e00; }

/* Road strip fixed to the bottom of the page */
.hud {
  --car-wing: #ffb000; --car-shadow: .9;
  position: fixed; inset: auto 0 0; z-index: 20; height: 56px;
  background: var(--black); border-top: 2px solid var(--hot);
  pointer-events: none; transform: translateY(110%); transition: transform .25s;
}
.hud.is-on { transform: none; }
.hud-road {
  position: relative; height: 100%; overflow: hidden;
  background: linear-gradient(90deg, #5a5a60 50%, transparent 0) var(--road) calc(100% - 4px) / 80px 2px repeat-x;
}
.hud-car { position: absolute; left: 0; bottom: 6px; width: 132px; transform: translateX(var(--bar-x)); }
.hud-car .car-lines, .hud-car .car-beam { display: none; }

/* Vertical instrument column on the right, ending on the road strip.
   The bottom padding leaves room for the top button. */
.rail {
  position: fixed; right: 0; bottom: 56px; z-index: 19; width: var(--rail);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 8px calc(var(--start-size) + 20px);
  background: var(--black); border-left: 4px solid var(--hot);
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%, 0 20px);
  pointer-events: none; transform: translateX(110%); transition: transform .28s ease;
}
.rail.is-on { transform: none; }
.dial { display: block; flex: none; width: var(--dial); height: var(--dial); overflow: visible; }
.dial-face { fill: #111114; stroke: #34343a; stroke-width: 2; }
.dial-red { fill: none; stroke: var(--hot); stroke-width: 7; }
.dial-ticks line { stroke: var(--cream); stroke-width: 1.5; }
.dial-ticks line.major { stroke-width: 3.5; }
.dial-ticks line.hot { stroke: var(--hot); }
.dial-nums text {
  fill: var(--cream); font: italic 900 25px var(--display);
  text-anchor: middle; dominant-baseline: central;
}
.dial-nums text.hot { fill: var(--hot); }
.dial-speed .dial-nums text { font-size: 21px; }
.dial-num { fill: var(--cream); font: 700 27px var(--mono); text-anchor: middle; }
.dial-unit { fill: #b1aca1; font: 700 15px var(--mono); letter-spacing: .08em; text-anchor: middle; }
.needle { transform: rotate(var(--needle)); transform-origin: 100px 100px; }
.dial-speed .needle { transform: rotate(var(--needle-speed)); }
.needle path { fill: var(--hot); }
.dial-hub { fill: #000; stroke: var(--hot); stroke-width: 2.5; }
.is-redline .dial-rpm .dial-num { fill: var(--hot); }

.gear-box {
  flex: none; width: 52px; text-align: center;
  background: #000; border: 2px solid #34343a; padding: 3px 0 1px; transform: skewX(-8deg);
}
.gear-label { display: block; color: #b1aca1; font: 700 .58rem/1.2 var(--mono); letter-spacing: .08em; }
.gear-value { display: block; color: var(--amber); font: italic 900 1.9rem/1.05 var(--display); }
.is-redline .gear-value { color: var(--hot); }

/* Engine start/stop style button: back to top */
.start-btn {
  position: fixed; bottom: 66px; z-index: 21;
  /* Centred in the column: half the column minus half the button, allowing for the left border */
  right: calc((var(--rail) - 4px - var(--start-size)) / 2);
  width: var(--start-size); height: var(--start-size); padding: 5px; border-radius: 50%; text-decoration: none;
  background: conic-gradient(from 210deg, #f4f4f4, #6d6d72, #d9d9dc, #55555a, #f4f4f4, #77777c, #f4f4f4);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .55);
  transform: translateX(calc(var(--rail) + 20px)); visibility: hidden;
  transition: transform .28s ease, visibility .28s;
}
.start-btn.is-on { transform: none; visibility: visible; }
.start-face {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 50%; color: var(--cream);
  background: radial-gradient(circle at 50% 34%, #3a3a40, #101012 68%);
  box-shadow: inset 0 0 0 3px var(--hot), inset 0 0 14px rgba(255, 74, 13, .75);
  transition: box-shadow .12s, transform .12s;
}
.start-face svg { display: block; width: 21px; height: 21px; fill: currentColor; }
.start-text { font: italic 900 .58rem/1 var(--display); letter-spacing: .06em; margin-top: 1px; }
.start-btn:hover .start-face { color: var(--amber); box-shadow: inset 0 0 0 3px var(--amber), inset 0 0 20px rgba(255, 176, 0, .85); }
.start-btn:active .start-face { transform: scale(.93); box-shadow: inset 0 0 0 3px var(--hot), inset 0 0 30px var(--hot); }
.start-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

/* Footer */
.site-foot { background: var(--bg); padding-block: 28px 84px; color: var(--muted); font-size: .9rem; }
.site-foot p { margin: 0 0 8px; max-width: 80ch; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 14px; }

/* Long-form policy: stays calm and readable */
.doc { width: min(760px, 100%); margin-inline: auto; padding: clamp(32px, 6vw, 56px) 16px 56px; }
.doc h1 {
  font: italic 900 clamp(2.2rem, 6vw, 3.4rem)/1 var(--display);
  text-transform: uppercase; letter-spacing: -.03em; margin: 0 0 8px;
}
.doc h2 { font-size: 1.35rem; line-height: 1.25; margin: 40px 0 10px; }
.doc h3 { font-size: 1.05rem; margin: 22px 0 6px; }
.doc p, .doc ul { margin: 0 0 14px; }
.doc li { margin-bottom: 8px; }
.doc .meta { color: var(--muted); margin-bottom: 28px; }
.callout { background: var(--panel); border-left: 5px solid var(--hot); padding: 16px 18px; margin-bottom: 24px; }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.table-scroll { overflow-x: auto; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

@media (max-width: 800px) {
  .site-nav { order: 3; flex-basis: 100%; margin-left: 0; }
  .theme-toggle { margin-left: auto; }
  .hud-car { width: 96px; }
  .gear-num { -webkit-text-stroke-width: 2px; }
}
@media (max-width: 600px) {
  :root { --rail: 74px; --dial: 62px; --start-size: 50px; }
  .rail { gap: 4px; padding: 8px 4px calc(var(--start-size) + 14px); clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 12px); border-left-width: 3px; }
  .dial-nums { display: none; } /* Too small to read here: ticks, needle and the live value remain */
  .dial-num { font-size: 38px; }
  .dial-unit { font-size: 22px; }
  .gear-box { width: 42px; }
  .gear-label { font-size: .5rem; }
  .gear-value { font-size: 1.45rem; }
  .start-btn { bottom: 63px; padding: 4px; }
  .start-face svg { width: 17px; height: 17px; }
  .start-text { font-size: .46rem; }
}
/* Short screens, such as a phone held sideways: keep the whole column on screen */
@media (max-height: 620px) {
@media (max-height: 470px) {
  :root { --dial: 52px; --start-size: 42px; }
  .rail { gap: 2px; padding-top: 4px; padding-bottom: calc(var(--start-size) + 12px); }
  .dial-nums { display: none; }
  .dial-num { font-size: 38px; }
  .dial-unit { font-size: 22px; }
  .gear-label { display: none; }
  .gear-value { font-size: 1.1rem; }
  .gear-box { width: 38px; padding: 0; }
  .start-text { display: none; }
  .start-btn { bottom: 61px; padding: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; }
  .app, .btn, .hud, .rail, .toggle-knob, .start-btn, .start-face { transition: none; }
  .app:hover, .app:focus-visible { transform: none; }
  .car-lines { display: none; }
}
