/* mcmaster-epg in the browser.
   Palette: slide-glass paper, ink, chamber teal for actions, iodine ochre reserved for
   uncertainty (confidence intervals and ranges). Type: Source Serif 4 for headings and
   result figures, IBM Plex Sans for the interface, IBM Plex Mono for program text.
   Fonts come from pinned @fontsource packages on cdn.jsdelivr.net. */

/* ------------------------------------------------------------------ fonts */
@font-face {
  font-family: "Source Serif 4 Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/source-serif-4@5.2.5/files/source-serif-4-latin-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4 Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/source-serif-4@5.2.5/files/source-serif-4-latin-ext-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 700;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/ibm-plex-sans@5.2.5/files/ibm-plex-sans-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 700;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource-variable/ibm-plex-sans@5.2.5/files/ibm-plex-sans-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource/ibm-plex-mono@5.2.5/files/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("https://cdn.jsdelivr.net/npm/@fontsource/ibm-plex-mono@5.2.5/files/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --paper: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #e9efed;
  --ink: #16201e;
  --ink-2: #364240;
  --muted: #55625e;
  --rule: #c6d0cc;
  --rule-strong: #7c8c87;
  --accent: #0b5d5b;
  --accent-hover: #084a48;
  --accent-ink: #ffffff;
  --accent-soft: #d9eae6;
  --accent-text: #0a5553;
  --signal: #a9670f;
  --signal-soft: #f3e3c4;
  --signal-text: #7c4a06;
  --stage-1: #0b5d5b;
  --stage-2: #4a948b;
  --stage-3: #93c6bd;
  --stage-1-ink: #ffffff;
  --stage-2-ink: #16201e;
  --stage-3-ink: #16201e;
  --error: #a1271f;
  --error-soft: #f8e4e1;
  --focus: #b4530a;
  --shadow: 0 1px 0 rgba(22, 32, 30, 0.04), 0 8px 24px -12px rgba(22, 32, 30, 0.18);

  --serif: "Source Serif 4 Variable", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans Variable", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.5625rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;
  --step-5: 3.052rem;
  --step-6: 3.815rem;

  --r-s: 6px;
  --r-m: 10px;
  --r-l: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1413;
    --surface: #131c1a;
    --surface-2: #1a2523;
    --ink: #e2e9e6;
    --ink-2: #c2cdc9;
    --muted: #9aa8a4;
    --rule: #2b3836;
    --rule-strong: #64776f;
    --accent: #5fc1b4;
    --accent-hover: #84d3c8;
    --accent-ink: #052220;
    --accent-soft: #15332f;
    --accent-text: #7fd0c5;
    --signal: #e2a84a;
    --signal-soft: #3a2d15;
    --signal-text: #edc078;
    --stage-1: #6fcabd;
    --stage-2: #2a7067;
    --stage-3: #1c3f3b;
    --stage-1-ink: #052220;
    --stage-2-ink: #e2e9e6;
    --stage-3-ink: #e2e9e6;
    --error: #f29a90;
    --error-soft: #3b1e1b;
    --focus: #f3a660;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0d1413;
  --surface: #131c1a;
  --surface-2: #1a2523;
  --ink: #e2e9e6;
  --ink-2: #c2cdc9;
  --muted: #9aa8a4;
  --rule: #2b3836;
  --rule-strong: #64776f;
  --accent: #5fc1b4;
  --accent-hover: #84d3c8;
  --accent-ink: #052220;
  --accent-soft: #15332f;
  --accent-text: #7fd0c5;
  --signal: #e2a84a;
  --signal-soft: #3a2d15;
  --signal-text: #edc078;
  --stage-1: #6fcabd;
  --stage-2: #2a7067;
  --stage-3: #1c3f3b;
  --stage-1-ink: #052220;
  --stage-2-ink: #e2e9e6;
  --stage-3-ink: #e2e9e6;
  --error: #f29a90;
  --error-soft: #3b1e1b;
  --focus: #f3a660;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-wrap: break-word;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.875em;
}

pre {
  margin: 0;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 3rem);
  padding-right: clamp(1rem, 4vw, 3rem);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--r-s);
  font-weight: 600;
}

.skip-link:focus {
  left: 0.5rem;
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
}

.bm-frame {
  fill: var(--accent);
}

.bm-lane {
  stroke: var(--accent-soft);
  stroke-width: 1.2;
  fill: none;
}

.bm-egg {
  fill: var(--signal-soft);
  stroke: var(--signal);
  stroke-width: 0.9;
}

.topbar-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  font-size: 0.9375rem;
}

.topbar-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.6rem;
  color: var(--ink-2);
  text-decoration: none;
}

.topbar-links a:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--rule-strong);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
}

.tt-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.tt-half {
  fill: currentColor;
}

@media (max-width: 40rem) {
  .topbar-links li:not(:last-child) {
    display: none;
  }
}

/* ------------------------------------------------------------------ hero */
.site-header {
  border-bottom: 1px solid var(--rule);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 1.5rem clamp(1.5rem, 4vw, 4rem);
  align-items: center;
  padding-top: clamp(1.75rem, 4vw, 3.25rem);
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
}

.hero h1 {
  font-size: clamp(2.3rem, 1.5rem + 3vw, 3.75rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 1.1rem;
  max-width: 12.5em;
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 1.6rem;
  max-width: 54ch;
}

.hero-figure {
  margin: 0;
  justify-self: end;
  width: 100%;
  max-width: 34rem;
}

.hero-foot {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1.2fr);
  gap: 0.75rem 2rem;
  align-items: start;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.chamber {
  display: block;
  width: 100%;
  height: auto;
}

.ch-slide {
  fill: var(--surface);
  stroke: var(--rule-strong);
  stroke-width: 1.25;
}

.ch-slide-edge {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
}

.ch-well {
  fill: var(--surface-2);
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.ch-grid {
  fill: var(--accent-soft);
  fill-opacity: 0.45;
  stroke: var(--accent);
  stroke-width: 1.25;
}

.ch-lane {
  stroke: var(--accent);
  stroke-width: 0.8;
  stroke-opacity: 0.7;
  fill: none;
}

.ch-tick,
.ch-dim {
  stroke: var(--rule-strong);
  stroke-width: 1;
  fill: none;
}

.egg-shell {
  fill: var(--signal-soft);
  stroke: var(--signal);
  stroke-width: 1.1;
}

.egg-thick {
  stroke-width: 2.2;
}

.egg-inner {
  fill: none;
  stroke: var(--signal);
  stroke-width: 0.7;
  stroke-opacity: 0.65;
}

.egg-cell,
.egg-pit,
.egg-plug {
  fill: var(--signal);
  fill-opacity: 0.55;
}

.egg-plug {
  fill-opacity: 0.8;
}

.egg-thick-l {
  stroke-width: 4.5;
}

.egg-thick-m {
  stroke-width: 3;
}

.egg-inner-l {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1;
  stroke-opacity: 0.5;
}

.egg-yolk {
  fill: var(--signal);
  fill-opacity: 0.16;
}

.egg-cell-l {
  fill: var(--signal-soft);
  stroke: var(--signal);
  stroke-width: 1;
  stroke-opacity: 0.8;
}

.lens-stop-a {
  stop-color: var(--surface);
}

.lens-stop-b {
  stop-color: var(--surface-2);
}

.lens-ring {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 2.5;
}

.lens-ring-in {
  fill: none;
  stroke: var(--rule);
  stroke-width: 1;
}

.lens-shadow {
  fill: var(--ink);
  fill-opacity: 0.07;
}

.lens-spot {
  fill: var(--accent-soft);
  fill-opacity: 0.35;
  stroke: var(--ink-2);
  stroke-width: 1.25;
}

.lens-ray {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 0.9;
  stroke-dasharray: 3 4;
  stroke-opacity: 0.7;
}

.lens-lane {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-opacity: 0.55;
}

.lens-edge {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-opacity: 0.7;
}

.hero-caption {
  margin: 0.6rem 0 0;
  font-size: var(--step--1);
  color: var(--muted);
  text-align: right;
}

@media (prefers-reduced-motion: no-preference) {
  .egg {
    animation: float-up 2.4s cubic-bezier(0.22, 0.8, 0.28, 1) both;
  }
  .egg-2 { animation-delay: 0.25s; }
  .egg-3 { animation-delay: 0.5s; }
  .egg-4 { animation-delay: 0.15s; }
  .egg-5 { animation-delay: 0.4s; }
  .egg-6 { animation-delay: 0.55s; animation-duration: 3s; }
  .egg-7 { animation-delay: 0.85s; animation-duration: 3s; }
  .egg-8 { animation-delay: 0.7s; animation-duration: 3s; }
}

@keyframes float-up {
  from {
    transform: translateY(46px);
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* engine status */
.engine {
  display: inline-grid;
  gap: 0.55rem;
  padding: 0.85rem 1rem 0.75rem;
  margin: 0 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  max-width: 100%;
  min-width: min(100%, 26rem);
}

.engine-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  font-weight: 550;
  font-size: 0.9375rem;
}

.engine-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
}

body[data-engine="ready"] .engine-dot {
  background: var(--accent);
}

body[data-engine="error"] .engine-dot {
  background: var(--error);
}

@media (prefers-reduced-motion: no-preference) {
  body[data-engine="loading"] .engine-dot {
    animation: pulse 1.4s ease-in-out infinite;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.engine-phase {
  font-weight: 400;
  color: var(--muted);
}

body[data-engine="error"] .engine {
  border-color: var(--error);
  background: var(--error-soft);
}

.engine-steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.engine-steps li {
  padding-top: 0.45rem;
  border-top: 3px solid var(--rule);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.engine-steps li.done {
  border-top-color: var(--accent);
  color: var(--ink-2);
}

.engine-steps li.active {
  border-top-color: var(--signal);
  color: var(--ink);
  font-weight: 600;
}

body[data-engine="ready"] .engine-steps li {
  border-top-color: var(--accent);
  color: var(--ink-2);
}

body[data-engine="error"] .engine-steps li.active {
  border-top-color: var(--error);
}

.engine-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: var(--step--1);
  color: var(--muted);
}

#engine-elapsed {
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  font-weight: 550;
}

body[data-engine="ready"] #engine-note {
  display: none;
}

.small-button {
  min-height: 36px;
  padding: 0.2rem 0.8rem;
  font-size: 0.875rem;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.15rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--ink-2);
  background: transparent;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

a.badge-link:hover {
  border-color: var(--accent);
  color: var(--accent-text);
}

.privacy {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--r-s) var(--r-s) 0;
  font-size: 0.875rem;
  color: var(--ink-2);
  max-width: 62ch;
}

.privacy p {
  margin: 0;
}

.privacy {
  max-width: none;
}

.disclaimer {
  margin: 0;
  padding-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 62ch;
}

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero-figure {
    justify-self: center;
    max-width: 24rem;
  }
  .hero-caption {
    text-align: left;
  }
  .hero-foot {
    grid-template-columns: minmax(0, 1fr);
  }
  .disclaimer {
    padding-top: 0;
  }
}

@media (max-width: 30rem) {
  .engine {
    display: grid;
  }
  .engine-steps li:not(.active) {
    color: transparent;
  }
  body[data-engine="ready"] .engine-steps {
    display: none;
  }
}

/* ------------------------------------------------------------------ notices */
.notices:empty {
  display: none;
}

.banner {
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--error-soft);
  border-left: 3px solid var(--error);
  border-radius: 0 var(--r-s) var(--r-s) 0;
}

.noscript {
  max-width: 78rem;
  margin: 1rem auto 0;
  padding: 0.75rem 1rem;
  background: var(--error-soft);
  border-left: 3px solid var(--error);
}

.session-profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0.2rem 0.4rem 0.2rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r-m);
  font-size: 0.9375rem;
}

/* ------------------------------------------------------------------ task navigation */
.tools-nav {
  padding-top: clamp(2rem, 4vw, 3rem);
}

.nav-title {
  font-size: var(--step-2);
  margin: 0 0 1rem;
}

.task-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "glyph name"
    "glyph desc"
    "glyph cmd";
  grid-template-rows: auto 1fr auto;
  column-gap: 1rem;
  row-gap: 0.2rem;
  height: 100%;
  min-height: 44px;
  padding: 1.1rem 1.2rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-l);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.task:hover {
  border-color: var(--rule-strong);
}

.task[aria-current="page"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.task[aria-current="page"] .task-cmd {
  color: var(--accent-text);
}

.task-glyph {
  grid-area: glyph;
  width: 2.75rem;
  height: 2.75rem;
  margin-top: 0.15rem;
}

.tg-frame {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.tg-fill {
  fill: var(--accent-soft);
}

.tg-line {
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-opacity: 0.6;
}

.tg-egg {
  fill: var(--signal-soft);
  stroke: var(--signal);
  stroke-width: 1.5;
}

.tg-dot {
  fill: none;
  stroke: var(--rule-strong);
  stroke-width: 1.5;
}

.tg-on {
  fill: var(--accent);
  stroke: var(--accent);
}

.task-name {
  grid-area: name;
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.25;
}

.task-desc {
  grid-area: desc;
  color: var(--ink-2);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.task-cmd {
  grid-area: cmd;
  justify-self: start;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.more-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

.more-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
}

.more-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
}

.more-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-s);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.more-list a code {
  color: var(--muted);
  font-size: 0.75rem;
}

.more-list a:hover {
  background: var(--surface-2);
}

.more-list a[aria-current="page"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.more-list a[aria-current="page"] code {
  color: var(--accent-ink);
}

@media (max-width: 56rem) {
  .task-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
  }
  .task {
    padding: 0.9rem 1rem;
  }
  .task-glyph {
    width: 2.25rem;
    height: 2.25rem;
  }
}

@media (max-width: 40rem) {
  .more-tools {
    display: block;
  }
  .more-title {
    margin-bottom: 0.4rem;
  }
  .more-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }
  .more-list a {
    display: flex;
    flex-direction: column;
    gap: 0;
    white-space: normal;
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--rule);
    background: var(--surface);
  }
}

/* ------------------------------------------------------------------ tool workspace */
main {
  padding-top: clamp(1.75rem, 3vw, 2.75rem);
  padding-bottom: 5rem;
}

.tool-head {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  align-items: baseline;
  gap: 0.35rem 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.tool-head h2 {
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, var(--step-4));
  margin: 0;
  scroll-margin-top: 1rem;
}

.tool-head h2:focus {
  outline: none;
}

.tool-head h2:focus-visible {
  outline: 3px solid var(--focus);
}

.tool-cmd {
  justify-self: start;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-s);
}

@media (max-width: 30rem) {
  .tool-head {
    grid-template-columns: minmax(0, 1fr);
  }
}

.intro {
  grid-column: 1 / -1;
  margin: 0.2rem 0 0;
  color: var(--ink-2);
  max-width: 68ch;
}

.notice {
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-left: 3px solid var(--signal);
  border-radius: 0 var(--r-s) var(--r-s) 0;
}

.tool-body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(1.5rem, 3.5vw, 3.5rem);
  align-items: start;
}

@media (max-width: 68rem) {
  .tool-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ forms */
form {
  margin: 0;
}

.form-block {
  margin: 0 0 0.5rem;
}

.field {
  margin: 0 0 1.15rem;
}

.lbl {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  margin-bottom: 0.35rem;
  font-weight: 550;
}

.opt {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}

.req {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--signal-text);
}

.control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 30rem;
}

.unit {
  flex: none;
  color: var(--muted);
  font-size: 0.875rem;
}

input[type="text"],
input:not([type]),
select,
textarea {
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-s);
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  width: 100%;
  max-width: 30rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

select {
  padding-right: 2.1rem;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

input[type="text"]:hover,
select:hover,
textarea:hover {
  border-color: var(--ink-2);
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  max-width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
}

input[type="file"] {
  font: inherit;
  font-size: 16px;
  max-width: 100%;
  min-height: 44px;
  color: var(--ink-2);
}

input[type="file"]::file-selector-button {
  font: inherit;
  font-size: 0.9375rem;
  min-height: 40px;
  margin-right: 0.75rem;
  padding: 0.3rem 0.9rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.file-control {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 30rem;
}

.file-input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.file-pick {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  min-height: 44px;
  cursor: pointer;
}

.file-button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0.3rem 1rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-s);
  background: var(--surface);
  color: var(--accent-text);
  font-weight: 550;
  font-size: 0.9375rem;
}

.file-pick:hover .file-button {
  border-color: var(--accent);
}

.file-input:focus-visible + .file-pick .file-button {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.file-input[aria-invalid="true"] + .file-pick .file-button {
  border: 2px solid var(--error);
}

.file-name {
  color: var(--muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
}

.hint {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
  max-width: 58ch;
}

[aria-invalid="true"] {
  border-color: var(--error) !important;
  border-width: 2px !important;
}

.field-error {
  margin: 0.35rem 0 0;
  color: var(--error);
  font-weight: 600;
  font-size: 0.9375rem;
}

fieldset.group {
  margin: 0 0 1.4rem;
  padding: 0;
  border: 0;
  min-width: 0;
}

fieldset.group > legend {
  float: left;
  width: 100%;
  margin: 0 0 0.5rem;
  padding: 0;
  font-weight: 600;
  color: var(--ink);
}

.legend-note {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.875rem;
}

.choices {
  clear: left;
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  background: var(--surface);
  overflow: hidden;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 46px;
  padding: 0.35rem 0.85rem;
  border-top: 1px solid var(--rule);
}

.choices > .choice:first-child {
  border-top: 0;
}

.choices > .choice:has(input:checked) {
  background: var(--accent-soft);
}

.choice:has(input:disabled) {
  opacity: 0.55;
}

.choice label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
}

.choice input,
.check input {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  margin: 0;
}

.sub {
  padding: 0.9rem 0.95rem 0.1rem 2.75rem;
  border-top: 1px dashed var(--rule);
  background: var(--surface);
}

.sub .field {
  margin-bottom: 0.9rem;
}

.sub .choice {
  border-top: 0;
  padding-left: 0;
  padding-right: 0;
  min-height: 40px;
}

.session-choice .hint {
  margin: -0.2rem 0 0.75rem 1.9rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.45rem 0;
  margin: 0 0 0.5rem;
}

.check > div {
  min-width: 0;
}

.check label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1rem 0.5rem;
  font-weight: 550;
  cursor: pointer;
}

.check .hint {
  margin-top: 0.15rem;
}

.check input {
  margin-top: 0.2rem;
}

.pair-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 550;
}

.pair-inputs {
  display: grid;
  grid-template-columns: auto minmax(0, 9rem) auto minmax(0, 9rem);
  gap: 0.5rem 0.6rem;
  align-items: center;
  max-width: 30rem;
}

.pair-inputs label {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-2);
}

@media (max-width: 30rem) {
  .pair-inputs {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .sub {
    padding-left: 0.95rem;
  }
}

.loaded {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin: 0.5rem 0 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

details.advanced {
  margin: 1.5rem 0 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  background: var(--surface);
}

details.advanced > summary,
details.stages > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.6rem;
  min-height: 48px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

details.advanced > summary::-webkit-details-marker,
details.stages > summary::-webkit-details-marker {
  display: none;
}

details.advanced > summary::before,
details.stages > summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}

details.advanced[open] > summary::before,
details.stages[open] > summary::before {
  transform: rotate(45deg);
}

.summary-note {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
}

.advanced-body {
  padding: 0.9rem 1rem 0.25rem;
  border-top: 1px solid var(--rule);
}

details.stages {
  margin: 0 0 1.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  background: var(--surface);
}

.stages-body {
  padding: 0.9rem 1rem 0.1rem;
  border-top: 1px solid var(--rule);
}

/* buttons */
button {
  font: inherit;
  font-size: 16px;
  min-height: 44px;
  padding: 0.45rem 1.1rem;
  border-radius: var(--r-s);
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.secondary {
  background: var(--surface);
  color: var(--accent-text);
  border-color: var(--rule-strong);
}

button.secondary:hover {
  border-color: var(--accent);
}

button[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

button.primary[aria-disabled="true"]:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.link-button {
  min-height: 44px;
  padding: 0.25rem 0.35rem;
  background: none;
  border: none;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.buttons .run {
  min-width: 11rem;
  min-height: 52px;
  font-size: 1.0625rem;
  border-radius: var(--r-m);
}

.time-note {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.command {
  margin: 1.5rem 0 0;
  padding: 0.75rem 0.85rem 0.8rem;
  background: var(--surface-2);
  border-radius: var(--r-m);
}

.command-label {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
}

.command-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.command-row pre {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-s);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.command-row pre code {
  font-size: 0.8125rem;
  color: var(--ink);
}

.copy-button {
  flex: none;
  min-width: 5rem;
  font-size: 0.875rem;
  padding: 0.3rem 0.75rem;
}

/* ------------------------------------------------------------------ results */
.results {
  min-width: 0;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 15rem;
  padding: 2rem 1.5rem;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-l);
  text-align: center;
  color: var(--muted);
  background: repeating-linear-gradient(90deg, transparent 0 calc(16.666% - 1px), var(--rule) calc(16.666% - 1px) 16.666%);
}

.empty-state p {
  margin: 0;
  max-width: 32ch;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border-radius: var(--r-s);
}

.output {
  margin: 0;
}

.status {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status:empty {
  margin: 0;
}

.error-block {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--error-soft);
  border-left: 3px solid var(--error);
  border-radius: 0 var(--r-s) var(--r-s) 0;
}

.err-line {
  margin: 0;
  color: var(--error);
}

.error-block details {
  margin-top: 0.25rem;
}

.error-block summary {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.error-block pre {
  padding: 0.6rem;
  background: var(--surface);
  border-radius: var(--r-s);
  font-size: 0.8125rem;
}

details > summary {
  cursor: pointer;
}

.card {
  margin: 0 0 1.25rem;
  padding: clamp(1rem, 2.5vw, 1.6rem) clamp(1rem, 2.5vw, 1.75rem) clamp(1rem, 2vw, 1.25rem);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
}

.figures {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem clamp(1.5rem, 4vw, 3rem);
  margin: 0 0 0.25rem;
}

.figure {
  min-width: 0;
  max-width: 24rem;
}

/* Three figures: the main estimate on the left, the two others stacked beside it. */
.figures:has(> .figure:nth-child(3)) {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1rem clamp(1.25rem, 3vw, 2.5rem);
}

.figures:has(> .figure:nth-child(3)) > .figure:first-child {
  grid-row: span 2;
}

@media (max-width: 30rem) {
  .figures:has(> .figure:nth-child(3)) {
    grid-template-columns: minmax(0, 1fr);
  }
  .figures:has(> .figure:nth-child(3)) > .figure:first-child {
    grid-row: auto;
  }
}

.fig-label {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 550;
  color: var(--ink-2);
}

.fig-value {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  font-size: clamp(2.6rem, 2rem + 2.6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}

.figure.secondary .fig-value {
  font-size: clamp(2rem, 1.6rem + 1.8vw, 3rem);
}

.fig-unit {
  margin-left: 0.35rem;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.fig-ci {
  margin: 0.35rem 0 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.ci-level {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0 0.4rem;
  border-radius: 4px;
  background: var(--signal-soft);
  color: var(--signal-text);
  font-weight: 600;
  font-size: 0.8125rem;
}

.card-context {
  margin: 0 0 0.9rem;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Binomial names of the parasites are set in italics where the page writes them. */
select[id$="-species"]:not(.is-none),
select[id$="-species"] option {
  font-style: italic;
}

select[id$="-species"] option[value=""] {
  font-style: normal;
}

.fig-sub {
  margin: 0.2rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.card-notes {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.card-notes li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1rem;
  border-top: 1px solid var(--rule);
}

.card-notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--rule-strong);
}

.card-notes li.warn {
  color: var(--signal-text);
  font-weight: 550;
}

.card-notes li.warn::before {
  background: var(--signal);
}

.chart {
  margin: 1.1rem 0 0;
}

.chart-title {
  margin: 0 0 0.35rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-2);
}

.chart-svg {
  width: 100%;
}

.chart-svg svg {
  display: block;
  overflow: visible;
}

.chart figcaption {
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sw {
  display: inline-block;
  width: 1.1rem;
  height: 0.7rem;
  border-radius: 2px;
  flex: none;
}

.sw-point {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
}

.sw-ci {
  height: 3px;
  background: var(--signal);
}

.sw-band {
  background: repeating-linear-gradient(135deg, var(--signal) 0 1px, var(--signal-soft) 1px 4px);
  border: 1px dashed var(--signal);
}

.sw-line {
  height: 2px;
  background: var(--accent);
}

.sw-m1,
.sw-m2 {
  height: 0;
  border-radius: 0;
  border-top: 2px dotted var(--ink-2);
}

.sw-m2 {
  border-top-style: dashed;
}

.sw-s1 { background: var(--stage-1); }
.sw-s2 { background: var(--stage-2); }
.sw-s3 { background: var(--stage-3); }
.sw-neg { background: var(--surface-2); border: 1px solid var(--rule-strong); }
.sw-obs { width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 2px solid var(--signal); }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}

.card-actions button {
  font-size: 0.9375rem;
}

.curve-note {
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* chart marks (SVG) */
.c-grid {
  stroke: var(--rule);
  stroke-width: 1;
}

.c-axis {
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.c-tick,
.c-axis-label,
.c-end,
.c-marker-label,
.c-row-label,
.c-est,
.c-seg-label {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

.c-tick {
  fill: var(--muted);
  font-size: 12px;
}

/* A halo in the card colour keeps labels legible where they cross grid lines. */
.c-end,
.c-est,
.c-marker-label,
.c-row-label,
.c-tick {
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.c-axis-label {
  fill: var(--muted);
  font-size: 12px;
}

.c-row-label {
  fill: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
}

.c-ci {
  stroke: var(--signal);
  stroke-width: 3.5;
  fill: none;
}

.c-cap {
  stroke: var(--signal);
  stroke-width: 2;
}

.c-pt {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.c-pt-hi {
  fill: var(--accent);
  stroke: var(--signal);
  stroke-width: 2.5;
}

.c-est {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.c-end {
  fill: var(--muted);
  font-size: 12px;
}

.c-marker {
  stroke: var(--ink-2);
  stroke-width: 1.25;
}

.c-marker-1 {
  stroke-dasharray: 2 3;
}

.c-marker-2 {
  stroke-dasharray: 7 4;
}

.c-marker-label {
  fill: var(--ink-2);
  font-size: 12px;
}

.c-band {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1;
  stroke-dasharray: 4 2;
}

.c-band-bg {
  fill: var(--signal-soft);
}

.c-hatch {
  stroke: var(--signal);
  stroke-opacity: 0.5;
  stroke-width: 1;
}

.c-line {
  stroke: var(--accent);
  stroke-width: 1.75;
  fill: none;
}

.c-obs {
  fill: var(--surface);
  stroke: var(--signal);
  stroke-width: 2.25;
}

.c-s1 { fill: var(--stage-1); }
.c-s2 { fill: var(--stage-2); }
.c-s3 { fill: var(--stage-3); stroke: var(--stage-2); stroke-width: 1; }
.c-neg { fill: var(--surface-2); stroke: var(--rule-strong); stroke-width: 1; stroke-dasharray: 3 2; }
.c-t1 { fill: var(--stage-1-ink); }
.c-t2 { fill: var(--stage-2-ink); }
.c-t3 { fill: var(--stage-3-ink); }
.c-tn { fill: var(--ink); }

.c-seg-label {
  font-size: 12px;
  font-weight: 600;
}

.c-bar {
  fill: var(--accent);
}

.c-bar-track {
  fill: var(--surface-2);
}

.c-unit {
  fill: var(--accent);
}

.c-open {
  fill: var(--signal);
}

@media (prefers-reduced-motion: no-preference) {
  .card.fresh .c-ci,
  .card.fresh .c-band-area,
  .card.fresh .c-bar,
  .card.fresh .c-seg {
    animation: draw-x 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
    transform-box: fill-box;
    transform-origin: left center;
  }
  .card.fresh .c-ci {
    transform-origin: center;
  }
  .card.fresh .fig-value {
    animation: fade-in 0.45s ease-out both;
  }
}

@keyframes draw-x {
  from {
    transform: scaleX(0.02);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* program output */
.program {
  margin: 0 0 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  background: var(--surface);
  overflow: hidden;
}

.program-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
  padding: 0.4rem 0.5rem 0.4rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
}

.program-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0;
}

.program-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.program-tools button {
  min-height: 36px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8125rem;
}

.cli-text {
  padding: 0.9rem 1rem;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
  max-height: 28rem;
  overflow: auto;
}

.warnings {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}

.warnings > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 550;
}

.warnings pre {
  padding: 0.75rem;
  background: var(--surface-2);
  border-radius: var(--r-s);
  font-size: 0.8125rem;
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.downloads button {
  font-size: 0.9375rem;
}

.downloads .hint {
  flex-basis: 100%;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 0 0 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  background: var(--surface);
}

.result-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.875rem;
}

.result-table caption {
  text-align: left;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
}

.result-table th,
.result-table td {
  padding: 0.45rem 0.9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.result-table tr:last-child > * {
  border-bottom: 0;
}

.result-table thead th {
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}

.result-table tbody th {
  font-weight: 500;
  color: var(--ink-2);
  width: 45%;
}

.result-table td {
  font-variant-numeric: tabular-nums;
}

.report h3 {
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--ink-2);
  letter-spacing: 0;
}

.report pre {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-m);
  font-size: 0.8125rem;
  line-height: 1.6;
  max-height: 30rem;
  overflow: auto;
}

/* ------------------------------------------------------------------ job bar */
.job-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: calc(100% - 2rem);
  padding: 0.4rem 0.45rem 0.4rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.45);
  z-index: 15;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.job-pulse {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--signal);
  flex: none;
}

@media (prefers-reduced-motion: no-preference) {
  .job-pulse {
    animation: pulse 1.2s ease-in-out infinite;
  }
}

.job-bar button {
  min-height: 40px;
  padding: 0.25rem 1rem;
  border-radius: 999px;
  border-color: var(--paper);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}

/* ------------------------------------------------------------------ footer */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  padding: 2.5rem 0 3rem;
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.5rem 3rem;
}

.footer-title {
  margin: 0 0 0.6rem;
  font-size: var(--step-1);
}

.citation {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 60ch;
}

.footer-version {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.footer-links {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
  margin: 0;
  padding: 0;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-privacy {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.875rem;
}

@media (max-width: 48rem) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------------ printable report */
.report-dialog {
  width: min(100% - 1.5rem, 54rem);
  max-width: none;
  max-height: calc(100% - 1.5rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-l);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
}

.report-dialog::backdrop {
  background: rgba(13, 20, 19, 0.55);
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.report-toolbar-title {
  flex: 1 1 auto;
  margin: 0;
  font-weight: 600;
}

.sheet {
  /* the sheet always uses the light palette, as on paper */
  --paper: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --ink: #16201e;
  --ink-2: #364240;
  --muted: #55625e;
  --rule: #c6d0cc;
  --rule-strong: #7c8c87;
  --accent: #0b5d5b;
  --accent-ink: #ffffff;
  --accent-soft: #d9eae6;
  --accent-text: #0a5553;
  --signal: #a9670f;
  --signal-soft: #f3e3c4;
  --signal-text: #7c4a06;
  --stage-1: #0b5d5b;
  --stage-2: #4a948b;
  --stage-3: #93c6bd;
  --stage-1-ink: #ffffff;
  --stage-2-ink: #16201e;
  --stage-3-ink: #16201e;
  --error: #a1271f;
  color-scheme: light;
  margin: 1.25rem auto;
  width: calc(100% - 2.5rem);
  max-width: 46rem;
  padding: clamp(1.25rem, 4vw, 2.75rem);
  background: var(--surface);
  color: var(--ink);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-size: 0.875rem;
  line-height: 1.5;
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem 1rem;
  padding-bottom: 0.9rem;
  margin-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.6rem;
}

.sheet-brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.25rem;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--accent-text);
}

.sheet-brand svg {
  width: 1.1rem;
  height: 1.1rem;
}

.sheet-date {
  margin: 0;
  text-align: right;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.sheet h3 {
  margin: 1.35rem 0 0.5rem;
  font-size: 1.05rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--rule);
}

.sheet-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}

.sheet-fields label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.sheet-fields input {
  min-height: 34px;
  max-width: none;
  padding: 0.2rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  font-size: 0.9375rem;
}

.sheet-fields .wide {
  grid-column: 1 / -1;
}

.sheet table {
  width: 100%;
  border-collapse: collapse;
}

.sheet th,
.sheet td {
  padding: 0.3rem 0.5rem 0.3rem 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.sheet th {
  width: 38%;
  font-weight: 500;
  color: var(--ink-2);
}

.sheet td {
  font-variant-numeric: tabular-nums;
}

.sheet pre {
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.sheet .fig-value {
  font-size: 2.6rem;
}

.sheet .figure.secondary .fig-value {
  font-size: 2.1rem;
}

.sheet .card-notes {
  font-size: 0.8125rem;
}

.sheet-foot {
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 0.75rem;
  color: var(--muted);
}

.sheet-foot p {
  margin: 0 0 0.35rem;
}

@media (max-width: 40rem) {
  .sheet-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .sheet {
    width: calc(100% - 1rem);
    margin: 0.5rem auto;
  }
}

/* ------------------------------------------------------------------ print */
@media print {
  :root,
  :root[data-theme="dark"],
  :root:not([data-theme="light"]) {
    --paper: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f4f3;
    --ink: #000000;
    --ink-2: #222222;
    --muted: #444444;
    --rule: #bbbbbb;
    --rule-strong: #888888;
    --accent: #0b5d5b;
    --accent-ink: #ffffff;
    --accent-soft: #e3efec;
    --accent-text: #0b5d5b;
    --signal: #a9670f;
    --signal-soft: #f3e3c4;
    --signal-text: #7c4a06;
    --stage-1: #0b5d5b;
    --stage-2: #4a948b;
    --stage-3: #93c6bd;
    --stage-1-ink: #ffffff;
    --stage-2-ink: #16201e;
    --stage-3-ink: #16201e;
    color-scheme: light;
  }

  @page {
    size: A4;
    margin: 14mm 14mm 16mm;
  }

  body {
    background: #ffffff;
    font-size: 10.5pt;
  }

  .skip-link,
  .topbar,
  .site-header,
  .tools-nav,
  .notices,
  .job-bar,
  .site-footer,
  .tool-form,
  .empty-state,
  .program-tools,
  .card-actions,
  .downloads,
  .status {
    display: none !important;
  }

  main {
    padding: 0;
  }

  .tool-body {
    display: block;
  }

  .card,
  .program,
  .table-wrap {
    box-shadow: none;
    break-inside: avoid;
  }

  .cli-text {
    max-height: none;
    overflow: visible;
    white-space: pre-wrap;
  }

  /* With the report open, print only the sheet. */
  body.printing-report > *:not(#report-dialog) {
    display: none !important;
  }

  body.printing-report #report-dialog {
    position: static;
    display: block;
    width: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #ffffff;
    overflow: visible;
  }

  body.printing-report #report-dialog::backdrop {
    background: transparent;
  }

  body.printing-report .report-toolbar {
    display: none;
  }

  body.printing-report .sheet {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    font-size: 9.5pt;
  }

  .sheet h3,
  .sheet .chart,
  .sheet table,
  .sheet .figures {
    break-inside: avoid;
  }

  a {
    color: inherit;
  }

  :focus,
  :focus-visible {
    outline: none !important;
    box-shadow: none !important;
  }
}
