/* Tokens lifted from app/Trainwreck/Design/Tokens.swift (dark = color, light = colorLight). */
:root {
  --ground: #0A0A0C; --panel: #151518; --panel-deep: #0E0E11; --panel-raised: #1A1A1E;
  --control: #2A2A30; --border: #232328; --border-strong: #2E2E35; --tick: #4A4A52;
  --meter-track: #1D1D22; --text: #F2F2F5; --text-2: #C9C9D1; --text-3: #9A9AA3; --inactive: #6E6E78;
  --deck1: #4CC2FF; --deck2: #FF9F45; --selected: #F2F2F5; --on-selected: #0A0A0C;
  --warn: #FFD23D; --clip: #FF4D4D; --rec: #FF4D4D; --rec-fill: #3A1216; --off: #FF6B6B;
  --cap-top: #383838; --cap-bottom: #141414; --cap-border: #4A4A52; --cap-line: #FFFFFF;
  --control-surface: #1A1A1E; --groove: #000000; --on-accent: #0A0A0C; --dialog: #151518;
  --glow: .8;
  --phone-frame: #0B0B0D; --phone-edge: #6A6A70; --phone-edge-outer: #2A2A2D; --phone-screen-edge: transparent; --phone-button: #3A3A3E;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --display: "Unbounded", var(--sans);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #F5F5F7; --panel: #EAEAEE; --panel-deep: #E1E1E6; --panel-raised: #FFFFFF;
    --control: #D8D8DE; --border: #D4D4DA; --border-strong: #C2C2CA; --tick: #A6A6AE;
    --meter-track: #DCDCE1; --text: #0A0A0C; --text-2: #3A3A42; --text-3: #63636B; --inactive: #8A8A93;
    --deck1: #077CBB; --deck2: #B4610A; --selected: #0A0A0C; --on-selected: #F5F5F7;
    --warn: #D9A400; --clip: #E5302F; --rec: #E5302F; --rec-fill: #FBE3E4; --off: #BC2D2D;
    --cap-top: #FFFFFF; --cap-bottom: #DCDCE2; --cap-border: #B0B0B8; --cap-line: #0A0A0C;
    --control-surface: #EAEAEE; --groove: #C9C9D0; --on-accent: #FFFFFF; --dialog: #FFFFFF;
    --glow: .45; color-scheme: light;
    --phone-frame: linear-gradient(145deg, #F2F3F5 0%, #C7C9CF 35%, #EEEFF2 55%, #B9BBC2 100%); --phone-edge: #A4A6AD; --phone-edge-outer: #D9DADF; --phone-screen-edge: rgba(0,0,0,.22); --phone-button: #B4B6BD;
  }
}
:root[data-theme="light"] {
  --ground: #F5F5F7; --panel: #EAEAEE; --panel-deep: #E1E1E6; --panel-raised: #FFFFFF;
  --control: #D8D8DE; --border: #D4D4DA; --border-strong: #C2C2CA; --tick: #A6A6AE;
  --meter-track: #DCDCE1; --text: #0A0A0C; --text-2: #3A3A42; --text-3: #63636B; --inactive: #8A8A93;
  --deck1: #077CBB; --deck2: #B4610A; --selected: #0A0A0C; --on-selected: #F5F5F7;
  --warn: #D9A400; --clip: #E5302F; --rec: #E5302F; --rec-fill: #FBE3E4; --off: #BC2D2D;
  --cap-top: #FFFFFF; --cap-bottom: #DCDCE2; --cap-border: #B0B0B8; --cap-line: #0A0A0C;
    --control-surface: #EAEAEE; --groove: #C9C9D0; --on-accent: #FFFFFF; --dialog: #FFFFFF;
  --glow: .45; color-scheme: light;
  --phone-frame: linear-gradient(145deg, #F2F3F5 0%, #C7C9CF 35%, #EEEFF2 55%, #B9BBC2 100%); --phone-edge: #A4A6AD; --phone-edge-outer: #D9DADF; --phone-screen-edge: rgba(0,0,0,.22); --phone-button: #B4B6BD;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font-family: var(--sans); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background-color .2s, color .2s;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 32px; } }

/* App type styles */
.caps { font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.d1 { color: var(--deck1); } .d2 { color: var(--deck2); }

/* Controls, as drawn in the app: Signal skin (D87), flat fills, no borders, glows or gradients */
.box {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  background: var(--control-surface); border: 1px solid transparent; color: var(--text);
  text-decoration: none; cursor: pointer; font: inherit;
}
.box.caps { font-size: 12px; }
.box[aria-pressed="true"], .box.on { background: var(--selected); color: var(--on-selected); }
.box:focus-visible, .seg button:focus-visible { outline: 2px solid var(--deck1); outline-offset: 2px; }
.badge {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  font: 700 13px/1 var(--mono); color: var(--on-selected);
}
.badge.b1 { background: var(--deck1); color: #0A0A0C; } .badge.b2 { background: var(--deck2); color: #0A0A0C; }
:root[data-theme="light"] .badge.b1, :root[data-theme="light"] .badge.b2 { color: #fff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .badge.b1, :root:not([data-theme="dark"]) .badge.b2 { color: #fff; } }
.chip {
  display: inline-grid; place-items: center; height: 22px; padding: 0 7px; border-radius: 7px;
  background: var(--control); font: 700 10px/1 var(--mono); color: var(--text);
}

/* Segmented control (Settings → Theme) */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--control-surface); }
.seg button {
  border: 0; background: transparent; color: var(--text-2); font: 500 13px/1 var(--sans);
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--selected); color: var(--on-selected); font-weight: 600; }

/* Theme switch: moon (dark) on the left, sun (light) on the right */
.theme-switch {
  position: relative; display: inline-flex; align-items: center; justify-content: space-between;
  width: 68px; height: 34px; padding: 0 9px; border: 0; border-radius: 999px;
  background: var(--control-surface); cursor: pointer; flex: none;
}
.theme-switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--selected); transition: transform .22s cubic-bezier(.3,.7,.4,1);
}
.theme-switch[aria-checked="true"]::before { transform: translateX(34px); }
.ts-ico { position: relative; z-index: 1; display: grid; place-items: center; width: 16px; height: 16px; color: var(--text-3); transition: color .22s; }
.theme-switch[aria-checked="false"] .moon, .theme-switch[aria-checked="true"] .sun { color: var(--on-selected); }
.theme-switch:focus-visible { outline: 2px solid var(--deck1); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .theme-switch::before, .ts-ico { transition: none; } }

/* Header */
header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--ground) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 60px; gap: 12px; }
header .brand { justify-self: start; white-space: nowrap; }
header .theme-switch { justify-self: center; }
header .nav-cta { justify-self: end; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 600; font-size: 16px; text-decoration: none; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border-strong); }
@media (max-width: 520px) { header .brand { font-size: 0; gap: 0; } }
.rec-pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; background: var(--control-surface); font: 700 12px/1 var(--sans); letter-spacing: .1em; }
.rec-pill i { width: 9px; height: 9px; border-radius: 50%; background: var(--rec); }

/* Hero */
.hero { padding: 56px 0 24px; position: relative; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero { padding: 88px 0 40px; } .hero-grid { grid-template-columns: 1.2fr 1fr; } h1 { font-size: clamp(56px, 5.6vw, 76px); } }
h1.stack { font-size: clamp(28px, 4.4vw, 52px); line-height: 1.08; white-space: nowrap; }
h1.stack em { padding-right: .04em; }
h1 { font-family: var(--display); font-size: clamp(36px, 6.6vw, 68px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 22px; font-weight: 700; }
h1 em { font-style: normal; background: linear-gradient(90deg, var(--deck1), var(--deck2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: 19px; color: var(--text-2); max-width: 30em; margin: 0 0 30px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cta .note { color: var(--text-3); font-size: 13px; width: 100%; margin-top: 4px; }

/* Phones */
/* iPhone 17 Pro proportions: 402 x 874 pt screen, ~55 pt corner radius, thin titanium bezel.
   Radii are "width% / height%" so the corners stay round at any size. */
.phone {
  position: relative; padding: 1.2%; background: var(--phone-frame);
  border-radius: 15.6% / 7.2%;
  box-shadow: 0 0 0 1px var(--phone-edge), 0 0 0 2px var(--phone-edge-outer), 0 40px 80px -30px rgba(0,0,0,.55);
}
.phone img { width: 100%; height: auto; aspect-ratio: 1206/2622; border-radius: 14.3% / 6.6%; background: var(--panel-deep); box-shadow: 0 0 0 1px var(--phone-screen-edge); }
/* Dynamic Island */
.phone::after { content: ""; position: absolute; left: 50%; top: 1.9%; width: 30%; aspect-ratio: 125/37; transform: translateX(-50%); background: #000; border-radius: 999px; }
/* Side buttons */
.phone::before { content: ""; position: absolute; right: -1.6%; top: 25%; width: 1.4%; height: 10%; border-radius: 0 3px 3px 0; background: var(--phone-button); }
/* The stage is a box with a fixed aspect ratio that fully contains both phones, so they
   never spill onto the buttons above or the meters below at any width. Phone height is
   about 2.2x its width; the front phone sits 12% lower than the back one. */
.stage { position: relative; width: min(100%, 400px); margin: 0 auto; aspect-ratio: 1 / 1.2; }
.stage .phone { position: absolute; width: 47%; }
.stage .phone.back { left: 4%; top: 1%; transform: rotate(3deg); z-index: 1; }
.stage .phone.front { right: 4%; bottom: 1%; transform: rotate(-2deg); z-index: 2; }
/* Desktop: room at the sides for the pitch scale ornaments. */
@media (min-width: 900px) {
  .stage { width: min(100%, 460px); aspect-ratio: 1 / 1.14; }
  .stage .phone { width: 43%; }
  .stage .phone.back { left: 11%; }
  .stage .phone.front { right: 11%; }
}


/* Pitch scale ornament */
.scale { position: absolute; top: 4%; bottom: 4%; display: flex; flex-direction: column; justify-content: space-between; z-index: 0; font: 10px/1 var(--mono); color: var(--text-3); }
.scale.l { left: 0; } .scale.r { right: 0; text-align: right; }
.scale span { display: flex; align-items: center; gap: 6px; height: 1px; }
.scale.r span { flex-direction: row-reverse; }
.scale span::after { content: ""; width: 12px; height: 1px; background: var(--tick); }
.scale span.z { color: var(--deck1); } .scale.r span.z { color: var(--deck2); }
.scale span.z::after { width: 28px; height: 2px; background: currentColor; }
.scale span:not(.n)  { color: transparent; }
@media (max-width: 899px) { .scale { display: none; } }

/* Level meter strip */
.meter { display: grid; gap: 4px; padding: 32px 0 8px; }
.meter .row { height: 13px; display: flex; gap: 1px; overflow: hidden; }
.meter .row b { flex: 0 0 2px; background: var(--meter-track); }
.meter .row b.lit { background: var(--c); }
.meter .row b.lit.w { background: var(--warn); }
.meter .row b.lit.x { background: var(--clip); }

/* Sections */
section { padding: 72px 0; scroll-margin-top: 60px; }
@media (min-width: 900px) { section { padding: 104px 0; } }
h2 { font-family: var(--display); font-size: clamp(26px, 4vw, 42px); line-height: 1.1; letter-spacing: -.025em; margin: 0 0 18px; font-weight: 700; }
.sub { color: var(--text-2); font-size: 18px; max-width: 34em; margin: 0; }
.label { color: var(--text-3); margin: 0 0 14px; display: block; }
hr.rule { border: 0; height: 1px; background: var(--border); margin: 0; }

/* Trainwreck lanes */
.lanes { display: grid; gap: 10px; margin: 44px 0 0; }
.lane { position: relative; display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 16px; background: var(--dialog); border-radius: 14px; padding: 14px 18px; }
.lane svg { width: 100%; height: 44px; display: block; overflow: visible; }
.tag { font-size: 11px; }
.tag.ok { color: var(--text-2); } .tag.wreck { color: var(--clip); }
@media (max-width: 560px) { .lane { grid-template-columns: 1fr; gap: 8px; } }
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { padding: 4px 4px 0; }
.steps h4 { margin: 14px 0 6px; font-size: 12px; }
.steps p { margin: 0; color: var(--text-2); font-size: 15px; }

/* Mode switcher */
.tour { display: grid; gap: 40px; align-items: center; margin-top: 48px; }
@media (min-width: 900px) { .tour { grid-template-columns: 340px 1fr; gap: 72px; } }
.tour .phone { width: min(78vw, 300px); margin: 0 auto; }
.tour .phone img { transition: opacity .2s; }
.modes { display: grid; grid-template-columns: 1.6fr 1.6fr 1fr; gap: 6px; max-width: 360px; margin-bottom: 28px; }
.modes .box { padding: 0 8px; }
.panes > div[hidden] { display: none; }
.panes h3 { font-family: var(--display); font-weight: 600; font-size: 22px; letter-spacing: -.02em; margin: 0 0 10px; }
.panes p { color: var(--text-2); margin: 0 0 18px; max-width: 30em; }
.specs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.specs li { font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; padding: 9px 12px; border-radius: 8px; color: var(--text-2); background: var(--control-surface); }
.specs li .mono { letter-spacing: 0; color: var(--text-3); margin-left: 6px; font-weight: 400; }

/* Feature grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin-top: 44px; }
.card { background: var(--dialog); border-radius: 14px; padding: 20px; }
.card h4 { margin: 14px 0 6px; font-family: var(--display); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.ico { height: 40px; display: flex; align-items: center; gap: 8px; }
.trans.solid { background: var(--c); color: var(--on-accent); }
.trans { width: 40px; height: 40px; border-radius: 50%; background: var(--control); color: var(--text); display: grid; place-items: center; font: 800 10px/1 var(--sans); letter-spacing: .1em; }

/* Ways to play */
.ways { display: grid; gap: 10px; margin-top: 44px; }
@media (min-width: 900px) { .ways { grid-template-columns: repeat(3, 1fr); } }
.way { background: var(--dialog); border-radius: 14px; padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.way h3 { margin: 4px 0 0; font-family: var(--display); font-weight: 600; font-size: 18px; letter-spacing: -.02em; }
.way p { margin: 0; color: var(--text-2); font-size: 15px; }
.route { margin-top: auto; padding-top: 12px; font: 10px/1.6 var(--mono); color: var(--text-3); }
.route b { font-weight: 400; }

/* Footer */
footer { border-top: 1px solid var(--border); padding: 40px 0 56px; color: var(--text-3); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Footer links */
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.foot-links a { color: var(--text-2); text-decoration: none; }
.foot-links a:hover, .foot-links a[aria-current="page"] { color: var(--text); }

/* Document pages: FAQ, contact, privacy, terms */
.doc { padding: 56px 0 96px; }
@media (min-width: 900px) { .doc { padding: 88px 0 120px; } }
.doc .wrap { max-width: 760px; }
.doc h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 14px; font-weight: 700; }
.doc .meta { color: var(--text-3); font-size: 14px; margin: 0 0 40px; }
.doc .intro { font-size: 19px; color: var(--text-2); margin: 0 0 40px; }
.doc h2 { font-family: var(--display); font-size: 19px; letter-spacing: -.015em; margin: 44px 0 10px; font-weight: 600; }
.doc p, .doc li { color: var(--text-2); }
.doc p { margin: 0 0 14px; }
.doc ul { padding-left: 20px; margin: 0 0 14px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--deck1); }
.doc strong { color: var(--text); font-weight: 600; }
.todo { background: color-mix(in srgb, var(--warn) 28%, transparent); color: var(--text); border-radius: 4px; padding: 1px 5px; font: 600 .88em var(--mono); }

/* FAQ */
.faq { display: grid; gap: 8px; }
.faq details { background: var(--dialog); border-radius: 14px; }
.faq summary { list-style: none; cursor: pointer; padding: 18px 52px 18px 20px; font-weight: 600; font-size: 17px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font: 400 22px/1 var(--mono); color: var(--text-3); }
.faq details[open] summary::after { content: "−"; }
.faq summary:focus-visible { outline: 2px solid var(--deck1); outline-offset: 2px; border-radius: 14px; }
.faq .a { padding: 0 20px 18px; }
.faq .a p:last-child { margin-bottom: 0; }
.faq h2:first-child { margin-top: 0; }

/* Contact */
.contact-card { background: var(--dialog); border-radius: 14px; padding: 24px; margin: 0 0 10px; }
.contact-card h2 { margin: 0 0 6px; font-size: 18px; }
.contact-card p { margin: 0 0 16px; }

/* Header App Store button, always visible. */
.nav-cta { min-height: 36px; padding: 0 16px; border-radius: 10px; }

/* Crossfader card icon, Signal (D87): controlSurface, groove, deck-colour end marks, centre mark, flat cap. */
.xf { position: relative; width: 112px; height: 32px; display: block; border-radius: 9px; background: var(--control-surface);
  background-image: linear-gradient(var(--deck1), var(--deck1)), linear-gradient(var(--deck2), var(--deck2)), linear-gradient(var(--text-3), var(--text-3)), linear-gradient(var(--groove), var(--groove));
  background-size: 3px 12px, 3px 12px, 2px 28px, calc(100% - 28px) 4px; background-position: 6px center, calc(100% - 6px) center, 50% center, center; background-repeat: no-repeat; }
.xf i { position: absolute; left: 62%; top: 5px; bottom: 5px; width: 30px; margin-left: -15px; border-radius: 4px; background: var(--text); }
.xf i::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: var(--ground); }
