/* ============================================================
   Cairn Health — landing page styles
   Mobile-first · no external assets · light + dark themes
   ============================================================ */

:root {
  --teal: #0F6B5C;
  --teal-strong: #0B5449;
  --teal-soft: rgba(15, 107, 92, 0.09);
  --sand: #F4EDE4;
  --ink: #1E2A32;
  --amber: #E8A13D;
  --ink-on-amber: #1E2A32;

  --bg: #FDFBF8;
  --bg-alt: var(--sand);
  --surface: #FFFFFF;
  --text: var(--ink);
  --text-muted: #55636D;
  --border: rgba(30, 42, 50, 0.12);
  --ring-track: rgba(30, 42, 50, 0.12);
  --shadow: 0 10px 30px rgba(30, 42, 50, 0.10);
  --shadow-soft: 0 4px 14px rgba(30, 42, 50, 0.07);

  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --teal: #2E9C87;
    --teal-strong: #37B39B;
    --teal-soft: rgba(46, 156, 135, 0.14);
    --ink-on-amber: #14202A;

    --bg: #131C22;
    --bg-alt: #182530;
    --surface: #1E2A32;
    --text: #EDE7DC;
    --text-muted: #A3AFB8;
    --border: rgba(244, 237, 228, 0.14);
    --ring-track: rgba(244, 237, 228, 0.16);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* scroll-padding keeps anchored sections clear of the sticky header —
   without it every in-page nav link lands with its heading behind the bar. */
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; }
p  { margin: 0 0 1em; }

a { color: var(--teal-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { padding-left: 0; }

.container {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}

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

.skip-link {
  position: absolute; left: 1rem; top: -3.5rem;
  background: var(--teal); color: #fff;
  padding: 0.6rem 1rem; border-radius: var(--radius-sm);
  z-index: 100; transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  text-align: center;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.btn-primary {
  background: var(--teal); color: #fff;
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover { background: var(--teal-strong); }
.btn-primary:disabled { opacity: 0.55; cursor: default; transform: none; }

.btn-outline {
  border-color: var(--teal); color: var(--teal-strong);
  background: transparent;
}
.btn-outline:hover { background: var(--teal-soft); }

.btn-light { background: var(--sand); color: #0F6B5C; }
.btn-light:hover { background: #fff; }

.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.92rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 0;
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-name { font-weight: 750; font-size: 1.08rem; letter-spacing: -0.01em; }

.nav-links { display: none; gap: 1.4rem; margin-inline: auto; }
.nav-links a { color: var(--text-muted); font-weight: 550; font-size: 0.95rem; }
.nav-links a:hover { color: var(--teal-strong); text-decoration: none; }

.nav > .btn { margin-left: auto; }

@media (min-width: 760px) {
  .nav-links { display: flex; }
  .nav > .btn { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 7vw, 5.5rem); }

.hero-grid {
  display: grid; gap: 3rem; align-items: center;
}
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}

.eyebrow {
  display: inline-block;
  background: var(--teal-soft); color: var(--teal-strong);
  font-weight: 650; font-size: 0.85rem;
  padding: 0.35rem 0.9rem; border-radius: 999px;
  margin-bottom: 1.2rem;
}

h1 em { font-style: normal; color: var(--teal); }
@media (prefers-color-scheme: dark) { h1 em { color: var(--teal-strong); } }

.hero-sub {
  font-size: 1.15rem; color: var(--text-muted);
  max-width: 34rem; margin-bottom: 1.8rem;
}

.waitlist-form {
  display: flex; flex-wrap: wrap; gap: 0.7rem;
  max-width: 30rem;
  scroll-margin-top: 6rem;
}
.waitlist-form input[type="email"] {
  flex: 1 1 220px;
  padding: 0.8rem 1.1rem;
  font: inherit; color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
}
.waitlist-form input[type="email"]:focus-visible {
  outline: 3px solid var(--amber); outline-offset: 1px; border-color: transparent;
}
.form-note {
  flex-basis: 100%; margin: 0.15rem 0 0 0.4rem;
  font-size: 0.85rem; color: var(--text-muted);
}
.form-note-success { color: var(--teal-strong); font-weight: 600; }
.form-note-error { color: #B3402A; font-weight: 600; }

.hero-disclaimer {
  margin-top: 1.4rem; font-size: 0.82rem; color: var(--text-muted);
}

/* Hero mock card */
.hero-visual { display: flex; justify-content: center; }
.mock-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.3rem 1.4rem 1.1rem;
}
.mock-header { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1rem; }
.mock-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.mock-title { font-size: 0.85rem; font-weight: 650; color: var(--text-muted); }

.mock-score-row { display: flex; align-items: center; gap: 1.2rem; }
.score-ring { width: 118px; flex: none; }
.ring-num { font: 750 1.7rem var(--font); fill: var(--text); }
.ring-label { font: 500 0.6rem var(--font); fill: var(--text-muted); }

.mock-metrics { list-style: none; margin: 0; padding: 0; flex: 1; }
.mock-metrics li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.mock-metrics li:last-child { border-bottom: 0; }
.metric-name { font-weight: 600; }
.metric-delta { font-weight: 700; font-size: 0.9rem; }
.metric-delta.down { color: #B3402A; }
.metric-delta.up { color: var(--teal-strong); }

.mock-insight {
  display: flex; gap: 0.7rem; align-items: flex-start;
  background: var(--teal-soft);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  margin: 1rem 0 0.9rem;
}
.insight-icon { width: 20px; flex: none; margin-top: 0.2rem; }
.mock-insight p { margin: 0; font-size: 0.86rem; line-height: 1.5; }

.mock-trend { width: 100%; height: 58px; }
.mock-caption {
  margin: 0.35rem 0 0; text-align: center;
  font-size: 0.75rem; color: var(--text-muted);
}

/* ---------- Explainer video ---------- */
/* Full container width on purpose: the video bakes in the app's own UI text,
   which is only legible once the frame is wide. */
.explainer-section { padding: clamp(3.5rem, 8vw, 5.5rem) 0; }

.explainer { width: 100%; margin: 0; }
/* Positioning context for the overlay controls — scoped to the video alone
   so they cannot drift over the caption below it. */
.explainer-frame { position: relative; display: block; }
.explainer-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 22px);
  box-shadow: var(--shadow);
}

/* Overlay controls. The pause button is not optional polish — WCAG 2.2.2
   requires a way to stop looping motion. */
.explainer-controls {
  position: absolute; right: 0.7rem; bottom: 0.7rem;
  display: flex; gap: 0.4rem;
  opacity: 0; transition: opacity 160ms ease;
}
.explainer-frame:hover .explainer-controls,
.explainer-controls:focus-within { opacity: 1; }
/* A paused video gives no other hint that it can be started. */
.explainer-frame:has(.explainer-btn[aria-pressed="true"]) .explainer-controls { opacity: 1; }

.explainer-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font: inherit; font-size: 0.78rem; font-weight: 650;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: 999px;
  cursor: pointer;
}
.explainer-btn:hover { background: var(--surface); }
.explainer-btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.explainer-btn svg { width: 11px; height: 11px; fill: currentColor; flex: none; }
.explainer-btn .icon-play { display: none; }
.explainer-btn[aria-pressed="true"] .icon-pause { display: none; }
.explainer-btn[aria-pressed="true"] .icon-play { display: block; }

/* Fullscreen shows the video at its authored size, where the in-app text
   is meant to be read — let it fill the screen instead of the hero box. */
.explainer-video:fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; }

.explainer-caption {
  max-width: 46rem;
  margin: 1rem auto 0;
  text-align: center;
  font-size: 0.9rem; line-height: 1.55;
  color: var(--text-muted);
}

/* ---------- Social proof ---------- */
.proof {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
  padding: 2.2rem 0;
}
.proof-inner { text-align: center; }
.proof-label {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em;
  font-weight: 700; color: var(--text-muted); margin-bottom: 1rem;
}
.proof-badges {
  list-style: none; margin: 0 0 1.6rem; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 0.7rem;
}
.proof-badges li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 1.15rem;
  font-weight: 650; font-size: 0.95rem;
  box-shadow: var(--shadow-soft);
}
.proof-stats {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem 3rem;
}
.proof-stats li { display: grid; gap: 0.1rem; }
.proof-stats strong { font-size: 1.5rem; color: var(--teal-strong); letter-spacing: -0.02em; }
.proof-stats span { font-size: 0.85rem; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section-head { max-width: 40rem; margin: 0 auto 3rem; text-align: center; }
.section-head p { color: var(--text-muted); font-size: 1.08rem; margin: 0; }
.section-head h2 em { font-style: italic; color: var(--teal); }

.features { padding: clamp(3.5rem, 8vw, 6rem) 0; }

.feature {
  display: grid; gap: 2.2rem; align-items: center;
  padding: clamp(1.8rem, 4vw, 3rem) 0;
}
@media (min-width: 860px) {
  .feature { grid-template-columns: 1fr 1fr; gap: 4rem; }
  .feature-reverse .feature-copy { order: 2; }
  .feature-reverse .feature-art { order: 1; }
}

.feature-icon {
  width: 52px; height: 52px;
  background: var(--teal-soft);
  border-radius: 14px;
  display: grid; place-items: center;
  margin-bottom: 1rem;
}
.feature-icon svg { width: 30px; height: 30px; }

.feature-copy p { color: var(--text-muted); }
.feature-copy p strong { color: var(--text); }

.check-list { list-style: none; margin: 1.1rem 0 0; padding: 0; }
.check-list li {
  position: relative;
  padding: 0.32rem 0 0.32rem 1.8rem;
  color: var(--text-muted);
}
.check-list li::before {
  content: "";
  position: absolute; left: 0; top: 0.62rem;
  width: 1.05rem; height: 1.05rem;
  border-radius: 50%;
  background: var(--teal-soft);
}
.check-list li::after {
  content: "";
  position: absolute; left: 0.26rem; top: 0.9rem;
  width: 0.5rem; height: 0.28rem;
  border-left: 2px solid var(--teal);
  border-bottom: 2px solid var(--teal);
  transform: rotate(-48deg);
}

.insight-quote {
  margin: 1.2rem 0;
  padding: 0.9rem 1.1rem;
  background: var(--teal-soft);
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text);
}

.micro-disclaimer {
  margin-top: 1.1rem;
  padding: 0.7rem 0.95rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.83rem !important;
  color: var(--text-muted) !important;
  background: color-mix(in srgb, var(--amber) 7%, transparent);
}

/* Feature artwork panels */
.feature-art {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.2rem;
}
.art-svg { width: 100%; height: auto; }
.art-chip { fill: var(--bg-alt); stroke: var(--border); stroke-width: 1; }
.art-axis { stroke: var(--border); stroke-width: 1.5; }
.art-label { font: 500 0.68rem var(--font); fill: var(--text-muted); }
.art-label-strong { font: 650 0.74rem var(--font); fill: var(--text); }
.art-big { font: 750 1.6rem var(--font); fill: var(--text); }
.art-tag { font: 650 0.62rem var(--font); fill: var(--ink-on-amber); }
.art-flag { font: 800 0.8rem var(--font); fill: var(--ink-on-amber); }

/* ---------- How it works ---------- */
.how {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.6rem;
  counter-reset: step;
}
@media (min-width: 780px) { .steps { grid-template-columns: repeat(3, 1fr); } }

.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.7rem 1.5rem;
}
.step-num {
  display: grid; place-items: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  background: var(--teal); color: #fff;
  font-weight: 750; font-size: 1.05rem;
  margin-bottom: 1rem;
}
.step h3 { font-size: 1.1rem; }
.step p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }

/* ---------- Pricing ---------- */
.pricing { padding: clamp(3.5rem, 8vw, 6rem) 0; }

.price-grid {
  display: grid; gap: 1.6rem;
  max-width: 860px; margin-inline: auto;
  align-items: stretch;
}
@media (min-width: 760px) { .price-grid { grid-template-columns: 1fr 1fr; } }

.price-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 2rem 1.8rem;
}
.price-card .btn { margin-top: auto; }
.price-card .check-list { margin-bottom: 1.6rem; }

.price-featured {
  border: 2px solid var(--teal);
  box-shadow: var(--shadow);
  position: relative;
}
.price-badge {
  position: absolute; top: -0.85rem; left: 50%; transform: translateX(-50%);
  background: var(--amber); color: var(--ink-on-amber);
  font-size: 0.78rem; font-weight: 750;
  padding: 0.25rem 0.9rem; border-radius: 999px;
  margin: 0; white-space: nowrap;
}

.price { display: flex; align-items: baseline; gap: 0.4rem; margin: 0.2rem 0 0.4rem; }
.price-amount { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; }
.price-per { color: var(--text-muted); font-size: 0.95rem; }

/* ---------- FAQ ---------- */
.faq {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}
.faq-inner { max-width: 760px; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  margin-bottom: 0.9rem;
  overflow: hidden;
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1.05rem 3rem 1.05rem 1.3rem;
  position: relative;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 {
  display: inline; margin: 0;
  font-size: 1.02rem; font-weight: 650;
}
.faq-item summary::after {
  content: "";
  position: absolute; right: 1.3rem; top: 50%;
  width: 0.55rem; height: 0.55rem;
  border-right: 2.5px solid var(--teal);
  border-bottom: 2.5px solid var(--teal);
  transform: translateY(-70%) rotate(45deg);
  transition: transform 0.18s ease;
}
.faq-item[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq-item summary:focus-visible { outline: 3px solid var(--amber); outline-offset: -3px; }
.faq-item p {
  margin: 0; padding: 0 1.3rem 1.2rem;
  color: var(--text-muted); font-size: 0.95rem;
}

/* ---------- Final CTA ---------- */
.cta-final {
  background: linear-gradient(135deg, var(--teal-strong), var(--teal));
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}
@media (prefers-color-scheme: dark) {
  .cta-final { background: linear-gradient(135deg, #0B5449, #0F6B5C); }
}
.cta-inner { text-align: center; color: #F4EDE4; max-width: 38rem; }
.cta-cairn { width: 56px; margin: 0 auto 1.2rem; }
.cta-inner h2 { color: #fff; }
.cta-inner p { color: rgba(244, 237, 228, 0.85); margin-bottom: 1.6rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg);
  padding: 3rem 0 2rem;
}
.footer-grid {
  display: grid; gap: 1.8rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
}
.footer-tagline { color: var(--text-muted); font-size: 0.9rem; margin: 0.6rem 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.footer-links a { color: var(--text-muted); font-size: 0.92rem; }
.footer-links a:hover { color: var(--teal-strong); }

.footer-legal { padding-top: 1.6rem; }
.disclaimer {
  font-size: 0.8rem; line-height: 1.65;
  color: var(--text-muted);
  max-width: 62rem;
}
.copyright { font-size: 0.8rem; color: var(--text-muted); margin: 1rem 0 0; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .faq-item summary::after, .skip-link { transition: none; }
  /* The explainer does not autoplay here (see the script in index.html);
     keep its controls permanently visible so play is always discoverable. */
  .explainer-controls { opacity: 1; transition: none; }
}
