/* Phone-first, calm, readable. System fonts only (no CDN). Light by default, dark via
   prefers-color-scheme. Body 17px, tap targets >= 44px, WCAG AA colour pairs.
   Shared refresh stylesheet (ui_refresh 2026-09-25) — identical across demo pages. */
:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0f2f4;
  --fg: #16191d;
  --muted: #4a5360;          /* 7.6:1 on #fff */
  --border: #d5dae0;
  --accent: #0a58a8;         /* links/buttons 6.6:1 on #fff */
  --accent-fg: #ffffff;
  --ok: #1b7340;             /* 5.9:1 on #fff */
  --warn: #85560a;           /* 5.9:1 on #fff */
  --danger: #b0261d;         /* 6.6:1 on #fff */
  --caution-bg: #fff5dc;
  --caution-border: #e2bd5b;
  --bar-track: #e3e7eb;
  --focus: #0a58a8;
  --radius: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1f25;
    --surface-2: #232a32;
    --fg: #eef1f4;
    --muted: #b7c0ca;        /* 9.3:1 on #1a1f25 */
    --border: #36404b;
    --accent: #8cc4ff;       /* 8.9:1 on #1a1f25 */
    --accent-fg: #0b1726;
    --ok: #74d6a0;
    --warn: #f1c35a;
    --danger: #ff8f86;
    --caution-bg: #2a2416;
    --caution-border: #6f5a24;
    --bar-track: #2c343d;
    --focus: #8cc4ff;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.55;
}

a { color: var(--accent); text-underline-offset: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  word-break: break-all;
}

.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: 1080px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

/* ---------- Header ---------- */
header.site { margin: 0 0 1rem; }

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ok);
  border: 1px solid currentColor;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
}

h1 {
  margin: 0;
  font-size: 1.625rem;       /* 26px phone */
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 750;
}

/* ---------- Layout ---------- */
.layout { display: grid; gap: 1rem; }

@media (min-width: 900px) {
  h1 { font-size: 2.125rem; }
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    grid-template-areas: "ask answer" "below answer";
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: 1.5rem;
    row-gap: 1rem;
  }
  .ask { grid-area: ask; }
  .answer { grid-area: answer; position: sticky; top: 1rem; }
  .layout > .below { grid-area: below; margin-top: 0; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

/* ---------- Form ---------- */
.field { margin: 0 0 0.9rem; }
.field[hidden] { display: none; }

label {
  display: block;
  font-weight: 650;
  margin: 0 0 0.35rem;
}

.field-hint {
  margin: 0.3rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

input[type="text"],
input[type="date"],
select {
  display: block;
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 1.0625rem;      /* >=16px avoids iOS zoom */
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus, select:focus { border-color: var(--focus); }

details.more {
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}
.panel:has(> details.fold) { padding-top: 0.25rem; padding-bottom: 0.25rem; }
details.fold[open] { padding-bottom: 0.75rem; }
details.fold > summary h2 { display: inline; }

details > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 650;
  color: var(--accent);
  list-style: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "";
  width: 0.55rem; height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: 0 0 auto;
  margin-right: 0.15rem;
}
details[open] > summary::before { transform: rotate(45deg); }

details.more > .more-body { padding: 0.25rem 0 0.25rem; }

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn {
  appearance: none;
  min-height: 48px;
  min-width: 44px;
  padding: 0.6rem 1rem;
  font: inherit;
  font-weight: 650;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }

.btn-primary {
  flex: 1 1 auto;
  color: var(--accent-fg);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.status:empty { display: none; }
.status {
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- Answer card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.1rem 1.1rem 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
}

.card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.25rem;
}

.card-brand {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--muted);
}

.card-meta {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.big {
  margin: 0.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.6rem;
  line-height: 1;
}

.big-num {
  font-size: clamp(4.25rem, 24vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.big-num.is-word { font-size: clamp(2.5rem, 12vw, 3.5rem); letter-spacing: -0.02em; }

.big-unit {
  font-size: 1.5rem;
  font-weight: 700;
}

.big.ok .big-num { color: var(--ok); }
.big.warn .big-num { color: var(--warn); }
.big.danger .big-num { color: var(--danger); }
.big.unsure .big-num { color: var(--fg); }

.key-date {
  margin: 0.6rem 0 0;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.35;
}
.key-date:empty { display: none; }

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bar-track);
  overflow: hidden;
  margin: 0.75rem 0 0.25rem;
}
.bar[hidden] { display: none; }
.bar > span {
  display: block;
  height: 100%;
  width: calc(var(--pct, 0) * 1%);
  background: var(--accent);
  border-radius: inherit;
}
.bar.ok > span { background: var(--ok); }
.bar.danger > span { background: var(--danger); }

.bar-caption {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}
.bar-caption:empty { display: none; }

.pill {
  display: inline-block;
  margin: 0.75rem 0 0;
  font-size: 0.9375rem;
  font-weight: 650;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1.5px solid var(--border);
}
.pill.ok { color: var(--ok); border-color: currentColor; }
.pill.warn { color: var(--warn); border-color: currentColor; }
.pill.danger { color: var(--danger); border-color: currentColor; }
.pill.unsure { color: var(--muted); }

.meaning {
  margin: 0.75rem 0 0;
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.45;
}

.caution {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.85rem;
  background: var(--caution-bg);
  border: 1px solid var(--caution-border);
  border-radius: 12px;
}

.next {
  margin: 0.9rem 0 0;
}
.next-k {
  display: block;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  margin: 1rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--border);
}
.facts div { min-width: 0; }
.facts dt {
  font-size: 0.875rem;
  color: var(--muted);
}
.facts dd {
  margin: 0;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.card-disclaimer {
  margin: 0.9rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.share-actions { margin-top: 0.9rem; }
.share-actions .btn { flex: 1 1 calc(50% - 0.5rem); }

.share-box { margin-top: 0.5rem; }
.share-box .row { display: flex; gap: 0.5rem; }
.share-box input { flex: 1; min-width: 0; font-size: 1rem; }

/* ---------- Secondary sections ---------- */
.below { margin-top: 1rem; }
.below .panel + .panel { margin-top: 0.75rem; }

.panel h2 {
  margin: 0;
  font-size: 1.125rem;
}

.fold-body > * + * { margin-top: 0.75rem; }
.fold-body p { margin: 0; }

.explain-list {
  margin: 0;
  padding-left: 1.2rem;
}
.explain-list li + li { margin-top: 0.5rem; }

.dyn {
  margin: 0;
  padding: 0.75rem 0.85rem;
  background: var(--surface-2);
  border-radius: 12px;
}

.source-list {
  margin: 0;
  padding-left: 1.2rem;
}
.source-list li { margin: 0.25rem 0; }
.source-list a { display: inline-block; min-height: 44px; padding: 0.55rem 0; }

.cite-line { font-size: 0.9375rem; color: var(--muted); }

.seed-chips {
  display: grid;
  gap: 0.5rem;
}
@media (min-width: 560px) { .seed-chips { grid-template-columns: 1fr 1fr; } }

.seed-chip {
  appearance: none;
  min-height: 56px;
  text-align: left;
  font: inherit;
  font-weight: 650;
  color: var(--fg);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
}
.seed-chip:hover { border-color: var(--accent); }
.seed-chip .chip-sub {
  display: block;
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
footer.site-foot {
  margin-top: 1.5rem;
  padding: 1rem 0.25rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9375rem;
  color: var(--muted);
}
footer.site-foot strong { color: var(--fg); }
footer.site-foot ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }

.fazier-launch-badge { margin: 1rem 0 0; }
.fazier-launch-badge a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  font-weight: 650;
  color: var(--fg);
  text-decoration: none;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
}
.fazier-launch-badge a:hover { border-color: var(--accent); color: var(--accent); }

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

@media print {
  .ask, .share-actions, .share-box, .below, footer.site-foot { display: none; }
  .card { box-shadow: none; }
}
