/* Self-hosted fonts (SIL OFL 1.1, see /assets/fonts/OFL-ibm-plex-spectral.txt).
   The site's Content-Security-Policy only allows fonts from this domain. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap; src: url(/assets/fonts/ibm-plex-sans-latin-wght-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/spectral-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/spectral-latin-600-normal.woff2) format("woff2"); }

/* Layout: one narrow reading column. Ten question rows with Yes/No segments,
   then a result block built around an 11-step score ruler with one amber marker. */
:root {
  --bg: #ffffff;
  --surface: #f6f4fb;
  --ink: #1e074c;
  --muted: #5a4e7c;
  --line: #ddd6ec;
  --choice-bg: #1e074c;
  --on-choice: #ffffff;
  --signal: #e3a038;
  --on-signal: #1e074c;
  --band-1: #e6e1f3;
  --band-2: #b7a9dc;
  --band-3: #1e074c;
  --font-display: "Spectral", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #140433;
    --surface: #1e074c;
    --ink: #f4f1fb;
    --muted: #b9afd6;
    --line: #3b2872;
    --choice-bg: #f4f1fb;
    --on-choice: #1e074c;
    --band-1: #2c1a68;
    --band-2: #5b40a8;
    --band-3: #a995e0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #140433;
  --surface: #1e074c;
  --ink: #f4f1fb;
  --muted: #b9afd6;
  --line: #3b2872;
  --choice-bg: #f4f1fb;
  --on-choice: #1e074c;
  --band-1: #2c1a68;
  --band-2: #5b40a8;
  --band-3: #a995e0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: 32px 64px;
}
.wrap { max-width: 720px; margin-inline: auto; }

.brand {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 12px 0 16px;
  text-wrap: balance;
}
.intro { color: var(--muted); max-width: 60ch; margin: 0; }
.intro + .intro { margin-top: 8px; }

.progress {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 32px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.progress span:last-child { font-variant-numeric: tabular-nums; }

.q {
  border: 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 20px 0;
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 14px;
}
.q-num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.q legend {
  display: contents;
}
.q-text { grid-column: 2; font-size: 17px; font-weight: 500; margin: 0; }
.choices { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}
.choice span {
  display: inline-block;
  min-width: 84px;
  text-align: center;
  padding: 9px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  font-weight: 500;
  font-size: 15px;
  background: transparent;
  color: var(--ink);
}
.choice input:hover + span { background: var(--surface); }
.choice input:checked + span {
  background: var(--choice-bg);
  color: var(--on-choice);
}
.choice input:focus-visible + span {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}
.choice.na span { border-style: dashed; font-weight: 400; }

/* Result */
.result {
  margin-top: 40px;
  padding: 24px 20px 28px;
  background: var(--surface);
  border-radius: 6px;
}
.result-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 6px;
}
.result-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.score-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 64px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.score-of { font-family: var(--font-mono); font-size: 14px; color: var(--muted); }
.band-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  margin: 0;
}
.result p.msg { margin: 12px 0 0; max-width: 56ch; }

.ruler { margin-top: 24px; }
.ruler-cells {
  position: relative;
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 3px;
}
.cell { height: 22px; background: var(--band-1); }
.cell.b2 { background: var(--band-2); }
.cell.b3 { background: var(--band-3); }
.cell.on { outline: 3px solid var(--signal); outline-offset: 1px; position: relative; z-index: 1; }
.ruler-ticks {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 3px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ruler-bands {
  display: grid;
  grid-template-columns: 3fr 3fr 5fr;
  gap: 3px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.ruler-bands span { border-top: 1px solid var(--line); padding-top: 4px; }

.flagged { margin-top: 28px; }
.flagged h2 {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 4px;
}
.flagged ul { list-style: none; margin: 0; padding: 0; }
.flagged li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.flagged li:last-child { border-bottom: 0; }
.f-num { font-family: var(--font-mono); font-size: 13px; color: var(--muted); padding-top: 2px; }
.f-title { font-weight: 600; }
.f-why { color: var(--muted); font-size: 15px; margin-top: 2px; }
.none { color: var(--muted); margin: 8px 0 0; }

.actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  border: 1.5px solid var(--ink);
}
button.primary { background: var(--signal); color: var(--on-signal); border-color: var(--signal); }
button.ghost { background: transparent; color: var(--ink); }
button:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.status { font-size: 14px; color: var(--muted); }

.next {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.next p { margin: 0; max-width: 56ch; }
.next .strong { font-weight: 600; }
.foot { margin-top: 40px; color: var(--muted); font-size: 13px; }

[hidden] { display: none !important; }
@media (max-width: 420px) {
  .score-num { font-size: 52px; }
  .choice span { min-width: 76px; padding-inline: 14px; }
}
@media (prefers-reduced-motion: no-preference) {
  .choice span { transition: background 0.12s ease, color 0.12s ease; }
}

/* Standalone page additions */
:root { color-scheme: light; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
.brand { display: inline-block; line-height: 0; }
.logo { height: 22px; width: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

/* Replaces two inline style attributes (blocked by the CSP). */
.band-name.pending-title { font-size: 22px; }
.result p.msg.pending-msg { margin-top: 8px; color: var(--muted); }

/* Landmarks, skip link, footer and cookie banner (consent.js), added so the
   standalone page meets the same accessibility and privacy rules as the site. */
a:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
.brand { padding-block: 4px; } /* 30px tall tap target (WCAG 2.5.8 asks for 24) */
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--ink); color: var(--bg);
  padding: 12px 20px; border-radius: 4px;
}
.skip:focus { top: 16px; }
.site-foot {
  margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.site-foot p { margin: 0; }
.site-foot a, .link-button { color: var(--muted); }
.link-button {
  font: inherit; background: none; border: 0; padding: 0; border-radius: 0;
  text-decoration: underline; cursor: pointer;
}
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60;
  max-width: 720px; margin: 0 auto; padding: 20px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px;
  background: var(--ink); color: var(--bg);
  border-radius: 8px; box-shadow: 0 8px 32px rgba(30, 7, 76, .28);
}
.cookie-banner p { flex: 1 1 280px; margin: 0; }
.cookie-banner a { color: var(--bg); text-decoration: underline; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 12px; }
/* Accept and Reject look the same on purpose. */
.cookie-actions button { min-width: 140px; background: transparent; color: var(--bg); border-color: var(--bg); }
@media (max-width: 600px) {
  .cookie-banner { left: 12px; right: 12px; bottom: 12px; padding: 16px; gap: 12px; font-size: 15px; }
  .cookie-actions { width: 100%; flex-wrap: nowrap; }
  .cookie-actions button { flex: 1; min-width: 0; }
}
