/* Long-form explainer layout: a reading column for prose, wider figures for the interactive parts.
   Light only: judging colors needs the same neutral surround every time. */
:root {
  --page: #f5f5f3;
  --panel: #ffffff;
  --ink: #1b1d22;
  --ink-2: #474c56;
  --muted: #676d78;
  --line: #dfe0e3;
  --line-2: #c3c6cc;
  --accent: #1f3a93;
  --accent-soft: #e8ecf8;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 1.125rem/1.62 var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* ---- Reading column ---- */

.masthead, .prose, .footnotes {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

.masthead { padding-top: 56px; }

.kicker {
  margin: 0 0 6px;
  font: 600 0.75rem/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker a { color: inherit; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
@media (hover: hover) {
  .kicker a:hover { color: var(--ink); text-decoration-color: currentColor; }
}

h1 {
  margin: 0;
  font-size: 2.875rem;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dek {
  margin: 14px 0 0;
  font-size: 1.3125rem;
  line-height: 1.5;
  color: var(--ink-2);
}

h2 {
  margin: 56px 0 10px;
  font-size: 1.6875rem;
  line-height: 1.25;
  font-weight: 600;
}

.prose h3 {
  margin: 36px 0 6px;
  font-size: 1.3125rem;
  line-height: 1.3;
  font-weight: 600;
}

h2 .num {
  font: 600 0.875rem/1 var(--sans);
  color: var(--muted);
  margin-right: 10px;
  vertical-align: 4px;
}

p, li { hyphens: auto; }
.prose ul { padding-left: 22px; }
.prose li { margin: 6px 0; }
strong { font-weight: 650; }

.answer {
  margin: 32px 0 0;
  padding: 20px 22px 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
}
.answer h2 { margin: 0 0 8px; font-size: 1.25rem; }
.answer ol { padding-left: 22px; margin: 10px 0; }
.answer li { margin: 8px 0; }

.try {
  font: 0.9375rem/1.5 var(--sans);
  color: var(--ink-2);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.try .live { display: inline-block; white-space: nowrap; }
.try::before {
  content: "Try it";
  font-weight: 650;
  color: var(--ink);
  margin-right: 8px;
}

/* ---- Figures ---- */

.figure {
  max-width: 1100px;
  margin: 36px auto;
  padding: 0 16px;
  font: 0.875rem/1.45 var(--sans);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 20px;
}

.figure-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 14px;
}
.figure-head h3 { margin: 0; font-size: 0.9375rem; font-weight: 650; }
.figure-head p { margin: 0; color: var(--muted); }

.caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ---- Comparison ---- */

.compare {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 28px;
}

.swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-content: start;
}

.swatch { margin: 0; }
.swatch canvas, .swatch .solid {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
}
.swatch figcaption { margin-top: 8px; }
.swatch figcaption strong { display: block; font-size: 0.9375rem; }
.swatch figcaption span { color: var(--muted); }
.swatch svg { display: block; width: 100%; height: auto; margin-top: 10px; }

.verdict {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.verdict .de {
  font: 600 1.875rem/1 var(--sans);
  font-variant-numeric: tabular-nums;
}
.verdict .word { font-weight: 650; font-size: 0.9375rem; }
.verdict p { flex-basis: 100%; margin: 2px 0 0; color: var(--ink-2); }

/* ---- Controls ---- */

.controls { display: grid; gap: 16px; align-content: start; }

.control-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.control-group legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field { display: grid; gap: 4px; }
.field-row { display: flex; justify-content: space-between; gap: 8px; }
.field-row output { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.hint { color: var(--muted); font-size: 0.78125rem; }

select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 6px 8px;
  width: 100%;
}

input[type="range"] { width: 100%; accent-color: var(--ink); margin: 2px 0; }

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  overflow: hidden;
}
.segmented label { position: relative; }
.segmented input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.segmented span {
  display: block;
  padding: 7px 8px;
  text-align: center;
  font-size: 0.8125rem;
  border-left: 1px solid var(--line-2);
  color: var(--ink-2);
}
.segmented label:first-child span { border-left: 0; }
.segmented input:checked + span { background: var(--ink); color: #fff; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }

button {
  font: inherit;
  font-size: 0.8125rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 6px 12px;
  cursor: pointer;
}
@media (hover: hover) {
  button:hover { border-color: var(--ink-2); }
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- Causes table ---- */

.causes { margin-top: 28px; }
.causes h3 { margin: 0 0 2px; font-size: 0.9375rem; }
.causes > p { margin: 0 0 10px; color: var(--muted); }
.causes table { width: 100%; border-collapse: collapse; }
.causes th, .causes td {
  text-align: left;
  vertical-align: middle;
  padding: 9px 10px 9px 0;
  border-top: 1px solid var(--line);
}
.causes th { font-weight: 650; }
.causes thead th {
  border-top: 0;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.causes td.num { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.causes tr.total th, .causes tr.total td { border-top: 1px solid var(--ink); }
.pair { display: inline-flex; border: 1px solid var(--line); }
.pair i { display: block; width: 26px; height: 20px; }
.cause-name { display: block; }
.cause-sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.78125rem; }

/* ---- Photons ---- */

.light-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 20px;
  margin-bottom: 16px;
}
.light-controls .segmented { min-width: 230px; }
.light-controls .field { flex: 1 1 260px; }

.spectrum-range {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  border-radius: 2px;
  border: 1px solid var(--line-2);
  background: var(--spectrum, #ccc);
}
.spectrum-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 8px;
  height: 22px;
  border-radius: 2px;
  background: var(--ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ink);
  cursor: pointer;
}
.spectrum-range::-moz-range-thumb {
  width: 6px;
  height: 20px;
  border-radius: 2px;
  background: var(--ink);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ink);
  cursor: pointer;
}
.spectrum-range::-moz-range-track { background: transparent; }

.boxes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.box { min-width: 0; }
.box h4 { margin: 0 0 8px; font-size: 0.875rem; }
.box h4 span { font-weight: 400; color: var(--muted); }
.box canvas { display: block; width: 100%; height: 300px; border: 1px solid var(--line); }

.budget { margin-top: 10px; }
.budget-bar {
  display: flex;
  height: 14px;
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.budget-bar i { display: block; height: 100%; transition: width 0.2s linear; }
.budget ul {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 0.78125rem;
  color: var(--ink-2);
}
.budget li { display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.budget li b { display: inline-block; width: 10px; height: 10px; border: 1px solid rgb(0 0 0 / 0.25); }
.budget .check { margin-top: 4px; font-size: 0.78125rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.returned { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.returned svg { flex: 1; min-width: 0; width: 100%; height: 74px; display: block; }
.returned .chip { width: 74px; border: 1px solid var(--line); display: flex; align-items: end; }
.returned .chip span { font-size: 0.6875rem; line-height: 1.2; padding: 3px 4px; background: rgb(255 255 255 / 0.85); width: 100%; }

/* ---- Charts ---- */

.chart svg { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: ew-resize; user-select: none; }
.chart text { font: 0.75rem var(--sans); fill: var(--ink-2); }
.chart .grid line { stroke: var(--line); }
.chart .cursor-line { stroke: var(--ink); stroke-width: 1; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 4px;
  font-size: 0.78125rem;
  color: var(--ink-2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .key { flex: none; }
/* Legend samples keep their own width and height attributes; the chart rules size every other svg to 100%. */
.chart-legend span > svg, #chart-floor .chart-legend span > svg, #chart-cie .chart-legend span > svg { display: inline-block; flex: none; width: auto; height: auto; }
.chart .readout {
  margin: 8px 0 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- Dullness ---- */

.ladder + .ladder { margin-top: 26px; }
.ladder h4 { margin: 0 0 10px; font-size: 0.875rem; font-weight: 650; }
.ladder h4 span { font-weight: 400; color: var(--muted); }
.rungs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.rung { margin: 0; }
.rung .chip, .light-sum .chip { aspect-ratio: 3 / 2; border: 1px solid var(--line); }
.rung svg { display: block; width: 100%; height: 52px; margin-top: 6px; }
.rung figcaption {
  margin-top: 4px;
  font-size: 0.78125rem;
  line-height: 1.4;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.veil-pick { max-width: 520px; margin-bottom: 14px; }

.light-sum {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin-top: 16px;
  max-width: 640px;
}
.light-sum figure { margin: 0; }
.light-sum figcaption { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.light-sum figcaption strong { display: block; color: var(--ink); }
.light-sum .op { font: 600 1.375rem/1 var(--sans); color: var(--muted); padding-top: 22px; }
.veil-note { margin: 14px 0 0; font-weight: 600; max-width: 760px; }

/* ---- Physics figures ---- */

.prose .eq { background: var(--panel); }
.chart-legend .key { display: inline-block; width: 12px; height: 12px; border: 1px solid rgb(0 0 0 / 0.2); }

.fr-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 6px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.fr-row:first-of-type { border-top: 0; }
.fr-label strong { display: block; font-size: 0.875rem; }
.fr-label span { color: var(--muted); font-size: 0.78125rem; }
.fr-bars { display: grid; gap: 4px; }
.fr-bar { display: flex; align-items: center; gap: 8px; font-size: 0.78125rem; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.fr-bar i { display: block; height: 12px; min-width: 1px; }

.floor-lambda { max-width: 420px; margin-bottom: 10px; }

.cie-note, .chart .cie-note { margin: 10px 0 0; font-weight: 600; max-width: 820px; }
#chart-cie svg, #chart-floor svg { display: block; width: 100%; height: auto; }
#chart-cie text, #chart-floor text { font: 0.75rem var(--sans); fill: var(--ink-2); }
#chart-cie .pt-label { font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
#chart-floor .readout { margin: 8px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.surface-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 680px;
}
.surface-trio figure { margin: 0; }
.surface-trio .chip { aspect-ratio: 3 / 2; border: 1px solid var(--line); }
.surface-trio figcaption { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.surface-trio figcaption strong { display: block; color: var(--ink); }

a.cite {
  font: 600 0.7em var(--sans);
  vertical-align: 0.4em;
  color: var(--accent);
  text-decoration: none;
  margin-left: 1px;
}
@media (hover: hover) {
  a.cite:hover { text-decoration: underline; }
}
.refs li { scroll-margin-top: 16px; }
.refs li:target { background: var(--accent-soft); }
.refs a { color: var(--accent); }
.refs-note { font-size: 0.875rem; }

/* ---- Math ---- */

details.math {
  margin: 28px 0 0;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0 20px;
}
details.math summary {
  cursor: pointer;
  padding: 14px 0;
  font: 650 0.9375rem var(--sans);
}
details.math[open] { padding-bottom: 16px; }
.eq {
  font: 1rem/1.6 "Cambria Math", Cambria, "Times New Roman", serif;
  padding: 8px 14px;
  margin: 10px 0;
  background: var(--page);
  border-left: 2px solid var(--line-2);
  overflow-x: auto;
}

.footnotes {
  margin-top: 64px;
  padding-bottom: 64px;
  font: 1rem/1.65 var(--sans);
  color: var(--ink-2);
}
.footnotes > p { font-weight: 650; font-size: 1.0625rem; color: var(--ink); margin-bottom: 4px; }
.footnotes li { margin: 6px 0; }
.footnotes::before {
  content: "";
  display: block;
  border-top: 1px solid var(--line);
  margin-bottom: 16px;
}
.footnotes ol { padding-left: 22px; }

/* ---- Narrow screens ---- */

@media (max-width: 860px) {
  .compare { grid-template-columns: 1fr; }
  .boxes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  h1 { font-size: 2.25rem; }
  .dek { font-size: 1.1875rem; }
  .panel { padding: 14px; }
  .swatches { gap: 10px; }
  .causes .pair i { width: 18px; }
  .rungs { gap: 6px; }
  .rung figcaption { font-size: 0.75rem; }
  .light-sum { gap: 6px; }
  .light-sum figcaption { font-size: 0.75rem; }
  .fr-row { grid-template-columns: 1fr; }
  .surface-trio { gap: 8px; }
  .surface-trio figcaption { font-size: 0.75rem; }
  .eq { font-size: 0.90625rem; }
  .causes td, .causes th { padding-right: 6px; }
}

/* ---- Pages 02–04: shared figure parts ---- */

.plot svg { display: block; width: 100%; height: auto; }
.plot text { font: 0.75rem var(--sans); fill: var(--ink-2); }
.plot .grid line { stroke: var(--line); }
.plot .pt-label { font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.plot-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.note { margin: 10px 0 0; font-weight: 600; max-width: 820px; }

.chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.chips.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips figure { margin: 0; min-width: 0; }
.chips .chip, .chips canvas { display: block; width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); }
.chips .chip.thin { aspect-ratio: auto; height: 10px; border-top: 0; }
.chips figcaption { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chips figcaption strong { display: block; color: var(--ink); font-size: 0.875rem; }
.chips .op { align-self: center; }

.mix-verdict { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-weight: 600; }

.spots svg { display: block; width: 100%; max-width: 420px; height: auto; border: 1px solid var(--line); }

.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data th, .data td { text-align: left; padding: 8px 10px 8px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.data thead th { border-top: 0; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.data tr.total th, .data tr.total td { border-top: 1px solid var(--ink); }
.prose .data { font: 0.9375rem/1.45 var(--sans); margin: 14px 0; }

.testcard canvas { display: block; width: 100%; aspect-ratio: 2 / 1; border: 1px solid var(--line); }

@media (max-width: 760px) {
  .plot-pair { grid-template-columns: minmax(0, 1fr); }
  .chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chips.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .chips.three figcaption { font-size: 0.75rem; }
}

@media (max-width: 860px) {
  .compare { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .wide-only { display: none; }
  .data th, .data td { padding-right: 6px; }
}

/* Links in running text use the accent, like citations and references. */
.prose a:not(.cite), .answer a { color: var(--accent); text-underline-offset: 2px; }
.chart .pt-label { font-weight: 650; fill: var(--ink); paint-order: stroke; stroke: #fff; stroke-width: 3px; }

/* iOS Safari zooms the page when a focused control's text is under 16px. */
@media (max-width: 760px) {
  select { font-size: 1rem; }
}

/* ---- Dumb / nerd toggle (js/mode.js) ---- */

.mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 0 0 10px;
}
.mode-bar .kicker { margin: 0; }
.mode-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 0.875rem/1.4 var(--sans);
}
.mode-word { color: var(--muted); cursor: pointer; user-select: none; }
:root[data-mode="dumb"] .mode-word[data-mode-set="dumb"],
:root:not([data-mode="dumb"]) .mode-word[data-mode-set="nerd"] { color: var(--ink); }

/* A native checkbox drawn as a switch: off is dumb, on is nerd. */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  background: var(--muted);
  cursor: pointer;
}
.switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
}
.switch:checked { background: var(--ink); }
.switch:checked::before { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Animate only once the page has set the switch, so it never slides on load. */
@media (prefers-reduced-motion: no-preference) {
  .mode-ready .switch { transition: background-color 0.15s ease-out; }
  .mode-ready .switch::before { transition: transform 0.15s ease-out; }
}
@media (forced-colors: active) {
  .switch { border: 1px solid CanvasText; }
  .switch::before { background: CanvasText; }
}

.brief { margin: 0 0 16px; max-width: 760px; font-size: 0.9375rem; line-height: 1.5; color: var(--ink); }

.nerd-hint {
  max-width: 640px;
  margin: 56px auto 72px;
  padding: 16px;
  font: 1rem/1.5 var(--sans);
  color: var(--ink-2);
  border-top: 1px solid var(--line);
}
.nerd-hint p { margin: 0 0 12px; }

/* Dumb keeps the short answer, the figures, their one-line explanations and the
   "Try it" rows; nerd (the default, also without JS) hides the dumb-only lines. */
:root:not([data-mode="dumb"]) .dumb-only { display: none; }
:root[data-mode="dumb"] .nerd-only,
:root[data-mode="dumb"] .prose > :not(.try),
:root[data-mode="dumb"] .figure .caption,
:root[data-mode="dumb"] .footnotes { display: none; }

/* Nerd mode sits on lab-notebook graph paper: light blue with a faint grid (major
   lines every fifth square). Dumb keeps the plain page color. Swatches sit on white
   panels either way, so judging colors is unaffected. --muted steps darker on the
   grid so small gray text keeps 5.9:1 on the paper and at least 4:1 where lines cross. */
:root[data-mode="nerd"] { --page: #edf2f7; --muted: #575d68; }
:root[data-mode="nerd"] body {
  background-image:
    linear-gradient(rgb(31 58 147 / 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgb(31 58 147 / 0.07) 1px, transparent 1px),
    linear-gradient(rgb(31 58 147 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(31 58 147 / 0.045) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
@media (prefers-reduced-motion: no-preference) {
  .mode-ready body { transition: background-color 0.3s ease-out; }
}

/* ---- Logo: the painted dog from justpaint, round like justpaint's navbar ---- */
.logo {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
  border: 1px solid var(--line);
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 20%;
  background: var(--panel);
}
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .logo { transition: transform 0.3s ease-out; }
  a:hover > .logo { transform: rotate(-6deg); }
}

/* ---- Pages 05–06: drying puddles and grains ---- */

.xsec canvas, .grain-xsec canvas { display: block; width: 100%; height: 230px; border: 1px solid var(--line); background: var(--panel); }
.grain-xsec canvas { height: 200px; }
.xsec-key {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 6px 0 0;
  font-size: 0.78125rem;
  color: var(--ink-2);
}
.xsec-key span { display: inline-flex; align-items: center; gap: 6px; }
.xsec-key b { font-weight: 650; color: var(--ink); }
.xsec-key b.k-up { color: #767676; }
.xsec-key .k-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-2); }
.xsec-key .k-stripe { display: inline-block; width: 18px; height: 6px; background: var(--ink-2); }

.timeline { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.timeline button { flex: none; min-width: 108px; }
.timeline input[type="range"] { flex: 1; min-width: 0; }
.timeline output { flex: none; min-width: 6.5em; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }

.blot-row {
  display: grid;
  grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}
.blot { margin: 0; }
.blot canvas { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line); }
.blot figcaption { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.blot-row .mix-verdict { margin: 0; padding-top: 0; border-top: 0; }

.causes tr.now th, .causes tr.now td { background: var(--accent-soft); }
.causes tr.now em { font-style: normal; font-weight: 400; color: var(--ink-2); }

.grain-swatch { margin: 0; }
.grain-swatch canvas { display: block; width: 100%; aspect-ratio: 5 / 3; border: 1px solid var(--line); }
.grain-swatch figcaption { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }

.sink-chart svg { display: block; width: 100%; height: auto; }
.sink-chart text { font: 0.75rem var(--sans); fill: var(--ink-2); }
.sink-chart .grid line { stroke: var(--line); }
.sink-chart .row-label { fill: var(--ink); font-weight: 600; }

@media (max-width: 560px) {
  .blot-row { grid-template-columns: minmax(0, 1fr); }
  .blot { max-width: 280px; }
  .xsec canvas { height: 200px; }
  .timeline output { min-width: 5.5em; }
}

/* ---- Page 07: the consistency clock ---- */

.drop-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.drop-swatch { margin: 0; position: relative; }
.drop-swatch canvas { display: block; width: 100%; max-width: 460px; aspect-ratio: 1; border: 1px solid var(--line); image-rendering: auto; }
.drop-swatch figcaption { margin-top: 6px; font-size: 0.8125rem; color: var(--ink-2); }
.drop-status { position: absolute; top: 8px; left: 8px; margin: 0; padding: 2px 8px; font-size: 0.78125rem; background: rgb(255 255 255 / 0.9); }
.drop-status:empty { display: none; }

.clock {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  max-width: 760px;
}
.clock-head { font-size: 0.8125rem; font-weight: 650; text-align: center; }
.clock-row { font-size: 0.8125rem; font-weight: 650; padding-right: 4px; }
.clock-cell {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel);
  text-align: center;
}
.clock-cell canvas { display: block; width: 100%; aspect-ratio: 1; }
.clock-cell span { display: block; padding: 3px 2px; font-size: 0.75rem; color: var(--ink-2); border-top: 1px solid var(--line); }
.clock-cell.is-bloom span { color: var(--ink); font-weight: 650; }
.clock-cell.is-now { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (hover: hover) {
  .clock-cell:hover { border-color: var(--ink-2); }
}

.segmented.five span { padding: 7px 2px; font-size: 0.78125rem; }

@media (max-width: 560px) {
  .clock { gap: 4px; }
  .clock-head, .clock-row { font-size: 0.6875rem; }
  .clock-cell span { font-size: 0.75rem; line-height: 1.2; padding: 2px 0; }
}
