/* christer design tokens. Dark default, light via prefers-color-scheme.
   One accent (warm amber, "candlelight"). Contrast ratios (WCAG AA checked by hand):
   dark:  text #f2f0ea on #0e1014 = 16.5:1 ; muted #a9adb8 on #0e1014 = 8.2:1 ; accent-ink #1a1203 on accent #f0b84a = 10.6:1
   light: text #15171c on #f7f5f0 = 16.2:1 ; muted #4d525e on #f7f5f0 = 7.4:1 ; accent-text #7a4e00 on #f7f5f0 = 6.6:1 */
:root {
  color-scheme: dark light;

  /* surfaces + ink (dark default) */
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2d323d;
  --text: #f2f0ea;
  --muted: #a9adb8;

  /* the one accent */
  --accent: #f0b84a; /* fills: primary button, active gap, timer ring */
  --accent-ink: #1a1203; /* text on accent fill */
  --accent-text: #f0b84a; /* accent used as text/icon on bg */
  --accent-soft: rgba(240, 184, 74, 0.14);

  /* semantic (functional only, not decorative) */
  --ok: #5fd39a;
  --ok-soft: rgba(95, 211, 154, 0.14);
  --bad: #ff8a80;
  --bad-soft: rgba(255, 138, 128, 0.14);
  --focus: #8ab4ff;

  /* spacing (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 72px;

  /* radii */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;

  /* type: system stack only, no webfont */
  --font:
    ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* scale ~1.2, rem based */
  --t-xs: 0.75rem;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: 1.25rem;
  --t-xl: 1.625rem;
  --t-2xl: 2.25rem;
  --t-3xl: clamp(2.5rem, 7vw, 4.25rem);
  --lh-tight: 1.15;
  --lh-body: 1.5;

  /* sizes */
  --tap: 48px; /* minimum tap target (>= 44) */
  --gap-w: 56px; /* timeline gap target width */

  /* motion */
  --dur-fast: 120ms;
  --dur: 220ms;
  --dur-slow: 420ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f5f0;
    --surface: #ffffff;
    --surface-2: #efece4;
    --border: #d6d1c4;
    --text: #15171c;
    --muted: #4d525e;
    --accent: #f0b84a;
    --accent-ink: #1a1203;
    --accent-text: #7a4e00;
    --accent-soft: rgba(240, 184, 74, 0.22);
    --ok: #0b6b42;
    --ok-soft: rgba(11, 107, 66, 0.1);
    --bad: #a3211a;
    --bad-soft: rgba(163, 33, 26, 0.09);
    --focus: #1a56c4;
    --shadow: 0 8px 24px rgba(40, 30, 10, 0.12);
  }
}

/* manual override hooks used by the prototypes' theme switch */
:root[data-theme='dark'] {
  --bg: #0e1014;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2d323d;
  --text: #f2f0ea;
  --muted: #a9adb8;
  --accent-text: #f0b84a;
  --accent-soft: rgba(240, 184, 74, 0.14);
  --ok: #5fd39a;
  --ok-soft: rgba(95, 211, 154, 0.14);
  --bad: #ff8a80;
  --bad-soft: rgba(255, 138, 128, 0.14);
  --focus: #8ab4ff;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
:root[data-theme='light'] {
  --bg: #f7f5f0;
  --surface: #fff;
  --surface-2: #efece4;
  --border: #d6d1c4;
  --text: #15171c;
  --muted: #4d525e;
  --accent-text: #7a4e00;
  --accent-soft: rgba(240, 184, 74, 0.22);
  --ok: #0b6b42;
  --ok-soft: rgba(11, 107, 66, 0.1);
  --bad: #a3211a;
  --bad-soft: rgba(163, 33, 26, 0.09);
  --focus: #1a56c4;
  --shadow: 0 8px 24px rgba(40, 30, 10, 0.12);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur: 0ms;
    --dur-slow: 0ms;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- v2 additions (app-v2.html, ux-spec.md). Additive only; v1 keeps working. ----
   Larger base type and taller primary actions for older players at arm's length. */
:root {
  --t-base: 1.0625rem; /* 17px body in the app (was 16px) */
  --t-btn: 1.125rem; /* 18px button labels */
  --tap-lg: 60px; /* primary action height */
  --gap-w2: 64px; /* timeline gap target width (idle) */
  --gap-w2-on: 96px; /* selected gap width */
  --card-h: 120px; /* timeline card height */
  --z-sticky: 10;
  --z-coach: 20;
  --z-toast: 30;
  --z-sheet: 40;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--t-md)/var(--lh-body) var(--font);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent-text);
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}
.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 var(--s-5);
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: var(--t-lg);
  text-decoration: none;
  color: var(--text);
}
.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.lang {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 3px;
  background: var(--surface);
}
.lang button {
  all: unset;
  cursor: pointer;
  min-width: 44px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--muted);
}
.lang button[aria-pressed='true'] {
  background: var(--accent);
  color: var(--accent-ink);
}
.lang button:focus-visible {
  outline: 3px solid var(--focus);
}

.hero {
  display: grid;
  gap: var(--s-7);
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  padding: var(--s-8) 0 var(--s-7);
}
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-3xl);
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
.lead {
  font-size: var(--t-lg);
  color: var(--muted);
  max-width: 34ch;
  margin: 0 0 var(--s-6);
  text-wrap: pretty;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 var(--s-6);
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: var(--t-md);
  text-decoration: none;
  transition:
    transform var(--dur-fast) var(--ease),
    filter var(--dur-fast);
}
.btn:hover {
  filter: brightness(1.06);
}
.btn:active {
  transform: scale(0.98);
}
.sub {
  margin: var(--s-3) 0 0;
  color: var(--muted);
  font-size: var(--t-sm);
}

/* hero visual: a timeline made of CSS, not an illustration */
.tl {
  display: flex;
  align-items: flex-end;
  gap: var(--s-3);
  justify-content: center;
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.yc {
  flex: 1;
  max-width: 84px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: var(--t-lg);
}
.yc:nth-child(1) {
  height: 96px;
}
.yc:nth-child(3) {
  height: 132px;
}
.yc:nth-child(5) {
  height: 168px;
}
.yc.gap {
  border: 2px dashed var(--accent-text);
  background: var(--accent-soft);
  color: var(--accent-text);
  height: 132px;
  font-size: var(--t-xl);
}
.yc small {
  display: block;
  font-size: var(--t-xs);
  font-weight: 500;
  color: var(--muted);
}

section {
  padding: var(--s-7) 0;
  border-top: 1px solid var(--border);
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-xl);
  margin: 0 0 var(--s-5);
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-5);
  counter-reset: s;
}
.steps li {
  counter-increment: s;
  padding-top: var(--s-4);
  border-top: 2px solid var(--accent);
}
.steps li::before {
  content: counter(s);
  display: block;
  font-family: var(--font-display);
  font-size: var(--t-2xl);
  color: var(--accent-text);
  line-height: 1;
  margin-bottom: var(--s-3);
}
.steps h3 {
  margin: 0 0 var(--s-2);
  font-size: var(--t-lg);
}
.steps p {
  margin: 0;
  color: var(--muted);
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-6);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.panel h3 {
  margin: 0 0 var(--s-3);
  font-size: var(--t-lg);
}
.panel p,
.panel li {
  color: var(--muted);
  margin: 0 0 var(--s-2);
}
.panel ul {
  margin: 0;
  padding-left: 1.2em;
}
.panel strong {
  color: var(--text);
}
footer {
  border-top: 1px solid var(--border);
  padding: var(--s-6) 0 calc(var(--s-7) + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: var(--t-sm);
}
footer p {
  margin: 0 0 var(--s-2);
  max-width: 70ch;
}

@media (max-width: 760px) {
  .hero {
    grid-template-columns: 1fr;
    padding: var(--s-6) 0 var(--s-6);
    gap: var(--s-6);
  }
  .steps,
  .two {
    grid-template-columns: 1fr;
  }
  .lead {
    max-width: none;
  }
}

.lang a {
  min-width: 44px;
  min-height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.lang a[aria-current='page'] {
  background: var(--accent);
  color: var(--accent-ink);
}
.lang a:focus-visible {
  outline: 3px solid var(--focus);
}
.yc.gap.tall {
  height: 150px;
}
.prose {
  max-width: 70ch;
  padding: var(--s-6) 0;
}
.prose h1 {
  font-size: var(--t-2xl);
}
.prose pre {
  white-space: pre-wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-4);
  font-size: var(--t-sm);
  overflow: auto;
}
footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin: 0 0 var(--s-3);
}
