/* Guided flow — the site's own stylesheet.
   No external fonts, no @import, no network: the page renders identically offline and over HTTP. */

:root {
  --ink: #0f241a;
  --ink-soft: #33503f;
  --ink-faint: #60796a;
  --paper: #eef6f0;
  --paper-raise: #ffffff;
  --rule: #d3e4d8;
  --accent: #008751;
  --accent-soft: #e2f1e7;
  --warn: #8a6414;
  --warn-soft: #f7efdc;
  --bad: #8c3a2f;
  --bad-soft: #f4e5e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 36, 26, .06), 0 10px 30px rgba(15, 36, 26, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, .primary:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

p { margin: 0 0 .9em; }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }
h3 { font-size: 1.05rem; }
h4 { font-size: .86rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .08em;
     color: var(--ink-faint); margin: 1.1rem 0 .35rem; }

.eyebrow { font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .6em; }
.eyebrow a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule); }
.caption { color: var(--ink-soft); font-size: 1.04rem; max-width: 62ch; }
.instruction { font-family: var(--serif); font-style: italic; }
.note, .vintage, .tech { color: var(--ink-faint); font-size: .86rem; }
.vintage { margin-top: 2.5rem; }
.tech { font-size: .8rem; }

/* ---------------------------------------------------------------- primary navigation */

.topnav {
  max-width: 960px;
  margin: 0 auto;
  padding: .85rem clamp(18px, 4vw, 40px) .1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
body[data-page="Causal Presidents"] .topnav {
  max-width: 1180px;
  padding-left: clamp(18px, 4vw, 48px);
  padding-right: clamp(18px, 4vw, 48px);
}
body.wide-page .topnav { max-width: 1240px; }
.topnav .wordmark {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.topnav ul { list-style: none; display: flex; gap: clamp(.9rem, 2vw, 1.7rem); margin: 0; padding: 0; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-size: .86rem; }
.topnav a:hover { color: var(--accent); }
.topnav a[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------------------------------------------------------------- cover */

.cover-head, .cover-foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px);
}
.cover-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: clamp(18px, 3vw, 44px);
  align-items: end;
  padding-top: clamp(26px, 4vw, 46px);
  padding-bottom: clamp(22px, 3vw, 34px);
}
.cover-head h1 { font-size: clamp(2.1rem, 4.4vw, 3.1rem); line-height: 1.03; margin-bottom: .45em; }
.cover-head .caption { max-width: 54ch; }
.cover-lead { min-width: 0; }
.cover-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.cover-stat { display: flex; flex-direction: column; gap: .3rem; }
.cover-count {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  line-height: 1.1;
  color: #fff;
  margin: 0;
}
.cover-scope { color: #fff; font-size: .82rem; margin: 0; max-width: 30ch; }
.cover-methods { color: #fff; font-size: .95rem; margin: 0; }
.cover-span { color: #fff; font-size: .82rem; margin: 0; }
.cover-cta .primary {
  background: #fff;
  color: var(--accent);
  border-color: #fff;
  padding: .62em 1.6em;
}
.cover-cta .primary:hover { background: #e7f3ec; }

.carousel {
  width: 100vw;
  margin: 1.6rem 0 1rem calc(50% - 50vw);
  position: relative;
}
.track-wrap { position: relative; }

.track {
  display: flex;
  gap: clamp(12px, 1.4vw, 20px);
  list-style: none;
  margin: 0;
  padding: 6px clamp(18px, 4vw, 48px) 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: #c9c3b4 transparent;
  -webkit-overflow-scrolling: touch;
}
.track::-webkit-scrollbar { height: 8px; }
.track::-webkit-scrollbar-thumb { background: #d3ccbc; border-radius: 99px; }

.slide {
  flex: 0 0 auto;
  scroll-snap-align: center;
  width: auto;
}
.slide-figure {
  margin: 0;
  height: min(60vh, 580px);
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: repeating-linear-gradient(135deg, #ece8dd 0 8px, #f4f1e8 8px 16px);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  position: relative;
}
.slide-figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* A supplied portrait sits on its party's declared colours: the bands show as a matte and a caption strip.
   The photograph itself is only cropped and resized (docs/portraits.md §3); nothing is cut out of it. */
.slide-figure.has-portrait { position: relative; background: var(--party-bands); }
.slide-figure.has-portrait img {
  position: absolute; left: 12px; right: 12px; top: 12px; bottom: 46px;
  width: calc(100% - 24px); height: calc(100% - 58px);
  border-radius: 6px;
}
.party-tag {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: .5rem .4rem;
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; text-align: center;
  color: #fff; background: rgba(12, 24, 16, .55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; justify-content: center; gap: .4rem;
}
.party-tag svg { width: 15px; height: 15px; flex: none; }
.credit-list { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .78rem; color: var(--ink-faint); }
.credit-list li { margin-bottom: .2rem; }
.frame-empty { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; gap: .2rem; }
.frame-empty .initials { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.2rem); color: #b7b0a0; letter-spacing: .04em; }
.frame-empty .frame-note { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: #a49d8c; }

.slide-body { padding: .7rem .2rem 0; max-width: 34ch; }
.slide-name { font-family: var(--serif); font-size: 1.12rem; margin: 0; }
.slide-meta { font-size: .8rem; color: var(--ink-soft); margin: .15em 0 0; }
.slide-note { font-size: .78rem; font-style: italic; color: var(--ink-faint); margin: .3em 0 0; }

.carousel-btn {
  position: absolute;
  top: calc(min(60vh, 580px) / 2);
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: rgba(255, 253, 248, .92);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
}
.carousel-btn:hover { background: #fff; }
.carousel-btn.prev { left: 10px; }
.carousel-btn.next { right: 10px; }

.carousel-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1180px;
  margin: .4rem auto 0;
  padding: 0 clamp(18px, 4vw, 48px);
}
.rail-note { font-size: .8rem; color: var(--ink-faint); margin: 0; flex: 1; }
.motion-toggle {
  border: 1px solid var(--rule);
  background: var(--paper-raise);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: .35em 1em;
  font-size: .8rem;
  cursor: pointer;
}

.cover-foot { padding-top: 1.4rem; padding-bottom: 3rem; }

/* The premise line under the portraits: the field named plainly, and the groundwork claimed once. */
.field-note {
  margin: 2.8rem auto 0;
  max-width: 52ch;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.3;
  color: var(--ink);
}
.field-note p { margin: 0 0 .35em; }
.field-note p:last-child { margin-bottom: 0; }

.ratio {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  border-left: 3px solid var(--accent);
  padding-left: .9rem;
  max-width: 56ch;
  margin: 0 0 1.5rem;
}
.about { margin-top: 1.6rem; border-top: 1px solid var(--rule); padding-top: .8rem; }
.about summary { cursor: pointer; font-size: .86rem; color: var(--ink-soft); }
.prose { margin-top: .9rem; max-width: 66ch; }
.prose p { color: var(--ink-soft); }

/* ---------------------------------------------------------------- event strip */

.event-strip { margin: 0 0 1rem; }
.event-strip ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.event-strip li {
  height: clamp(70px, 11vw, 118px);
  border-radius: 10px;
  overflow: hidden;
  background: var(--rule);
}
.event-strip img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; display: block; }
.strip-credits { margin-top: .3rem; font-size: .7rem; color: var(--ink-faint); text-align: right; }
.strip-credits summary { cursor: pointer; list-style: none; }
.strip-credits summary::-webkit-details-marker { display: none; }
.strip-credits .credit-list { margin: .3rem 0 0; text-align: left; }

/* ---------------------------------------------------------------- controls */

.primary {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: .72em 1.5em;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--accent);
  transition: background .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.primary:hover { background: #17594b; box-shadow: 0 8px 20px rgba(0, 135, 81, .22); }
.primary.is-disabled { background: #cfd6d2; border-color: #cfd6d2; color: #fff; pointer-events: none;
                       box-shadow: none; }
.cover-cta .primary::after, .controls .primary::after { content: "→"; font-size: 1.05em; line-height: 1; }
.ghost {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  color: #fff;
  text-decoration: none;
  padding: .62em 1.1em;
  font-size: .92rem;
  font-weight: 550;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
}
a.ghost::before { content: "←"; font-size: 1.05em; line-height: 1; }
.ghost:hover { background: #17594b; border-color: #17594b; color: #fff; }
.ghost:active { background: #0f4237; border-color: #0f4237; color: #fff; }
.primary:focus-visible, .ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- flow pages */

.flow { max-width: 960px; margin: 0 auto; padding: clamp(24px, 4vw, 56px) clamp(18px, 4vw, 40px) 72px; }
.flow-head {
  margin-bottom: 1.8rem;
  padding: clamp(16px, 2.6vw, 28px);
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.flow-head h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); margin: .5em 0 .35em; }
.flow-head .caption { max-width: 68ch; margin-bottom: 0; }
.flow-head .note { margin: .8em 0 0; font-size: .88rem; color: var(--ink-faint); }

.steps { display: flex; flex-wrap: wrap; gap: .4rem .45rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.steps .step {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #000;
  background: var(--accent);
  padding: .28em .62em .28em .28em;
  border-radius: 999px;
}
.step-dot {
  display: inline-grid;
  place-items: center;
  width: 1.85em;
  height: 1.85em;
  border-radius: 50%;
  border: 1px solid #fff;
  background: #fff;
  color: var(--accent);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: 0;
}
.steps .step.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, .08);
}
.steps .step.is-active .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.steps .step.is-active .step-label { font-weight: 700; }

.domains { display: grid; gap: 1.6rem; }
.domain h2 { font-size: .82rem; font-family: var(--sans); text-transform: uppercase; letter-spacing: .1em;
             color: var(--ink-faint); margin-bottom: .6rem; }
.choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.choice label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-areas: "box name" ". meta";
  column-gap: 12px;
  align-items: center;
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}
.choice label:hover { border-color: var(--ink-faint); }
.choice input { grid-area: box; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.choice-label { grid-area: name; font-weight: 550; }
.choice-plain { font-weight: 400; color: var(--ink-soft); }
.choice-meta { grid-area: meta; font-size: .8rem; color: var(--ink-faint); }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.controls { display: flex; align-items: center; gap: 1rem; margin-top: 2.4rem; padding-top: 1.2rem;
            border-top: 1px solid var(--rule); }
.controls > .primary { margin-left: auto; }
.control-note { flex: 1; font-size: .85rem; color: var(--ink-faint); }
/* The design-level results link, centred between Back and Next, wearing the same pill as those two so it
   reads as a third control rather than a footnote. No arrow: it is the only one that is not a step. */
.controls-centre { flex: 1; display: flex; flex-direction: column; align-items: center;
                   gap: .35rem; text-align: center; }
.controls-link { display: inline-flex; align-items: center; gap: .5em; color: #fff; text-decoration: none;
                 padding: .62em 1.1em; font-size: .92rem; font-weight: 550; background: var(--accent);
                 border: 1px solid var(--accent); border-radius: 999px;
                 transition: background .15s ease, border-color .15s ease; }
.controls-link:hover { background: #17594b; border-color: #17594b; color: #fff; }
.controls-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls-centre .control-note { flex: none; }

/* ---------------------------------------------------------------- ask */

.ask-form { display: grid; gap: .6rem; margin-top: 1.6rem; }
.ask-form label { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint); }
.ask-row { display: flex; gap: .5rem; align-items: center; }
.ask-row input {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  color: var(--ink);
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 11px 14px;
}
.ask-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask-row #ask-clear { margin-left: auto; }
.ask-form textarea {
  font: inherit;
  color: var(--ink);
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px 14px;
  resize: vertical;
  min-height: 4.5rem;
}
.ask-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ask-answer {
  margin-top: 1.4rem;
  padding: 20px 22px;
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.ask-answer[hidden] { display: none; }
.ask-answer p { font-size: .95rem; }
.ask-head { margin-bottom: .8rem; }

/* ---------------------------------------------------------------- outcome blocks */

.blocks { display: grid; gap: 16px; }
.block {
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.block[hidden] { display: none; }
.block { min-width: 0; }
.block.tone-good { border-left-color: var(--accent); }
.block.tone-warn { border-left-color: var(--warn); }
.block.tone-bad { border-left-color: var(--bad); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1rem; margin-bottom: .45rem; }
.block-head h2 { font-size: 1.22rem; }

.pill {
  display: inline-block;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .02em;
  padding: .22em .7em;
  border-radius: 999px;
  white-space: nowrap;
}
.pill.good { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.chosen { font-family: var(--serif); font-size: 1.06rem; margin: .1rem 0 .3rem; }
.assumes { color: var(--ink-soft); font-size: .95rem; margin: 0 0 .65rem; }
.status-line { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; margin: 0; }
.status-sentence { color: var(--ink-faint); font-size: .86rem; }
.reason { color: var(--ink-soft); font-size: .92rem; margin: .45rem 0 0; }
.reason code, .blocker code { font-size: .82rem; background: #efeadf; border-radius: 4px; padding: .05em .35em; }

/* ---------------------------------------------------------------- card kinds
   The four kinds of card a variable can be, shaped differently on every flow screen: a published number
   leads with the figure; a design that ran and found nothing solid reads as a dashed absence; a channel
   card carries an accent chip; a declared gap is visibly a hole. Colour words stay as the tones set them. */

.kind-number { border-left-color: var(--accent); }
.num-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin: .5rem 0 .4rem; }
.num-hero .figure { font-family: var(--serif); font-size: 2.1rem; font-weight: 650; letter-spacing: -.01em; }
.num-hero .qual { font-size: .92rem; color: var(--ink-soft); }

.stamp {
  display: inline-block;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .04em;
  padding: .2em .65em;
  border-radius: 999px;
  border: 1px dashed currentColor;
  white-space: nowrap;
}
.stamp-absent { color: var(--accent); background: transparent; }
.stamp-channel { color: var(--warn); background: var(--warn-soft); border-style: solid; }
.stamp-gap { color: var(--bad); background: var(--bad-soft); border-style: solid; }
.stamp-ahead { color: var(--accent); background: var(--accent-soft); border-style: solid; }

.kind-described { border-left-style: dashed; }
.kind-channel { border-left-color: var(--warn); }
.kind-gap {
  border-left-style: dashed;
  background: repeating-linear-gradient(-45deg,
      var(--bad-soft) 0 8px, transparent 8px 16px), var(--paper-raise);
}

/* ---------------------------------------------------------------- the grouping window
   The comparison figure stacks both groupings' panels in one tall published image; the grouping radio
   turns the shown part into a window on the selected panel, so the same click that swaps the numbers
   list also moves the picture. Without JS the whole figure shows, nothing is hidden by default. */

.panel-window {
  position: relative;
  overflow: hidden;
  transition: height .35s ease;
}
.panel-window img.chart {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .35s ease;
}
.chart-figure .tenure-strip { transition: opacity .3s ease; }
figure.state-dose > .tenure-strip { opacity: 0; pointer-events: none; }
.chart-figure .grouping-control label.is-muted { opacity: .45; cursor: not-allowed; }
.chart-figure .grouping-control label.is-muted input { cursor: not-allowed; }

/* The short findings paragraph under every trend table: plain, quiet, one reading. */
.findings { font-size: .88rem; color: var(--ink-soft); margin: .55rem 0 .2rem; }
.blocker { font-size: .87rem; color: var(--ink-faint); margin-top: .35rem; }
.plain p { font-size: .98rem; }
.plain p:first-child { font-family: var(--serif); font-size: 1.06rem; }
.channel-note { border-left: 3px solid var(--warn); padding-left: .7rem; color: var(--warn); font-size: .9rem; }

.columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.assumption { font-family: var(--serif); font-size: 1.02rem; }
.gloss { font-family: var(--sans); font-weight: 400; font-size: .8rem; color: var(--ink-faint); }
ul.tight { margin: .2rem 0 .8rem; padding-left: 1.1rem; }
ul.tight li { margin-bottom: .28rem; font-size: .92rem; color: var(--ink-soft); }
.figure-col { margin: 0; }
img.graph { width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.figure-col figcaption { font-size: .78rem; color: var(--ink-faint); margin-top: .5rem; }

details.technical, details.alt-group { margin-top: 1rem; border-top: 1px solid var(--rule); padding-top: .7rem; }
details summary { cursor: pointer; font-size: .88rem; color: var(--ink-soft); }
details.alt { margin: .8rem 0; padding: .8rem; border: 1px solid var(--rule); border-radius: 8px; background: #fffefb; }
details.alt summary { display: flex; gap: .5rem; align-items: center; }

.spec-list { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: 2px; }
.spec-list li { display: grid; grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr); gap: .8rem;
                padding: .3rem 0; border-bottom: 1px dashed #e7e1d4; font-size: .86rem; }
.spec-list .k { color: var(--ink-faint); text-transform: lowercase; }
.spec-list .v { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; word-break: break-word; }

.grouping-control {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.2rem;
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid #cfe0d7;
  border-radius: 999px;
  padding: .55em 1em;
  font-size: .88rem;
  margin-bottom: .2rem;
}
.grouping-control .toggle { display: inline-flex; gap: .45rem; align-items: center; cursor: pointer; }
.grouping-control input { accent-color: var(--accent); }

.chart-figure { margin: 1rem 0 .4rem; }
img.chart { width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.chart-figure figcaption { font-size: .78rem; color: var(--ink-faint); margin-top: .5rem; }

/* The portrait strip over a time-axis panel. Decorative by construction: empty alt, aria-hidden, and no text
   at all - asserted in tests/verify_site.py, which is what lets faces sit beside an outcome in the first place.
   Each cell is placed at the band's own coordinates inside the figure's SVG (read back by build.py), and the
   strip shares the figure's left edge and width, so the percentages map 1:1 onto the drawing. Hidden on a
   phone, where the cells would be slivers and the panel's own labels are already unreadable. */
.tenure-strip { position: relative; height: 64px; margin: 0 0 .45rem; padding: 0; list-style: none; }
.tenure-strip li { position: absolute; top: 0; height: 64px; }
.tenure-strip img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%;
  border: 1px solid var(--rule); border-radius: 4px; background: #fff; }
@media (max-width: 719px) { .tenure-strip { display: none; } }
.group-list[hidden] { display: none; }

/* ---------------------------------------------------------------- design-level results */

.designs .block { margin-bottom: 1.2rem; }
.designs .block h2 { font-size: 1.3rem; margin-bottom: .8rem; }
.designs .block h3 { font-size: 1.05rem; margin: 1.6rem 0 .5rem; }
.designs .block h4 {
  font-size: .82rem;
  margin: 1.1rem 0 .35rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ---------------------------------------------------------------- the cover's grid and flag */

.cover-head {
  background: var(--accent);
  color: #fff;
  border-radius: 18px;
  padding: clamp(18px, 3vw, 34px);
}
.cover-head h1 { color: #fff; }
/* Full white, not an alpha: 88 % white on the flag green measures about 3.9:1 and drops the caption below
   AA, while #fff on #008751 measures 4.6:1 and passes for every size in this panel. */
.cover-head .caption, .cover-head .eyebrow, .cover-head .instruction { color: #fff; }
.cover-head .eyebrow a { border-bottom-color: rgba(255, 255, 255, .6); }

/* Five presidents in one row: the rail is the study window, so no card sits on a row of its own. */
.presidents {
  position: relative;
  max-width: 1180px;
  margin: 1.1rem auto 0;
  padding: 0 clamp(18px, 4vw, 48px);
}
.flag-band {
  position: absolute;
  inset: -10px clamp(8px, 3vw, 38px) 0;
  border-radius: 20px;
  background: var(--flag-bands);
  opacity: .14;
  z-index: 0;
}
.president-grid {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.2vw, 16px);
}
.president {
  display: flex;
  flex-direction: column;
  background: var(--paper-raise);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: .5rem .5rem 0;
  box-shadow: var(--shadow);
}
.president .slide-figure { height: auto; width: 100%; aspect-ratio: 3 / 4; }
.president .slide-figure.has-portrait img {
  left: 6px; right: 6px; top: 6px; bottom: 26px;
  width: calc(100% - 12px); height: calc(100% - 32px);
}
.president .party-tag { font-size: .58rem; padding: .3rem .25rem; }
.president .slide-body { padding: .55rem .35rem .7rem; max-width: none; }
.president .slide-name { font-size: 1rem; }
.president .slide-meta { font-size: .74rem; }
.president .slide-note { font-size: .72rem; }

/* ---------------------------------------------------------------- study category picker */

.domain-picker { display: flex; align-items: center; gap: .8rem; margin: 0 0 1.1rem; flex-wrap: wrap; }
.domain-picker label {
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-faint);
}
.domain-picker select {
  font: inherit; padding: .45rem .7rem; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--paper-raise); color: var(--ink); min-width: 13rem;
}
.domain[hidden] { display: none; }

/* ---------------------------------------------------------------- bigger graphs */

.wide-page .flow { max-width: 1240px; }
.wide-page img.graph { border-radius: 10px; }
.flow img.graph { width: 100%; height: auto; background: #fff; }
.graph-figure { margin: 0 0 1.3rem; }
.graph-figure img.graph { width: 100%; height: auto; }
.graph-figure figcaption { font-size: .82rem; color: var(--ink-faint); margin-top: .45rem; }

/* ---------------------------------------------------------------- tenure deviations */

.tenure { margin-top: 1.4rem; }
.deviation-table { width: 100%; border-collapse: collapse; font-size: .84rem; margin: .5rem 0 .8rem; }
.deviation-table th {
  text-align: left; font-weight: 600; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-faint); border-bottom: 1px solid var(--rule); padding: .35rem .5rem;
}
.deviation-table td { padding: .35rem .5rem; border-bottom: 1px dashed var(--rule); }
.deviation-table td.num { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; text-align: right; }
.deviation-table th.num { text-align: right; }

/* ---------------------------------------------------------------- small screens */

/* ---------------------------------------------------------------- about and methodology */

.method-section { margin: 2.6rem 0 0; }
.method-section h2 { font-size: 1.45rem; margin-bottom: .6rem; }
.method-section p, .method-section li, .method-section dd { max-width: 68ch; }
.method-works, .method-items { margin: .9rem 0 0; }
.method-works dt, .method-items dt {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}
.method-works dt:first-of-type, .method-items dt:first-of-type { padding-top: .2rem; border-top: none; margin-top: .4rem; }
.method-works dd, .method-items dd { margin: .3rem 0 0; color: var(--ink-soft); }
.references ol { padding-left: 1.15rem; font-size: .86rem; color: var(--ink-soft); }
.references li { margin-bottom: .55rem; max-width: 76ch; }
.doi { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; word-break: break-all; }
.page-about .prose { max-width: 70ch; }
.page-about .block h2 { font-size: 1.3rem; margin-bottom: .4rem; }

/* ---------------------------------------------------------------- technical details */

.table-scroll {
  overflow-x: auto;
  margin: 1rem 0 0;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: #fff;
}
.data-table { border-collapse: collapse; width: 100%; font-size: .82rem; }
.data-table th, .data-table td {
  text-align: left;
  padding: .55rem .7rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.data-table thead th {
  background: var(--paper);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-faint);
  white-space: nowrap;
  font-weight: 600;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table code { font-size: .95em; }
.tag {
  display: inline-block;
  font-size: .6rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .05rem .4rem;
  margin-left: .35rem;
  white-space: nowrap;
}
.equation-block { margin: 1.5rem 0 0; }
.equation-block h3 { font-size: 1.02rem; margin-bottom: .45rem; }
.equation {
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: .9rem 1rem;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  line-height: 1.65;
  margin: 0;
}
.terms {
  display: grid;
  grid-template-columns: minmax(92px, 150px) 1fr;
  gap: .35rem 1rem;
  margin: .75rem 0 0;
  font-size: .86rem;
}
.terms dt { margin: 0; }
.terms dd { margin: 0; color: var(--ink-soft); }

@media (max-width: 1079px) {
  /* Three up, with the last two centred: a 6-column track means the 4th and 5th cards can sit as a
     balanced pair instead of leaving a dead column under the first row. */
  .president-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .president { grid-column: span 2; }
  .president:nth-child(4) { grid-column: 2 / span 2; }
  .president:nth-child(5) { grid-column: 4 / span 2; }
  .cover-head { grid-template-columns: 1fr; align-items: start; }
  .cover-cta {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: .35rem 1.4rem;
  }
  .cover-stat { grid-column: 1 / -1; }
  .cover-methods { grid-column: 1; }
  .cover-span { grid-column: 1; }
  .cover-cta .primary { grid-column: 2; grid-row: 2 / span 2; }
}

@media (max-width: 719px) {
  .president-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .president { grid-column: span 2; }
  .president:nth-child(4) { grid-column: auto / span 2; }
  .president:nth-child(5) { grid-column: 2 / span 2; }
  .cover-cta { flex-direction: column; align-items: flex-start; }
  .topnav { flex-wrap: wrap; row-gap: .25rem; }
  .topnav ul { gap: .75rem; }
  .topnav a { font-size: .8rem; }
  .topnav .wordmark { font-size: .95rem; }
  .step-label { display: none; }
  .step.is-active .step-label { display: inline; }
  .steps { gap: .2rem .2rem; }
  .steps .step { padding: .2em .45em .2em .2em; }
  .step-dot { width: 1.55em; height: 1.55em; font-size: .66rem; }
  .graph-figure { overflow-x: auto; }
  .graph-figure img.graph { min-width: 640px; }
  /* The tenure table has five columns and a monospace number column, so on a phone it is wider than the
     panel it sits in. It scrolls inside its own box rather than pushing the whole page sideways. */
  .tenure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .deviation-table { font-size: .78rem; }
  .deviation-table th, .deviation-table td { padding-left: .35rem; padding-right: .35rem; }
}

@media (max-width: 860px) {
  .columns { grid-template-columns: 1fr; }
  .figure-col { order: -1; }
  .slide-figure { height: min(46vh, 380px); }
  .carousel-btn { top: calc(min(46vh, 380px) / 2); }
  .cover-head h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .controls { flex-wrap: wrap; }
  .control-note { order: 3; flex-basis: 100%; }
  .spec-list li { grid-template-columns: 1fr; gap: .1rem; }
}

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