/* NeuroAIDA survey platform — no inline styles anywhere, so the CSP can stay strict. */

/* ── typography ─────────────────────────────────────────────────────────────
   Anthropic's brand faces are named first, so they render for anyone who has
   them installed. They are NOT bundled or hotlinked: "Anthropic Sans",
   "Anthropic Serif" and "Anthropic Mono" are Anthropic's proprietary brand
   typefaces (verified 8 Aug 2026 in their brand stylesheet, which declares
   AnthropicSans-Roman-Web.woff2 and AnthropicSerif-Roman-Web.woff2), and
   rehosting them as the identity of a different product is not something this
   project has a licence for. The CSP is default-src 'none' with no font-src,
   so a remote font would be blocked in any case.

   Georgia is the first fallback because it is the fallback Anthropic
   themselves specify: font-family: 'Anthropic Serif', Georgia, serif.

   Split follows Claude's own interface: sans for chrome and controls, serif
   for prose you actually read.
*/
:root {
  --font-sans: "Anthropic Sans", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji",
    sans-serif;
  --font-serif: "Anthropic Serif", Georgia, "Iowan Old Style", "Times New Roman",
    Times, serif;
  --font-mono: "Anthropic Mono", ui-monospace, "JetBrains Mono", SFMono-Regular,
    Menlo, Consolas, monospace;
}

/* ── colour theme ───────────────────────────────────────────────────────────
   Four states. LIGHT IS THE DEFAULT:
     (no attribute)        light  — the base palette on bare :root
     data-theme="light"    light  — explicit
     data-theme="dark"     dark
     data-theme="auto"     follow the operating system

   Dark is deliberately NOT applied by a bare prefers-color-scheme rule. If it
   were, a reader on a dark-set OS would get dark before theme.js ran, and with
   JavaScript disabled they would get dark permanently — neither of which is
   "light by default". Making dark reachable only through an explicit
   data-theme value means the default holds even with no script at all.

   `color-scheme` is set alongside each palette so native form controls,
   scrollbars and focus rings follow the theme instead of fighting it.
*/

:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #1a1a1f;
  --muted: #5c5c66;
  --line: #e2e2e8;
  --accent: #5b3fd4;
  --accent-ink: #ffffff;
  --error: #b3261e;
  --error-bg: #fdecea;
  --callout-bg: #f4f2fd;
  --radius: 8px;
  --maxw: 46rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14141a;
  --fg: #ececf2;
  --muted: #a0a0ad;
  --line: #2e2e38;
  --accent: #a894f5;
  --accent-ink: #14141a;
  --error: #ff9a92;
  --error-bg: #3a1f1d;
  --callout-bg: #1e1c2c;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --bg: #14141a;
    --fg: #ececf2;
    --muted: #a0a0ad;
    --line: #2e2e38;
    --accent: #a894f5;
    --accent-ink: #14141a;
    --error: #ff9a92;
    --error-bg: #3a1f1d;
    --callout-bg: #1e1c2c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--maxw); margin: 0 auto; padding: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
.brand span { font-weight: 400; color: var(--muted); }

/* ── theme toggle ──
   Ships with the `hidden` attribute and is revealed by theme.js. Without
   JavaScript the buttons could not do anything, and a control that visibly
   does nothing is worse than no control. */
.header-actions { display: flex; align-items: center; gap: .75rem; }

.theme-toggle {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.theme-toggle[hidden] { display: none; }
.theme-btn {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .78rem; line-height: 1;
  padding: .4rem .6rem; cursor: pointer;
}
.theme-btn + .theme-btn { border-left: 1px solid var(--line); }
.theme-btn:hover { color: var(--fg); }
.theme-btn[aria-pressed="true"] {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 30rem) {
  .site-header { flex-wrap: wrap; }
  .theme-btn { padding: .35rem .5rem; font-size: .72rem; }
}

.site-footer {
  max-width: var(--maxw); margin: 0 auto; padding: 1.25rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem;
}

/* Serif for the parts that are read as prose; sans stays on the controls.
   This mirrors Claude's own interface, where the chrome is sans and the
   message text is serif. */
h1, h2 { font-family: var(--font-serif); font-weight: 600; text-wrap: balance; }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 1.25rem 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 2rem 0 .5rem; }
a { color: var(--accent); }

.lede { color: var(--muted); margin-top: 0; }
.lede, .intro p, .callout { font-family: var(--font-serif); font-size: 1.02rem; }
.intro p, .callout { text-wrap: pretty; }
.fineprint, .muted { color: var(--muted); font-size: .85rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.callout {
  background: var(--callout-bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem; margin: 1.25rem 0;
}
.intro p { margin: .5rem 0; }
.privacy { margin: 1.25rem 0; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem; }
.privacy summary { cursor: pointer; font-weight: 600; }

.error-banner {
  background: var(--error-bg); border: 1px solid var(--error); color: var(--error);
  border-radius: var(--radius); padding: .75rem 1rem;
}

/* ── survey list ── */
.survey-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.survey-list li { margin-bottom: .75rem; }
.survey-list a {
  display: block; padding: 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: var(--fg);
}
.survey-list a:hover { border-color: var(--accent); }
.survey-title { display: block; font-weight: 600; }
.survey-meta { display: block; color: var(--muted); font-size: .85rem; }

/* ── form ── */
.qsection { margin-bottom: 2.5rem; }
.section-help { color: var(--muted); }

fieldset.question {
  border: 0; border-top: 1px solid var(--line);
  margin: 0 0 1.5rem; padding: 1.25rem 0 0;
}
fieldset.question.has-error { border-top-color: var(--error); }
/* Question text is prose, not a control label — serif, like the rest of the
   reading matter. The options beneath stay sans. */
fieldset.question legend {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600;
  padding: 0; text-wrap: pretty;
}
.req { color: var(--error); }
.keyq {
  font-size: .65rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 4px; padding: .1rem .35rem; margin-left: .4rem; vertical-align: middle;
}
.qhelp { color: var(--muted); font-size: .9rem; margin: .35rem 0; }
.qerror { color: var(--error); font-size: .9rem; margin: .35rem 0; }

.opt { display: flex; gap: .6rem; align-items: flex-start; padding: .3rem 0; cursor: pointer; }
.opt input { margin-top: .35rem; flex: none; }

input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%; max-width: 32rem; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); font: inherit;
}
textarea { max-width: 100%; }
.other-text { margin: .35rem 0 0 1.9rem; max-width: 24rem; }
.unit { color: var(--muted); margin-left: .4rem; }
.counter { color: var(--muted); }
.counter.over { color: var(--error); font-weight: 600; }

/* honeypot — off-screen, never shown to humans */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.narrow { max-width: 22rem; }
.narrow label { display: block; margin-top: .85rem; font-weight: 600; }

/* ── grid question ── */
.gridwrap { overflow-x: auto; }
table.grid, table.data { border-collapse: collapse; width: 100%; margin-top: .5rem; }
table.grid th, table.grid td, table.data th, table.data td {
  border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; font-size: .9rem;
}
table.grid thead th, table.data thead th { background: var(--callout-bg); font-size: .8rem; }
table.grid td { text-align: center; }
table.grid tbody th { font-weight: 400; }
.cell { display: block; cursor: pointer; }
td.num, .data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── buttons ── */
.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn.small { padding: .3rem .6rem; font-size: .85rem; }
form.inline { display: inline; }

/* ── admin results ── */
.result-block { border-top: 1px solid var(--line); padding-top: .5rem; margin-top: 1.5rem; }
.qid {
  font-family: var(--font-mono);
  font-size: .8rem; color: var(--muted); margin-right: .4rem;
}
.verbatim { padding-left: 1.1rem; }
.verbatim li { margin-bottom: .6rem; white-space: pre-wrap; }
