/* =========================================================================
   VitalSim Rhythm microsite — styles.css
   Dark "on the monitor" theme. Design tokens per strategy/06-design-system.md
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --bg:          #07080D;
  --surface:     #12141D;
  --surface-2:   #1A1E2A;
  --line:        #262B3A;
  --line-strong: #37405A;
  --ink:         #F4F6FB;
  --body:        #C9D0DE;
  --muted:       #9AA3B5;
  --brand:       #C64BE0;
  --brand-strong:#9A2FB8;
  --ecg:         #33D17A;
  --focus:       #C64BE0;

  /* Pro Vision component colors — SOVEREIGN, exact */
  --pv-p:   #2F80ED;
  --pv-pr:  #9B51E0;
  --pv-qrs: #EB5757;
  --pv-st:  #F2994A;
  --pv-t:   #27AE60;

  /* Rhythm-family colors */
  --fam-sinus:  #2FA861;
  --fam-sv:     #1EA6C9;
  --fam-cond:   #C08033;
  --fam-vent:   #B84BC6;
  --fam-arrest: #E0574F;

  --alert:      #E0574F;
  --alert-tint: #241318;

  /* Type scale */
  --fs-hero:  clamp(2.25rem, 5.5vw, 3.5rem);
  --fs-h1:    clamp(2rem, 4.5vw, 2.75rem);
  --fs-h2:    clamp(1.5rem, 3.2vw, 2rem);
  --fs-h3:    1.25rem;
  --fs-lead:  clamp(1.05rem, 1.6vw, 1.25rem);
  --fs-body:  1.0625rem;
  --fs-small: 0.9375rem;

  /* Spacing (8pt scale) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow: 0 16px 40px -18px rgba(0,0,0,.7);
  --glow-ecg: 0 0 60px -14px rgba(51,209,122,.22);

  --content-max: 1120px;
  --measure: 68ch;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, figure, blockquote, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; }
a { color: inherit; text-decoration: none; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 76px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--body);
  background: var(--bg);
}

h1, h2, h3, h4 {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-hero); }
main > section h2, .guide-article h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 700; }

p { color: var(--body); }

.lead {
  font-size: var(--fs-lead);
  color: var(--body);
  max-width: var(--measure);
}

.measure { max-width: var(--measure); }

strong { color: var(--ink); font-weight: 700; }

/* ---------- Focus ---------- */
a:focus, button:focus, summary:focus, input:focus, [tabindex]:focus {
  outline: none;
}
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, [tabindex]:focus-visible, :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Utility ---------- */
.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--s5);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s4);
  top: -100px;
  background: var(--brand-strong);
  color: #fff;
  padding: var(--s3) var(--s5);
  border-radius: var(--radius-sm);
  z-index: 1000;
  transition: top 160ms ease;
}
.skip-link:focus { top: var(--s4); }

section { padding-block: var(--s8); }
@media (min-width: 1024px) { section { padding-block: var(--s9); } }

.section-head { max-width: var(--measure); margin-bottom: var(--s6); }
.section-head h2 { margin-bottom: var(--s4); }
.section-head-center { margin-inline: auto; text-align: center; }
.section-head-center p { margin-inline: auto; }

.section-cta-center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-small);
  white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.btn-primary {
  background: var(--brand-strong);
  color: #fff;
}
.btn-primary:hover { background: var(--brand); }

.btn-secondary {
  background: transparent;
  color: var(--ecg);
  border: 1.5px solid var(--ecg);
}
.btn-secondary:hover { background: rgba(51,209,122,.1); }

/* App Store badge link */
.badge-link {
  display: inline-block;
  line-height: 0;
  border-radius: var(--radius-sm);
}
.badge-img {
  height: 48px;
  width: auto;
  display: block;
}
.hero-cta .badge-img,
.final-cta .badge-img {
  height: 52px;
}
.sticky-cta .badge-img {
  height: 36px;
}

.cta-microcopy {
  font-size: var(--fs-small);
  color: var(--muted);
  margin-top: var(--s3);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4);
}

.section-cta {
  margin-top: var(--s6);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: flex;
  align-items: center;
  background: rgba(7,8,13,.8);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) {
  .site-header { backdrop-filter: blur(12px); }
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--bg); }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 700;
  color: var(--ink);
  font-size: 1.0625rem;
}
.logo-icon { border-radius: var(--radius-sm); }
.logo-word { white-space: nowrap; }

.site-nav {
  display: none;
  align-items: center;
  gap: var(--s6);
  font-weight: 600;
  font-size: var(--fs-small);
}
.site-nav a { color: var(--body); white-space: nowrap; }
.site-nav a:hover { color: var(--ink); }

@media (min-width: 720px) {
  .site-nav { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: var(--s8);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(51,209,122,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51,209,122,.07) 1px, transparent 1px),
    linear-gradient(rgba(51,209,122,.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51,209,122,.14) 1px, transparent 1px);
  background-size: 8px 8px, 8px 8px, 40px 40px, 40px 40px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 75%);
          mask-image: linear-gradient(to bottom, black, transparent 75%);
  pointer-events: none;
}
.hero .wrap {
  position: relative;
  display: grid;
  gap: var(--s7);
  align-items: center;
}
@media (min-width: 900px) {
  .hero .wrap { grid-template-columns: 1.1fr 1fr; }
  .hero-media { order: 2; }
  .hero-content { order: 1; }
}

.hero-content h1 { margin-bottom: var(--s5); }
.hero-content .lead { margin-bottom: var(--s6); }

.hero-cta { margin-bottom: var(--s5); }

.trust-line {
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: var(--measure);
}

.hero-media { display: flex; justify-content: center; }

/* ---------- Device frame ---------- */
.device-frame {
  display: inline-block;
  background: var(--surface);
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 340px;
}
.device-frame img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.device-frame.frame-hero {
  max-width: 440px;
  box-shadow: var(--shadow), var(--glow-ecg);
}

/* ---------- Trust strip ---------- */
.trust-strip {
  background: var(--surface-2);
  border-block: 1px solid var(--line);
  padding-block: var(--s5);
}
.trust-strip ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s3) var(--s7);
}
.trust-strip li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.trust-strip li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ecg);
  flex-shrink: 0;
}

/* ---------- Two-col content sections (text + image) ---------- */
.split {
  display: grid;
  gap: var(--s6);
  align-items: center;
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--s8); }
  .split.reverse .split-media { order: 2; }
  .split.reverse .split-content { order: 1; }
}
.split-media { display: flex; justify-content: center; }
.split-content p + p { margin-top: var(--s4); }

/* ---------- Pro Vision legend ---------- */
.pv-legend {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s6);
  box-shadow: var(--shadow-sm);
}
.pv-trace {
  width: 100%;
  height: auto;
  max-width: 560px;
  margin-inline: auto;
  margin-bottom: var(--s5);
}
.pv-seg {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pv-base   { stroke: var(--line-strong); }
.pv-wave-p   { stroke: var(--pv-p); }
.pv-wave-pr  { stroke: var(--pv-pr); }
.pv-wave-qrs { stroke: var(--pv-qrs); }
.pv-wave-st  { stroke: var(--pv-st); }
.pv-wave-t   { stroke: var(--pv-t); }

.pv-swatches {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s3) var(--s6);
  margin-bottom: var(--s4);
}
.pv-swatches li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 600;
  color: var(--ink);
  font-size: var(--fs-small);
  white-space: nowrap;
}
.pv-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pv-dot-p   { background: var(--pv-p); }
.pv-dot-pr  { background: var(--pv-pr); }
.pv-dot-qrs { background: var(--pv-qrs); }
.pv-dot-st  { background: var(--pv-st); }
.pv-dot-t   { background: var(--pv-t); }

.pv-caption {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-small);
  margin: 0 auto;
  max-width: var(--measure);
}

/* ---------- Family chips ---------- */
.family-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3) var(--s5);
  margin-top: var(--s4);
}
.family-chips li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: var(--s2) var(--s4);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-small);
  color: var(--ink);
  white-space: nowrap;
}
.chip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chip-dot-sinus  { background: var(--fam-sinus); }
.chip-dot-sv     { background: var(--fam-sv); }
.chip-dot-cond   { background: var(--fam-cond); }
.chip-dot-vent   { background: var(--fam-vent); }
.chip-dot-arrest { background: var(--fam-arrest); }

/* ---------- Feature grid ---------- */
.feature-groups {
  display: grid;
  gap: var(--s7);
}
.feature-group .group-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 1.0625rem;
  margin-bottom: var(--s4);
}
.feature-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 720px) {
  .feature-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .feature-list { grid-template-columns: repeat(3, 1fr); }
}
.feature-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.feature-list li:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.feature-list strong { display: block; margin-bottom: var(--s2); }

/* ---------- Gallery ---------- */
.gallery {
  display: flex;
  gap: var(--s5);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--s4);
  scrollbar-width: thin;
}
.gallery figure {
  scroll-snap-align: start;
  flex: 0 0 auto;
  width: 72%;
  max-width: 300px;
}
.gallery figcaption {
  margin-top: var(--s3);
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: 300px;
}
@media (min-width: 960px) {
  .gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    overflow: visible;
    padding-bottom: 0;
  }
  .gallery figure { width: auto; max-width: none; }
  .gallery figcaption { max-width: none; }
}
.gallery .device-frame { max-width: none; width: 100%; }

/* ---------- How it works ---------- */
.how-steps {
  counter-reset: step;
  display: grid;
  gap: var(--s5);
  margin-bottom: var(--s7);
}
@media (min-width: 720px) {
  .how-steps { grid-template-columns: repeat(2, 1fr); }
}
.how-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: var(--s7);
}
.how-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--ecg);
  font-weight: 700;
  font-size: var(--fs-small);
  display: flex;
  align-items: center;
  justify-content: center;
}
.how-steps > li > strong { display: block; margin-bottom: var(--s1); }
.how-steps .family-chips { margin-top: var(--s3); }

.how-media {
  display: grid;
  gap: var(--s5);
  align-items: center;
  justify-items: center;
  text-align: center;
}
.platform-line {
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: var(--measure);
}

/* ---------- Guides hub ---------- */
.guides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s5);
}
@media (min-width: 600px) {
  .guides-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .guides-grid { grid-template-columns: repeat(3, 1fr); }
}
.guide-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.guide-card:hover {
  transform: translateY(-3px);
  border-color: var(--ecg);
  box-shadow: var(--shadow);
}
.guide-card h3 { margin-bottom: var(--s2); }
.guide-card p { margin-bottom: var(--s4); color: var(--body); }
.guide-card .read-more { color: var(--ecg); font-weight: 600; font-size: var(--fs-small); }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: var(--s3); }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
}
.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.0625rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ecg);
  transition: transform 160ms ease;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p {
  margin-top: var(--s4);
  color: var(--body);
}

/* ---------- Final CTA ---------- */
.final-cta {
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.final-cta .wrap { display: flex; flex-direction: column; align-items: center; }
.final-cta h2 { margin-bottom: var(--s4); }
.final-cta p { margin-bottom: var(--s6); max-width: var(--measure); }

/* ---------- Who it's for ---------- */
.who p { max-width: var(--measure); }

/* ---------- Footer ---------- */
footer.site-footer {
  padding-block: var(--s8);
  background: var(--bg);
}
.footer-grid {
  display: grid;
  gap: var(--s7);
  margin-bottom: var(--s7);
}
@media (min-width: 720px) {
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
}
.footer-app { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); }
.footer-brand { display: flex; align-items: center; gap: var(--s3); }
.footer-brand-icon { border-radius: var(--radius-sm); }
.footer-brand-name { font-weight: 700; color: var(--ink); font-size: 1.0625rem; }
.footer-app p { color: var(--muted); font-size: var(--fs-small); }

.footer-col h3 {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: var(--s4);
}
.footer-col ul { display: grid; gap: var(--s3); }
.footer-col a { color: var(--body); font-size: var(--fs-small); }
.footer-col a:hover { color: var(--brand); }

.footer-disclaimer {
  border-top: 1px solid var(--line);
  padding-top: var(--s6);
  color: var(--muted);
  font-size: var(--fs-small);
  max-width: var(--measure);
}
.footer-disclaimer strong { color: var(--body); }

.footer-copyright {
  margin-top: var(--s5);
  color: var(--muted);
  font-size: var(--fs-small);
}

/* ---------- Sticky mobile CTA ---------- */
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 90;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  padding: var(--s3) var(--s5);
  padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  box-shadow: 0 -8px 24px rgba(0,0,0,.4);
}
.sticky-cta-label {
  font-weight: 700;
  color: var(--ink);
  font-size: var(--fs-small);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body { padding-bottom: 76px; }
@media (min-width: 720px) {
  .sticky-cta { display: none; }
  body { padding-bottom: 0; }
}
@media print {
  .sticky-cta { display: none; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { padding-top: var(--s6); }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  font-size: var(--fs-small);
  color: var(--muted);
}
.breadcrumb li:not(:last-child)::after {
  content: "›";
  margin-left: var(--s2);
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb li[aria-current="page"] { color: var(--body); }

/* ---------- Guide article ---------- */
.guide-hero { padding-top: var(--s6); }
.guide-hero h1 { margin-block: var(--s5); max-width: var(--measure); }
.guide-hero .lead { margin-bottom: var(--s6); }

.guide-article { padding-block: var(--s7); }
.guide-article section + section,
.guide-article > .callout + section { margin-top: var(--s8); }
.guide-article h2 { margin-bottom: var(--s4); }
.guide-article h2:not(:first-child) { margin-top: 0; }
.guide-article p { max-width: var(--measure); }
.guide-article p + p { margin-top: var(--s4); }
.guide-article ul.list-plain,
.guide-article ol.list-plain {
  max-width: var(--measure);
  display: grid;
  gap: var(--s4);
}
.guide-article .list-plain li { max-width: var(--measure); }
.guide-article .guide-media { margin-top: var(--s6); display: flex; justify-content: center; }
.guide-article figure.guide-media { flex-direction: column; align-items: center; }
.guide-article .guide-media figcaption {
  margin-top: var(--s3);
  color: var(--muted);
  font-size: var(--fs-small);
  text-align: center;
}

/* Safety callout */
.callout {
  background: var(--alert-tint);
  border-left: 4px solid var(--alert);
  border-radius: var(--radius-sm);
  padding: var(--s5);
  max-width: var(--measure);
  margin-top: var(--s6);
}
.callout p { color: var(--ink); margin: 0; }
.callout strong { color: #fff; }

/* Related guides */
.related-guides {
  margin-top: var(--s8);
  padding-top: var(--s7);
  border-top: 1px solid var(--line);
}
.related-guides h2,
.related-guides .related-title {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: var(--s5);
}
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s4);
}
@media (min-width: 600px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .feature-list li:hover,
  .guide-card:hover {
    transform: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .hero::before { display: none; }
}
