:root {
  --pulse-blue: #3b8cf5;
  --pulse-blue-deep: #1f63d1;
  --pulse-blue-soft: #9bc2f7;
  --ink: #0c1b33;
  --ink-muted: #3d4f6a;
  --paper: #f4f8fd;
  --white: #ffffff;
  --line: rgba(12, 27, 51, 0.1);
  --font: "Outfit", system-ui, sans-serif;
  --max: 68rem;
  --radius: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--pulse-blue-deep);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--pulse-blue);
}

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  width: 100%;
  left: 0;
  right: 0;
}

.site-header--nav-only {
  justify-content: flex-end;
}

.site-header--nav-only .site-header-actions {
  margin-left: auto;
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem 1.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-header a {
  color: var(--white);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-header a:hover {
  color: var(--pulse-blue-soft);
}

.site-header nav {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.button-header-download {
  min-height: 2.35rem;
  padding: 0.45rem 1rem;
  background: var(--white);
  color: var(--pulse-blue-deep) !important;
  border-color: transparent;
  font-size: 0.9rem;
}

.button-header-download:hover {
  color: var(--pulse-blue-deep) !important;
  opacity: 0.95;
}

.brand-mark {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: center;
  overflow-x: clip;
  overflow-y: visible;
  color: var(--white);
  background:
    radial-gradient(120% 80% at 70% 10%, rgba(155, 194, 247, 0.35), transparent 55%),
    linear-gradient(160deg, var(--pulse-blue) 0%, var(--pulse-blue-deep) 58%, #0f3f9a 100%);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 7rem;
  background: linear-gradient(to top, var(--paper), transparent);
  pointer-events: none;
}

.hero-layout {
  position: relative;
  z-index: 1;
  width: min(100% - 3rem, var(--max));
  margin: 0 auto;
  padding: 7rem 0 6.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 2rem 2.5rem;
  align-items: center;
}

.hero-copy {
  max-width: 34rem;
}

.hero-wordmark {
  margin: 0 0 0.35rem;
  font-size: clamp(2.75rem, 9vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-wrap: balance;
  transform-origin: left center;
  animation: heartbeat 2.7s ease-in-out infinite;
}

.hero h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 3.5vw, 1.7rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
}

.hero-lead {
  margin: 0 0 1.75rem;
  max-width: 28rem;
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.9);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0;
}

.app-store-badge {
  display: inline-flex;
  line-height: 0;
  border-radius: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.app-store-badge:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  color: inherit;
}

.app-store-badge img {
  height: 50px;
  width: auto;
}

.hero-gallery {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.hero-devices {
  position: relative;
  isolation: isolate;
  margin-inline: auto;
  width: min(100%, 32rem);
  /* Precomputed: 13.5rem × (2868/1320) + dots — avoid calc() multiply (can invalidate → 0 height) */
  height: 31.85rem;
  overflow: visible;
}

.phone {
  position: absolute;
  margin: 0;
  width: 12.5rem;
  max-width: 46%;
  aspect-ratio: 1320 / 2868;
  border-radius: 1.4rem;
  overflow: hidden;
  background: #0a1628;
  box-shadow:
    0 18px 40px rgba(8, 24, 56, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.18);
  transition: left 0.45s ease, top 0.45s ease, opacity 0.45s ease, width 0.45s ease;
}

.phone img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: auto;
  -webkit-user-drag: none;
  transition: opacity 0.35s ease;
}

.phone-main {
  left: 0;
  top: 0;
  z-index: 3;
  width: 13.5rem;
  max-width: 50%;
}

.phone-peek-near {
  left: 30%;
  top: 0.5rem;
  z-index: 2;
  opacity: 0.96;
}

.phone-peek-far {
  left: 54%;
  top: 1rem;
  z-index: 1;
  opacity: 0.9;
}

.gallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.gallery-dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: rgba(12, 27, 51, 0.25);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.gallery-dot:hover {
  background: rgba(255, 255, 255, 0.75);
}

.gallery-dot.is-active {
  background: var(--white);
  border-color: var(--white);
  transform: scale(1.12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--white);
  color: var(--pulse-blue-deep);
}

.button-primary:hover {
  color: var(--pulse-blue-deep);
  opacity: 0.95;
}

.button-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: var(--white);
}

.button-ghost:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.ecg {
  display: block;
  width: min(100%, 22rem);
  height: auto;
  aspect-ratio: 640 / 120;
  margin: 0 0 1.15rem;
  opacity: 0.95;
  overflow: visible;
}

.ecg-path {
  fill: none;
  stroke: var(--white);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-ecg 2.7s linear infinite;
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-wrap: balance;
}

.section-lead {
  margin: 0 0 2rem;
  max-width: 34rem;
  color: var(--ink-muted);
  font-size: 1.05rem;
}

.feature-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-cards li {
  padding: 1.25rem 1.35rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1rem;
  border-top: 3px solid var(--pulse-blue);
}

.feature-cards strong {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.feature-cards span {
  color: var(--ink-muted);
  font-size: 0.98rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem 2.75rem;
}

.site-footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
}

.site-footer a {
  text-decoration: none;
  color: var(--ink-muted);
  font-weight: 500;
}

.site-footer a:hover {
  color: var(--pulse-blue-deep);
}

.site-footer p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  max-width: none;
}

.site-footer p a,
.footer-store-link {
  color: var(--pulse-blue-deep);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-footer p a:hover,
.footer-store-link:hover {
  color: var(--pulse-blue);
  text-decoration: underline;
}

/* Interior pages */
.page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.page-header {
  background: linear-gradient(160deg, var(--pulse-blue) 0%, var(--pulse-blue-deep) 100%);
  color: var(--white);
  padding: 1.25rem 1.5rem 3rem;
}

.page-header-inner {
  max-width: 48rem;
  margin: 0 auto;
}

.page-header .brand-mark {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.035em;
}

.page-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.88);
}

.page-body {
  flex: 1;
  max-width: 48rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.page-body h2 {
  margin: 2.25rem 0 0.65rem;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.page-body h2:first-child {
  margin-top: 0;
}

.page-body p,
.page-body li {
  color: var(--ink-muted);
}

.page-body ul {
  padding-left: 1.2rem;
}

.page-body li + li {
  margin-top: 0.4rem;
}

.page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.page-nav a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.page-nav a:hover {
  color: var(--white);
  text-decoration: underline;
}

.faq dt {
  margin: 1.5rem 0 0.35rem;
  font-weight: 650;
}

.faq dd {
  margin: 0;
  color: var(--ink-muted);
}

@keyframes draw-ecg {
  0% {
    stroke-dashoffset: 900;
  }
  55% {
    stroke-dashoffset: 0;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes heartbeat {
  0%,
  58%,
  100% {
    transform: scale(1);
  }
  64% {
    transform: scale(1.018);
  }
  70% {
    transform: scale(1);
  }
  76% {
    transform: scale(1.028);
  }
  84% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-wordmark,
  .ecg-path,
  .button,
  .phone,
  .phone img {
    animation: none !important;
    transition: none !important;
  }

  .ecg-path {
    stroke-dashoffset: 0;
  }
}

/* Stack feature cards when narrow (any orientation) */
@media (max-width: 900px) {
  .feature-cards {
    grid-template-columns: 1fr;
  }
}

/* Portrait only: copy-first declutter */
@media (max-width: 900px) and (orientation: portrait) {
  .hero {
    min-height: 0;
    align-items: start;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    padding: 5.5rem 0 3.5rem;
    gap: 2rem;
  }

  .hero-gallery {
    order: 0;
  }

  .hero-devices {
    height: 26.15rem;
    width: min(100%, 24rem);
    margin-inline: auto;
  }

  .phone {
    width: 10.5rem;
    max-width: 48%;
  }

  .phone-main {
    width: 11rem;
    max-width: 48%;
  }
}

/* Portrait phone: compact nav + single centered phone */
@media (max-width: 640px) and (orientation: portrait) {
  .site-header {
    align-items: center;
    padding: 1rem 1.25rem;
  }

  .site-header-actions {
    width: 100%;
    gap: 0.75rem;
  }

  .site-header nav {
    gap: 0.85rem;
  }

  .nav-secondary {
    display: none;
  }

  .hero-layout {
    padding: 4.75rem 0 3rem;
    gap: 1.75rem;
  }

  .hero-wordmark {
    font-size: clamp(2.25rem, 11vw, 3.25rem);
    margin-bottom: 0.25rem;
  }

  .ecg {
    width: min(100%, 16rem);
    margin-bottom: 0.85rem;
  }

  .hero-lead {
    margin-bottom: 1.35rem;
    font-size: 1rem;
  }

  .hero-devices {
    height: 23rem;
    width: min(100%, 14rem);
  }

  .phone-peek,
  .phone-peek-far,
  .phone-peek-near {
    display: none;
  }

  .phone-main {
    left: 50%;
    top: 0;
    width: 9.5rem;
    max-width: none;
    transform: translateX(-50%);
  }
}

/* Phone landscape: desktop-style two-column + full nav + fan */
@media (orientation: landscape) and (max-height: 500px) {
  .hero {
    min-height: 100svh;
    align-items: center;
  }

  .hero-layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    padding: 4.5rem 0 2.5rem;
    gap: 1.25rem 1.75rem;
    align-items: center;
  }

  .hero-wordmark {
    font-size: clamp(1.85rem, 6vw, 2.75rem);
    margin-bottom: 0.2rem;
  }

  .ecg {
    width: min(100%, 14rem);
    margin-bottom: 0.65rem;
  }

  .hero-lead {
    margin-bottom: 1rem;
    font-size: 0.95rem;
  }

  .hero-cta {
    gap: 0.55rem;
  }

  .app-store-badge img {
    height: 42px;
  }

  .hero-devices {
    height: 18.5rem;
    width: min(100%, 22rem);
  }

  .phone {
    width: 7.5rem;
    max-width: 42%;
  }

  .phone-main {
    left: 0;
    width: 8.25rem;
    max-width: 46%;
    transform: none;
  }

  .phone-peek,
  .phone-peek-far,
  .phone-peek-near {
    display: block;
  }

  .nav-secondary {
    display: revert;
  }
}
