/* Digital Public Strategy Commons (DPSC) - styles.
   Tokens match the Figma file "DPSC website: design system and screens" (collection "DPSC color",
   text styles "DPSC/*"). Every text and accent color passes WCAG AA (4.5:1) in light and dark mode.
   Font: Atkinson Hyperlegible Next, designed by the Braille Institute for legibility. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f3f5fa;
  --border: #c9d2e3;
  --ink: #0b1220;
  --ink-2: #2e3a52;
  --muted: #4f5b73;
  --primary: #1a4bff;
  --primary-strong: #0f35c9;
  --primary-soft: #e6ecff;
  --on-primary: #ffffff;
  --guess: #c2410c;
  --guess-soft: #fff1e8;
  --backfires: #c81e1e;
  --below: #b45309;
  --above: #15803d;
  --best: #0e6b3a;
  --backfires-soft: #fdecec;
  --below-soft: #fff4e5;
  --above-soft: #e8f7ee;
  --best-soft: #dcf5e7;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1220;
    --surface: #171c2e;
    --border: #2e3650;
    --ink: #f5f7fc;
    --ink-2: #d4dae8;
    --muted: #aeb7cb;
    --primary: #6e8bff;
    --primary-strong: #9cb0ff;
    --primary-soft: #1d2a5c;
    --on-primary: #0e1220;
    --guess: #ff8a4c;
    --guess-soft: #3a2316;
    --backfires: #ff6b6b;
    --below: #f5a524;
    --above: #4ade80;
    --best: #34d399;
    --backfires-soft: #3a1a1e;
    --below-soft: #3a2a12;
    --above-soft: #12301f;
    --best-soft: #0f3326;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1220;
  --surface: #171c2e;
  --border: #2e3650;
  --ink: #f5f7fc;
  --ink-2: #d4dae8;
  --muted: #aeb7cb;
  --primary: #6e8bff;
  --primary-strong: #9cb0ff;
  --primary-soft: #1d2a5c;
  --on-primary: #0e1220;
  --guess: #ff8a4c;
  --guess-soft: #3a2316;
  --backfires: #ff6b6b;
  --below: #f5a524;
  --above: #4ade80;
  --best: #34d399;
  --backfires-soft: #3a1a1e;
  --below-soft: #3a2a12;
  --above-soft: #12301f;
  --best-soft: #0f3326;
}

/* Type scale (DPSC/* text styles): Display 46, Heading 30, Title 22, Lede 22, Body 19, Label 18, Small 16, Overline 14. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 19px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary-strong); text-underline-offset: 3px; text-decoration-thickness: 2px; }
h1 { font-size: clamp(2.1rem, 5.5vw, 2.9rem); font-weight: 700; line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 16px; }
h2 { font-size: clamp(1.55rem, 3.6vw, 1.9rem); font-weight: 700; line-height: 1.2; margin: 0 0 10px; }
h3 { font-size: 1.15rem; font-weight: 700; margin: 22px 0 8px; color: var(--ink-2); }
.page { max-width: 880px; margin: 0 auto; padding: 56px 20px 40px; }
.intro { margin-bottom: 32px; }
.lede { font-size: 1.16rem; line-height: 1.5; color: var(--ink-2); margin: 0; }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 12px; }
.eyebrow a { color: var(--primary-strong); text-decoration: none; }
.hint { color: var(--ink-2); margin: 0 0 18px; }
.note { color: var(--muted); font-size: 1rem; margin: 14px 0 0; }

/* Method box and lever list */
.method, .levers-note {
  margin: 18px 0 0; padding: 16px 20px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 1.02rem; color: var(--ink-2);
}
.method strong, .levers-note strong { color: var(--ink); }
.levers-note { margin-top: 10px; padding: 12px 20px; }
.levers-note summary { cursor: pointer; font-weight: 700; color: var(--primary-strong); }
.levers-note ul { margin: 12px 0 4px; padding-left: 1.2em; display: grid; gap: 8px; }

/* Progress: five steps */
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; list-style: none; padding: 0; margin: 0 0 36px; counter-reset: step; }
.progress li { font-size: 1rem; font-weight: 600; color: var(--muted); padding-top: 10px; border-top: 8px solid var(--border); border-radius: 2px; counter-increment: step; }
.progress li::before { content: counter(step) "  "; }
.progress li.done { border-color: var(--primary); color: var(--ink-2); }
.progress li.current { border-color: var(--primary); color: var(--ink); font-weight: 700; }
@media (max-width: 620px) { .progress li { font-size: 0.85rem; } }

/* Choice cards */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: var(--ink);
  background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px 20px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.card strong { font-size: 1.16rem; line-height: 1.3; }
.card span { color: var(--ink-2); font-size: 1rem; line-height: 1.45; }
.card:hover:not(:disabled) { border-color: var(--primary); box-shadow: 0 2px 0 var(--primary); }
.card[aria-checked="true"] { border: 3px solid var(--primary); padding: 17px 19px; background: var(--primary-soft); }
.card[aria-checked="true"] strong { color: var(--primary-strong); }
.card[aria-checked="true"] strong::before {
  content: ""; display: inline-block; width: 0.5em; height: 0.85em; margin: 0 0.55em 0 0.1em; vertical-align: -0.05em;
  border: solid var(--primary-strong); border-width: 0 0.18em 0.18em 0; transform: rotate(45deg);
}
.card:disabled { opacity: 0.4; cursor: not-allowed; }
.card .effort { display: inline-flex; align-items: center; gap: 8px; font-style: normal; font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; display: inline-block; }
.pips i.on { background: currentColor; }
.card .effort.heavy { color: var(--guess); }

/* 2 x 2 matrix */
.matrix { display: grid; grid-template-columns: 32px 1fr; grid-template-rows: 1fr auto; gap: 10px; }
.matrix .quadrants { grid-column: 2; grid-row: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.matrix .quadrants .card { min-height: 150px; justify-content: center; }
.axis-y { grid-column: 1; grid-row: 1; writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 0.95rem; color: var(--muted); font-weight: 700; }
.axis-x { grid-column: 2; grid-row: 2; text-align: center; font-size: 0.95rem; color: var(--muted); font-weight: 700; }
.axis-y::after, .axis-x::after { content: "  \2192"; }
@media (max-width: 560px) { .matrix .quadrants { grid-template-columns: 1fr; } }

/* Investment meter */
.second-question { margin-top: 36px; }
.budget {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 16px 22px; margin: 0 0 18px;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); position: sticky; top: 10px; z-index: 2;
}
.budget-label { font-weight: 700; }
.budget-dots { display: inline-flex; gap: 6px; }
.budget-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--primary); display: inline-block; }
.budget-dots i.on { background: var(--primary); }
.budget-dots i.over { background: var(--backfires); border-color: var(--backfires); }
.budget-text { color: var(--ink-2); }

/* Adjustable effort ratings */
.effort-panel { margin: 0 0 18px; padding: 14px 20px; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius); }
.effort-panel summary { cursor: pointer; font-weight: 700; color: var(--primary-strong); font-size: 1.05rem; }
.effort-panel[open] summary { margin-bottom: 10px; }
.effort-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.effort-row.changed .effort-name strong::after { content: "  your rating"; font-size: 0.78rem; font-weight: 700; color: var(--guess); }
.effort-name { display: flex; flex-direction: column; }
.effort-name span { font-size: 0.9rem; color: var(--muted); line-height: 1.35; }
.effort-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.effort-choices button {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.85rem; font-weight: 600; padding: 6px 10px;
  border: 2px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--ink-2); cursor: pointer;
}
.effort-choices button .pips i { width: 10px; height: 10px; border-width: 1.5px; }
.effort-choices button[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.small-button { font-size: 0.95rem; padding: 8px 16px; margin-top: 12px; }
@media (max-width: 700px) { .effort-row { grid-template-columns: 1fr; } }

.budget-panel { margin-top: 16px; }
.budget-setting { padding: 12px 0; border-top: 1px solid var(--border); }
.budget-setting p { margin: 0 0 8px; }
.budget-setting label { display: flex; flex-direction: column; margin-bottom: 6px; }
.budget-setting label span { font-size: 0.9rem; color: var(--muted); }
.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--primary); height: 28px; }
.range-row output { font-weight: 700; min-width: 5.5em; color: var(--primary-strong); }

/* Guess */
.guess { border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 18px 18px; margin: 0 0 16px; background: var(--bg); }
.guess legend { font-weight: 700; font-size: 1.16rem; padding: 0 8px; }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.scale button {
  display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--border); background: var(--bg); color: var(--ink); cursor: pointer;
}
.scale button strong { font-size: 1.02rem; }
.scale button span { font-size: 0.9rem; color: var(--muted); line-height: 1.35; }
.scale button:hover { border-color: var(--guess); }
.scale button[aria-pressed="true"] { border: 3px solid var(--guess); padding: 11px 13px; background: var(--guess-soft); }
@media (max-width: 620px) { .scale { grid-template-columns: 1fr 1fr; } }

/* Buttons */
.step-buttons { display: flex; justify-content: flex-end; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.button {
  display: inline-block; font: inherit; font-size: 1.08rem; font-weight: 700; padding: 13px 28px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--primary); background: var(--primary); color: var(--on-primary); text-decoration: none;
}
.button:hover:not(:disabled) { background: var(--primary-strong); border-color: var(--primary-strong); }
.button.secondary { background: var(--bg); color: var(--primary-strong); }
.button.secondary:hover { background: var(--primary-soft); }
.button:disabled { opacity: 0.4; cursor: not-allowed; }
.button[hidden] { display: none; }

/* Results */
.result, .suggestion, .closing { background: var(--bg); border: 2px solid var(--border); border-radius: 20px; padding: 26px 28px; margin-bottom: 18px; }
.goal-text { color: var(--ink-2); margin: 0 0 10px; }
.basis { color: var(--muted); font-size: 1rem; margin: 0 0 8px; }
.both-guesses { background: var(--surface); border-left: 6px solid var(--primary); border-radius: 10px; padding: 12px 16px; margin: 20px 0 0; color: var(--ink-2); }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.meter-cell {
  --c: var(--border); --soft: var(--surface);
  background: var(--soft); border: 2px solid var(--c); border-radius: 12px; padding: 0 12px 12px; min-height: 96px;
  display: flex; flex-direction: column; gap: 8px; opacity: 0.5;
}
.meter-cell::before { content: ""; display: block; height: 7px; margin: 0 -12px 2px; border-radius: 9px 9px 0 0; background: var(--c); }
.meter-cell.v-backfires { --c: var(--backfires); --soft: var(--backfires-soft); }
.meter-cell.v-below { --c: var(--below); --soft: var(--below-soft); }
.meter-cell.v-above { --c: var(--above); --soft: var(--above-soft); }
.meter-cell.v-best { --c: var(--best); --soft: var(--best-soft); }
.meter-cell.model, .meter-cell.guess { opacity: 1; border-width: 3px; }
.meter-label { font-weight: 700; font-size: 1rem; line-height: 1.25; color: var(--ink); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.badge { font-size: 0.82rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; color: var(--on-primary); }
.badge.you { background: var(--guess); }
.badge.model { background: var(--primary); }
.headline { font-weight: 700; font-size: 1.25rem; margin: 4px 0 0; }
.reasons { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.reasons li { padding-left: 32px; position: relative; }
.reasons li::before { position: absolute; left: 4px; top: -2px; font-weight: 700; font-size: 1.3rem; }
.reasons li.helps::before { content: "+"; color: var(--above); }
.reasons li.hurts::before { content: "\2212"; color: var(--backfires); }
.suggestion { border: 3px solid var(--primary); background: var(--primary-soft); }
.suggestion ul { padding-left: 1.2em; }
.closing { margin-top: 18px; }
.closing h2 { margin-top: 0; }
.cost-switch { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 0; color: var(--ink-2); }
.cost-switch a { padding: 6px 16px; border: 2px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--ink-2); background: var(--bg); font-weight: 600; }
.cost-switch a[aria-current="true"] { border-color: var(--primary); color: var(--primary-strong); background: var(--primary-soft); }
.cost-switch .too-small { color: var(--muted); font-size: 0.92rem; padding: 6px 4px; }
.small { font-size: 0.95rem; }
@media (max-width: 620px) { .meter { grid-template-columns: 1fr 1fr; } .result, .suggestion, .closing { padding: 20px; } }

/* Map of how the levers connect */
.network { background: var(--bg); border: 2px solid var(--border); border-radius: 20px; padding: 26px 28px; margin-top: 18px; }
.network h2 { margin-top: 0; }
.network-legend { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; margin: 0 0 8px; font-weight: 600; color: var(--ink-2); }
.network-legend li { display: inline-flex; align-items: center; gap: 8px; }
.network-layout { display: grid; grid-template-columns: 1fr; gap: 16px; }
.network-graph svg { width: 100%; height: auto; display: block; overflow: visible; }
.edge { stroke-width: 3; fill: none; transition: opacity 0.15s; }
.edge.needs { stroke: var(--primary); }
.edge.together { stroke: var(--above); }
.edge.against { stroke: var(--backfires); stroke-dasharray: 7 6; }
.arrow.needs { fill: var(--primary); }
.edge.dim { opacity: 0.12; }
.edge.lit { stroke-width: 4.5; }
.node { cursor: pointer; transition: opacity 0.15s; }
.node circle { fill: var(--bg); stroke: var(--ink-2); stroke-width: 3; }
.node.in-plan circle { fill: var(--primary); stroke: var(--primary); }
.node text { font: 700 19px var(--font); fill: var(--ink); }
.node.selected circle { stroke: var(--guess); stroke-width: 5; }
.node.selected text { fill: var(--primary-strong); text-decoration: underline; }
.node.dim { opacity: 0.35; }
.node:focus { outline: none; }
.node:focus-visible circle { stroke: var(--guess); stroke-width: 5; }
.network-panel { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.network-panel h3 { margin: 0 0 8px; color: var(--ink); font-size: 1.2rem; }
.network-panel ul { margin: 0 0 10px; padding-left: 1.1em; display: grid; gap: 6px; }
.panel-kind { margin: 10px 0 4px; font-weight: 700; }
.panel-kind.needs, .panel-kind.neededBy { color: var(--primary-strong); }
.panel-kind.together { color: var(--above); }
.panel-kind.against { color: var(--backfires); }
.panel-all { margin: 10px 0 0; padding-top: 10px; border-top: 2px solid var(--border); }
.in-plan-tag { font-size: 0.8rem; font-weight: 700; color: var(--on-primary); background: var(--primary); border-radius: 999px; padding: 2px 10px; vertical-align: middle; }
.network-all { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--ink-2); }

.footer { padding-top: 0; color: var(--muted); font-size: 1rem; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
