:root {
  --paper: #f3eee4;
  --paper-2: #e7dfd0;
  --ink: #1b1612;
  --muted: #5c5349;
  --rule: #d4cbb8;
  --sys: #9d2f32;
  --sys-soft: #c45a55;
  --dia: #2a5364;
  --dia-soft: #4f7d90;
  --pp: #c57a32;
  --mercury: #6f7f76;
  --ok: #2f5d3a;
  --warn: #8a4a12;
  --crisis: #7a1d22;
  --panel: #fffaf1;
  --shadow: 0 18px 40px rgba(40, 28, 16, 0.08);
  --serif: Fraunces, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --cond: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  --max: 72rem;
  --read: 42rem;
  --bar: 3.1rem;
}
:root[data-theme="dark"] {
  --paper: #121416;
  --paper-2: #1b1f24;
  --ink: #efe6d8;
  --muted: #b3a89a;
  --rule: #2c333b;
  --sys: #e07a74;
  --sys-soft: #c45a55;
  --dia: #7eb0c8;
  --dia-soft: #4f7d90;
  --pp: #e0a05a;
  --mercury: #9aada3;
  --ok: #8fbf96;
  --warn: #e0a05a;
  --crisis: #f0a0a0;
  --panel: #181c21;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(155, 47, 50, 0.035) 1px, transparent 1px);
  background-size: 100% 28px;
  opacity: 0.45;
  z-index: 0;
}
:root[data-theme="dark"] body::before { opacity: 0.12; }
.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  background: var(--ink);
  color: var(--paper);
  padding: 0.4rem 0.7rem;
}
.skip-link:focus { top: 0.5rem; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--bar);
  padding: 0 0.9rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.82rem;
}
.home { color: var(--ink); text-decoration: none; font-weight: 500; white-space: nowrap; }
.topnav {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a[aria-current="true"], .topnav a:hover { color: var(--ink); }
.spacer { flex: 1; }
.langs { display: flex; gap: 0.45rem; }
.chip {
  color: var(--muted);
  text-decoration: none;
  padding: 0.15rem 0.25rem;
}
.chip[aria-current="true"] { color: var(--ink); font-weight: 500; }
.icon-btn, .ghost, .btn {
  font-family: var(--sans);
  border: 0;
  cursor: pointer;
}
.icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
.page { position: relative; z-index: 1; }
main { padding: 1.25rem 1rem 4rem; }
section { scroll-margin-top: calc(var(--bar) + 0.8rem); }
.hero, .result, .prose, .panel, .close, footer, .logger, .faq { max-width: var(--read); margin-inline: auto; }
.wide { max-width: var(--max); margin-inline: auto; }
.kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sys);
  margin: 0 0 0.7rem;
}
h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.12; }
h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); margin: 0 0 0.8rem; }
h2 { font-size: clamp(1.5rem, 4vw, 2.15rem); margin: 2.4rem 0 0.7rem; }
h3 { font-size: 1.2rem; margin: 1.4rem 0 0.45rem; }
p { margin: 0 0 1rem; }
.standfirst { font-size: 1.2rem; max-width: 40rem; }
.tiny { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.entry {
  margin: 1.4rem 0 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.entry details { margin-top: 0.6rem; }
.entry summary { cursor: pointer; }
.bp-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--cond);
}
.bp-row input {
  width: 6.2rem;
  font: 700 3.4rem/1 var(--cond);
  border: 0;
  border-bottom: 3px solid var(--sys);
  background: transparent;
  color: var(--ink);
  padding: 0.1rem 0;
  appearance: textfield;
  border-radius: 0;
}
.bp-row input[data-kind="dbp"] { border-bottom-color: var(--dia); }
.bp-row input[data-kind="pulse"] {
  width: 4.4rem;
  font-size: 1.7rem;
  border-bottom-color: var(--muted);
}
.bp-row input::-webkit-outer-spin-button,
.bp-row input::-webkit-inner-spin-button { appearance: none; }
.slash { font: 700 2.6rem/1 var(--cond); color: var(--muted); }
.unit { font-family: var(--sans); font-size: 0.95rem; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0; }
.opts label, .seg {
  font-family: var(--sans);
  font-size: 0.85rem;
  border: 1px solid var(--rule);
  padding: 0.35rem 0.6rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.opts input { accent-color: var(--sys); }
.btn {
  display: inline-block;
  margin-top: 0.4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1rem;
  font-size: 1rem;
  font-weight: 500;
}
.btn:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid var(--sys);
  outline-offset: 2px;
}
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
}
.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.notice {
  margin: 0.8rem 0 0;
  padding: 0.7rem 0.8rem;
  border-left: 3px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, var(--panel));
  font-size: 0.98rem;
}
.crisis {
  border-left-color: var(--crisis);
  background: color-mix(in srgb, var(--crisis) 12%, var(--panel));
}
.reading {
  font-family: var(--cond);
  font-weight: 700;
  font-size: clamp(3rem, 12vw, 6.2rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
  margin: 0.3rem 0 0.4rem;
}
.reading .sys { color: var(--sys); }
.reading .dia { color: var(--dia); }
.colloq { font-style: italic; color: var(--muted); margin-bottom: 1rem; }
.colloq:empty { display: none; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}
.metric {
  padding: 0.55rem 0.1rem 0.2rem;
  border-top: 1px solid var(--rule);
}
.metric b { display: block; font-family: var(--cond); font-size: 1.55rem; }
.metric span { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); }
.cat {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: baseline;
  margin: 1rem 0;
}
.cat strong { font-size: 1.35rem; }
.cat .aha, .cat .esc { font-family: var(--sans); font-size: 0.9rem; }
.wave-wrap, .lab, .split, .matrix, .logger, .faq details {
  background: var(--panel);
  border: 1px solid var(--rule);
}
.wave-wrap { padding: 0.7rem; margin: 1rem 0 1.5rem; }
canvas, svg.wave { width: 100%; height: auto; display: block; }
.controls { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.sliders { display: grid; gap: 0.85rem; margin: 1rem 0; }
.sliders label { font-family: var(--sans); font-size: 0.82rem; }
input[type="range"] { width: 100%; accent-color: var(--sys); }
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
  margin: 1rem 0;
}
.split article { padding: 1rem; }
.split article + article { border-left: 1px solid var(--rule); }
.artery {
  height: 4.2rem;
  margin: 0.6rem 0;
  border-radius: 999px;
  border: 2px solid var(--ink);
  position: relative;
  overflow: hidden;
}
.artery i {
  position: absolute;
  inset: 18% 8%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--sys) 55%, var(--dia));
  transform-origin: center;
}
.elastic i { animation: pulse 1.8s ease-in-out infinite; }
.stiff i { transform: scaleY(0.55) scaleX(0.92); background: var(--sys); }
@keyframes pulse {
  0%, 100% { transform: scaleY(0.7) scaleX(0.92); }
  50% { transform: scaleY(1) scaleX(1); }
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 0.8rem 0 1.2rem;
}
th, td { text-align: left; padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-family: var(--sans); font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.num { font-family: var(--cond); font-variant-numeric: tabular-nums; }
.checklist { list-style: none; padding: 0; }
.checklist li { display: flex; gap: 0.55rem; margin: 0.35rem 0; font-family: var(--sans); font-size: 0.95rem; }
.matrix { display: grid; grid-template-columns: 1fr 1fr; }
.matrix button, .matrix div {
  min-height: 6.2rem;
  padding: 0.8rem;
  border: 0;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.matrix button[aria-pressed="true"] { background: color-mix(in srgb, var(--pp) 18%, var(--panel)); }
.cuff {
  height: 9rem;
  position: relative;
  margin: 1rem 0;
  background: linear-gradient(#cfc6b6, #b7ad9c);
  overflow: hidden;
}
.cuff .col {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 40%;
  background: #4b5852;
}
.cuff .osc {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--ink);
  opacity: 0.7;
}
.mercury {
  width: 3.2rem;
  height: 12rem;
  margin: 1rem 0;
  border: 1px solid var(--ink);
  position: relative;
  background: #efe8da;
}
.mercury .fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  background: #4d5a54;
}
.risk {
  height: 4.6rem;
  margin: 1rem 0;
  background: linear-gradient(90deg, #d7ead4, #f3e0b0 45%, #e7b3a8);
  position: relative;
}
.risk b {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
}
.risk span {
  position: absolute;
  top: 100%;
  font-family: var(--sans);
  font-size: 0.72rem;
  transform: translateX(-50%);
  margin-top: 0.2rem;
}
.faq details { padding: 0.7rem 0.9rem; margin: 0.4rem 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.sources a { color: var(--dia); }
.ev { display: none; font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin: 0.3rem 0 0.8rem; }
html[data-evidence="on"] .ev { display: block; }
.noscript {
  max-width: var(--read);
  margin: 1rem auto;
  padding: 0.8rem 1rem;
  border: 1px dashed var(--rule);
}
footer {
  margin: 3rem auto 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--muted);
}
footer a { color: inherit; }
.day-plot { display: flex; align-items: flex-end; gap: 0.28rem; height: 7rem; margin: 1rem 0; }
.day-plot i {
  flex: 1;
  background: var(--sys);
  min-height: 8%;
  opacity: 0.85;
}
.or-demo b[data-on="1"] { background: color-mix(in srgb, var(--sys) 18%, transparent); padding: 0 0.15rem; }
@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .split article + article { border-left: 0; border-top: 1px solid var(--rule); }
  .bp-row input, .slash { font-size: 2.8rem; }
  .bp-row input { width: 4.8rem; }
  .langs { max-width: 38vw; overflow-x: auto; scrollbar-width: none; }
  .chip { font-size: 0.72rem; }
}
@media print {
  .topbar, .btn, .ghost, .sliders, .controls, .icon-btn { display: none !important; }
  body { background: white; }
  body::before { display: none; }
}
