/* ============================================================
   Heart First — Styles
   Mobile-first. Both themes driven by tokens.css.
   ============================================================ */

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
main > section { padding-block: var(--section-y); }
.text-accent { color: var(--accent); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: var(--fw-semibold); line-height: var(--lh-heading); color: var(--text-strong); letter-spacing: -0.01em; }
.hero-title { font-size: var(--fs-h1); line-height: 1.08; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
.lead { font-size: var(--fs-body-lg); color: var(--text-muted); line-height: var(--lh-relaxed); max-width: 46ch; }
.eyebrow {
  display: inline-block; font-size: var(--fs-eyebrow); font-weight: var(--fw-medium);
  color: var(--text-muted); background: var(--surface); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: var(--radius-pill);
}
.section-head .eyebrow { margin-bottom: var(--u-5); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--u-2);
  font-weight: var(--fw-semibold); font-size: var(--fs-sm);
  padding: 12px 18px; border-radius: var(--radius);
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  white-space: nowrap;
}
.btn-lg { padding: 15px 24px; font-size: var(--fs-body); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-arrow { flex: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: var(--u-3); margin-top: var(--u-8); }

/* ---------- Header / Nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; padding-block: var(--u-3); background: var(--bg); }
.header-inner {
  max-width: var(--container); margin-inline: auto;
  display: flex; align-items: center; gap: var(--u-4);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px 10px 20px;
  box-shadow: var(--shadow-sm);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: var(--fw-semibold); font-size: 1.125rem; color: var(--text-strong); }
.brand-mark { display: grid; place-items: center; color: var(--text-strong); }
.nav-links { display: none; align-items: center; gap: var(--u-8); margin-left: auto; font-weight: var(--fw-medium); }
.nav-links a { color: var(--text); transition: color var(--dur) var(--ease); }
.nav-links a:hover { color: var(--accent); }
.nav-cart { display: inline-flex; align-items: center; gap: 8px; }
.nav-cta { display: none; }
.nav-toggle { display: inline-flex; flex-direction: column; gap: 5px; margin-left: auto; padding: 12px; background: var(--surface-2); border-radius: var(--radius); }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease); }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  max-width: var(--container); margin: var(--u-2) auto 0; padding: var(--u-4);
  display: flex; flex-direction: column; gap: var(--u-2);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a { padding: 12px 14px; border-radius: var(--radius); font-weight: var(--fw-medium); }
.mobile-menu a:not(.btn):hover { background: var(--surface); }
.mobile-menu .btn { justify-content: center; }

/* ---------- Hero ---------- */
.hero-grid { display: grid; gap: var(--u-12); align-items: center; }
.hero-copy .eyebrow { margin-bottom: var(--u-5); }
.hero-title { margin-bottom: var(--u-5); }
.hero-copy .lead { max-width: 52ch; }

.hero-visual { display: flex; flex-direction: column; gap: var(--u-4); }
.hero-col { display: flex; flex-direction: column; gap: var(--u-4); }
/* Hero cards = designer PNG exports (light + dark), swapped by theme. */
.app-card { width: 100%; max-width: 380px; }
.app-card img { width: 100%; height: auto; filter: drop-shadow(0 12px 28px hsl(var(--shadow-color) / 0.16)); }

/* Reusable light/dark image swap */
.themed-light { display: block; }
.themed-dark { display: none; }
[data-theme="dark"] .themed-light { display: none; }
[data-theme="dark"] .themed-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .themed-light { display: none; }
  :root:not([data-theme]) .themed-dark { display: block; }
}

/* (legacy SVG-card styles below are unused now that hero cards are images) */
.app-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.7em; margin-bottom: 0.75em; }
.app-card-head strong { font-weight: var(--fw-semibold); color: var(--text-strong); font-size: 1em; }
.rec { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.9em; color: var(--text-muted); white-space: nowrap; }
.rec .dot { width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--accent); }
.ecg-grid {
  border-radius: 0.55em; padding: 0.7em;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 1.25em 1.25em; background-color: var(--surface-inset);
}
.ecg-line { width: 100%; height: 4.6em; display: block; }
.ecg-grid.sm .ecg-line { height: 3.4em; }
.ecg-axis { display: flex; justify-content: space-between; font-size: 0.68em; color: var(--text-faint); margin-top: 0.4em; }
.hr-bpm { display: inline-flex; align-items: center; gap: 0.4em; font-size: 0.9em; color: var(--text-strong); font-weight: var(--fw-medium); white-space: nowrap; }
.hr-chart svg { width: 100%; height: 5em; display: block; }
.hr-legend { display: flex; align-items: center; gap: 0.4em; justify-content: center; font-size: 0.68em; color: var(--text-faint); margin-top: 0.4em; }
.hr-legend i { width: 1em; height: 0.2em; border-radius: 2px; background: var(--accent); }
.badge-ai { font-size: 0.72em; font-weight: var(--fw-medium); color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); padding: 0.25em 0.6em; border-radius: var(--radius-pill); white-space: nowrap; }
.report-text { font-size: 0.85em; color: var(--text-muted); line-height: 1.4; }
.report-meta { display: flex; flex-wrap: wrap; gap: 0.3em 0.8em; margin-top: 0.8em; font-size: 0.78em; color: var(--text-muted); }
.report-meta span { display: inline-flex; align-items: center; gap: 0.3em; }
.report-measured { font-size: 0.78em; color: var(--text-faint); margin-top: 0.4em; }
.report-notes { display: block; font-size: 0.78em; color: var(--text-muted); margin-top: 0.8em; }
.notes-input { display: block; margin-top: 0.45em; padding: 0.6em 0.8em; border: 1px solid var(--border); border-radius: 0.5em; color: var(--text-faint); background: var(--surface-inset); }
.reading-meta { display: inline-flex; align-items: center; gap: 0.5em; font-size: 0.75em; color: var(--info); }
.reading-meta .zoom { color: var(--text-muted); font-style: normal; }

/* ---------- Stats ---------- */
.stats { padding-block: clamp(40px, 5vw, 72px); }
.stats-divider { height: 1px; max-width: var(--container); margin: clamp(28px,4vw,56px) auto; background: var(--divider-glow); opacity: 0.6; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--u-10) var(--u-6); text-align: center; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-num { font-size: var(--fs-stat); font-weight: var(--fw-bold); color: var(--text-strong); }
.stat-label { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- How it works ---------- */
.how-grid { display: grid; gap: var(--u-10); }
.feature-grid { display: grid; gap: var(--u-4); }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--u-6); }
.feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius); background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text-strong); margin-bottom: var(--u-4); }
.feature-icon.sm { width: 40px; height: 40px; margin-bottom: 0; }
.feature-card h3 { margin-bottom: var(--u-2); }
.feature-card p { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Platform ---------- */
.platform-grid { display: grid; gap: var(--u-12); align-items: center; }
.platform-list { display: grid; gap: var(--u-3); margin-top: var(--u-8); }
.platform-list li { display: flex; gap: var(--u-4); align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--u-5); }
.platform-list h3 { font-size: 1.05rem; margin-bottom: 4px; }
.platform-list p { font-size: var(--fs-sm); color: var(--text-muted); }
.platform-visual { position: relative; display: grid; gap: var(--u-5); }
.dash { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.dash img { width: 100%; height: auto; }
.dash-2 { width: 88%; margin-left: auto; }

/* ---------- Device ---------- */
.device-grid { display: grid; gap: var(--u-12); align-items: center; }
.device-visual { position: relative; aspect-ratio: 1 / 1; max-width: 540px; margin-inline: auto; width: 100%; }
.device-tile { position: absolute; aspect-ratio: 1 / 1; background: var(--accent); border-radius: 9%; display: grid; place-items: center; padding: 9%; }
.device-tile img { width: 100%; height: auto; display: block; }
.device-tile-a { top: 0; left: 0; width: 49%; box-shadow: var(--shadow-lg); }
.device-tile-b { bottom: 0; right: 0; width: 49%; box-shadow: var(--shadow-md); }

/* ---------- Get the App ---------- */
.getapp-grid { display: grid; gap: var(--u-12); align-items: center; }
.store-badges { display: flex; flex-wrap: wrap; gap: var(--u-3); margin-top: var(--u-6); }
.store-badge { display: inline-flex; align-items: center; gap: 10px; background: #111114; color: #fff; padding: 10px 16px; border-radius: var(--radius); }
.store-badge svg { flex: none; }
.store-badge span { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.store-badge small { font-size: 0.62rem; opacity: 0.85; }
.store-badge strong { font-size: 0.95rem; font-weight: var(--fw-semibold); }
.phone-visual { border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-lg); }
.phone-visual img { width: 100%; display: block; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-top: var(--section-y); }
.footer-grid { display: grid; gap: var(--u-10); grid-template-columns: 1fr; }
.footer-brand .brand { margin-bottom: var(--u-5); }
.footer-dl-label { font-weight: var(--fw-medium); margin-bottom: var(--u-3); }
.store-badges.sm { margin-top: 0; }
.footer-controls { display: flex; flex-wrap: wrap; gap: var(--u-6); margin-top: var(--u-8); }
.control-label { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--u-2); }
.toggle-pill { display: inline-flex; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px; gap: 2px; }
.seg { padding: 8px 14px; border-radius: var(--radius-pill); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-muted); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.seg.is-active { background: var(--accent); color: var(--accent-contrast); }
.seg-icon { display: grid; place-items: center; padding: 8px; width: 38px; }
.footer-col h4 { font-size: var(--fs-body); margin-bottom: var(--u-4); color: var(--text-strong); }
.footer-col a { display: block; padding: 6px 0; color: var(--text-muted); font-size: var(--fs-sm); transition: color var(--dur) var(--ease); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { padding-block: var(--u-10) var(--u-8); margin-top: var(--u-12); border-top: 1px solid var(--border); }
.footer-bottom p { text-align: center; font-size: var(--fs-sm); color: var(--text-faint); }

/* ============================================================
   RESPONSIVE — min-width breakpoints (SM 640, MD 768, LG 1024, XL 1280)
   ============================================================ */
@media (min-width: 640px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: var(--u-6); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .device-visual { gap: var(--u-6); }
}

@media (min-width: 768px) {
  .store-badge { padding: 12px 18px; }
}

@media (min-width: 1024px) {
  .nav-links { display: flex; }
  .nav-cta { display: inline-flex; margin-left: var(--u-6); }
  .nav-toggle { display: none; }
  .mobile-menu { display: none !important; }

  .hero-grid { grid-template-columns: 1fr 1fr; gap: var(--u-16); }

  /* Hero collage — two staggered columns (matches Figma 2XL: left ECG+HR, right AI+Reading offset down) */
  .hero-visual { display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(20px, 4%, 52px); align-items: start; }
  .hero-col { display: flex; flex-direction: column; gap: clamp(22px, 3vw, 44px); }
  .hero-col-b { margin-top: clamp(40px, 6.5vw, 84px); }   /* right column starts lower */

  .how-grid { grid-template-columns: 0.85fr 1.15fr; align-items: center; }
  .platform-grid { grid-template-columns: 1.05fr 0.95fr; }
  .device-grid { grid-template-columns: 1fr 1fr; }
  .getapp-grid { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--u-12); }
}

@media (min-width: 1280px) {
  .hero-grid { gap: var(--u-24); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
