/* Foundly onboarding — app.css
   White canvas, same tokens as the agency site root block.
   The accent goes on three things only: the active step, the progress fill, the one button per screen. */

@font-face { font-family: Fraunces; src: url('/assets/fonts/fraunces-500-latin.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Manrope; src: url('/assets/fonts/manrope-400-600-latin.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }

:root {
  /* colour, from sites/foundly-agency/index.html :root */
  --bg: #faf9f5;
  --ink: #242424;
  --muted: #60605a;
  --accent: #c8a06a;
  --line: #d5d3ca;
  --error: #b42318;
  --accent-rgb: 200 160 106;
  --ink-rgb: 36 36 36;

  /* type */
  --font-display: Fraunces, Georgia, serif;
  --font-body: Manrope, system-ui, sans-serif;
  --text: 1.0625rem;
  --text-small: 0.9rem;
  --leading: 1.6;

  /* layout dials */
  --content-max: 880px;
  --theatre-max: 1280px;
  --rail-width: 260px;
  --gutter: clamp(20px, 4vw, 40px);
  --space: 28px;
  --space-lg: 56px;
  --radius: 4px;
  --control-height: 44px;

  /* motion */
  --ease: 180ms ease;

  font-size: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text);
  line-height: var(--leading);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 16px; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: var(--text-small); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ── Wordmark ── */
.wordmark {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  letter-spacing: -0.075em;
  text-decoration: none;
  color: var(--ink);
  display: inline-block;
}
.wordmark span { color: var(--accent); }

/* ── The one button per screen ── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 26px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--ease), transform var(--ease);
}
.button:hover { opacity: 0.9; }
.button:active { transform: translateY(1px); }
.button[disabled] { opacity: 0.5; cursor: default; }
.button.quiet { background: transparent; border: 1px solid var(--line); }

.link {
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  color: var(--muted);
}
.link:hover { color: var(--ink); }

/* ── Entry page ── */
.entry {
  max-width: 520px;
  margin: 0 auto;
  padding: 12vh var(--gutter) var(--space-lg);
}
.entry .wordmark { margin-bottom: var(--space-lg); }
.lede { color: var(--muted); margin-bottom: var(--space); }
.form { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field span { font-size: var(--text-small); color: var(--muted); }
.field input {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: var(--control-height);
  padding: 0 14px;
  width: 100%;
}
.field input:focus { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.error { color: var(--error); margin: 0; }
.form .button { justify-self: start; margin-top: 4px; }

/* ── Course frame ── */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: var(--text-small); }
.shell {
  display: grid;
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
  min-height: calc(100vh - 85px);
}
.rail {
  border-right: 1px solid var(--line);
  padding: var(--space) 0;
}
.rail ol { list-style: none; margin: 0; padding: 0; }
.step {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 12px var(--gutter);
  color: var(--muted);
  border-left: 3px solid transparent;
  transition: background var(--ease), color var(--ease);
}
.step .n { font-size: var(--text-small); }
.step .t { display: block; }
.step .s { display: block; font-size: var(--text-small); color: var(--muted); }
.step.locked { opacity: 0.55; }
.step.complete { color: var(--ink); }
.step.current { color: var(--ink); border-left-color: var(--accent); }
.step.current .n { font-weight: 600; }
.step.open { background: rgb(var(--ink-rgb) / 0.04); }
.step button {
  all: unset;
  cursor: pointer;
  display: contents;
}
.step.locked button { cursor: default; }

.pane {
  padding: var(--space-lg) var(--gutter);
  width: 100%;
  max-width: calc(var(--content-max) + var(--gutter) * 2);
  margin: 0 auto;
}
.eyebrow { font-size: var(--text-small); color: var(--muted); margin-bottom: 8px; }
.note { color: var(--muted); font-size: var(--text-small); margin-top: 14px; }
.actions { margin-top: var(--space); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.status { color: var(--muted); margin: 0; }

/* ── Player ── */
.player { margin-top: var(--space); }
.stage {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.stage .overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.25);
  border: 0;
  cursor: pointer;
  transition: opacity var(--ease);
}
.stage .overlay svg { width: 72px; height: 72px; fill: #fff; }
.stage.playing .overlay { opacity: 0; pointer-events: none; }
.stage .overlay:focus-visible { outline-offset: -4px; outline-color: #fff; }

.controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 4px 0;
}
.controls button {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--ink);
}
.controls button:hover { background: rgb(var(--ink-rgb) / 0.06); }
.controls button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.controls svg { width: 20px; height: 20px; fill: currentColor; }
.controls .time { font-variant-numeric: tabular-nums; font-size: var(--text-small); color: var(--muted); white-space: nowrap; }
.bar {
  position: relative;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  pointer-events: none;
}
.player.complete .bar { pointer-events: auto; cursor: pointer; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--accent); }
.vol { display: inline-flex; align-items: center; gap: 6px; }
.vol input[type='range'] { width: 72px; accent-color: var(--ink); }

/* theatre: hide the rail, widen the pane, done in CSS not the Fullscreen API */
body.theatre .shell { grid-template-columns: minmax(0, 1fr); }
body.theatre .rail { display: none; }
body.theatre .pane { max-width: calc(var(--theatre-max) + var(--gutter) * 2); }

/* ── Quiz ── */
.question {
  padding: var(--space) 0;
  border-top: 1px solid var(--line);
}
.question:first-of-type { border-top: 0; padding-top: 8px; }
.question legend { padding: 0; margin-bottom: 14px; }
.question legend .q { display: block; font-size: var(--text-small); color: var(--muted); margin-bottom: 6px; }
.question fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.option {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  cursor: pointer;
}
.option input { margin: 5px 0 0; width: 18px; height: 18px; accent-color: var(--ink); }
.option .k { color: var(--muted); font-size: var(--text-small); }
.question.unanswered { background: linear-gradient(90deg, rgb(var(--ink-rgb) / 0.035), transparent 60%); padding-left: 12px; margin-left: -12px; }
.nudge { color: var(--error); font-size: var(--text-small); margin: 6px 0 0; }

.result-head { margin-bottom: var(--space); }
.score { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1; margin-bottom: 10px; }
.missed { padding: 20px 0; border-top: 1px solid var(--line); }
.missed p { margin: 6px 0; }
.missed .f { color: var(--muted); }

.rewatch-list { list-style: none; margin: var(--space) 0 0; padding: 0; display: grid; gap: 2px; }
.rewatch-list li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.rewatch-list li:last-child { border-bottom: 1px solid var(--line); }

/* ── Mobile: the rail becomes a thin stepper above the pane ── */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); padding: 0 var(--gutter); }
  .rail ol { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 12px 0; }
  .rail ol::-webkit-scrollbar { display: none; }
  .step {
    grid-template-columns: auto;
    gap: 0;
    padding: 6px 10px;
    border-left: 0;
    border-bottom: 2px solid transparent;
    flex: 0 0 auto;
    border-radius: var(--radius);
  }
  .step .t, .step .s { display: none; }
  .step.current { border-bottom-color: var(--accent); }
  .step.current, .step.open { display: flex; gap: 8px; align-items: baseline; }
  .step.current .t, .step.open .t { display: block; font-size: var(--text-small); }
  .pane { padding: var(--space) var(--gutter) var(--space-lg); }
  .controls { grid-template-columns: auto minmax(0, 1fr) auto; }
  .controls .vol, .controls .theatre { display: none; }
  .wordmark { font-size: 1.9rem; }
  .top { padding: 16px var(--gutter); }
}

/* no pointer hover means no working volume slider (iOS sets volume in hardware only) */
@media (hover: none) {
  .vol input[type='range'] { display: none; }
}

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