/* IQLens — answer-sheet design system. No external fonts or libraries (fast, CSP-friendly). */

:root {
  --paper: #F4F7FB;
  --sheet: #FFFFFF;
  --ink: #0E1A33;
  --graphite: #46536B;
  --rule: #D3DBE8;
  --tint: #A9B4CA;
  --pen: #2342F5;
  --pen-ink: #FFFFFF;
  --pen-tint: #E5EAFF;
  --marker: #FFE14D;
  --ok: #0B7A52;
  --ok-tint: #DDF4EA;
  --bad: #B83232;
  --bad-tint: #FBE6E6;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0B1222;
    --sheet: #121C33;
    --ink: #EAF0FF;
    --graphite: #A7B4D0;
    --rule: #263556;
    --tint: #5A6B94;
    --pen: #8197FF;
    --pen-ink: #0B1222;
    --pen-tint: #1A2A5E;
    --marker: #F2D13B;
    --ok: #4CD6A0;
    --ok-tint: #10382B;
    --bad: #FF8D8D;
    --bad-tint: #3F1A1A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--pen); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--pen); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--graphite); max-width: 60ch; }
.muted { color: var(--graphite); }
.small { font-size: .9rem; }

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- header / footer ---------- */
.site-head { border-bottom: 1px solid var(--rule); background: var(--paper); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: .55rem; font: 700 1.3rem var(--serif); color: var(--ink); text-decoration: none; }
.logo-mark { width: 26px; height: 26px; }
.logo-mark .ring { fill: none; stroke: var(--ink); stroke-width: 3; }
.logo-mark .dot { fill: var(--pen); }
.site-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; }
.site-nav a { color: var(--graphite); text-decoration: none; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }

.site-foot { border-top: 1px solid var(--rule); margin-top: 4rem; padding-block: 2rem 3rem; color: var(--graphite); font-size: .95rem; }
.site-foot .cols { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .site-foot .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-foot h2 { font: 700 1rem var(--sans); margin-bottom: .5rem; color: var(--ink); }
.site-foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.site-foot a { color: var(--graphite); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.3rem; border-radius: 999px; border: 2px solid var(--ink);
  font: 600 1rem var(--sans); color: var(--ink); background: transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, background-color .12s ease;
}
.btn:hover { background: var(--pen-tint); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--pen); border-color: var(--pen); color: var(--pen-ink); }
.btn-primary:hover { background: var(--pen); filter: brightness(1.1); }
.btn-ghost { border-color: var(--rule); }
.btn-lg { min-height: 56px; padding-inline: 1.9rem; font-size: 1.1rem; }
.linkbtn { background: none; border: 0; padding: .3rem 0; color: var(--pen); font: 500 .95rem var(--sans); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; margin-block: 1.4rem; }

/* ---------- home ---------- */
.hero { display: grid; gap: 2.5rem; padding-block: clamp(2rem, 6vw, 4.5rem); align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.15fr .85fr; } }
.hero h1 { max-width: 17ch; }
.chips-line { display: flex; flex-wrap: wrap; gap: .5rem .6rem; padding: 0; margin: 1.2rem 0 0; list-style: none; }
.chips-line li { border: 1.5px solid var(--rule); border-radius: 999px; padding: .25rem .8rem; font-size: .92rem; color: var(--graphite); background: var(--sheet); }

.sample {
  background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r); padding: 1.2rem;
}
.sample-q { margin-bottom: .8rem; }
.sample-fb { margin: 1rem 0 0; min-height: 1.6em; }
.sample-fb .btn { margin-top: .6rem; display: flex; width: fit-content; }

.band { padding-block: clamp(2.2rem, 5vw, 3.5rem); border-top: 1px solid var(--rule); }
.two-col { display: grid; gap: 2rem; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1.4fr; gap: 3rem; } }
.defs { display: grid; gap: 1.2rem; margin: 0; }
.defs dt { font: 700 1.1rem var(--serif); }
.defs dd { margin: .15rem 0 0; color: var(--graphite); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 1.2rem; }
.steps li { counter-increment: s; padding-left: 3rem; position: relative; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 2px solid var(--ink); display: grid; place-items: center; font: 700 1rem var(--serif);
}
.steps strong { display: block; font: 700 1.1rem var(--serif); }

/* ---------- prose pages ---------- */
.prose { max-width: 70ch; padding-block: 2.5rem 1rem; }
.prose h1 { margin-bottom: .4em; }
.prose h2 { margin-top: 2em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: .4em; }
.crumbs { font-size: .92rem; color: var(--graphite); padding-top: 1.4rem; }
.crumbs a { color: var(--graphite); }
.table-wrap { overflow-x: auto; margin-block: 1.2rem; }
table { border-collapse: collapse; width: 100%; min-width: 480px; background: var(--sheet); }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--rule); }
th { font: 700 .95rem var(--sans); background: var(--pen-tint); }
.callout { border-left: 4px solid var(--marker); background: var(--sheet); padding: .9rem 1.1rem; margin-block: 1.4rem; border-radius: 0 var(--r) var(--r) 0; }

details.faq { border-bottom: 1px solid var(--rule); padding-block: .9rem; }
details.faq summary { cursor: pointer; font: 700 1.1rem var(--serif); list-style-position: outside; }
details.faq[open] summary { margin-bottom: .5rem; }
details.faq p { color: var(--graphite); margin-bottom: 0; }

/* ---------- test stage ---------- */
.stage { width: min(760px, 100% - 2rem); margin: 1.5rem auto 0; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: var(--r); padding: clamp(1.1rem, 4vw, 2.2rem); }
.stage:has(.report) { width: min(900px, 100% - 2rem); }
.intro h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
.facts { display: grid; gap: .9rem; margin: 1.5rem 0; }
.facts div { display: grid; gap: .15rem; padding-bottom: .9rem; border-bottom: 1px solid var(--rule); }
@media (min-width: 640px) { .facts div { grid-template-columns: 8rem 1fr; gap: 1rem; } }
.facts dt { font-weight: 700; }
.facts dd { margin: 0; color: var(--graphite); }
.tips h2 { font: 700 1.1rem var(--sans); margin-bottom: .4rem; }
.tips ul { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--graphite); }
.check { display: flex; gap: .6rem; align-items: center; margin-block: .8rem; cursor: pointer; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--pen); }

.qhead { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.qtools { display: flex; align-items: center; gap: .9rem; }
.timer { font: 700 1.1rem var(--sans); font-variant-numeric: tabular-nums; padding: .15rem .7rem; border: 1.5px solid var(--rule); border-radius: 999px; }
.timer.warn { background: var(--marker); border-color: var(--marker); color: #0E1A33; }
.timer.is-hidden { display: none; }
.progress { height: 8px; background: var(--rule); border-radius: 99px; overflow: hidden; margin-bottom: 1.6rem; }
.progress span { display: block; height: 100%; width: 0; background: var(--pen); border-radius: 99px; transition: width .35s ease; }
.qprompt { font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.3; outline: none; margin-bottom: 1.2rem; }

.matrix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 330px); margin: 0 auto 1.6rem; }
.mcell { aspect-ratio: 1; border: 1.5px solid var(--rule); border-radius: 8px; background: var(--paper); }
.mcell.missing { border: 2px dashed var(--ink); background: color-mix(in srgb, var(--marker) 38%, var(--paper)); }
.cell { display: block; width: 100%; height: 100%; }
.sh { stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.sh-solid { fill: var(--ink); }
.sh-empty { fill: none; }
.sh-half { fill: var(--tint); }
.qd { fill: none; stroke: var(--rule); stroke-width: 2; }
.qd.on { fill: var(--ink); stroke: var(--ink); }
.qmark { font: 700 56px var(--serif); fill: var(--ink); }

.opts { display: grid; gap: .65rem; }
.opts-visual { grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.opt {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--paper); color: var(--ink); border: 1.5px solid var(--rule); border-radius: var(--r);
  padding: .75rem .95rem; min-height: 56px; font: 500 1.05rem var(--sans);
  transition: border-color .12s ease, background-color .12s ease;
}
.opt:hover { border-color: var(--ink); }
.bubble {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center;
  font: 700 .9rem var(--sans); background: var(--sheet); color: var(--ink); transition: background-color .12s ease, color .12s ease;
}
.opt.is-sel { border-color: var(--pen); background: var(--pen-tint); }
.opt.is-sel .bubble { background: var(--pen); border-color: var(--pen); color: var(--pen-ink); }
.opt-visual { flex-direction: column; align-items: stretch; gap: .5rem; padding: .6rem; }
.opt-visual .bubble { align-self: flex-start; }
.opt-visual .cell { width: 100%; height: auto; aspect-ratio: 1; }
.opt.is-right { border-color: var(--ok); background: var(--ok-tint); }
.opt.is-right .bubble { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-tint); }
.opt.is-wrong .bubble { background: var(--bad); border-color: var(--bad); color: #fff; }
.otext { flex: 1; }

.qnav { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.6rem; }
.kbd { margin: 1rem 0 0; text-align: center; display: none; }
@media (hover: hover) and (pointer: fine) { .kbd { display: block; } }

.break, .confirm { text-align: left; }
.dots { display: flex; gap: .5rem; padding: 0; margin: 0 0 1.5rem; list-style: none; flex-wrap: wrap; }
.dots li { padding: .25rem .8rem; border-radius: 999px; border: 1.5px solid var(--rule); color: var(--graphite); font-size: .92rem; }
.dots li.done { background: var(--ok-tint); border-color: var(--ok); color: var(--ink); }
.dots li.now { border-color: var(--pen); color: var(--ink); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.chip { border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 999px; padding: .4rem .9rem; cursor: pointer; font: 500 .95rem var(--sans); }
.chip:hover { border-color: var(--pen); }

/* ---------- report ---------- */
.rhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.rhead h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: .2em; outline: none; }
.rbtns { display: flex; gap: .6rem; flex-wrap: wrap; }
.banner { border: 1.5px solid var(--rule); border-left: 5px solid var(--marker); border-radius: 8px; padding: .8rem 1rem; margin-block: 1rem; background: var(--paper); }
.banner-warn { border-left-color: var(--bad); }
.plain { margin: .4rem 0 0; padding-left: 1.2rem; }
.plain li { margin-bottom: .3rem; }

.score { padding: 1.4rem 0 1.6rem; border-bottom: 1px solid var(--rule); }
.score-lbl { margin: 0; font-weight: 600; color: var(--graphite); }
.iqnum { font: 700 clamp(5.5rem, 24vw, 9rem)/1 var(--serif); letter-spacing: -0.04em; margin: .05em 0 .1em; font-variant-numeric: tabular-nums; }
.iqband { font: 700 1.5rem var(--serif); margin-bottom: .4rem; }
.iqrange { margin-bottom: .6rem; }

.rsec { padding-block: 1.6rem; border-bottom: 1px solid var(--rule); }
.rsec:last-of-type { border-bottom: 0; }
.bell { width: 100%; height: auto; display: block; }
.bell-all { fill: var(--paper); stroke: var(--rule); stroke-width: 1.5; }
.bell-mine { fill: color-mix(in srgb, var(--pen) 28%, transparent); }
.bell-base { stroke: var(--ink); stroke-width: 1.5; }
.bell-tick { stroke: var(--ink); stroke-width: 1.5; }
.bell-lbl { font: 500 13px var(--sans); fill: var(--graphite); }
.bell-you { stroke: var(--pen); stroke-width: 2.5; }
.bell-dot { fill: var(--pen); stroke: var(--sheet); stroke-width: 2; }
.bell-you-lbl { font: 700 15px var(--sans); fill: var(--ink); }

.drows { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.3rem; }
.dtop { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; margin-bottom: .35rem; }
.dval { font-variant-numeric: tabular-nums; }
.dbar { height: 14px; border-radius: 99px; background: var(--rule); overflow: hidden; }
.dfill { display: block; height: 100%; width: var(--w, 0%); background: var(--pen); border-radius: 99px; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.dtext { margin-top: .5rem; color: var(--graphite); font-size: .98rem; }
.dtext strong { color: var(--ink); }

.statgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stat { border: 1.5px solid var(--rule); border-radius: var(--r); padding: .8rem; display: grid; gap: .1rem; background: var(--paper); }
.statn { font: 700 1.6rem var(--serif); font-variant-numeric: tabular-nums; }
.statl { font-size: .88rem; color: var(--graphite); }

.rv-tools { margin-bottom: .8rem; }
.rev-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.rev { border: 1.5px solid var(--rule); border-left-width: 6px; border-radius: var(--r); padding: 1rem; background: var(--paper); }
.rev.ok { border-left-color: var(--ok); }
.rev.bad { border-left-color: var(--bad); }
.rev.skip { border-left-color: var(--tint); }
.rv-top { display: flex; gap: .8rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .5rem; }
.rv-n { font: 700 1.1rem var(--serif); }
.rv-meta { color: var(--graphite); font-size: .92rem; flex: 1; }
.rv-res { font-weight: 700; font-size: .92rem; }
.rev.ok .rv-res { color: var(--ok); }
.rev.bad .rv-res { color: var(--bad); }
.rv-prompt { font-weight: 600; margin-bottom: .6rem; }
.rev .matrix { width: min(100%, 220px); margin: 0 0 1rem; }
.rv-ans { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.rv-k { display: block; font-size: .85rem; color: var(--graphite); }
.rv-cell { display: inline-block; width: 64px; border: 1.5px solid var(--rule); border-radius: 6px; background: var(--sheet); }
.rv-why { margin: 0; color: var(--graphite); font-size: .98rem; }
.only-missed .rev.ok { display: none; }

.paywall { background: var(--paper); border: 1.5px dashed var(--ink); border-radius: var(--r); padding: 1.4rem; margin-block: 1.4rem; }
.disclaimer { font-size: .95rem; color: var(--graphite); }

/* ---------- small screens ---------- */
@media (max-width: 520px) {
  .opts-visual { gap: .5rem; }
  .opt-visual { padding: .45rem; }
  .qnav .btn { flex: 1; }
  .statgrid { grid-template-columns: 1fr; }
  .rbtns .btn { flex: 1; }
}

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

/* ---------- print (Save as PDF) ---------- */
@media print {
  :root { --paper: #fff; --sheet: #fff; --ink: #000; --graphite: #333; --rule: #bbb; --pen: #1b34c7; --pen-tint: #eee; }
  body { background: #fff; font-size: 11pt; }
  .site-head, .site-foot, .rbtns, .row, .rv-tools, .skip { display: none !important; }
  .stage { border: 0; width: 100%; margin: 0; padding: 0; }
  .rsec, .rev { break-inside: avoid; }
  .iqnum { font-size: 72pt; }
  .dfill { width: var(--w) !important; transition: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .bell-mine, .progress span, .rev, .dbar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- content pages: table of contents, related links, practice questions ---------- */
.meta { color: var(--graphite); font-size: .92rem; margin: -.2rem 0 1rem; }
.toc { border: 1.5px solid var(--rule); border-radius: var(--r); padding: .9rem 1.1rem; margin: 1.4rem 0 .6rem; background: var(--sheet); }
.toc-h { font: 700 .95rem var(--sans); margin: 0 0 .4rem; }
.toc ul { margin: 0; padding-left: 1.1rem; columns: 1; }
@media (min-width: 640px) { .toc ul { columns: 2; column-gap: 2rem; } }
.toc li { margin-bottom: .2rem; break-inside: avoid; }
.prose h2[id] { scroll-margin-top: 1rem; }

.keep { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.keep h2 { font-size: 1.3rem; margin-top: 0; }
.keep ul, .linklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.keep li, .linklist li { display: grid; gap: .1rem; }
.keep a, .linklist a { font: 700 1.05rem var(--serif); }
.keep span, .linklist span { color: var(--graphite); font-size: .96rem; }

.qa { border: 1.5px solid var(--rule); border-radius: var(--r); padding: 1rem 1.1rem; margin-block: 1rem; background: var(--sheet); }
.qa-type { margin: 0 0 .2rem; font-size: .88rem; color: var(--graphite); }
.qa-q { margin: 0 0 .4rem; }
.qa details.faq { border-bottom: 0; padding-block: .3rem 0; }

.table-wrap th[scope="row"] { background: transparent; font-weight: 600; }
.site-nav { gap: .6rem 1.1rem; }
.site-nav a { font-size: .98rem; }
@media print { .toc, .keep { display: none !important; } }

.qa details.reveal summary { font: 600 1rem var(--sans); color: var(--pen); }
.qa details.reveal[open] summary { margin-bottom: .3rem; }
