/* LicenseReady — site styles
   Type: Source Serif 4 (headings) + Public Sans (text), self-hosted, OFL (see fonts/OFL.txt).
   Sized for readers of all ages: 18px body, high-contrast text, 48px+ tap targets. */

@font-face {
  font-family: "Public Sans";
  src: url("/assets/fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/assets/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}

:root {
  --paper: #fbf9f5;
  --surface: #ffffff;
  --sand: #f3eee5;
  --ink: #15233b;
  --text: #1d2737;
  --muted: #4a5466;
  --line: #e2dbcf;
  --line-strong: #c9c0b1;
  --accent: #0e5e55;
  --accent-hover: #0a4a43;
  --accent-ink: #ffffff;
  --accent-soft: #e2efeb;
  --focus-ring: #0e5e55;
  --rust: #9c3f12;
  --rust-soft: #fbece1;
  --good: #17663a;
  --good-soft: #e3f1e7;
  --bad: #a3261b;
  --bad-soft: #fbe8e5;
  --bar: #15233b;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11161d; --surface: #18202a; --sand: #1d2631; --ink: #f1ede6; --text: #e6e9ee; --muted: #b0b8c4;
    --line: #2c3643; --line-strong: #3e4a59; --accent: #63c7b5; --accent-hover: #86d6c7; --accent-ink: #0b1a17;
    --accent-soft: #163330; --focus-ring: #86d6c7; --rust: #f0a070; --rust-soft: #33231a; --good: #6fd39a; --good-soft: #15291d;
    --bad: #ff8a7d; --bad-soft: #351b18; --bar: #d9dee6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11161d; --surface: #18202a; --sand: #1d2631; --ink: #f1ede6; --text: #e6e9ee; --muted: #b0b8c4;
  --line: #2c3643; --line-strong: #3e4a59; --accent: #63c7b5; --accent-hover: #86d6c7; --accent-ink: #0b1a17;
  --accent-soft: #163330; --focus-ring: #86d6c7; --rust: #f0a070; --rust-soft: #33231a; --good: #6fd39a; --good-soft: #15291d;
  --bad: #ff8a7d; --bad-soft: #351b18; --bar: #d9dee6; color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* component display rules must never override the hidden attribute */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--paper); color: var(--text);
  font: 400 1.125rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.3rem); line-height: 1.1; letter-spacing: -.015em; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
strong { font-weight: 650; color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--radius); z-index: 10; }
.skip:focus { top: 12px; color: var(--paper); }

.kicker { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: .75em; }

/* ---------- Header / footer ---------- */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 8px; top: 5px; width: 7px; height: 12px; border: solid var(--paper); border-width: 0 3px 3px 0; transform: rotate(45deg); }
body.in-quiz .header-cta { display: none; }

.site-footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); font-size: 1rem; }
.site-footer p { max-width: 760px; }
.footer-links { display: flex; gap: 24px; margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 24px; border-radius: var(--radius); border: 2px solid transparent;
  font: 600 1.0625rem/1.2 var(--sans); cursor: pointer; text-decoration: none; text-align: center;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-secondary:hover { background: var(--accent-soft); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-link { background: none; border: 0; padding: 8px 4px; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; font-weight: 500; }
.btn-lg { min-height: 58px; padding: 14px 30px; font-size: 1.125rem; }
.btn-sm { min-height: 44px; padding: 8px 18px; font-size: 1rem; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- Landing ---------- */
.view { padding: 0 0 64px; }
.resume { background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.resume-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.resume p { margin: 0; }
.resume-actions { display: flex; align-items: center; gap: 12px; }

.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; align-items: start; padding-top: 64px; padding-bottom: 72px; }
.hero-copy h1 { max-width: 15ch; }
.lead { font-size: 1.25rem; line-height: 1.6; color: var(--text); max-width: 34em; margin-bottom: 1.6em; }
.cta-row { margin-bottom: 20px; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; color: var(--muted); font-size: 1rem; }
.facts li { display: inline-flex; align-items: center; gap: 8px; }
.facts li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.sample { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: 0 1px 0 var(--line), 0 12px 32px -18px rgba(21, 35, 59, .25); }
.sample-label { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--ink); margin: 0 0 2px; }
.sample-topic { font-size: .95rem; color: var(--muted); margin: 0 0 16px; }
.sample-q { font-weight: 600; color: var(--ink); font-size: 1.125rem; line-height: 1.5; }
.sample-after { margin-top: 4px; }
.sample-after .btn { margin-top: 4px; width: 100%; }

.stats { padding-top: 8px; padding-bottom: 64px; }
.stats h2 { max-width: 22ch; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; margin: 28px 0 20px; }
.stat-grid > div { border-top: 2px solid var(--ink); padding-top: 16px; display: flex; flex-direction: column; }
.stat-grid dt { font-weight: 600; color: var(--ink); order: 2; margin-top: 4px; }
.stat-grid dd { margin: 0; order: 1; font: 700 clamp(2.6rem, 6vw, 3.4rem)/1 var(--serif); color: var(--accent); letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.stat-grid p { order: 3; margin: 2px 0 0; color: var(--muted); font-size: 1rem; }
.source { font-size: .95rem; color: var(--muted); max-width: 52em; margin: 0; }

.note-wrap { padding: 24px 0 64px; }
.note { margin: 0; max-width: 760px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 36px 40px; }
.note blockquote { margin: 0; }
.note blockquote p { font-family: var(--serif); font-size: 1.25rem; line-height: 1.6; color: var(--text); }
.note figcaption { font-weight: 600; color: var(--ink); }
.note figcaption::before { content: "— "; }

.band { background: var(--sand); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 64px 0; }
.section-lead { max-width: 40em; margin-bottom: 32px; }
.topic-list { list-style: none; counter-reset: t; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; }
.topic-list li { counter-increment: t; border-top: 2px solid var(--ink); padding: 18px 0 28px; }
.topic-list li::before { content: counter(t, decimal-leading-zero); display: block; font: 600 .95rem var(--sans); color: var(--accent); margin-bottom: 6px; letter-spacing: .02em; }
.topic-list h3 { margin-bottom: .35em; }
.topic-list p { margin: 0; color: var(--muted); font-size: 1.0625rem; }

.split { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 56px; padding-top: 72px; padding-bottom: 56px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { position: relative; padding: 0 0 22px 40px; }
.checklist li::before { content: ""; position: absolute; left: 0; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); }
.checklist li::after { content: ""; position: absolute; left: 9px; top: 8px; width: 5px; height: 10px; border: solid var(--accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

.faq { padding-top: 24px; }
.faq > * { max-width: 760px; }
details { border-bottom: 1px solid var(--line); }
details:first-of-type { border-top: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 18px 36px 18px 0; position: relative; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-52%); font: 400 1.6rem/1 var(--sans); color: var(--accent); }
details[open] summary::after { content: "–"; }
details > p { margin: 0 0 20px; max-width: 38em; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; margin-top: 40px; }
.panel h3 { margin-bottom: .4em; }
.panel-accent { border-top: 4px solid var(--accent); }

/* ---------- Forms ---------- */
form.signup { display: grid; gap: 10px; margin-top: 12px; }
form.signup label { font-weight: 600; color: var(--ink); font-size: 1rem; }
form.signup label.check { font-weight: 400; color: var(--text); display: flex; gap: 12px; align-items: flex-start; margin: 6px 0 8px; }
form.signup label.check input { margin-top: 5px; width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.optional { font-weight: 400; color: var(--muted); }
input[type="email"], select {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: var(--radius);
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 1.0625rem;
}
input[type="email"]:focus, select:focus { border-color: var(--accent); }
form.signup .btn { margin-top: 6px; }
.inline { display: flex; gap: 10px; }
.inline input { flex: 1; min-width: 0; }
.inline .btn { margin-top: 0; }
.form-msg { min-height: 1.4em; margin: 0; font-size: 1rem; }
.form-msg.ok { color: var(--good); font-weight: 600; }
.form-msg.err { color: var(--bad); font-weight: 600; }

/* ---------- Choices (sample + quiz) ---------- */
.choices { display: grid; gap: 12px; margin: 20px 0 24px; }
.choices.compact { gap: 10px; margin: 14px 0 18px; }
.choice {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%;
  min-height: 56px; padding: 14px 16px; border-radius: var(--radius); border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; line-height: 1.5; cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.choices.compact .choice { min-height: 50px; padding: 11px 14px; font-size: 1.0625rem; }
.choice:hover:not([disabled]) { border-color: var(--accent); background: var(--accent-soft); }
.choice .key {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); font-weight: 700; font-size: .95rem; color: var(--ink); margin-top: -1px;
}
.choice .text { flex: 1; }
.choice .tag { display: block; font-size: .9rem; font-weight: 700; margin-top: 4px; }
.choice[disabled] { cursor: default; }
.choice[disabled]:not(.correct):not(.wrong) { opacity: .7; }
.choice.correct { border-color: var(--good); background: var(--good-soft); }
.choice.correct .key { background: var(--good); border-color: var(--good); color: var(--surface); }
.choice.correct .tag { color: var(--good); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice.wrong .key { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.choice.wrong .tag { color: var(--bad); }

.verdict { font-weight: 700; font-size: 1.125rem; margin-bottom: .35em; }
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--bad); }

/* ---------- Quiz ---------- */
.view-quiz { padding-top: 28px; }
.quiz-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q-count { font-weight: 600; color: var(--ink); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0 28px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.q-topic { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: .5em; }
.question { font-family: var(--sans); font-size: clamp(1.3rem, 3.2vw, 1.55rem); font-weight: 650; line-height: 1.4; letter-spacing: 0; outline: none; }
.feedback { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 24px; }
.feedback p:last-child { margin-bottom: 0; }
.why-label { font-size: .9rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: .8em 0 .2em; }
.quiz-actions { margin-bottom: 16px; }
.quiz-actions .btn { min-width: 220px; }
.hint { color: var(--muted); font-size: .95rem; }
@media (hover: none) { .hint { display: none; } }

/* ---------- Results ---------- */
#view-results { padding-top: 48px; }
.score { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.score-num { margin: 0; font-family: var(--serif); font-weight: 700; font-size: clamp(3.5rem, 10vw, 5rem); line-height: 1; color: var(--ink); letter-spacing: -.03em; }
.score h2 { margin-bottom: .3em; }
.score-sub { margin: 0; }

.focus { background: var(--rust-soft); border-radius: 12px; padding: 22px 24px; margin-bottom: 36px; }
.focus h3 { color: var(--rust); font-size: 1.2rem; }
.focus ul { margin: 0; padding-left: 1.2em; }
.focus li { margin: .25em 0; }
.focus li strong { color: var(--ink); }

.topics-title { margin-bottom: 14px; }
.topics { display: grid; gap: 18px; }
.topic-row .topic-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 1.0625rem; }
.topic-row .topic-head .n { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.topic-row .bar { position: relative; height: 10px; background: var(--line); border-radius: 999px; }
.topic-row .bar > .fill { height: 100%; border-radius: 999px; background: var(--bar); }
.topic-row.weak .bar > .fill { background: var(--rust); }
.topic-row .bar > .mark, .tick-key { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--muted); }
.topics-note { color: var(--muted); font-size: .95rem; margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.tick-key { position: static; display: inline-block; flex: none; }

.review { margin-top: 40px; border-top: 1px solid var(--line); }
.review ol { padding-left: 1.3em; margin: 0 0 16px; }
.review li { margin: 0 0 22px; }
.review li p { margin: .2em 0; }
.review .q { font-weight: 600; color: var(--ink); }
.review .yours { color: var(--bad); }
.review .right { color: var(--good); font-weight: 600; }
.retake { margin-top: 28px; }

/* ---------- Content pages ---------- */
.prose { padding: 48px 20px 64px; }
.prose h1 { font-size: clamp(2rem, 5vw, 2.6rem); }
.prose h2 { font-size: 1.5rem; margin-top: 1.6em; }
.prose li { margin: .35em 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: 40px; padding-bottom: 56px; }
  .hero-copy h1 { max-width: 18ch; }
  .topic-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 16px; padding-top: 56px; }
}
@media (max-width: 600px) {
  body { font-size: 1.0625rem; }
  .wrap { padding: 0 16px; }
  .header-inner { min-height: 60px; }
  .brand { font-size: 1.2rem; }
  .header-cta { padding: 8px 14px; }
  .lead { font-size: 1.125rem; }
  .cta-row .btn { width: 100%; }
  .sample { padding: 20px; }
  .band { padding: 48px 0; }
  .topic-list { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; gap: 20px; }
  .note { padding: 24px 20px; }
  .note blockquote p { font-size: 1.125rem; }
  .panel { padding: 22px 18px; }
  .inline { flex-direction: column; }
  .score { grid-template-columns: 1fr; gap: 12px; }
  /* Keep "Next" reachable after a long explanation */
  .quiz-actions { position: sticky; bottom: 0; margin: 0 -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
  .quiz-actions .btn { width: 100%; }
}
@media (max-width: 380px) { .header-cta { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
