/* ============================================================================
   Explosive Athlete Audit — design system
   Light, low-friction intake → dark, cinematic report. Brand: black / gold / blue,
   executed as a precision instrument. Type: Saira (display) + Hanken Grotesk (body).
   ========================================================================== */

:root {
  /* brand */
  --gold: #F5C518;
  --gold-deep: #D9AC0E;
  --blue: #1E6FD9;
  --blue-deep: #1857AD;

  /* light surfaces (intake) */
  --bg: #EDEFF2;
  --surface: #FFFFFF;
  --surface-2: #F5F6F8;
  --ink: #101216;          /* body text, AA on white */
  --ink-2: #565C66;        /* secondary text, ~5.5:1 on white */
  --line: #E0E3E8;
  --line-strong: #C9CDD4;

  /* tier colors (chosen for text contrast) */
  --t-below: #C62F2F;      /* white text */
  --t-average: #E07A2A;    /* ink text */
  --t-above: #F5C518;      /* ink text */
  --t-elite: #1FA85C;      /* ink text */

  /* type */
  --display: 'Saira', system-ui, -apple-system, sans-serif;
  --body: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;

  /* fluid spacing */
  --sp-1: 0.375rem;
  --sp-2: 0.625rem;
  --sp-3: 1rem;
  --sp-4: 1.5rem;
  --sp-5: clamp(1.75rem, 4vw, 2.75rem);
  --sp-6: clamp(2.5rem, 6vw, 4.5rem);

  --radius: 10px;
  --radius-sm: 7px;

  /* semantic z-index scale */
  --z-sticky: 100;
  --z-backdrop: 800;
  --z-modal: 900;

  --maxw: 720px;
}

/* dark theme — toggled on <body> for the loading + report screens. Set here (not on a descendant)
   so body's own background/color re-resolve to the dark tokens and every child inherits white text. */
body.theme-dark {
  --bg: #0A0A0A;
  --surface: #141417;
  --surface-2: #1C1C20;
  --ink: #FFFFFF;
  --ink-2: #A7ACB4;        /* ~8:1 on near-black */
  --line: #2A2A30;
  --line-strong: #3A3A42;
  background: var(--bg);
  color: var(--ink);
}

/* ---- reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { line-height: 1.05; text-wrap: balance; font-weight: 700; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
body.theme-dark :focus-visible { outline-color: var(--gold); }

.app { min-height: 100dvh; display: flex; flex-direction: column; }
.screen {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: var(--sp-5) clamp(1.1rem, 5vw, 2rem) var(--sp-6);
}
[hidden] { display: none !important; }

/* tabular figures everywhere numbers matter */
.num, input[type="number"], .score, .pill, .breakdown__score, .intro__metaNum {
  font-variant-numeric: tabular-nums;
}

/* ---- brand ---------------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
}
.brand__bar { width: 1.5rem; height: 3px; background: var(--gold); border-radius: 2px; }
.brand__perf { color: var(--ink-2); font-weight: 600; }
body.theme-dark .brand__perf { color: var(--ink-2); }
.brand--sm { font-size: 1.05rem; }
.brand--sm .brand__bar { width: 1rem; }

.kicker {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--blue);
  margin-top: var(--sp-4);
}

/* ---- buttons -------------------------------------------------------------- */
.btn {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.25rem;
  font-size: 1rem;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
  min-height: 48px;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--gold); color: #0A0A0A; }
.btn--primary:hover { background: var(--gold-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--lg { font-size: 1.15rem; padding: 0.95rem 2rem; width: 100%; max-width: 360px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- intro ---------------------------------------------------------------- */
.intro h1 {
  font-family: var(--display);
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  letter-spacing: -0.02em;
  margin: 0.4rem 0 var(--sp-3);
}
.intro__lead { font-size: 1.05rem; color: var(--ink-2); max-width: 54ch; }
.intro__meta {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  margin: var(--sp-3) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: var(--sp-3) 0;
}
.intro__meta li { font-size: 0.95rem; color: var(--ink-2); display: flex; align-items: baseline; gap: 0.5rem; }
.intro__metaNum { font-family: var(--display); font-weight: 700; font-size: 1.9rem; color: var(--ink); }
.intro__note { font-size: 0.88rem; color: var(--ink-2); margin-top: var(--sp-3); }

/* intro hero: heading text + radar-preview card. Stacked on mobile (heading, lead, preview,
   metrics, button); side-by-side on desktop (text left, preview right). */
.intro__grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "kicker" "title" "lead" "preview" "metrics" "button";
  align-items: start;
  column-gap: clamp(2rem, 5vw, 4rem);
  margin-top: var(--sp-3);
}
.intro__grid > .kicker { grid-area: kicker; margin-top: 0; }
.intro__grid > h1 { grid-area: title; }
.intro__grid > .intro__lead { grid-area: lead; }
.intro__grid > .preview { grid-area: preview; margin: var(--sp-4) 0; }
.intro__grid > .intro__meta { grid-area: metrics; }
.intro__grid > .intro__cta { grid-area: button; }

@media (min-width: 760px) {
  .intro__grid {
    grid-template-columns: 1.05fr 0.9fr;
    grid-template-areas:
      "kicker  preview"
      "title   preview"
      "lead    preview"
      "metrics preview"
      "button  preview";
  }
  .intro__grid > .preview { align-self: center; margin: 0; }
}

.preview__card {
  background: #141417; color: #fff;
  border: 1px solid #2A2A30; border-radius: 14px;
  padding: clamp(1rem, 3vw, 1.5rem);
  width: 100%; max-width: 380px; margin-inline: auto;
}
.preview__head { display: flex; justify-content: space-between; align-items: center; }
.preview__tag { font-family: var(--display); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; color: #A7ACB4; }
.preview__score { font-family: var(--display); font-weight: 800; font-size: 1.9rem; color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1; }
.preview__radar { width: 100%; max-width: 260px; display: block; margin: 0.6rem auto 0.4rem; overflow: visible; }
.preview__rows { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.4rem; }
.preview__row { display: grid; grid-template-columns: 1fr auto auto; gap: 0.6rem; align-items: center; font-size: 0.9rem; color: #E7E9EC; }
.preview__row b { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.preview .pill { font-size: 0.62rem; padding: 0.18rem 0.5rem; }

/* ---- audit form ----------------------------------------------------------- */
.audit { display: flex; flex-direction: column; padding-bottom: 0; }
.audit__top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.audit__counter { font-family: var(--display); font-weight: 600; color: var(--ink-2); letter-spacing: 0.04em; }
.progress { height: 4px; background: var(--line); border-radius: 4px; margin: var(--sp-3) 0 var(--sp-5); overflow: hidden; }
.progress__fill { height: 100%; width: 12.5%; background: var(--gold); border-radius: 4px; transition: width .35s cubic-bezier(.2,.7,.2,1); }

.units { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: var(--sp-4); }
.units__label { font-size: 0.74rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.units__toggle { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.units__toggle button { background: var(--surface); color: var(--ink-2); border: none; padding: 0.3rem 0.7rem; font-size: 0.85rem; font-weight: 600; min-height: 36px; }
.units__toggle button.is-on { background: var(--ink); color: #fff; }

.step__title { font-family: var(--display); font-size: clamp(1.7rem, 5vw, 2.3rem); letter-spacing: -0.01em; }
.step__hint { color: var(--ink-2); margin: 0.35rem 0 var(--sp-4); }

.field { margin-bottom: var(--sp-4); }
.field__label { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; margin-bottom: 0.4rem; }
.field__optional { font-weight: 500; color: var(--ink-2); font-size: 0.82rem; }
.field__note { font-size: 0.82rem; color: var(--ink-2); margin-top: 0.3rem; }

.control, .field input[type="text"], .field input[type="email"], .field input[type="number"], .field select {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  min-height: 48px;
  transition: border-color .15s ease;
}
.field input:focus, .field select:focus { border-color: var(--blue); outline: none; }
.field input::placeholder { color: #9AA0A8; }

.inputrow { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.inputrow > * { flex: 1 1 0; min-width: 7rem; }
.input-suffix { position: relative; }
.input-suffix > span { position: absolute; right: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); font-size: 0.85rem; pointer-events: none; }

/* radio / segmented */
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choices label {
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.95rem;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 44px;
}
.choices input { accent-color: var(--blue); }
.choices label:has(input:checked) { border-color: var(--blue); background: color-mix(in oklab, var(--blue) 8%, var(--surface)); }

/* info icon + 1RM link */
.info-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 0.78rem; font-weight: 700;
  display: inline-grid; place-items: center; padding: 0; min-height: 0;
  line-height: 1;
}
.info-btn:hover { border-color: var(--blue); color: var(--blue); }
.calc-link { background: none; border: none; color: var(--blue); font-weight: 600; font-size: 0.85rem; padding: 0.3rem 0; min-height: 0; text-decoration: underline; text-underline-offset: 2px; }

/* sticky nav (thumb zone on mobile) */
.audit__nav {
  position: sticky; bottom: 0; z-index: var(--z-sticky);
  display: flex; gap: 0.75rem; justify-content: space-between;
  padding: var(--sp-3) 0;
  margin-top: var(--sp-4);
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.audit__nav .btn--primary { flex: 1; }
.audit__nav .btn--ghost { flex: 0 0 auto; }
.field__error { color: var(--t-below); font-size: 0.85rem; margin-top: 0.3rem; }

/* ---- modals --------------------------------------------------------------- */
.modal {
  border: none; border-radius: var(--radius);
  padding: var(--sp-4);
  max-width: 440px; width: calc(100vw - 2rem);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}
.modal::backdrop { background: rgba(8,8,10,0.55); }
.modal__title { font-family: var(--display); font-size: 1.4rem; margin-bottom: 0.5rem; }
.modal__lead { font-weight: 600; margin-bottom: 0.5rem; }
.modal__body { color: var(--ink-2); }
.modal__close { margin-top: var(--sp-3); width: 100%; }
.calc__row { display: flex; gap: 0.75rem; margin: var(--sp-3) 0; }
.calc__row label { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; }
.calc__row input { width: 100%; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.6rem; min-height: 46px; }
.calc__result { font-family: var(--display); font-size: 1.3rem; }
.calc__result span { color: var(--blue); font-weight: 700; }
.calc__disclaimer { font-size: 0.78rem; color: var(--ink-2); margin: 0.5rem 0; }
.calc__actions { display: flex; gap: 0.6rem; }
.calc__actions .btn { flex: 1; }

/* ---- loading -------------------------------------------------------------- */
.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--sp-4); min-height: 70dvh;
}
.loading__pulse {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--gold);
}
.loading__bar { width: min(320px, 80%); height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.loading__barFill { height: 100%; width: 40%; background: var(--gold); border-radius: 4px; }
.loading__quote { font-family: var(--display); font-size: 1.15rem; color: var(--ink-2); letter-spacing: 0.01em; }

/* ---- report --------------------------------------------------------------- */
.report__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.report__sub { color: var(--ink-2); margin-top: 0.2rem; }
.report h1 { font-family: var(--display); font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -0.02em; margin-top: var(--sp-4); }

.hero {
  display: grid; grid-template-columns: 1fr; gap: var(--sp-4);
  align-items: center;
  margin: var(--sp-4) 0 var(--sp-5);
  padding: var(--sp-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.hero__score { text-align: center; }
.hero__overall { font-family: var(--display); font-weight: 800; font-size: clamp(4rem, 18vw, 7rem); line-height: 0.9; letter-spacing: -0.03em; }
.hero__outof { color: var(--ink-2); font-size: 1rem; }
.hero__label { margin-top: 0.6rem; }
.radar-wrap { width: 100%; max-width: 320px; aspect-ratio: 1 / 1; margin-inline: auto; position: relative; }
.radar-wrap canvas { width: 100% !important; height: 100% !important; display: block; }

/* pills */
.pill {
  display: inline-block; font-family: var(--display); font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.32rem 0.7rem; border-radius: 999px; white-space: nowrap;
}
.pill--below   { background: var(--t-below);   color: #fff; }
.pill--average { background: var(--t-average); color: #100A02; }
.pill--above   { background: var(--t-above);   color: #14110A; }
.pill--elite   { background: var(--t-elite);   color: #07140C; }
.pill--none    { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* breakdown */
.section-h { font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin: var(--sp-5) 0 var(--sp-3); }
.breakdown { display: flex; flex-direction: column; }
.breakdown__row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 1rem;
  padding: 0.9rem 0; border-bottom: 1px solid var(--line);
}
.breakdown__row:first-child { border-top: 1px solid var(--line); }
.breakdown__cat { font-weight: 600; }
.breakdown__score { font-family: var(--display); font-weight: 700; font-size: 1.5rem; text-align: right; min-width: 2.5ch; }
.breakdown__score--none { font-size: 0.95rem; color: var(--ink-2); font-family: var(--body); font-weight: 500; }

/* analysis */
.analysis { display: flex; flex-direction: column; gap: var(--sp-4); }
.analysis__block h4 { font-family: var(--display); letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.95rem; color: var(--gold); margin-bottom: 0.3rem; }
.analysis__block p { color: #E7E9EC; }
body.theme-dark .analysis__block p { color: #DFE2E6; }
.profile-callout { padding: var(--sp-4); border: 1px solid var(--gold); border-radius: var(--radius); margin: var(--sp-4) 0; }
.profile-callout h4 { font-family: var(--display); color: var(--gold); text-transform: uppercase; letter-spacing: 0.05em; }
.path { font-size: 1.05rem; }
.missing-note { color: var(--ink-2); border-top: 1px solid var(--line); padding-top: var(--sp-4); margin-top: var(--sp-4); }
.closing { font-family: var(--display); font-size: 1.3rem; line-height: 1.25; margin: var(--sp-5) 0; }

/* CTA */
.cta { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: var(--sp-5); margin-top: var(--sp-5); }
.cta h3 { font-family: var(--display); font-size: clamp(1.5rem, 4.5vw, 2rem); letter-spacing: -0.01em; }
.cta p { color: var(--ink-2); margin: var(--sp-3) 0; }
.cta .btn { width: 100%; margin-top: var(--sp-3); }
.cta__secondary { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.cta__dm { font-size: 0.9rem; color: var(--ink-2); margin-top: var(--sp-4); text-align: center; }
.cta__dm a { color: var(--gold); font-weight: 600; }

/* error */
.errorScreen { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sp-3); min-height: 60dvh; }
.errorScreen h2 { font-family: var(--display); font-size: 2rem; }

/* ---- responsive ----------------------------------------------------------- */
@media (min-width: 640px) {
  .hero { grid-template-columns: 0.85fr 1fr; }
  .audit__nav .btn--ghost { flex: 0 0 130px; }
}

/* ---- motion (enhances an already-visible default) ------------------------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes slideIndet { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
  @keyframes stepIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

  .reveal { opacity: 0; animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards; animation-delay: var(--d, 0ms); }
  .loading__pulse { animation: spin 1s linear infinite; }
  .loading__barFill { animation: slideIndet 1.3s ease-in-out infinite; }
  .step-anim { animation: stepIn .35s cubic-bezier(.2,.7,.2,1); }
}
