/* Marketing landing (templates/ui/marketing/landing.html). A dark-only, standalone page:
   app.css is not loaded, so these rules own the whole document. CSP-safe: no inline
   styles; stagger delays come from data-i, not style="--i: …". */

/* Fonts: self-hosted only (no CDN reaches users in Iran reliably) */
@font-face { font-family: 'Vazirmatn'; src: url("../fonts/Vazirmatn-Regular-web.5e09c13332c3.woff2") format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url("../fonts/Vazirmatn-Medium-web.e81fc9c6ad37.woff2") format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url("../fonts/Vazirmatn-SemiBold-web.674695bdff10.woff2") format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Vazirmatn'; src: url("../fonts/Vazirmatn-Bold-web.dd6a827b1ada.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Estedad'; src: url("../fonts/Estedad-Bold-web.20a7f7a84f29.woff2") format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Estedad'; src: url("../fonts/Estedad-ExtraBold-web.a5b19d650d23.woff2") format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url("../fonts/JetBrainsMono-Medium-web.de6bd3de2261.woff2") format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url("../fonts/JetBrainsMono-Bold-web.863d237d2109.woff2") format('woff2'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;

  /* Radix slate (dark) */
  --slate-1: #111113;
  --slate-2: #18191b;
  --slate-3: #212225;
  --slate-4: #272a2d;
  --slate-5: #2e3135;
  --slate-6: #363a3f;
  --slate-7: #43484e;
  --slate-8: #5a6169;
  --slate-11: #b0b4ba;
  --slate-12: #edeef0;

  /* Radix iris (dark): brand hue, outside the clinical severity band */
  --iris-6: #3d3e82;
  --iris-7: #4a4a95;
  --iris-9: #5b5bd6;
  --iris-10: #6e6ade;
  --iris-11: #b1a9ff;
  --iris-12: #e0dffe;

  /* Severity scales (dark): never used for decoration */
  --red-3: #3b1219;
  --red-6: #72232d;
  --red-7: #8c333a;
  --red-9: #e5484d;
  --red-11: #ff9592;
  --red-12: #ffd1d9;
  --orange-6: #66350c;
  --orange-11: #ffa057;
  --green-7: #28684a;
  --green-9: #30a46c;
  --green-11: #3dd68c;

  /* Patient-monitor trace colours follow device convention, not brand or severity */
  --trace-ecg: #3dd68c;
  --trace-pleth: #4ccce6;
  --trace-co2: #ffca16;
  --screen: #070809;

  --bg: var(--slate-1);
  --surface: var(--slate-2);
  --text: var(--slate-12);
  --text-muted: var(--slate-11);

  --font-sans: 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Estedad', 'Vazirmatn', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Vazirmatn', ui-monospace, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* Shared with the app (DR-07): same names and values as frontend/src/tokens/brand.css
     and motion.css; ui/tests/test_review_p3.py pins that they agree */
  --brand: #5b5bd6;
  --brand-deep: #4a4a95;
  --brand-gradient: linear-gradient(145deg, var(--brand), var(--brand-deep));
  --weight-brand: 700;
  --duration-fast: 120ms;
  --duration: 200ms;
  --duration-slow: 320ms;

  /* Direction helpers: "forward" is left in RTL, right in LTR */
  --dir: -1;
  --flip: 1;
  --origin-start: right;
  --to-end: to left;
}
[dir="ltr"] {
  --dir: 1;
  --flip: -1;
  --origin-start: left;
  --to-end: to right;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background:
    radial-gradient(60rem 30rem at 50% -10rem, rgba(91, 91, 214, 0.16), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.75;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { line-height: 1.6; }
::selection { background: var(--iris-6); color: var(--iris-12); }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--iris-10); outline-offset: 3px; }
section[id], [id="demo"] { scroll-margin-top: 5rem; }

/* Stagger index for the load-in, panel and reveal delays */
[data-i="1"] { --i: 1; }
[data-i="2"] { --i: 2; }
[data-i="3"] { --i: 3; }
[data-i="4"] { --i: 4; }
[data-i="5"] { --i: 5; }

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.625rem 1rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  background: var(--iris-9);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.icon {
  width: 1.125em;
  height: 1.125em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Latin clinical literals (doses, units, vitals) stay LTR and never reorder */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  direction: ltr;
  unicode-bidi: isolate;
}
/* Persian prose counts read in the view's direction, so "۶۰۰+" matches running text */
.fa-num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
html[lang="fa"] .num:is(div, dd, p) { text-align: right; }

.container {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}
@media (max-width: 30rem) {
  .container { padding: 0 1.25rem; }
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.4; text-wrap: balance; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    box-shadow var(--duration) ease,
    transform 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn-sm { min-height: 2.25rem; padding: 0.375rem 0.875rem; font-size: 0.85rem; }
.btn-lg { min-height: 3.25rem; padding: 0.875rem 1.75rem; font-size: 1.05rem; }
.btn-primary {
  background: var(--iris-9);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 24px -8px rgba(91, 91, 214, 0.65);
}
.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--slate-6);
  color: var(--text);
}
.btn-ghost { background: transparent; color: var(--text-muted); }
.icon-forward { transform: scaleX(var(--flip)); transition: transform var(--duration) var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 32px -8px rgba(91, 91, 214, 0.85);
  }
  .btn-outline:hover { background: var(--slate-4); border-color: var(--slate-8); }
  .btn-ghost:hover { background: var(--slate-3); color: var(--text); }
  .btn:hover .icon-forward { transform: translateX(calc(var(--dir) * 3px)) scaleX(var(--flip)); }
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(17, 17, 19, 0.7);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background-color var(--duration) ease, border-color var(--duration) ease;
}
.site-header.is-scrolled {
  background: rgba(17, 17, 19, 0.88);
  border-bottom-color: var(--slate-4);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}
.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  display: grid;
  place-items: center;
  background: var(--brand-gradient);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  line-height: 1.4;
}
.brand-name { font-family: var(--font-heading); font-size: 1.2rem; font-weight: var(--weight-brand); }
.header-tools { display: flex; align-items: center; gap: 0.5rem; }
.cta-short { display: none; }
/* Phones have no room for Sign in; the register page header links to it */
@media (max-width: 30rem) {
  .lang-label, .cta-long, .header-signin { display: none; }
  .cta-short { display: inline; }
  /* 44px phone taps (design rule 9) */
  .header-tools .btn-sm, .brand { min-height: 2.75rem; }
}

/* Hero */
.hero {
  display: grid;
  gap: 3rem;
  padding: 4rem 0 4.5rem;
  align-items: center;
}
@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 4rem;
    padding-top: 5rem;
  }
}
@media (max-width: 30rem) {
  .hero { padding-top: 2.5rem; gap: 2.5rem; }
}
.hero-text {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--iris-6);
  border-radius: 999px;
  background: rgba(91, 91, 214, 0.12);
  color: var(--iris-11);
  font-size: 0.875rem;
  font-weight: 600;
}
.live-dot {
  position: relative;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green-11);
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--green-11);
  animation: ping 2.2s var(--ease-out) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.6; }
  80%, 100% { transform: scale(2.8); opacity: 0; }
}
.hero-title {
  font-size: clamp(2.1rem, 2.4vw + 1.25rem, 3.4rem);
  font-weight: 800;
}
.hero-title em { font-style: normal; color: var(--iris-11); }
html[lang="en"] .hero-title { line-height: 1.12; letter-spacing: -0.025em; }
.hero-lead {
  color: var(--text-muted);
  font-size: 1.125rem;
  max-width: 36rem;
  text-wrap: pretty;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
.hero-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  list-style: none;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.hero-notes li { display: inline-flex; align-items: center; gap: 0.375rem; }
.hero-notes .icon { color: var(--iris-11); width: 1rem; height: 1rem; }
/* Columns follow the metric count: the card count is left out while none are published */
.metrics {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 36rem;
  margin-top: 0.75rem;
  border: 1px solid var(--slate-5);
  border-radius: 0.875rem;
  background: rgba(24, 25, 27, 0.7);
}
.metric {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 0.125rem;
  padding: 0.875rem 1rem;
  min-width: 0;
}
.metric + .metric { border-inline-start: 1px solid var(--slate-5); }
.metric dd {
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.35;
}
.metric dt { color: var(--text-muted); font-size: 0.78rem; line-height: 1.5; }
@media (max-width: 30rem) {
  .metric { padding: 0.75rem; }
  .metric dd { font-size: 1.15rem; }
}

/* Load-in: CSS only, so content never depends on the script to appear */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes rise-sm { from { opacity: 0; transform: translateY(6px); } }
@keyframes rise-scale { from { opacity: 0; transform: translateY(20px) scale(0.985); } }
@media (prefers-reduced-motion: no-preference) {
  .enter {
    animation: rise 700ms var(--ease-out) both;
    animation-delay: calc(80ms + var(--i, 0) * 70ms);
  }
  .monitor.enter {
    animation-name: rise-scale;
    animation-duration: 900ms;
  }
}

/* Patient monitor */
.monitor {
  position: relative;
  border: 1px solid var(--slate-5);
  border-radius: 1.25rem;
  background: var(--screen);
  box-shadow:
    0 30px 80px -24px rgba(0, 0, 0, 0.85),
    0 0 64px -12px rgba(91, 91, 214, 0.3);
  overflow: hidden;
  transition: border-color 500ms ease, box-shadow 500ms ease;
}
.monitor.is-alarm {
  border-color: var(--red-7);
  box-shadow:
    0 30px 80px -24px rgba(0, 0, 0, 0.85),
    0 0 72px -12px rgba(229, 72, 77, 0.45);
}
.monitor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  background: var(--slate-2);
  border-bottom: 1px solid var(--slate-4);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.monitor-id { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.led {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--green-11);
  box-shadow: 0 0 8px var(--green-11);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}
.is-alarm .led {
  background: var(--red-9);
  box-shadow: 0 0 10px var(--red-9);
  animation: blink 1s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }
/* Device-style alarm banner over the screen; out of flow so the top bar never reflows */
.alarm-chip {
  position: absolute;
  top: 0.375rem;
  right: 0.625rem; /* physical: the screen is LTR, while the chip's own direction follows the language */
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.5rem;
  border: 1px solid var(--red-6);
  border-radius: 999px;
  background: var(--red-3);
  color: var(--red-11);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.6;
  opacity: 0;
  transform: scale(0.96);
  transform-origin: right top;
  visibility: hidden;
  transition: opacity var(--duration) var(--ease-out), transform var(--duration) var(--ease-out), visibility 0s linear var(--duration);
}
.alarm-chip .icon { width: 0.9rem; height: 0.9rem; }
html[lang="fa"] .alarm-chip { direction: rtl; }
.is-alarm .alarm-chip {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}
.patient-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-inline-start: auto;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.patient-tag .sep { opacity: 0.8; }

.wave-area {
  position: relative;
  height: 15rem;
  background: var(--screen);
}
@media (max-width: 30rem) {
  .wave-area { height: 12.5rem; }
}
.wave-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}
.wave-grid::before, .wave-grid::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.07);
}
.wave-grid::before { top: 33.333%; }
.wave-grid::after { top: 66.666%; }
.wave-area canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ch-label {
  position: absolute;
  inset-inline-start: 0.625rem;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
  background: rgba(7, 8, 9, 0.7);
  font: 700 0.68rem/1.5 var(--font-mono);
  pointer-events: none;
}
.ch-ecg { top: 0.375rem; color: var(--trace-ecg); }
.ch-pleth { top: calc(33.333% + 0.375rem); color: var(--trace-pleth); }
.ch-co2 { top: calc(66.666% + 0.375rem); color: var(--trace-co2); }

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--slate-4);
  border-top: 1px solid var(--slate-4);
}
@media (max-width: 30rem) {
  .hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hud-cell {
  padding: 0.5rem 0.875rem 0.625rem;
  background: var(--screen);
  transition: background-color 300ms ease;
}
.hud-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font: 600 0.68rem/1.5 var(--font-mono);
}
.hud-val {
  margin-top: 0.125rem;
  font: 700 1.6rem/1.1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  transition: color 300ms ease, opacity 300ms ease;
}
.hud-unit { margin-inline-start: 0.125rem; color: var(--slate-11); font-weight: 500; opacity: 0.75; }
.hud-cell[data-ch="hr"] .hud-val { color: var(--trace-ecg); }
.hud-cell[data-ch="spo2"] .hud-val { color: var(--trace-pleth); }
.hud-cell[data-ch="co2"] .hud-val { color: var(--trace-co2); }
.hud-cell[data-ch="nibp"] .hud-val { color: var(--slate-12); }
.hud-cell.is-measuring .hud-val { opacity: 0.4; }
.is-alarm .hud-cell[data-alarm] { animation: alarm-flash 1.2s ease-in-out infinite; }
.is-alarm .hud-cell[data-alarm] .hud-val { color: var(--red-11); }
@keyframes alarm-flash { 50% { background-color: var(--red-3); } }
.beat {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
  stroke: none;
  color: var(--trace-ecg);
  transition: color 300ms ease;
}
.is-alarm .beat { color: var(--red-11); }

/* Scenario tabs */
.tabs {
  position: relative;
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--slate-2);
  border-top: 1px solid var(--slate-4);
  border-bottom: 1px solid var(--slate-4);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.375rem 0.875rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease, transform 160ms var(--ease-out);
}
.tab:active { transform: scale(0.97); }
.tab[aria-selected="true"] { color: var(--slate-12); }
.tab[data-tab="crisis"][aria-selected="true"] { color: var(--red-11); }
@media (hover: hover) and (pointer: fine) {
  .tab:hover { color: var(--slate-12); }
}
/* Positioned in physical pixels from offsetLeft, so it uses left rather than a logical inset */
.tab-indicator {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  border: 1px solid var(--iris-7);
  border-radius: 0.5rem;
  background: rgba(91, 91, 214, 0.2);
  pointer-events: none;
}
.tab-indicator.is-ready {
  transition:
    transform 300ms var(--ease-out),
    width 300ms var(--ease-out),
    background-color 250ms ease,
    border-color 250ms ease;
}
@media (max-width: 30rem) {
  .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .tab {
    justify-content: center;
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    hyphens: auto;
  }
  .tab .icon { display: none; }
  .hero-actions .btn { flex: 1 1 auto; }
}
.tab-indicator.is-crisis { background: rgba(229, 72, 77, 0.16); border-color: var(--red-7); }
html:not(.js) .tab-indicator { display: none; }
html:not(.js) .tab[aria-selected="true"] { background: rgba(91, 91, 214, 0.2); }

/* Panels share one grid cell so the monitor never changes height between tabs */
.panels { display: grid; padding: 1rem; background: var(--slate-1); }
.panel { grid-area: 1 / 1; display: grid; gap: 0.75rem; align-content: start; }
.panel[hidden] { display: grid; visibility: hidden; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); filter: blur(2px); } }
@media (prefers-reduced-motion: no-preference) {
  .panel:not([hidden]) { animation: panel-in 260ms var(--ease-out); }
  .panel:not([hidden]) .seq {
    animation: rise-sm 360ms var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 45ms);
  }
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--red-6);
  border-inline-start: 4px solid var(--red-9);
  border-radius: 0.625rem;
  background: var(--red-3);
  color: var(--red-12);
  font-size: 0.875rem;
  line-height: 1.7;
}
.alert > .icon { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; color: var(--red-11); }
.alert strong { display: block; color: #fff; font-size: 0.95rem; }

.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}
@media (min-width: 36rem) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--slate-4);
  border-radius: 0.625rem;
  background: var(--slate-2);
}
.tile-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.5;
}
.tile-label .icon { width: 0.875rem; height: 0.875rem; }
.tile-val { color: #fff; font: 700 1.05rem/1.4 var(--font-mono); white-space: nowrap; }
.tile-sub { color: var(--text-muted); font-size: 0.72rem; line-height: 1.5; }
.tile-sub.num { font-size: 0.68rem; }
.nowrap { white-space: nowrap; }
.tile.is-warning { border-color: var(--orange-6); }
.tile.is-warning .tile-label,
.tile.is-warning .tile-val { color: var(--orange-11); }

.crisis {
  display: grid;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--red-6);
  border-inline-start: 4px solid var(--red-9);
  border-radius: 0.625rem;
  background: var(--red-3);
}
.crisis-head { display: flex; align-items: center; gap: 0.5rem; color: var(--red-11); font-weight: 700; line-height: 1.5; }
.crisis-head .icon { width: 1.25rem; height: 1.25rem; }
.crisis-steps { display: grid; gap: 0.5rem; list-style: none; }
.crisis-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.625rem;
  align-items: start;
  color: var(--red-12);
  font-size: 0.875rem;
  line-height: 1.8;
}
.crisis-steps strong { color: #fff; }
.step-dot {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red-9);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.dose-chip {
  display: inline-block;
  padding: 0 0.375rem;
  border: 1px solid var(--red-7);
  border-radius: 0.3rem;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font: 700 0.85em/1.6 var(--font-mono);
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}

.weight {
  display: grid;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--slate-5);
  border-radius: 0.625rem;
  background: var(--slate-2);
}
.weight-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.875rem;
}
.weight-out {
  flex: none;
  min-width: 4.75rem;
  padding: 0.125rem 0.625rem;
  border-radius: 0.375rem;
  background: var(--iris-9);
  color: #fff;
  text-align: center;
  font: 700 0.95rem/1.6 var(--font-mono);
  direction: ltr;
  unicode-bidi: isolate;
}
.range {
  --fill: 40%;
  width: 100%;
  height: 1.75rem;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.range:focus-visible { outline: none; }
.range::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: 999px;
  background: linear-gradient(var(--to-end), var(--iris-9) var(--fill), var(--slate-5) var(--fill));
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.375rem;
  height: 1.375rem;
  margin-top: -0.5rem;
  border: 3px solid var(--iris-9);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 150ms var(--ease-out), box-shadow 150ms ease;
}
.range:active::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(91, 91, 214, 0.3); }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--iris-7); }
.range::-moz-range-track { height: 0.375rem; border-radius: 999px; background: var(--slate-5); }
.range::-moz-range-progress { height: 0.375rem; border-radius: 999px; background: var(--iris-9); }
.range::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 3px solid var(--iris-9);
  border-radius: 50%;
  background: #fff;
}
.range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--iris-7); }
.calc-note {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.calc-note .icon { width: 0.875rem; height: 0.875rem; }

/* Sections */
.section {
  padding-block: clamp(4rem, 8vw, 6.5rem);
  border-top: 1px solid var(--slate-4);
}
.section-cta { border-top: 0; padding-top: 0; }
.overline {
  margin-bottom: 0.5rem;
  color: var(--iris-11);
  font-size: 0.875rem;
  font-weight: 600;
}
html[lang="en"] .overline { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; }
.section-title {
  margin-bottom: 0.75rem;
  font-size: clamp(1.6rem, 1.5vw + 1rem, 2.25rem);
  font-weight: 800;
}
html[lang="en"] .section-title { line-height: 1.2; letter-spacing: -0.02em; }
.section-desc {
  max-width: 44rem;
  margin-bottom: 2.75rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}

/* Scroll reveal (opt-in from the head script; content stays visible without it) */
html.motion .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
html.motion .reveal.is-in { opacity: 1; transform: none; }

/* Decision loop */
.steps {
  position: relative;
  display: grid;
  gap: 1.5rem;
  list-style: none;
}
@media (min-width: 48rem) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps::before {
    content: '';
    position: absolute;
    top: calc(1.25rem - 1px);
    inset-inline-start: 1.25rem;
    width: calc(66.667% + 1rem);
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(var(--to-end), var(--iris-9), var(--iris-7));
    transform-origin: var(--origin-start);
  }
  html.motion .steps::before {
    transform: scaleX(0);
    transition: transform 1200ms var(--ease-in-out) 250ms;
  }
  html.motion .steps.is-in::before { transform: scaleX(1); }
}
.step { display: grid; gap: 1rem; align-content: start; }
.step-node {
  position: relative;
  z-index: 1;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--iris-7);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--iris-9);
  color: #fff;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 6px var(--bg);
}
html.motion .step-node {
  background: var(--slate-2);
  border-color: var(--slate-6);
  color: var(--text-muted);
  transition: background-color 300ms ease, border-color 300ms ease, color 300ms ease;
  transition-delay: calc(250ms + var(--i, 0) * 550ms);
}
html.motion .steps.is-in .step-node {
  background: var(--iris-9);
  border-color: var(--iris-7);
  color: #fff;
}
.step-body {
  display: grid;
  gap: 0.625rem;
  height: 100%;
  padding: 1.5rem;
  border: 1px solid var(--slate-4);
  border-radius: 1rem;
  background: var(--surface);
  transition: border-color var(--duration) ease;
}
.step-body h3 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.2rem; font-weight: 700; }
.step-body h3 .icon { color: var(--iris-11); }
.step-body p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.8; }
@media (hover: hover) and (pointer: fine) {
  .step-body:hover { border-color: var(--iris-7); }
}

/* Six card types */
.types { display: grid; gap: 1.25rem; }
@media (min-width: 48rem) { .types { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 64rem) { .types { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.type-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--slate-4);
  border-radius: 1rem;
  background: var(--surface);
  transition: border-color var(--duration) ease, box-shadow 300ms ease;
}
.type-card > :not(.spot) { position: relative; }
/* Cursor spotlight; moved with transform in physical pixels */
.spot {
  position: absolute;
  left: 0;
  top: 0;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(91, 91, 214, 0.16), transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.type-card.is-hover .spot { opacity: 1; }
.type-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.type-icon {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--slate-5);
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  background: var(--slate-3);
  color: var(--iris-11);
}
.type-icon .icon { width: 1.25rem; height: 1.25rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--slate-5);
  border-radius: 999px;
  background: var(--slate-3);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.6;
}
.badge .icon { width: 0.875rem; height: 0.875rem; }
.badge-crisis { border-color: var(--red-6); background: var(--red-3); color: var(--red-11); }
.type-card[data-type="crisis"] .type-icon { border-color: var(--red-6); background: var(--red-3); color: var(--red-11); }
.type-card h3 { font-size: 1.2rem; font-weight: 700; }
.type-card p { flex: 1; color: var(--text-muted); font-size: 0.95rem; line-height: 1.8; }
.type-eg {
  padding-top: 0.75rem;
  border-top: 1px dashed var(--slate-5);
  color: var(--text-muted);
  font-size: 0.8rem;
}
@media (hover: hover) and (pointer: fine) {
  .type-card:hover { border-color: var(--slate-7); box-shadow: 0 24px 48px -24px rgba(0, 0, 0, 0.8); }
}

/* Emergency view simulator */
.sim {
  display: grid;
  gap: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border: 1px solid var(--slate-5);
  border-radius: 1.25rem;
  background: var(--surface);
  transition: background-color 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
  view-transition-name: sim;
}
.sim[data-mode="emergency"] {
  background: #000;
  border-color: var(--red-7);
  box-shadow: 0 0 0 1px var(--red-6), 0 0 64px -12px rgba(229, 72, 77, 0.4);
}
.sim-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
}
.sim-title { margin: 0.5rem 0; font-size: clamp(1.6rem, 1.5vw + 1rem, 2.25rem); font-weight: 800; }
.sim-desc { max-width: 40rem; color: var(--text-muted); }
.sim[data-mode="emergency"] .sim-desc { display: none; }
.sim[data-mode="emergency"] .sim-title { font-size: clamp(1.9rem, 2vw + 1.1rem, 2.75rem); }
#sim-toggle[aria-pressed="true"] { background: transparent; border-color: var(--red-7); box-shadow: none; }
#sim-toggle[aria-pressed="true"] .when-off,
#sim-toggle[aria-pressed="false"] .when-on { display: none; }

.progress { display: grid; gap: 0.5rem; }
.progress-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: color var(--duration) ease;
}
.progress-label .icon { display: none; width: 1rem; height: 1rem; }
.progress.is-done .progress-label { color: var(--green-11); }
.progress.is-done .progress-label .icon { display: block; }
.progress-track { height: 0.375rem; overflow: hidden; border-radius: 999px; background: var(--slate-4); }
.progress-fill {
  height: 100%;
  background: var(--iris-9);
  transform: scaleX(0);
  transform-origin: var(--origin-start);
  transition: transform 400ms var(--ease-out), background-color 300ms ease;
}
.sim[data-mode="emergency"] .progress-fill { background: var(--red-9); }
.progress.is-done .progress-fill { background: var(--green-9); }

.checklist { display: grid; gap: 0.625rem; list-style: none; }
.check {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-height: 3.5rem; /* 56px gloved touch target */
  padding: 0.75rem 1.125rem;
  border: 1px solid var(--slate-5);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 150ms ease,
    background-color var(--duration) ease,
    font-size 0s,
    transform 140ms var(--ease-out);
}
.check:active { transform: scale(0.985); }
.check input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.check-box {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--slate-8);
  border-radius: 0.375rem;
  display: grid;
  place-items: center;
  color: #fff;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.check-box .icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 3;
  stroke-dasharray: 24;
  stroke-dashoffset: -24;
  transition: stroke-dashoffset 240ms var(--ease-out);
}
.check input:checked + .check-box { background: var(--green-9); border-color: var(--green-9); }
.check input:checked + .check-box .icon { stroke-dashoffset: 0; }
.check input:focus-visible + .check-box { outline: 2px solid var(--iris-10); outline-offset: 3px; }
.check:has(input:checked) { border-color: var(--green-7); background: rgba(48, 164, 108, 0.1); }
.check:has(input:checked) .check-text { color: var(--text-muted); }
.check-text { line-height: 1.7; transition: color var(--duration) ease; }
.check-step { margin-inline-end: 0.375rem; color: var(--slate-12); font-weight: 700; }
@media (hover: hover) and (pointer: fine) {
  .check:hover { border-color: var(--slate-7); }
}
.sim[data-mode="emergency"] .check {
  min-height: 4rem;
  border-color: var(--slate-6);
  background: #0b0b0c;
  font-size: 1.15rem;
}
.sim[data-mode="emergency"] .check-box { width: 1.875rem; height: 1.875rem; }
::view-transition-group(sim) { animation-duration: 320ms; animation-timing-function: var(--ease-out); }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: var(--duration); }

/* Final CTA */
.cta {
  display: grid;
  gap: 1.25rem;
  justify-items: center;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem;
  border: 1px solid var(--iris-6);
  border-radius: 1.5rem;
  background:
    radial-gradient(40rem 18rem at 50% 0%, rgba(91, 91, 214, 0.28), transparent 70%),
    var(--surface);
  text-align: center;
}
.cta h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2.4rem); font-weight: 800; }
.cta p { max-width: 38rem; color: var(--text-muted); font-size: 1.1rem; }
.cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

/* Footer */
.site-footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--slate-4);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.site-footer p + p { margin-top: 0.5rem; font-size: 0.82rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .live-dot::after { display: none; }
  .is-alarm .led { animation: none; }
  .is-alarm .hud-cell[data-alarm] { animation: none; background-color: var(--red-3); }
  .btn:active, .tab:active, .check:active { transform: none; }
  .btn:hover .icon-forward { transform: scaleX(var(--flip)); }
  .tab-indicator.is-ready { transition: background-color var(--duration) ease, border-color var(--duration) ease; }
  .alarm-chip { transform: none; }
  .progress-fill, .check-box .icon { transition-property: background-color; }
}
