/* =================================================================
   RytmoECG landing; premium dark, animated ECG, ECG-paper aesthetic.
   ================================================================= */

:root {
  --bg:        #07090D;
  --bg-alt:    #0B0E13;
  --bg-card:   #11161F;
  --bg-deep:   #050709;
  --line:      rgba(255, 255, 255, 0.06);
  --line-x:    rgba(255, 255, 255, 0.12);
  --line-xx:   rgba(255, 255, 255, 0.20);
  --ink:       #ECEEF2;
  --mute:      #9099A8;
  --dim:       #5C6573;
  --glow:      #6EE7B7;
  --glow-soft: rgba(110, 231, 183, 0.18);
  --warm:      #F59E0B;
  --amber:     #FBBF24;
  --cool:      #60A5FA;
  --bad:       #EF4444;
  --max:       1120px;
  /* Border-radius scale. Outer containers softer, inner tighter; pills round. */
  --radius-sm:   8px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-pill: 999px;
  /* Custom easing curves; built-in CSS ease-out is too weak for intentional motion.
     Emil Kowalski's recommended set:
       --ease-out:    quick start, smooth land. Use for UI feedback.
       --ease-in-out: balanced; use for elements moving across the screen.
       --ease-drawer: iOS feel; use for drawers, sheets, popovers. */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Global focus ring for keyboard accessibility (WCAG AA per PRODUCT.md). */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--glow);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 28px; }

::selection { background: var(--glow); color: var(--bg); }

/* =================== NAV =================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand {
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand.small { font-size: 14px; color: var(--mute); }
.pulse-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 0 rgba(110, 231, 183, 0.55);
  animation: pulse 1.6s infinite;
}
/* Heartbeat-shaped pulse: quick double-tap then rest. lub-dub. */
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(110, 231, 183, 0.65); }
  10%  { box-shadow: 0 0 0 6px rgba(110, 231, 183, 0.18); }
  20%  { box-shadow: 0 0 0 0   rgba(110, 231, 183, 0.00); }
  30%  { box-shadow: 0 0 0 4px rgba(110, 231, 183, 0.14); }
  40%  { box-shadow: 0 0 0 0   rgba(110, 231, 183, 0.00); }
  100% { box-shadow: 0 0 0 0   rgba(110, 231, 183, 0.00); }
}
.nav nav { display: flex; gap: 26px; }
.nav nav a {
  color: var(--mute);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: color 180ms var(--ease-out);
}
.nav nav a:hover { color: var(--ink); }
.nav nav a:active { color: var(--glow); }
.cta {
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  background: var(--glow);
  color: var(--bg);
  border-radius: 999px;
  text-decoration: none;
  transition:
    transform 140ms var(--ease-out),
    box-shadow 200ms var(--ease-out);
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(110, 231, 183, 0.18);
}
.cta:active { transform: scale(0.96); box-shadow: none; }

/* =================== HERO =================== */
.hero {
  padding: 96px 0 0;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(110, 231, 183, 0.10), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(96, 165, 250, 0.06), transparent 60%),
    var(--bg);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 28px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.lozenge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--glow);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-x);
  letter-spacing: 0.05em;
  font-size: 10px;
}
.lozenge.live::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--glow);
  animation: pulse 1s var(--ease-out) infinite;
}
.hero h1 {
  font-size: clamp(44px, 6.2vw, 84px);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin: 0 0 32px;
  max-width: 900px;
}
.strike {
  position: relative;
  color: var(--dim);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--warm);
}
.hero .lead {
  font-size: 20px;
  line-height: 1.5;
  color: var(--mute);
  max-width: 680px;
  margin: 0 0 36px;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 64px; }

.btn {
  display: inline-block;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition:
    transform 140ms var(--ease-out),
    background 200ms var(--ease-out),
    color 200ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    border-color 200ms var(--ease-out);
}
.btn.primary {
  background: var(--glow);
  color: var(--bg);
}
.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(110, 231, 183, 0.22);
}
.btn.primary:active {
  transform: scale(0.97);
  box-shadow: none;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-x);
}
.btn.ghost:hover { background: var(--bg-card); border-color: var(--line-xx); }
.btn.ghost:active { transform: scale(0.97); }
.btn.big { padding: 17px 30px; font-size: 15px; }

.micro {
  font-size: 12px;
  color: var(--dim);
  max-width: 560px;
  line-height: 1.6;
  margin: 0;
}

/* =================== HERO STAGE (iPhone + floating cards) =================== */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding-bottom: 80px;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; padding-bottom: 48px; }
}
.hero-copy { padding-right: 16px; }
.hero-micro { margin-top: 24px; }

.hero-stage {
  position: relative;
  height: 560px;
  perspective: 1200px;
}
@media (max-width: 900px) {
  .hero-stage { height: 520px; }
}

/* Phone frame */
.phone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 280px;
  height: 540px;
  margin-left: -140px;
  margin-top: -270px;
  background: linear-gradient(180deg, #0a0d12 0%, #060809 100%);
  border-radius: 38px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow:
    0 50px 120px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(110, 231, 183, 0.05),
    0 0 100px rgba(110, 231, 183, 0.07);
  z-index: 2;
  transition: transform 240ms ease-out;
}
.phone-notch {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 90px;
  height: 22px;
  margin-left: -45px;
  background: #04060a;
  border-radius: 999px;
  z-index: 3;
}
.phone-screen {
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 28px;
  overflow: hidden;
  padding: 50px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.phone-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 500;
  align-self: flex-start;
}
.ph-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--glow); }
.ph-dot.live-dot { animation: pulse 1.4s infinite; }
.ph-status-text { color: var(--ink); }

.phone-hr {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.ph-label {
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--warm);
  font-weight: 500;
  margin-bottom: 4px;
}
.ph-hr-row { display: flex; align-items: baseline; gap: 6px; }
.ph-hr-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 52px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.03em;
}
.ph-hr-unit { font-size: 12px; color: var(--mute); }
.ph-hr-sub {
  font-size: 10px;
  color: var(--mute);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.phone-ecg {
  width: 100%;
  height: 64px;
  border-radius: 8px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
}
.phone-ecg path {
  filter: drop-shadow(0 0 4px rgba(110, 231, 183, 0.5));
  stroke-dasharray: 100;
  animation: trace-draw 8s linear infinite;
}

.phone-stats { display: flex; gap: 6px; }
.ph-stat {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  text-align: left;
}
.ph-stat-k {
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--dim);
  font-weight: 500;
}
.ph-stat-v {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-top: 2px;
}
.ph-stat-v.ph-stat-good { color: var(--glow); }

/* Floating cards */
.fcard {
  position: absolute;
  background: rgba(17, 22, 31, 0.86);
  backdrop-filter: saturate(140%) blur(20px);
  -webkit-backdrop-filter: saturate(140%) blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  z-index: 3;
  transition:
    transform 240ms var(--ease-out),
    border-color 220ms var(--ease-out),
    box-shadow 260ms var(--ease-out);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  min-width: 110px;
}
.fcard:hover {
  border-color: rgba(110, 231, 183, 0.30);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--glow-soft);
}
.fcard-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--glow);
  font-weight: 500;
  margin-bottom: 4px;
}
.fcard-value {
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1;
}
.fcard-unit { font-size: 11px; color: var(--mute); margin-left: 2px; }
.fcard-sub { font-size: 10px; color: var(--mute); margin-top: 4px; font-family: 'Inter', sans-serif; }

.fcard-rmssd  { top: 60px;  left: -8px; }
.fcard-qtc    { top: 30px;  right: -20px; }
.fcard-sqi    { top: 250px; right: -10px; }
.fcard-lfhf   { top: 320px; left: -20px; }
.fcard-breath { top: 470px; right: 20px; }

@media (max-width: 900px) {
  .fcard { min-width: 92px; padding: 9px 11px; }
  .fcard-value { font-size: 17px; }
  .fcard-rmssd  { top: 20px;  left: 8px; }
  .fcard-qtc    { top: 10px;  right: 8px; }
  .fcard-sqi    { top: 230px; right: 0; }
  .fcard-lfhf   { top: 300px; left: 0; }
  .fcard-breath { top: 440px; right: 30px; }
}

/* ECG line that escapes the phone frame */
.escape-trace {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 700px;
  height: 100px;
  margin-left: -350px;
  margin-top: -50px;
  z-index: 1;
  opacity: 0.5;
  pointer-events: none;
}
.escape-trace .escape-path {
  filter: drop-shadow(0 0 8px rgba(110, 231, 183, 0.45));
  stroke-dasharray: 100;
  animation: trace-draw 14s linear infinite;
  /* Phone-ecg draws at 8s loop. Escape trails the on-screen line by 500ms so
     the signal feels like it propagates outward, not in lockstep. */
  animation-delay: 500ms;
}
@keyframes trace-draw {
  0%   { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}
@media (max-width: 900px) { .escape-trace { display: none; } }

/* =================== DEMO SECTION =================== */
.demo-block { padding: 96px 0; }

.demo-frame {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
}
@media (max-width: 700px) { .demo-frame { padding: 18px; } }

.demo-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.demo-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}
.demo-select {
  background: var(--bg-deep);
  color: var(--ink);
  border: 1px solid var(--line-x);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  flex: 1;
  min-width: 220px;
  cursor: pointer;
  transition: border-color 180ms var(--ease-out);
}
.demo-select:hover { border-color: var(--line-xx); }
/* Global :focus-visible above handles the focus ring; keep style consistent. */
.demo-run { padding: 11px 22px; font-size: 13px; min-width: 110px; }
.demo-run.loading { opacity: 0.7; cursor: wait; }
.demo-output { transition: opacity 200ms var(--ease-out); }
.demo-output.loading { opacity: 0.35; }

.demo-monitor {
  background: var(--bg-deep);
  border: 1px solid var(--line-x);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 18px;
}
.demo-monitor-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.demo-runlight {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  transition:
    background 200ms var(--ease-out),
    box-shadow 240ms var(--ease-out);
}
.demo-runlight.active {
  background: var(--glow);
  box-shadow: 0 0 12px var(--glow);
}
.demo-svg {
  width: 100%;
  height: 200px;
  display: block;
}

.demo-output {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 8px;
}
@media (max-width: 700px) { .demo-output { grid-template-columns: repeat(2, 1fr); } }

.demo-card {
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  min-height: 86px;
}
.dc-label {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--dim);
  font-weight: 500;
  margin-bottom: 6px;
}
.dc-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.dc-unit { font-size: 10px; color: var(--mute); margin-top: 2px; letter-spacing: 0.05em; }

.demo-card-verdict { background: linear-gradient(180deg, rgba(110, 231, 183, 0.07) 0%, var(--bg-deep) 100%); }
.demo-card-verdict .dc-value { color: var(--glow); font-size: 16px; }

.demo-footnote {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.55;
  margin: 14px 0 0;
}

/* =================== SECTION BLOCKS =================== */
.block {
  padding: 112px 0;
  border-top: 1px solid var(--line);
}
.block.alt { background: var(--bg-alt); }
.kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--glow);
  font-weight: 500;
  margin: 0 0 16px;
}
.block h2 {
  font-size: clamp(32px, 4.2vw, 52px);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.08;
  margin: 0 0 22px;
  max-width: 880px;
}
.section-lead {
  font-size: 17px;
  color: var(--mute);
  max-width: 760px;
  margin: 0 0 56px;
  line-height: 1.55;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; gap: 48px; } }

/* =================== PIPELINE =================== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 860px) { .pipeline-grid { grid-template-columns: repeat(2, 1fr); } }
.ppl {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 10px;
  transition: border-color 160ms, transform 160ms;
  position: relative;
}
.ppl:hover { border-color: var(--glow-soft); transform: translateY(-2px); }
.ppl-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--glow);
  display: block;
  margin-bottom: 10px;
}
.ppl b { display: block; font-weight: 500; font-size: 14.5px; margin-bottom: 6px; color: var(--ink); }
.ppl span { font-size: 12.5px; color: var(--mute); line-height: 1.5; }

/* =================== ANATOMY (PQRST) =================== */
.anatomy {
  margin: 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.pqrst-svg { width: 100%; height: auto; display: block; }
.wave-label { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 18px; fill: var(--ink); }
.iv-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; fill: var(--glow); letter-spacing: 0.04em; }
.iv-label.warm { fill: var(--warm); }
.iv-label.cool { fill: var(--cool); }
.scale-text { font-family: 'JetBrains Mono', monospace; font-size: 11px; fill: var(--dim); }
.anatomy figcaption { color: var(--dim); font-size: 13px; margin-top: 18px; max-width: 700px; line-height: 1.6; }

.wave-defs {
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 860px) { .wave-defs { grid-template-columns: 1fr; } }
.wd {
  background: var(--bg-card);
  border: 1px solid var(--line);
  padding: 22px;
  border-radius: 10px;
}
.wd h4 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--glow);
  letter-spacing: 0.02em;
}
.wd p { margin: 0; color: var(--mute); font-size: 13.5px; line-height: 1.6; }

/* =================== RHYTHM GALLERY =================== */
.rhythms {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .rhythms { grid-template-columns: 1fr; } }

.rhythm {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  transition: border-color 160ms, transform 160ms;
}
.rhythm:hover { border-color: var(--line-x); transform: translateY(-2px); }

.rhythm header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rhythm h3 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.005em;
}
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.tag-good  { color: var(--glow); }
.tag-warn  { color: var(--warm); }
.tag-amber { color: var(--amber); }
.tag-bad   { color: var(--bad); }

.rhythm-svg {
  width: 100%;
  height: 120px;
  background: var(--bg-deep);
  border-radius: 8px;
  display: block;
  margin-bottom: 14px;
}
.rhythm-svg path { filter: drop-shadow(0 0 4px currentColor); }
.rhythm-mark text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  fill: var(--ink);
}
.rhythm-mark .brk      { fill: var(--warm); }
.rhythm-mark .warn-t   { fill: var(--warm); }
.rhythm-mark .amber-t  { fill: var(--amber); }
.rhythm-mark .cool-t   { fill: var(--cool); }
.rhythm-mark .bad-t    { fill: var(--bad); }

.rhythm-desc {
  color: var(--mute);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 6px;
}
.rhythm-desc b { color: var(--ink); font-weight: 500; }
.rhythm-desc:last-child { margin-bottom: 0; }

/* =================== QT FIGURE =================== */
.qt-figure { margin: 0; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.qt-svg { width: 100%; height: auto; display: block; }
.qt-figure figcaption { color: var(--dim); font-size: 12.5px; margin-top: 14px; line-height: 1.6; }

/* =================== POINCARE =================== */
.poincare-figure { margin: 0; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.poincare-svg { width: 100%; height: auto; display: block; }
.poincare-figure figcaption { color: var(--dim); font-size: 12.5px; margin-top: 14px; line-height: 1.6; }

/* =================== ALGORITHMS =================== */
.algos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 860px) { .algos { grid-template-columns: 1fr; } }

.algo {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  transition:
    border-color 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}
.algo:hover {
  border-color: var(--line-x);
  transform: translateY(-1px);
}
.algo header { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 10px; }

/* Featured algos sit on top of the catalog with extra weight. */
.algos-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 56px;
}
@media (min-width: 860px) {
  .algos-featured { grid-template-columns: repeat(3, 1fr); }
}
.algo-featured {
  padding: 26px;
  border-color: var(--line-x);
  background: linear-gradient(180deg, rgba(110, 231, 183, 0.04) 0%, var(--bg-card) 100%);
}
.algo-featured h3 { font-size: 17px; }
.featured-lead {
  font-size: 14.5px !important;
  color: var(--ink) !important;
  line-height: 1.55 !important;
  margin-bottom: 14px !important;
}
.algos-catalog-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.algos-catalog-lead {
  font-size: 14px;
  color: var(--mute);
  margin: 0 0 24px;
  max-width: 540px;
}
.algo h3 { font-size: 15.5px; font-weight: 500; margin: 0; letter-spacing: -0.005em; }
.algo .unit {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--glow);
}
.algo p { margin: 0 0 8px; color: var(--mute); font-size: 13px; line-height: 1.6; }
.algo p b { color: var(--ink); font-weight: 500; }
.algo p:last-child { margin-bottom: 0; }

/* =================== PERSONAS =================== */
.personas {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 8px;
}
@media (min-width: 860px) {
  .personas { grid-template-columns: repeat(3, 1fr); }
}
.persona {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition:
    border-color 220ms var(--ease-out),
    transform 220ms var(--ease-out);
}
.persona:hover { border-color: var(--line-x); transform: translateY(-1px); }
.persona header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.persona-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 500;
}
.persona h3 { font-size: 18px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
.persona-lead {
  font-size: 13.5px;
  color: var(--ink);
  font-style: italic;
  margin: 0 0 16px;
  line-height: 1.5;
}
.persona-points {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.persona-points li {
  font-size: 13px;
  color: var(--mute);
  line-height: 1.55;
  padding-left: 18px;
  position: relative;
}
.persona-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 1px;
}

/* Persona-specific accent tinting. */
.persona-nerd .persona-icon    { background: var(--glow); color: var(--bg); }
.persona-nerd .persona-points li::before { background: var(--glow); }
.persona-patient .persona-icon { background: var(--cool); color: var(--bg); }
.persona-patient .persona-points li::before { background: var(--cool); }
.persona-athlete .persona-icon { background: var(--warm); color: var(--bg); }
.persona-athlete .persona-points li::before { background: var(--warm); }

.footnote { margin-top: 28px; font-size: 13px; color: var(--dim); max-width: 700px; line-height: 1.6; }

/* =================== HONEST LIMITS =================== */
.bad, .good { list-style: none; padding: 0; margin: 0; }
.bad li, .good li {
  padding: 14px 0 14px 28px;
  border-bottom: 1px solid var(--line);
  color: var(--mute);
  font-size: 14.5px;
  line-height: 1.55;
  position: relative;
}
.bad li:last-child, .good li:last-child { border-bottom: 0; }
.bad li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 19px;
  width: 14px; height: 2px;
  background: var(--warm);
}
.good li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px var(--glow-soft);
}

/* =================== DOWNLOAD =================== */
.download .center { text-align: center; }
.download h2 { margin-left: auto; margin-right: auto; }
.download .section-lead { margin-left: auto; margin-right: auto; }
.download .micro { margin: 36px auto 0; }

/* =================== FOOTER =================== */
footer { padding: 56px 0 72px; background: var(--bg-deep); border-top: 1px solid var(--line); }
footer .micro { margin-bottom: 10px; }

/* =================================================================
   DETECTION PAGE; charts, monitors, three-pass visuals.
   Extends the ECG-monitor language: bg-deep ground, sage paper grid,
   mono tabular numbers, amber for "watch", cool for the secondary pass.
   ================================================================= */

/* Shared ECG monitor surface (web ECG monitor component). */
.det-monitor {
  background: var(--bg-deep);
  border: 1px solid var(--line-x);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 8px;
}
.det-monitor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.det-monitor-top .m-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--mute);
}
.det-monitor-top .m-right {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--dim);
}
.det-svg { display: block; width: 100%; height: auto; }

/* Sweep-draw for hero / strip traces (the documented ECG-sweep exception). */
.det-trace {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: det-draw 6s var(--ease-out) forwards;
}
.det-trace.loop { animation: det-draw 9s linear infinite; }
@keyframes det-draw { to { stroke-dashoffset: 0; } }

/* Mono chart numerals; figures stay tabular so columns do not jitter. */
.chart-num { font-family: 'JetBrains Mono', ui-monospace, monospace; }

/* Three-pass rail. */
.passes-rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
  position: relative;
}
.passes-rail::before {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 26px;
  height: 1px;
  background: linear-gradient(90deg, var(--glow-soft), var(--line-x), var(--glow-soft));
}
.pass-node {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
}
.pass-node .pn-dot {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0 4px var(--bg), 0 0 12px var(--glow-soft);
  margin: 0 auto 14px;
  position: relative; z-index: 2;
}
.pass-node.warm .pn-dot { background: var(--warm); box-shadow: 0 0 0 4px var(--bg), 0 0 12px rgba(245,158,11,0.3); }
.pass-node.cool .pn-dot { background: var(--cool); box-shadow: 0 0 0 4px var(--bg), 0 0 12px rgba(96,165,250,0.3); }
.pass-node .pn-scale {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 6px;
}
.pass-node h3 { font-size: 19px; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 8px; }
.pass-node p { color: var(--mute); font-size: 14.5px; margin: 0; }
@media (max-width: 860px) {
  .passes-rail { grid-template-columns: 1fr; }
  .passes-rail::before { display: none; }
}

/* Twin comparison charts (RSA vs PVC). */
.twin-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 32px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-card .cc-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 4px;
}
.chart-card h3 { font-size: 17px; font-weight: 500; margin: 0; letter-spacing: -0.01em; }
.chart-card .cc-sub { color: var(--mute); font-size: 13.5px; margin: 4px 0 14px; }
.verdict-pill {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid var(--line-x); white-space: nowrap;
}
.verdict-pill.quiet { color: var(--dim); }
.verdict-pill.fire  { color: var(--warm); border-color: rgba(245,158,11,0.4); }
.verdict-pill.good  { color: var(--glow); border-color: var(--glow-soft); }
.verdict-pill.cool  { color: var(--cool); border-color: rgba(96,165,250,0.4); }
@media (max-width: 700px) { .twin-charts { grid-template-columns: 1fr; } }

/* Threshold gauge; the bar each pass must clear to fire. */
.gauge {
  margin-top: 30px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 26px 18px;
}
.gauge-track {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, rgba(110,231,183,0.35), rgba(245,158,11,0.5));
  margin: 38px 0 30px;
}
.gauge-mark {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--bg-deep);
}
.gauge-mark::after {
  content: attr(data-label);
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 22px; white-space: nowrap;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.05em; color: var(--mute);
}
.gauge-ends {
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim);
}

/* Scroll reveal; plays once, honours reduced motion. */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .det-trace, .det-trace.loop { animation: none; stroke-dashoffset: 0; }
}
