/* The Amyloid Heart: graphite and chalk on tinted drawing paper. */

@font-face { font-family: "Newsreader"; src: url("../assets/fonts/Newsreader-normal.woff2") format("woff2"); font-weight: 300 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("../assets/fonts/Newsreader-italic.woff2") format("woff2"); font-weight: 300 600; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../assets/fonts/IBMPlexSans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../assets/fonts/IBMPlexSans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("../assets/fonts/IBMPlexSans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../assets/fonts/IBMPlexMono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("../assets/fonts/IBMPlexMono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("../assets/fonts/Caveat-normal.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../assets/fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #e7e5df;
  --paper-2: #f4f2ed;
  --paper-3: #dcd8cf;
  --sky: #dcdbd6;
  --ink: #22272b;
  --ink-2: #4b555b;
  --ink-3: #75828a;
  --rule: #aeaaa0;
  --chalk: #fafaf6;
  --congo: #b23a2e;
  --congo-2: #d98a80;
  --green: #6b962c;
  --echo: #15191c;
  --focus: #1f6f8b;
  --grain: 0.07;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;

  --gutter: clamp(16px, 2.2vw, 30px);
  --panel-w: clamp(340px, 31vw, 460px);
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: clamp(2rem, 1.4rem + 1.6vw, 2.75rem);
  --step-4: clamp(2.1rem, 1.5rem + 1.3vw, 2.85rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b2024;
    --paper-2: #232a2f;
    --paper-3: #2c3439;
    --sky: #1b2024;
    --ink: #e6e7e2;
    --ink-2: #b3bcc0;
    --ink-3: #87949b;
    --rule: #4c5860;
    --chalk: #ffffff;
    --congo: #e2665a;
    --congo-2: #8f3d34;
    --green: #a7cf5c;
    --echo: #0c0e10;
    --focus: #7fc4dc;
    --grain: 0.10;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #1b2024;
  --paper-2: #232a2f;
  --paper-3: #2c3439;
  --sky: #1b2024;
  --ink: #e6e7e2;
  --ink-2: #b3bcc0;
  --ink-3: #87949b;
  --rule: #4c5860;
  --chalk: #ffffff;
  --congo: #e2665a;
  --congo-2: #8f3d34;
  --green: #a7cf5c;
  --echo: #0c0e10;
  --focus: #7fc4dc;
  --grain: 0.10;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  /* a slightly darker band at the top, as in draft 2 */
  background-image: linear-gradient(180deg, var(--sky) 0%, var(--paper) 42%);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* paper tooth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain);
  transition: opacity 0.9s ease;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.4 -0.2'/></filter><rect width='240' height='240' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; filter: invert(1); } }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--congo); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ layout */
.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-columns: var(--panel-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "mast  stage"
    "panel stage"
    "bar   bar";
}
.masthead { grid-area: mast; padding: var(--gutter) var(--gutter) 10px; }
.stage { grid-area: stage; position: relative; min-height: 0; container-type: size; }
.panel {
  grid-area: panel;
  min-height: 0;
  overflow-y: auto;
  padding: 6px var(--gutter) 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.transport { grid-area: bar; }

/* ---------------------------------------------------------------- masthead */
.eyebrow {
  margin: 0 0 6px;
  font: 500 0.6875rem/1.3 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.title {
  margin: 0;
  white-space: nowrap;
  font: 400 var(--step-4)/0.98 var(--serif);
  /* one line in the side panel: the title is about 8.4 font-sizes wide */
  font-size: min(var(--step-4), calc((var(--panel-w) - 2 * var(--gutter)) / 8.6));
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.title em { font-style: italic; font-weight: 400; }
.subtitle {
  margin: 8px 0 0;
  font: 400 0.8125rem/1.35 var(--sans);
  color: var(--ink-2);
}
.subtitle .dot { color: var(--congo); padding: 0 0.35em; }
/* draft 1: the site address, in Inter 500, the face of the InVision wordmark and of the name
   written in on the closing slide */
.site-url { margin: 0; font: 500 0.8125rem/1.3 var(--iv-sans); color: var(--ink-2); white-space: nowrap; }
.site-url .tld { color: var(--ink-3); }
.site-url-top { align-self: center; margin-right: 8px; }
.site-url-flow { display: none; }

.tools {
  position: absolute;
  top: var(--gutter);
  right: var(--gutter);
  z-index: 5;
  display: flex;
  gap: 8px;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 17px;
  background: color-mix(in srgb, var(--paper-2) 82%, transparent);
  color: var(--ink);
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tool:hover { border-color: var(--ink-2); }
.tool svg { width: 15px; height: 15px; }

/* ------------------------------------------------------------------ stage */
.fig {
  position: absolute;
  inset: 0;
  margin: 0;
  display: none;
}
.fig.is-active { display: block; }
@media (min-width: 821px) { .fig { top: 62px; } }
.fig canvas.fig-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gl-host { position: absolute; inset: 0; }
.gl-host canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.fig .poster {
  position: absolute;
  inset: 6% 8% 8%;
  width: 84%;
  height: 86%;
  object-fit: contain;
  opacity: 0.95;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.fig.gl-ready .poster { opacity: 0; }
.fig-note {
  position: absolute;
  left: var(--gutter);
  bottom: 12px;
  margin: 0;
  font: 500 0.625rem/1.3 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.overlay svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tag {
  position: absolute;
  transform: translate(-50%, -50%);
  font: 600 1.28rem/1 var(--hand);
  color: var(--ink);
  white-space: nowrap;
  text-shadow: 0 0 3px var(--paper), 0 0 6px var(--paper);
}
.tag small { display: block; font: 400 0.95rem/1.1 var(--hand); color: var(--ink-2); }
.tag.is-flag { color: var(--congo); }
.tag.is-left { text-align: right; }
.leader { stroke: var(--ink); stroke-width: 1.1; fill: none; opacity: 0.75; }
.leader-dot { fill: var(--ink); }

/* view switcher on the figure (echo) */
.fig-bar {
  position: absolute;
  top: calc(var(--gutter) + 44px);
  right: var(--gutter);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: calc(100% - 2 * var(--gutter));
}
.echo-split { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.echo-split > div { position: relative; min-width: 0; }
/* a stage taller than wide stacks the imaging plane over the echo, not two slivers */
@container (max-aspect-ratio: 19 / 20) {
  .echo-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44% 56%; }
}
.pane-label {
  position: absolute;
  top: 14px;
  left: 18px;
  margin: 0;
  font: 500 0.625rem/1 var(--sans);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------ chapters */
.chapter { display: none; }
.chapter.is-active { display: block; animation: settle 0.3s ease both; }
@keyframes settle { from { opacity: 0.6; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.ch-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: end;
  gap: 14px;
  margin: 14px 0 12px;
  padding-top: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.ch-num {
  font: italic 400 3.2rem/0.92 var(--serif);
  font-variation-settings: "opsz" 72;
  color: var(--congo);
}
.ch-title { margin: 0; font: 500 var(--step-2)/1.05 var(--serif); letter-spacing: -0.01em; }
.ch-kicker { margin: 3px 0 0; font: 500 0.6875rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); }
.dek { margin: 0 0 16px; font: 400 var(--step-1)/1.4 var(--serif); text-wrap: pretty; }

.prose { max-width: 62ch; }
.prose p { margin: 0 0 0.85em; text-wrap: pretty; }
.prose h3 {
  margin: 1.4em 0 0.5em;
  font: 600 0.75rem/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.prose ol, .prose ul { margin: 0 0 0.9em; padding-left: 1.25em; }
.prose li { margin: 0.25em 0; }
.prose ol.steps { list-style: none; counter-reset: step; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 8px; background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.prose ol.steps li { counter-increment: step; position: relative; padding-left: 1.7em; }
.prose ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; font: 500 0.875rem/1.7 var(--mono); color: var(--congo); }
.prose strong { font-weight: 600; }
.cite { font: 500 0.66em/0 var(--sans); vertical-align: super; margin-left: 1px; }
.cite a { text-decoration: none; color: var(--congo); }
.cite a:hover { text-decoration: underline; }
.note { font: 400 0.8125rem/1.45 var(--sans); color: var(--ink-2); }

/* readouts */
.readouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}
.readout {
  padding: 8px 10px 9px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--paper-2) 70%, transparent);
  min-width: 0;
}
.readout dt { margin: 0 0 4px; font: 500 0.625rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }   /* long labels wrap, never truncate */
.readout dd { margin: 0; font: 500 1.0625rem/1.1 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout dd small { font: 400 0.6875rem var(--mono); color: var(--ink-2); margin-left: 3px; }
.readout.is-flag dd { color: var(--congo); }
.readout.text dd { font: 500 0.9rem/1.25 var(--sans); white-space: normal; }

.live {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 2px solid var(--congo);
  background: color-mix(in srgb, var(--paper-2) 60%, transparent);
  font: 400 0.9375rem/1.45 var(--serif);
  min-height: 3.4em;
}
.live b { font-weight: 600; }
.live .k-red { color: var(--congo); font-weight: 600; }
.live .k-green { color: var(--green); font-weight: 600; }

/* controls */
.controls { display: grid; gap: 12px; margin: 0 0 18px; }
/* a switch for phones, where the figure shows one half at a time */
@media (min-width: 821px) { .narrow-only { display: none; } }
.control label, .control .label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font: 500 0.6875rem/1.2 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.control label output, .control .label output { font: 500 0.75rem var(--mono); letter-spacing: 0; color: var(--ink); text-transform: none; }
.ticks { display: flex; justify-content: space-between; margin-top: 4px; font: 400 0.6875rem/1 var(--sans); color: var(--ink-3); }
/* 03: read-only burden loop */
.sweep-bar { position: relative; height: 3px; margin: 10px 0 8px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.sweep-bar i { position: absolute; inset: 0 auto 0 0; width: var(--fill, 0%); background: var(--congo); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, var(--ink) 0 var(--fill, 0%), var(--rule) var(--fill, 0%) 100%);
  border-radius: 1px;
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--rule); border-radius: 1px; }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  border: 2px solid var(--congo);
  background: var(--paper-2);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--congo); background: var(--paper-2); }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: color-mix(in srgb, var(--paper-2) 70%, transparent);
}
.seg button {
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-2);
  font: 500 0.75rem/1 var(--sans);
  letter-spacing: 0.02em;
  cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font: 500 0.75rem/1 var(--sans); color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--congo); width: 15px; height: 15px; margin: 0; }

/* red flag list */
.flags { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; counter-reset: flag; }
.flags li { counter-increment: flag; }
.flags button {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 400 0.9rem/1.35 var(--serif);
  text-align: left;
  cursor: pointer;
}
.flags button::before {
  content: counter(flag);
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--congo);
  border-radius: 50%;
  font: 600 0.6875rem/1 var(--sans);
  color: var(--congo);
}
.flags button:hover, .flags button[aria-pressed="true"] { border-color: var(--rule); background: color-mix(in srgb, var(--paper-2) 70%, transparent); }
.flags li.is-off button { opacity: 0.45; }

/* score calculator */
.score { width: 100%; border-collapse: collapse; font: 400 0.875rem/1.3 var(--sans); margin: 4px 0 10px; }
.score th, .score td { padding: 6px 4px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: middle; }
.score th { font: 500 0.625rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.score td.num, .score th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.score input { width: 5.2em; padding: 3px 5px; border: 1px solid var(--rule); border-radius: 4px; background: var(--paper-2); color: var(--ink); font: 500 0.8125rem var(--mono); text-align: right; }
.score tr.hit td.pts { color: var(--congo); font-weight: 600; }
.score tfoot td { border-bottom: 0; font-weight: 600; }
.verdict { margin: 0 0 12px; font: 500 0.9375rem/1.4 var(--serif); }
.verdict b { color: var(--congo); }

.mimics { width: 100%; border-collapse: collapse; font: 400 0.84rem/1.35 var(--serif); }
.mimics th, .mimics td { padding: 7px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; text-align: left; }
.mimics th { font: 500 0.625rem/1.2 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 0 12px; }

.quiz { display: grid; gap: 12px; }
.q { padding: 10px 12px; border: 1px solid var(--rule); border-radius: 8px; }
.q p { margin: 0 0 8px; }
.q .opts { display: flex; flex-wrap: wrap; gap: 6px; }
.q .opts button { padding: 6px 10px; border: 1px solid var(--rule); border-radius: 6px; background: transparent; color: var(--ink); font: 500 0.8125rem/1.2 var(--sans); cursor: pointer; text-align: left; }
.q .opts button.right { border-color: var(--green); color: var(--green); }
.q .opts button.wrong { border-color: var(--congo); color: var(--congo); text-decoration: line-through; }
.q .why { margin: 8px 0 0; font: 400 0.84rem/1.4 var(--serif); color: var(--ink-2); }

/* ---------------------------------------------------------------- transport */
.transport {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 0 var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 10px 18px 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  backdrop-filter: blur(6px);
}
/* draft 1: the sponsor line at the foot of the screen, in the page's own face and ink; the
   closing slide turns it to the InVision colors (see :root[data-ch="contact"] .foot) */
.foot {
  grid-area: foot;
  position: relative;
  z-index: 6;
  margin: 0;
  padding: 6px var(--gutter) calc(8px + env(safe-area-inset-bottom, 0px));
  font: 500 0.75rem/16px var(--sans);
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--ink-2);
}
.foot p { margin: 0; }
.foot .org { color: var(--ink); }
:root[data-ch="contact"] .foot .org { color: var(--iv-teal-text); }
@media (min-width: 821px) {
  .app.with-foot {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "mast  stage"
      "panel stage"
      "bar   bar"
      "foot  foot";
  }
  .app.with-foot .transport { margin-bottom: 0; }
}
.play {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.play svg { width: 16px; height: 16px; }
.play:disabled { opacity: 0.3; cursor: default; }
.play .i-pause { display: none; }
.play[aria-pressed="true"] .i-play { display: none; }
.play[aria-pressed="true"] .i-pause { display: block; }
.chapters { position: relative; list-style: none; margin: 0; padding: 0 0 14px; display: grid; grid-template-columns: repeat(var(--n-ch, 9), minmax(0, 1fr)); }
.chapters button {
  width: 100%;
  padding: 2px 4px 6px 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  text-align: left;
  cursor: pointer;
}
.chapters .n { display: block; font: 500 0.625rem/1.2 var(--sans); letter-spacing: 0.1em; }
.chapters .t { display: block; font: 400 0.9375rem/1.2 var(--serif); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapters button[aria-current="step"] .n { color: var(--congo); }
.chapters button[aria-current="step"] .t { color: var(--ink); font-weight: 500; }
.chapters button:hover .t { color: var(--ink); }
.track { position: absolute; left: 0; right: 0; bottom: 4px; height: 12px; pointer-events: none; }
.track svg { width: 100%; height: 100%; overflow: visible; }
.track .line { stroke: var(--rule); stroke-width: 1.2; fill: none; }
.track .done { stroke: var(--ink); stroke-width: 1.4; fill: none; }
.track .dot { fill: var(--paper-2); stroke: var(--congo); stroke-width: 2; }
.hint {
  position: absolute;
  left: 50%;
  bottom: calc(-14px - env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 100%);
  margin: 0;
  white-space: nowrap;
  font: 500 0.5625rem/1 var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: none;
}

/* ------------------------------------------------------------------ dialog */
dialog {
  width: min(760px, calc(100% - 2 * var(--gutter)));
  max-height: min(84vh, 900px);
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--paper-2);
  color: var(--ink);
}
dialog::backdrop { background: color-mix(in srgb, var(--paper) 55%, transparent); backdrop-filter: blur(2px); }
.dlg-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--rule); background: var(--paper-2); }
.dlg-head h2 { margin: 0; font: 500 var(--step-1)/1.2 var(--serif); }
.dlg-body { padding: 14px 22px 22px; overflow-y: auto; }
.plates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 1em 0 0.4em; }
.plates figure { margin: 0; }
.plates img { display: block; width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--rule); }
.plates figcaption { margin-top: 6px; font: 500 0.72rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.reflist { margin: 0; padding-left: 1.6em; font: 400 0.84rem/1.45 var(--serif); }
.reflist li { margin: 0 0 0.55em; padding-left: 0.2em; }
.reflist li:target { background: color-mix(in srgb, var(--congo) 14%, transparent); }
.reflist .ids { font: 400 0.75rem var(--mono); color: var(--ink-2); }

/* sponsor disclosure (draft 1): first in the Sources dialog, so the sponsor comes before the sources */
.dlg-sub {
  margin: 4px 0 12px;
  font: 600 0.75rem/1.2 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.disclosure { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.disc-lead { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 16px; }
/* a 56 px box holds about 30 px of ink; the negative margins trim the empty bearings */
.disc-lead .iv-mark { flex: none; width: 56px; height: 56px; margin: -8px 0 -12px -8px; }
.disc-lead p { margin: 0; font: 400 1.0625rem/1.45 var(--serif); text-wrap: pretty; }
.disc { display: grid; grid-template-columns: 7.25rem minmax(0, 1fr); gap: 9px 16px; margin: 0; }
.disc > div { display: contents; }
.disc dt { padding-top: 0.2em; font: 500 0.6875rem/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.disc dd { margin: 0; font: 400 0.875rem/1.5 var(--serif); text-wrap: pretty; }
.disc a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 2px; }
.disc a:hover { text-decoration-color: currentColor; }
.disc-copy { margin: 16px 0 0; font: 400 0.75rem/1.4 var(--sans); color: var(--ink-3); }
.disc .nw { white-space: nowrap; }
@media (max-width: 560px) {
  .dlg-body { padding: 14px 16px 20px; }
  .disc-lead p { font-size: 1rem; }
  .disc { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .disc dd { margin-bottom: 9px; }
}

/* ------------------------------------------------- closing slide: InVision (draft 1) */
/* The last stop turns the page to the InVision look: white (or the dark clinical ground in
   Slate), Inter, one teal. Brand rules: #2dc1b3 decorates, #0f766e speaks on white; the
   wordmark is Inter 500 in one colour. */
:root {
  --iv-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --iv-bg: #ffffff;
  --iv-text: #16202b;
  --iv-text-2: #3b4854;
  --iv-muted: #5b6b78;
  --iv-teal: #2dc1b3;
  --iv-teal-text: #0f766e;
  --iv-band: #f0f7f5;
  --iv-border: #d7ebe6;
  --iv-btn: #0f766e;
  --iv-btn-text: #ffffff;
  --iv-btn-hover: #0c5f58;
  --iv-graphite: #4a5056;   /* the pencil of the drawings, carried onto the closing slide */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --iv-bg: #0a0e14;
    --iv-text: #e6edf6;
    --iv-text-2: #a9b6c8;
    --iv-muted: #6c7d93;
    --iv-teal-text: #2dc1b3;
    --iv-band: #141b26;
    --iv-border: #263143;
    --iv-btn: #14b8a6;
    --iv-btn-text: #04201c;
    --iv-btn-hover: #2dc1b3;
    --iv-graphite: #b3bbc3;
  }
}
:root[data-theme="dark"] {
  --iv-bg: #0a0e14;
  --iv-text: #e6edf6;
  --iv-text-2: #a9b6c8;
  --iv-muted: #6c7d93;
  --iv-teal-text: #2dc1b3;
  --iv-band: #141b26;
  --iv-border: #263143;
  --iv-btn: #14b8a6;
  --iv-btn-text: #04201c;
  --iv-btn-hover: #2dc1b3;
  --iv-graphite: #b3bbc3;
}
/* the page chrome (tools, chapter bar) takes the InVision palette on the last stop */
:root[data-ch="contact"] {
  --paper: #ffffff;
  --paper-2: #f5f8f7;
  --sky: #ffffff;
  --ink: #16202b;
  --ink-2: #3b4854;
  --ink-3: #5b6b78;
  --rule: #d7ebe6;
  --congo: #0f766e;
  --focus: #0f766e;
  --grain: 0;
}
@media (prefers-color-scheme: dark) {
  :root[data-ch="contact"]:not([data-theme="light"]) {
    --paper: #0a0e14;
    --paper-2: #141b26;
    --sky: #0a0e14;
    --ink: #e6edf6;
    --ink-2: #a9b6c8;
    --ink-3: #6c7d93;
    --rule: #263143;
    --congo: #2dc1b3;
    --focus: #38bdf8;
    --grain: 0;
  }
}
:root[data-ch="contact"][data-theme="dark"] {
  --paper: #0a0e14;
  --paper-2: #141b26;
  --sky: #0a0e14;
  --ink: #e6edf6;
  --ink-2: #a9b6c8;
  --ink-3: #6c7d93;
  --rule: #263143;
  --congo: #2dc1b3;
  --focus: #38bdf8;
  --grain: 0;
}
:root[data-ch="contact"] body { background-image: none; }
body, .tool, .transport, .play, .chapters .n, .chapters .t, .foot, .foot .org {
  transition: background-color 0.9s ease, color 0.9s ease, border-color 0.9s ease;
}

.chapter-contact.is-active {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  align-items: center;
  overflow-y: auto;
  padding: calc(var(--gutter) + 52px) var(--gutter) 128px;
  background: var(--iv-bg);
  color: var(--iv-text);
  font-family: var(--iv-sans);
  animation: iv-in 0.9s ease both;
}
:root[data-theme="dark"] .chapter-contact.is-active { background: radial-gradient(120% 90% at 18% 0%, #101826 0%, #0a0e14 62%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chapter-contact.is-active { background: radial-gradient(120% 90% at 18% 0%, #101826 0%, #0a0e14 62%); }
}
@keyframes iv-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes iv-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes iv-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes iv-grey { from { color: var(--iv-text); } to { color: var(--iv-muted); } }
@keyframes iv-write { from { clip-path: inset(-30% 100% -30% 0); } to { clip-path: inset(-30% 0 -30% 0); } }

.iv {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(28px, 6vw, 96px);
  align-items: center;
}
.iv-brand { display: flex; flex-direction: column; align-items: center; text-align: center; container-type: inline-size; }
/* the artwork fills about half the box: a 132 px mark needs a 244 px element */
.iv-brand .iv-mark { width: 244px; height: 244px; margin: -48px 0 -30px; display: block; }
.iv-wordmark { margin: 0; font: 500 clamp(2.75rem, 2rem + 2.6vw, 4.25rem)/1 var(--iv-sans); letter-spacing: -0.01em; color: var(--iv-teal-text); }
.iv-tagline { margin: 14px 0 0; font: 500 1rem/1.35 var(--iv-sans); color: var(--iv-muted); }
/* the site name, rewritten: "identify amyloid" in Inter 500, the face of the site address in the
   header; a graphite pencil strike through "identify", which greys as it is struck; and the
   InVision wordmark (Inter 500, one teal) written in above it */
.iv-rename {
  margin: 0.95em 0 0;   /* room for the name written in above the line */
  font: 500 clamp(2rem, 12.5cqi, 3.25rem)/1 var(--iv-sans);   /* the line is about 6.8 em wide: 85% of the column */
  letter-spacing: -0.02em;
  color: var(--iv-text);
  white-space: nowrap;
}
.iv-was { position: relative; display: inline-block; }
.iv-old { color: var(--iv-muted); }
.iv-strike { position: absolute; left: -5%; width: 108%; top: 0.4em; height: 0.34em; overflow: visible; }
.iv-strike path { fill: none; stroke: var(--iv-graphite); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 1; }
.iv-strike .s2 { stroke-width: 3; opacity: 0.85; }
.iv-new {
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -0.06em);
  font: 500 0.78em/1 var(--iv-sans);
  letter-spacing: -0.02em;
  color: var(--iv-teal-text);
}
.iv-copy { max-width: 60ch; }
.iv-eyebrow {
  margin: 0;
  font: 600 0.75rem/1.2 var(--iv-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--iv-teal-text);
}
.iv-eyebrow::before { content: ""; display: block; width: 56px; height: 3px; margin-bottom: 18px; background: var(--iv-teal); border-radius: 2px; }
.iv-title {
  margin: 12px 0 14px;
  font: 600 clamp(1.75rem, 1.15rem + 1.7vw, 2.6rem)/1.12 var(--iv-sans);
  letter-spacing: -0.02em;
  color: var(--iv-text);
  text-wrap: balance;
}
.iv-dek { margin: 0; font: 400 1.0625rem/1.55 var(--iv-sans); color: var(--iv-text-2); text-wrap: pretty; }
.iv-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.iv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 1.5px solid var(--iv-btn);
  border-radius: 10px;
  background: var(--iv-btn);
  color: var(--iv-btn-text);
  font: 600 0.9375rem/1.2 var(--iv-sans);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.iv-btn:hover { background: var(--iv-btn-hover); border-color: var(--iv-btn-hover); }
.iv-btn.iv-ghost { background: transparent; border-color: var(--iv-teal); color: var(--iv-teal-text); }
.iv-btn.iv-ghost:hover { background: var(--iv-band); }
.iv-note { margin: 12px 0 0; font: 400 0.8125rem/1.45 var(--iv-sans); color: var(--iv-muted); }
.iv-mail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  margin: 22px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--iv-border);
  border-radius: 10px;
  background: var(--iv-band);
  font: 400 0.9375rem/1.3 var(--iv-sans);
}
.iv-label { font: 600 0.6875rem/1 var(--iv-sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--iv-muted); }
.iv-addr { font-weight: 500; color: var(--iv-text); user-select: all; }
.iv-copy-btn {
  margin-left: auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--iv-teal);
  border-radius: 8px;
  background: transparent;
  color: var(--iv-teal-text);
  font: 600 0.8125rem/1 var(--iv-sans);
  cursor: pointer;
}
.iv-copy-btn:hover { background: var(--iv-bg); }
.iv-more { margin: 14px 0 0; font: 500 0.9375rem/1.4 var(--iv-sans); }
.iv-more a { color: var(--iv-teal-text); text-decoration-color: var(--iv-teal); }
.iv-more a::after { content: " \2192"; }
.iv-legal {
  margin: 26px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--iv-border);
  font: 400 0.6875rem/1.5 var(--iv-sans);
  color: var(--iv-muted);
}
.chapter-contact.is-active :focus-visible { outline-color: var(--iv-teal); }
/* the brand arrives first, then the words */
.chapter-contact.is-active .iv-mark { animation: iv-rise 0.8s 0.15s ease both; }
.chapter-contact.is-active .iv-wordmark { animation: iv-rise 0.8s 0.3s ease both; }
.chapter-contact.is-active .iv-rename { animation: iv-rise 0.8s 0.3s ease both; }
.chapter-contact.is-active .iv-old { animation: iv-grey 0.6s 1.05s ease both; }
.chapter-contact.is-active .iv-strike .s1 { animation: iv-draw 0.42s 1.05s cubic-bezier(0.5, 0, 0.3, 1) both; }
.chapter-contact.is-active .iv-strike .s2 { animation: iv-draw 0.3s 1.45s cubic-bezier(0.5, 0, 0.3, 1) both; }
.chapter-contact.is-active .iv-new { animation: iv-write 0.6s 1.75s ease-out both; }
.chapter-contact.is-active .iv-tagline { animation: iv-rise 0.8s 0.42s ease both; }
.chapter-contact.is-active .iv-eyebrow { animation: iv-rise 0.8s 0.4s ease both; }
.chapter-contact.is-active .iv-title { animation: iv-rise 0.8s 0.5s ease both; }
.chapter-contact.is-active .iv-dek { animation: iv-rise 0.8s 0.6s ease both; }
.chapter-contact.is-active .iv-actions,
.chapter-contact.is-active .iv-note { animation: iv-rise 0.8s 0.72s ease both; }
.chapter-contact.is-active .iv-mail,
.chapter-contact.is-active .iv-more,
.chapter-contact.is-active .iv-legal { animation: iv-rise 0.8s 0.84s ease both; }

/* the tenth stop in the chapter bar carries the mark in place of a number */
/* flow-root keeps the mark's negative margins inside the numeral row; a 22 px box holds 12 px of ink */
.chapters .go-iv .n { display: flow-root; height: 0.75rem; }
.chapters .go-iv .iv-mark { display: block; width: 22px; height: 22px; margin: -6px 0 -4px -3px; }

@media (max-width: 820px) {
  .chapter-contact.is-active { align-items: start; padding: 64px var(--gutter) calc(96px + env(safe-area-inset-bottom, 0px)); }
  .iv { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .iv-brand { flex-direction: row; justify-content: flex-start; gap: 4px; text-align: left; flex-wrap: wrap; }
  .iv-brand .iv-mark { width: 88px; height: 88px; margin: -18px -8px -18px -12px; }
  .iv-wordmark { font-size: 2.25rem; }
  .iv-rename { font-size: min(2rem, 7.4vw); margin-left: 2px; }
  .iv-tagline { flex-basis: 100%; margin-top: 4px; }
  .iv-btn { flex: 1 1 100%; }
  .chapters .go-iv .n { height: 0.9rem; }
  .chapters .go-iv .iv-mark { margin: -5px auto -3px; }
}
@media (prefers-reduced-motion: reduce) {
  .chapter-contact.is-active, .chapter-contact.is-active * { animation: none !important; }
  body, body::before, .tool, .transport, .play, .chapters .n, .chapters .t, .foot, .foot .org { transition: none; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1400px) and (min-width: 821px) {
  .eyebrow-long { display: none; }   /* the full eyebrow wraps in a narrow side panel */
}
@media (max-width: 1100px) {
  :root { --panel-w: clamp(320px, 38vw, 400px); }
  .chapters .t { font-size: 0.8125rem; }
}
@media (max-width: 820px) {
  html, body { height: auto; }
  .app {
    height: auto;
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "mast" "stage" "panel" "bar";
  }
  .masthead { padding-right: 120px; }
  .eyebrow { padding-right: 40px; }
  .title { font-size: var(--step-3); }
  /* the tool buttons shrink to icons: the address moves under the subtitle */
  .site-url-top { display: none; }
  .site-url-flow { display: block; margin-top: 3px; }
  .stage { position: sticky; top: 0; z-index: 3; height: min(46vh, 420px); background: var(--paper); border-bottom: 1px solid var(--rule); }
  .panel { overflow: visible; padding-bottom: 110px; }
  .transport {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-radius: 12px 12px 0 0;
    border-width: 1px 0 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }
  /* draft 1: the sponsor line is the last line of the fixed bottom bar, under the chapter numbers */
  .foot {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(22px + env(safe-area-inset-bottom, 0px));
    padding: 0 12px env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--paper-2) 88%, transparent);
    backdrop-filter: blur(6px);
  }
  .app.with-foot .transport { bottom: calc(22px + env(safe-area-inset-bottom, 0px)); padding-bottom: 4px; }
  .app.with-foot .panel { padding-bottom: 132px; }
  .app.with-foot .chapter-contact.is-active { padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)); }
  .play { width: 38px; height: 38px; }
  .chapters .t { display: none; }
  .chapters .n { font-size: 0.75rem; text-align: center; }
  .chapters button { text-align: center; padding: 6px 0 8px; }
  .fig-bar { top: 10px; right: 10px; left: 10px; justify-content: center; }
  .echo-split { grid-template-columns: 1fr; grid-template-rows: 38% 62%; }
  .readouts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tools { top: 14px; right: 14px; }
  .tool .t { display: none; }
  .tag { font-size: 1.02rem; }
  .tag small { font-size: 0.8rem; }
}
@media (max-width: 480px) {
  /* one-line masthead rows, so the figure and the text share the screen;
     the title shrinks to clear the tool buttons */
  .masthead { padding-top: 14px; padding-bottom: 8px; padding-right: var(--gutter); }
  .eyebrow { padding-right: 100px; margin-bottom: 4px; }
  .eyebrow-long { display: none; }
  .title { font-size: clamp(1.25rem, 11.8vw - 15px, 1.625rem); }
  .subtitle { margin-top: 4px; }
}
@media (max-width: 420px) {
  /* three tiles a row; long labels wrap instead of truncating */
  .readouts { gap: 6px; }
  .readout { padding: 7px 8px; }
  .readout dt { letter-spacing: 0.1em; }
  .readout dd { font-size: 1rem; }
  .readout.text dd { font-size: 0.8125rem; }
  .ch-num { font-size: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .chapter.is-active { animation: none; }
  .fig .poster { transition: none; }
}
