/* Unmasked web. Colours and type from the app (theme/Color.kt, theme/Type.kt). */
@font-face { font-family: "DM Sans"; src: url("/fonts/dmsans.woff2") format("woff2"); font-weight: 100 1000; font-display: optional; }
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: optional; /* no late swap = no layout shift */ }

:root {
  --indigo: #3D2B8E; --teal: #2A9D8F; --amber: #E9C46A;
  --bg: #F8F7FF; --surface: #FFFFFF; --card: #F0EEF6;
  --text: #1C1B2E; --muted: #5E5B73; --line: #DCD8EA;
  --accent: #3D2B8E; --accent-ink: #FFFFFF; --accent-soft: #E9E5FB;
  --link: #3D2B8E; --focus: #2A9D8F;
  --care-bg: #FFF6E0; --care-line: #E9C46A; --care-ink: #3A2E05;
  --radius: 14px; --tap: 48px;
  --head: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1625; --surface: #241F35; --card: #2E2844; --text: #F0EEF6; --muted: #B3AFC6; --line: #3B3454;
    --accent: #AA99F0; --accent-ink: #1A1625; --accent-soft: #332B52; --link: #C4B8F7; --focus: #5FD3C4;
    --care-bg: #3A3013; --care-line: #E9C46A; --care-ink: #FFF3D1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1A1625; --surface: #241F35; --card: #2E2844; --text: #F0EEF6; --muted: #B3AFC6; --line: #3B3454;
  --accent: #AA99F0; --accent-ink: #1A1625; --accent-soft: #332B52; --link: #C4B8F7; --focus: #5FD3C4;
  --care-bg: #3A3013; --care-line: #E9C46A; --care-ink: #FFF3D1;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.0625rem/1.6 var(--body); overflow-wrap: break-word; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--head); line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); margin: 0 0 .5em; font-weight: 750; }
h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin: 2em 0 .6em; font-weight: 700; }
h3 { font-size: 1.15rem; margin: 1.5em 0 .4em; font-weight: 700; }
p, ul, ol { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 10px 14px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }
header.site { border-bottom: 1px solid var(--line); background: var(--surface); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 750 1.2rem var(--head); color: var(--text); text-decoration: none; min-height: var(--tap); }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
nav.top { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
nav.top a, .theme-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 500; }
nav.top a:hover { background: var(--card); }
nav.top a[aria-current="page"] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
.theme-btn { background: none; border: 1px solid var(--line); cursor: pointer; font: inherit; gap: 6px; }

main { padding: 32px 0 56px; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 6px; }
.tile h3 { margin: 0; }
.tile .meta { color: var(--muted); font-size: .95rem; margin: 0; }
.tile .btn { margin-top: auto; align-self: flex-start; }
.badge { display: inline-block; font: 600 .78rem/1 var(--body); letter-spacing: .02em; padding: 5px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--text); vertical-align: middle; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 20px; border-radius: 12px; border: 2px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 650 1rem var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--text); }
.btn.danger { background: transparent; border-color: #B3261E; color: #B3261E; }
:root[data-theme="dark"] .btn.danger { border-color: #F2B8B5; color: #F2B8B5; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { border-color: #F2B8B5; color: #F2B8B5; } }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0; }

.promise { border-left: 4px solid var(--teal); padding: 4px 0 4px 16px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; padding: 0; list-style: none; }
.facts li { background: var(--card); border-radius: 12px; padding: 12px 14px; }
.facts strong { display: block; font: 700 1.15rem var(--head); }
ol.refs li { margin-bottom: .6em; }
.note { background: var(--card); border-radius: var(--radius); padding: 16px 18px; }

/* Assessment runner */
.runner { max-width: 720px; }
.progress { height: 8px; background: var(--card); border-radius: 99px; overflow: hidden; margin: 8px 0 24px; }
.progress > span { display: block; height: 100%; background: var(--teal); width: 0; transition: width .2s; }
fieldset.q { border: 0; padding: 0; margin: 0; }
fieldset.q legend { font: 650 clamp(1.25rem, 3.2vw, 1.5rem)/1.35 var(--head); margin-bottom: 18px; padding: 0; }
.opts { display: grid; gap: 10px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt label { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.opt label::before { content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); box-sizing: border-box; }
.opt input:checked + label { border-color: var(--accent); background: var(--accent-soft); }
.opt input:checked + label::before { border: 7px solid var(--accent); }
.opt input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt .key { margin-left: auto; color: var(--muted); font-size: .85rem; }
.runner-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* Results */
.score { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.score .big { font: 800 3.2rem/1 var(--head); }
.meter { position: relative; height: 12px; background: var(--card); border-radius: 99px; margin: 10px 0 4px; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--teal); }
.meter > i { position: absolute; top: -5px; bottom: -5px; width: 3px; background: var(--text); border-radius: 2px; }
table.subs { width: 100%; border-collapse: collapse; margin: 8px 0 16px; }
table.subs th, table.subs td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
table.subs td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.care { background: var(--care-bg); color: var(--care-ink); border: 2px solid var(--care-line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 24px; }
.care h2 { margin-top: 0; font-size: 1.3rem; }
.care a { color: inherit; font-weight: 650; }
.history { list-style: none; padding: 0; display: grid; gap: 10px; }
.history a { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: var(--tap); padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.history a:hover { border-color: var(--accent); }
.status { min-height: 1.6em; }
form.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
form.inline label { display: grid; gap: 6px; flex: 1 1 260px; font-weight: 600; }
input[type="email"], input[type="text"] { min-height: var(--tap); padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--text); font: inherit; width: 100%; }

footer.site { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .95rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 14px; }
footer.site nav a { color: var(--text); display: inline-flex; min-height: 44px; align-items: center; }
footer.site .btn { font-size: .95rem; }
@media (max-width: 560px) {
  header.site .wrap { padding-top: 6px; padding-bottom: 6px; }
  nav.top a { padding: 0 8px; }
  .score .big { font-size: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  header.site, footer.site, .actions, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
/* Headings that receive focus programmatically (new question, new result) for screen readers
   don't need a visible ring; everything reachable by Tab keeps it. */
[data-focus]:focus { outline: none; }
