:root {
  --bg: #f2f6f8;
  --surface: #ffffff;
  --ink: #17242e;
  --muted: #566b77;
  --accent: #2c6e8f;
  --accent-ink: #21566f;
  --accent-soft: #e3eef3;
  --warn: #9a5b0a;
  --warn-bg: #faf3e2;
  --danger: #a83a2c;
  --danger-bg: #f9ece9;
  --line: #d9e2e8;
  --code-bg: #e9f0f4;
  --shadow: 0 1px 2px rgba(23, 36, 46, 0.06), 0 8px 24px -12px rgba(23, 36, 46, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f161c;
    --surface: #161f27;
    --ink: #e4ecf1;
    --muted: #92a4b0;
    --accent: #5fa8c9;
    --accent-ink: #8cc4dd;
    --accent-soft: #1b2b35;
    --warn: #e0a44c;
    --warn-bg: #2a2213;
    --danger: #e07a6b;
    --danger-bg: #2e1a17;
    --line: #253340;
    --code-bg: #1d2933;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Seravek", "Segoe UI", system-ui, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px 80px; }
.wrap--narrow { max-width: 900px; }

/* ---------- Site header / nav ---------- */
.site-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px;
  padding: 26px 0 18px;
  border-bottom: 2px solid var(--ink);
}
.site-head .brand {
  font-family: "Futura", "Avenir Next", "Century Gothic", sans-serif;
  font-weight: 700; font-size: 18px; letter-spacing: 0.02em;
  color: var(--ink); text-decoration: none;
}
.site-head .brand span { color: var(--accent-ink); }
.site-head nav { display: flex; gap: 18px; margin-left: auto; font-size: 14.5px; }
.site-head nav a {
  color: var(--accent-ink); text-decoration: none; font-weight: 600;
  border-bottom: 2px solid transparent; padding-bottom: 2px;
}
.site-head nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); }
.site-head nav a:hover, .site-head nav a:focus-visible { border-bottom-color: var(--accent); }

a { color: var(--accent-ink); }
a:focus-visible, button:focus-visible, input:focus-visible + label {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.eyebrow {
  font-family: "Futura", "Avenir Next", "Century Gothic", sans-serif;
  text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 12px; color: var(--accent-ink); font-weight: 600; margin: 0 0 10px;
}
h1 {
  font-family: "Futura", "Avenir Next", "Century Gothic", sans-serif;
  font-size: clamp(26px, 4.5vw, 38px); line-height: 1.15;
  margin: 0 0 10px; text-wrap: balance; letter-spacing: -0.01em;
}
.standfirst { font-size: 17px; color: var(--muted); max-width: 62ch; margin: 0 0 8px; }

/* ---------- Planner layout ---------- */
.planner {
  display: grid; grid-template-columns: minmax(300px, 5fr) minmax(320px, 6fr);
  gap: 28px; align-items: start; margin-top: 28px;
}
@media (max-width: 820px) { .planner { grid-template-columns: 1fr; } }

.controls { display: flex; flex-direction: column; gap: 20px; }

fieldset {
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
  margin: 0; padding: 14px 16px 16px;
}
fieldset:disabled { opacity: 0.55; }
legend {
  font-family: "Futura", "Avenir Next", sans-serif;
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 11.5px; font-weight: 700; color: var(--accent-ink);
  padding: 0 6px;
}
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input {
  position: absolute; opacity: 0; width: 100%; height: 100%;
  inset: 0; margin: 0; cursor: pointer;
}
.choice label {
  display: block; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--muted);
  background: var(--bg);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
@media (prefers-reduced-motion: reduce) { .choice label { transition: none; } }
.choice input:checked + label {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--ink);
}
.choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggles { display: flex; flex-direction: column; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 600; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.toggle .sub { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }

/* ---------- Results panel ---------- */
.results {
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  position: sticky; top: 16px;
}
@media (max-width: 820px) { .results { position: static; } }

.results h2 {
  font-family: "Futura", "Avenir Next", sans-serif;
  font-size: 15px; text-transform: uppercase; letter-spacing: 0.12em;
  margin: 0 0 4px; color: var(--accent-ink);
}
.results .scenario-name { font-size: 21px; font-weight: 700; margin: 0 0 14px; }

.settings-list { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; }
.settings-list > div {
  display: contents;
}
.settings-list dt {
  font-size: 13px; color: var(--muted); font-weight: 600;
  padding: 8px 18px 8px 0; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.settings-list dd {
  margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line);
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.settings-list dd .note {
  display: block;
  font-family: "Avenir Next", "Seravek", "Segoe UI", system-ui, sans-serif;
  font-size: 12.5px; color: var(--muted);
}
.settings-list > div:last-child dt,
.settings-list > div:last-child dd { border-bottom: none; }

.msg-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.msg {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: 13.5px;
}
.msg::before { font-weight: 700; margin-right: 6px; }
.msg.tip::before { content: "Tip:"; color: var(--accent-ink); }
.msg.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.msg.warn::before { content: "Watch out:"; color: var(--warn); }

/* ---------- Long-form guide pages ---------- */
.masthead { padding: 40px 0 30px; border-bottom: 2px solid var(--ink); margin-bottom: 8px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--line);
}
nav.toc { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 16px 0 24px; font-size: 14.5px; }
nav.toc a {
  color: var(--accent-ink); text-decoration: none; font-weight: 600;
  border-bottom: 1px solid transparent;
}
nav.toc a:hover, nav.toc a:focus-visible { border-bottom-color: var(--accent); }

section { margin-top: 40px; }
.section-label {
  font-family: "Futura", "Avenir Next", "Century Gothic", sans-serif;
  text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 11.5px; font-weight: 700; color: var(--accent-ink); margin: 0 0 6px;
}
h2.section-title {
  font-family: "Futura", "Avenir Next", "Century Gothic", sans-serif;
  font-size: 26px; margin: 0 0 4px; letter-spacing: -0.005em; scroll-margin-top: 24px;
}
.section-intro { color: var(--muted); max-width: 68ch; margin: 6px 0 20px; }
h3 { font-size: 18.5px; margin: 30px 0 8px; }
p { max-width: 72ch; margin: 0 0 14px; }
ul, ol { max-width: 70ch; padding-left: 24px; margin: 0 0 14px; }
li { margin-bottom: 6px; }

.val {
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.88em; background: var(--code-bg);
  padding: 1px 7px; border-radius: 5px; white-space: nowrap;
}

.table-scroll {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow); margin: 14px 0 22px;
}
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 620px; }
th {
  text-align: left; font-family: "Futura", "Avenir Next", sans-serif;
  text-transform: uppercase; letter-spacing: 0.09em; font-size: 11px;
  color: var(--muted); font-weight: 700;
  padding: 12px 16px; border-bottom: 2px solid var(--line);
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td:first-child { font-weight: 600; white-space: nowrap; }

.callout {
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 18px 0;
}
.callout p { margin: 0 0 8px; max-width: none; }
.callout p:last-child { margin-bottom: 0; }
.callout .co-title {
  font-family: "Futura", "Avenir Next", sans-serif;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  font-size: 11.5px; margin-bottom: 6px; color: var(--accent-ink);
}
.callout.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout.warn .co-title { color: var(--warn); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-bg); }
.callout.danger .co-title { color: var(--danger); }

.checklist { list-style: none; padding-left: 0; }
.checklist li { padding-left: 30px; position: relative; margin-bottom: 9px; }
.checklist li::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 15px; height: 15px; border: 2px solid var(--accent); border-radius: 4px;
}

.src-list { font-size: 14px; color: var(--muted); }
.src-list li { margin-bottom: 5px; }

footer.endnote {
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px; max-width: 72ch;
}
