/* Editorial theme: warm paper, serif headings, sans UI, deep-teal accent.
   Light and dark palettes; no build step. */
:root {
  color-scheme: light dark;
  --paper: #fbfaf6;
  --paper-2: #f3f1ea;
  --card: #ffffff;
  --ink: #1c1b19;
  --ink-2: #4a4844;
  --ink-3: #6f6b64;
  --rule: #e4e0d6;
  --rule-strong: #cfcabd;
  --accent: #1f5e5a;
  --accent-ink: #ffffff;
  --accent-soft: #e3eeec;
  --good: #2d6a4f;
  --good-soft: #e4f0e8;
  --bad: #a03030;
  --bad-soft: #f8e7e4;
  --warn: #8a6d1f;
  --shadow: 0 1px 2px rgb(28 27 25 / 0.04), 0 4px 16px rgb(28 27 25 / 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 68ch;
  --head-h: 3.75rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151514;
    --paper-2: #222220;
    --card: #1c1c1a;
    --ink: #ecebe6;
    --ink-2: #c3c0b8;
    --ink-3: #96928a;
    --rule: #2f2e2b;
    --rule-strong: #45433e;
    --accent: #6fc2b8;
    --accent-ink: #0f1f1d;
    --accent-soft: #1b302d;
    --good: #7ccf9f;
    --good-soft: #1a2c22;
    --bad: #f0928a;
    --bad-soft: #3a201e;
    --warn: #e0c36f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--head-h) + 1rem); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, iframe { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.75rem); margin: 3.5rem 0 1rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.5rem; }
p { max-width: var(--measure); text-wrap: pretty; }
li { text-wrap: pretty; }
small, .meta { font-family: var(--sans); font-size: 0.8rem; color: var(--ink-3); }
b, strong { font-weight: 600; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 20;
  font-family: var(--sans); font-size: 0.85rem; background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.9rem; border-radius: var(--radius-sm); text-decoration: none;
}
.skip:focus { top: 0.6rem; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.masthead .inner {
  max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; min-height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.wordmark { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; color: var(--ink); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 0.55rem; }
.wordmark::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 3px; background: var(--accent); transform: rotate(45deg); flex: none; }
.wordmark span { color: var(--ink-3); font-weight: 400; }
nav { display: flex; gap: 0.25rem; }
nav a {
  font-family: var(--sans); font-size: 0.85rem; font-weight: 500; color: var(--ink-2); text-decoration: none;
  padding: 0.45rem 0.75rem; border-radius: 999px; white-space: nowrap; transition: background 0.15s, color 0.15s;
}
nav a:hover { color: var(--ink); background: var(--paper-2); }
nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

@media (max-width: 860px) {
  .masthead .inner { flex-direction: column; align-items: stretch; gap: 0; padding: 0.6rem 0 0; }
  .wordmark { padding: 0 1.25rem 0.4rem; }
  nav {
    overflow-x: auto; scrollbar-width: none; padding: 0.2rem 1.25rem 0.55rem;
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  nav::-webkit-scrollbar { display: none; }
  :root { --head-h: 6rem; }
}

/* ---------- Page scaffolding ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 3.5rem 1.5rem 5rem; }
.narrow { max-width: 780px; }
@media (max-width: 600px) { main { padding: 2.25rem 1.25rem 4rem; } body { font-size: 16.5px; } }

.kicker {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 1rem;
}
.kicker::before { content: ""; width: 1.5rem; height: 2px; background: currentColor; border-radius: 2px; }
.lede { font-size: clamp(1.12rem, 2vw, 1.3rem); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

.note {
  font-family: var(--sans); font-size: 0.86rem; line-height: 1.55; color: var(--ink-2);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-left: 4px solid var(--accent);
  background: var(--accent-soft); padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); max-width: var(--measure);
}
.hypo {
  font-family: var(--sans); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent);
  border-radius: 999px; padding: 0.1rem 0.5rem; white-space: nowrap;
}

.cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--sans); font-size: 0.95rem; font-weight: 600; text-decoration: none;
  background: var(--accent); color: var(--accent-ink); padding: 0.75rem 1.3rem; border-radius: 999px;
  box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s;
}
.cta:hover { transform: translateY(-1px); text-decoration: none; }
.cta.ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule-strong); box-shadow: none; }
.cta.ghost:hover { border-color: var(--ink-3); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.75rem 0 0; }

/* ---------- Home ---------- */
.video {
  aspect-ratio: 16 / 9; margin: 2.5rem 0; border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--paper-2);
  border: 1px solid var(--rule); box-shadow: var(--shadow);
  display: grid; place-items: center; align-content: center; gap: 0.9rem;
  color: var(--ink-3); font-family: var(--sans); font-size: 0.9rem; text-align: center; padding: 1rem;
}
.video:not(:has(iframe))::before {
  content: ""; width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7v10l8-5z' fill='%232f8a82'/%3E%3C/svg%3E") center / 1.6rem no-repeat;
  box-shadow: var(--shadow);
}
.video iframe { width: 100%; height: 100%; border: 0; }

.stakeholders { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.9rem; margin-top: 1.25rem; }
.stakeholders div {
  padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stakeholders strong { display: block; font-size: 1.02rem; margin-bottom: 0.3rem; }
.stakeholders p { margin: 0; font-size: 0.94rem; line-height: 1.5; color: var(--ink-2); }

.members { font-family: var(--sans); font-size: 0.95rem; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.5rem 1.5rem; }
.members li { padding: 0.55rem 0; border-bottom: 1px solid var(--rule); }

/* ---------- Simulator ---------- */
.sim { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 3rem; align-items: start; margin-top: 2.5rem; }
.controls {
  position: sticky; top: calc(var(--head-h) + 1rem);
  max-height: calc(100vh - var(--head-h) - 2rem); overflow-y: auto; overscroll-behavior: contain;
  padding-right: 0.5rem; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
}
@media (max-width: 900px) {
  .sim { grid-template-columns: 1fr; gap: 2rem; }
  .controls { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

.panel-label { font-family: var(--sans); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 0.6rem; }
.presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.btn {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500; background: var(--card); color: var(--ink-2);
  border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0.4rem 0.85rem; cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn.active, .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.pin { border-style: dashed; background: transparent; }
.btn.pin[aria-pressed="true"] { border-style: solid; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.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; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.link-btn {
  font-family: var(--sans); font-size: 0.75rem; font-weight: 600; color: var(--accent);
  background: none; border: 0; padding: 0.2rem 0.1rem; cursor: pointer; text-underline-offset: 3px;
}
.link-btn:hover { text-decoration: underline; }

/* Collapsible decisions */
#vars { counter-reset: step; }
.decision { border-top: 1px solid var(--rule); }
.decision:last-child { border-bottom: 1px solid var(--rule); }
.decision summary {
  counter-increment: step; list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.95rem 0.25rem 0.95rem 0; border-radius: var(--radius-sm);
}
.decision summary::-webkit-details-marker { display: none; }
.decision summary::before {
  content: counter(step, decimal-leading-zero); flex: none; padding-top: 0.28rem;
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums;
}
.decision summary::after {
  content: ""; flex: none; margin: 0.45rem 0 0 auto; width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform 0.2s ease, border-color 0.15s;
}
.decision[open] > summary::after { transform: translate(0, 0.2rem) rotate(-135deg); }
.decision summary:hover .dec-title { color: var(--accent); }
.decision summary:hover::after { border-color: var(--accent); }
.dec-head { display: flex; flex-direction: column; min-width: 0; }
.dec-title { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.35; transition: color 0.15s; }
/* The current choice only shows when the decision is collapsed. */
.dec-current {
  display: none; font-family: var(--sans); font-size: 0.78rem; font-weight: 500; color: var(--accent); margin-top: 0.15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dec-current::before { content: "Selected: "; color: var(--ink-3); font-weight: 400; }
.decision:not([open]) .dec-current { display: block; }

fieldset { border: 0; margin: 0; padding: 0 0 1.1rem; min-width: 0; }
.decision[open] fieldset { animation: reveal 0.22s ease-out; }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
fieldset .help { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-3); margin: -0.4rem 0 0.7rem; }

.opt {
  display: flex; gap: 0.65rem; align-items: flex-start; font-family: var(--sans); font-size: 0.86rem; font-weight: 500;
  padding: 0.6rem 0.75rem; margin: 0.35rem 0; cursor: pointer; border-radius: var(--radius-sm);
  border: 1px solid var(--rule); background: var(--card);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.opt:hover { border-color: var(--rule-strong); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt input { accent-color: var(--accent); margin: 0.2rem 0 0; flex: none; width: 1rem; height: 1rem; }
.opt input:focus-visible { outline: none; }
.opt span small { display: block; font-size: 0.76rem; font-weight: 400; line-height: 1.45; margin-top: 0.1rem; }

.dash h2:first-child { margin-top: 0; }
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dash-head h2 { margin: 0 0 1rem; }
#dash { display: grid; gap: 0.6rem; }
.ind {
  display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; padding: 1rem 1.15rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow);
}
.ind .name { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.ind .area { font-family: var(--sans); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.ind .score {
  grid-row: 1 / span 2; grid-column: 2; align-self: center;
  font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ind .score small { font-family: var(--sans); font-size: 0.7rem; font-weight: 400; margin-left: 0.15rem; }
.ind.is-low .score { color: var(--bad); }
.ind.is-high .score { color: var(--good); }
.bar { grid-column: 1 / -1; position: relative; height: 10px; background: var(--paper-2); border-radius: 999px; margin-top: 0.6rem; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; transition: width 0.4s cubic-bezier(.2,.7,.2,1), background 0.3s; }
.bar .fill.low { background: var(--bad); }
.bar .mid { position: absolute; left: 50%; top: -4px; bottom: -4px; border-left: 1.5px dotted var(--ink-3); }
.bar .ghost { position: absolute; top: -6px; bottom: -6px; width: 3px; border-radius: 2px; background: var(--ink); opacity: 0.6; transition: left 0.4s cubic-bezier(.2,.7,.2,1); }
.ind .delta { grid-column: 1 / -1; font-family: var(--sans); font-size: 0.75rem; font-weight: 500; color: var(--ink-3); min-height: 0; }
.ind .delta:not(:empty) { margin-top: 0.45rem; }
.ind .delta.up { color: var(--good); }
.ind .delta.down { color: var(--bad); }
.legend { font-family: var(--sans); font-size: 0.75rem; color: var(--ink-3); margin: 0.9rem 0 0; }
.legend i { display: inline-block; width: 3px; height: 12px; border-radius: 2px; background: var(--ink); opacity: 0.6; vertical-align: middle; margin: 0 0.35rem 0 0.8rem; }

.tradeoff {
  font-size: 1.12rem; line-height: 1.6; max-width: none;
  background: var(--paper-2); border-radius: var(--radius); padding: 1.25rem 1.4rem 1.3rem; margin-top: 2.5rem;
  border-left: 4px solid var(--ink);
}
.tradeoff::before {
  content: "The trade-off"; display: block; margin-bottom: 0.35rem;
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3);
}

.gl { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.gl li {
  display: flex; gap: 0.75rem; align-items: flex-start; font-size: 0.98rem; line-height: 1.5;
  padding: 0.75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--card);
}
.gl li::before {
  flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: grid; place-items: center; margin-top: 0.05rem;
  font-family: var(--sans); font-size: 0.85rem; font-weight: 700; line-height: 1;
}
.gl li.gain::before { content: "+"; color: var(--good); background: var(--good-soft); }
.gl li.lose::before { content: "−"; color: var(--bad); background: var(--bad-soft); }
.gl li.mixed::before { content: "~"; color: var(--ink-3); background: var(--paper-2); }
.gl li.lose { border-color: color-mix(in srgb, var(--bad) 30%, var(--rule)); }

.why { font-family: var(--sans); font-size: 0.84rem; line-height: 1.55; }
.why ul { padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.why li { list-style: none; padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--card); }
.why b { font-family: var(--serif); }
.why .meta { font-size: 0.8rem; }

.chip { display: inline-block; font-family: var(--sans); font-size: 0.72rem; font-weight: 500; padding: 0.1rem 0.5rem; border-radius: 999px; margin: 0.1rem 0.25rem 0.1rem 0; background: var(--paper-2); white-space: nowrap; }
.chip.up { color: var(--good); background: var(--good-soft); }
.chip.down { color: var(--bad); background: var(--bad-soft); }
.chip.x { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- Model page ---------- */
.table-wrap { overflow-x: auto; margin: 1rem 0 2rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.82rem; line-height: 1.5; margin: 1rem 0 2rem; }
.table-wrap table { margin: 0; }
th {
  text-align: left; font-weight: 600; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3);
  background: var(--paper-2); border-bottom: 1px solid var(--rule-strong); padding: 0.65rem 0.9rem; vertical-align: bottom; white-space: nowrap;
}
td { border-bottom: 1px solid var(--rule); padding: 0.8rem 0.9rem; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--paper-2) 55%, transparent); }
tr:target td { background: var(--accent-soft); }
td.id { font-family: var(--serif); font-weight: 600; white-space: nowrap; }
td .if { white-space: nowrap; }
.toc {
  font-family: var(--sans); font-size: 0.88rem; list-style: none; padding: 1rem 1.25rem; max-width: 640px;
  columns: 2; column-gap: 2rem; background: var(--paper-2); border-radius: var(--radius);
}
.toc li { padding: 0.25rem 0; break-inside: avoid; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
@media (max-width: 600px) { .toc { columns: 1; } }
.scale td:first-child { font-family: var(--serif); font-weight: 600; width: 6rem; }

/* ---------- References ---------- */
.refs { padding-left: 0; list-style: none; }
.refs li { padding-left: 2rem; text-indent: -2rem; margin-bottom: 0.9rem; max-width: var(--measure); overflow-wrap: anywhere; }
.refs li:target { background: var(--accent-soft); border-radius: var(--radius-sm); }

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.8rem; color: var(--ink-3); background: var(--paper-2); }
footer .inner { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem; }

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