/* ==========================================================================
   styles.css — minimal, warm, mobile-first.
   System fonts, one accent, no framework. Dark-mode aware.
   ========================================================================== */
:root {
  --bg: #faf7f2;
  --bg-soft: #ffffff;
  --bg-tint: #ecf5ef;
  --fg: #23282e;
  --fg-muted: #5b6470;
  --accent: #0d7a52;
  --accent-ink: #ffffff;
  --accent-soft: #d9efe3;
  --border: #e5e0d8;
  --border-strong: #cfc9bf;
  --risk: #b0342e;
  --ok: #1a6b4a;
  --warn: #946300;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17191d;
    --bg-soft: #1f2227;
    --bg-tint: #20302a;
    --fg: #eceff3;
    --fg-muted: #a3ab b5;
    --accent: #3fb27f;
    --accent-ink: #10241b;
    --accent-soft: #244638;
    --border: #31363d;
    --border-strong: #454b54;
    --risk: #e07b76;
    --ok: #6fd0a5;
    --warn: #d9a441;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 680px; margin: 0 auto; padding: 0 18px; }
.muted { color: var(--fg-muted); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }

.skip-link {
  position: absolute; left: -9999px; background: var(--accent); color: var(--accent-ink);
  padding: 12px 16px; border-radius: 0 0 8px 0; z-index: 99; text-decoration: none;
}
.skip-link:focus { left: 0; }
.noscript-notice {
  background: #fff7e8; border: 2px solid var(--warn); color: var(--fg);
  border-radius: 12px; padding: 14px 16px; margin: 12px 0; font-weight: 600;
}

/* header -------------------------------------------------------------- */
.site-header { background: var(--bg-soft); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: var(--accent); color: var(--accent-ink);
}
.brand-text strong { font-size: 1rem; letter-spacing: -.01em; }
.site-nav { display: flex; gap: 8px; }
.site-nav a {
  color: var(--fg-muted); text-decoration: none; font-size: .92rem; font-weight: 600;
  padding: 12px 10px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px;
}
.site-nav a:hover { color: var(--fg); }
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; padding: 8px 0; row-gap: 0; }
  .site-nav { gap: 2px; width: 100%; justify-content: flex-start; }
  .site-nav a { font-size: .84rem; padding: 12px 8px; }
}

/* hero ---------------------------------------------------------------- */
.hero { padding: clamp(36px, 7vw, 64px) 0 clamp(24px, 4vw, 40px); }
.eyebrow {
  color: var(--accent); font-weight: 700; font-size: .9rem; letter-spacing: .01em; margin: 0 0 10px;
}
.hero h1 { font-size: clamp(1.7rem, 5.5vw, 2.4rem); margin-bottom: 12px; }
.hero-sub { color: var(--fg-muted); font-size: 1.06rem; max-width: 56ch; margin: 0 0 16px; }
.reassure { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.reassure li { padding-left: 26px; position: relative; }
.reassure li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }

/* form ---------------------------------------------------------------- */
.assessor { padding-bottom: 40px; }
form { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px 18px; }
.group-heading { font-size: 1.05rem; margin: 20px 0 4px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 650; margin-bottom: 5px; }
.field select, .field input {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1.5px solid var(--border-strong); border-radius: 10px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.field select:focus-visible, .field input:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.hint { color: var(--fg-muted); font-size: .84rem; margin: 4px 0 0; }
.form-footnote { margin: 6px 0 14px; }
.btn {
  font: inherit; font-weight: 700; border: none; cursor: pointer;
  border-radius: 12px; padding: 14px 22px; min-height: 50px;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-small {
  min-height: 44px; padding: 9px 16px; border-radius: 10px; font-size: .9rem;
  background: var(--accent-soft); color: var(--fg);
}
.form-status { min-height: 1.2em; color: var(--risk); font-weight: 650; }
.model-note { color: var(--fg-muted); font-size: .84rem; margin: 8px 0 0; }

/* result -------------------------------------------------------------- */
.result { padding-bottom: 56px; }
.result-card { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 20px; }
.result-head { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.result-pct { font-size: clamp(2.4rem, 9vw, 3.4rem); font-weight: 800; margin: 0; line-height: 1; }
.result-sub { color: var(--fg-muted); margin: 2px 0 0; }
.result-grid { display: grid; gap: 18px; }
@media (min-width: 640px) { .result-grid { grid-template-columns: 1fr 1fr; } }
.result-block h3 { font-size: .98rem; margin-bottom: 8px; }
.factor-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.factor-list li { display: grid; gap: 4px; }
.factor-name { font-weight: 600; font-size: .93rem; }
.factor-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; display: block; }
.factor-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
/* per-fold dots on the GAN page (rendered by gan.js; CSP-safe, no inline styles) */
.folds { display: grid; gap: 8px; margin: 14px 0; }
.fold-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .86rem; }
.fold-name { min-width: 240px; font-weight: 600; }
.fold-dots { display: inline-flex; gap: 6px; }
.fold-dot { width: 10px; height: 10px; border-radius: 999px; background: var(--accent); display: inline-block; }
.next-steps { padding-left: 22px; margin: 0; display: grid; gap: 8px; font-size: .95rem; }
.disclaimer { color: var(--fg-muted); font-size: .84rem; margin-top: 12px; border-top: 1px dashed var(--border-strong); padding-top: 10px; }

/* assistant ----------------------------------------------------------- */
.ask-assistant { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.chat-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.chip {
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg);
  border-radius: 999px; padding: 10px 14px; min-height: 44px;
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--border-strong);
  border-radius: 10px; background: var(--bg); color: var(--fg); font: inherit;
}
#chat-log { display: grid; gap: 8px; margin-top: 12px; }
.chat-msg { padding: 10px 13px; border-radius: 12px; max-width: 85%; font-size: .92rem; }
.bot-msg { background: var(--bg-tint); justify-self: start; }
.user-msg { background: var(--accent-soft); justify-self: end; }

/* footer -------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0 34px; background: var(--bg-soft); }
.footer-inner { display: grid; gap: 12px; }
.footer-title { font-weight: 700; margin: 0 0 2px; }
.footer-note { font-size: .88rem; color: var(--fg-muted); margin: 0; }
.footer-note a, .disclaimer a, .hint a, .footer-nav a {
  color: var(--accent); text-decoration: none; padding: 8px 0; display: inline-flex; align-items: center; min-height: 44px;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.footer-disclaimer { font-size: .8rem; color: var(--fg-muted); margin: 0; max-width: 80ch; }

/* prose pages (how/summary/about) ------------------------------------- */
.prose-page { padding: 30px 0 60px; }
.prose-page h1 { font-size: clamp(1.5rem, 4.5vw, 2rem); }
.prose-page h2 { font-size: 1.2rem; margin-top: 2em; }
.prose-page p, .prose-page li { max-width: 72ch; }
.prose-page a { color: var(--accent); }
.prose-block { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 18px; margin: 14px 0; }
.cards { display: grid; gap: 14px; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(4, 1fr); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.toc a {
  font-size: .88rem; font-weight: 600; text-decoration: none;
  color: var(--accent); background: var(--bg-soft); border: 1px solid var(--border);
  padding: 8px 12px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 999px;
}
.table-scroll { overflow-x: auto; }
.model-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.model-table th, .model-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.model-table thead th { position: sticky; top: 60px; background: var(--bg-soft); }
.row-ensemble { background: var(--bg-tint); font-weight: 700; }
.card-value { font-size: 1.5rem; font-weight: 800; margin: .2em 0; }
.why-card h3 { font-size: 1rem; }
.section-head { margin: 40px 0 16px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
