/* ============================================================
   Carrie by DTxPlus — site stylesheet
   ------------------------------------------------------------
   Structure (do not interleave):
     1. Base + typography roles
     2. Components (desktop canonical, ≥1100px is the reference)
     3. TABLET LAYER   @media (max-width: 1099px)
     4. MOBILE LAYER   @media (max-width: 699px)  · per the 390px artboard
        (tables collapse to cards at ≤639px, per the mobile spec)
     5. Reduced motion
   Desktop rules are canonical: tune tablet/mobile inside their
   layers only — never by editing desktop rules.
   Fold discipline (1440×900): every homepage section reads
   complete in one viewport; grouped elements (.no-split) never
   straddle a fold. Add space, don't shrink type.
   ============================================================ */

/* ---------- 1. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-surface-0);
  color: var(--color-brand-ink-700);
  font-family: var(--font-family-body);
  font-size: 16px;
  line-height: 1.55;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; }
a { color: var(--color-brand-magenta-ink); text-decoration: none; }
a:hover { color: var(--color-brand-magenta); }
button { font-family: var(--font-family-body); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-brand-magenta);
  outline-offset: 2px;
}
.container { max-width: 1160px; margin-inline: auto; padding-inline: 32px; }
.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: 16px; top: -48px; z-index: 100;
  background: var(--color-brand-black); color: #fff; font: 600 13px/1 var(--font-family-body);
  padding: 12px 16px; border-radius: 0 0 8px 8px; transition: top var(--motion-fast) var(--easing-standard);
}
.skip-link:focus { top: 0; color: #fff; }

/* Typography roles */
.h1 { font-family: var(--font-family-display); font-weight: 800; font-size: 54px; line-height: 1.08; letter-spacing: -0.015em; color: var(--color-brand-black); margin: 0; }
.h1--page { font-size: 44px; line-height: 1.1; }
.h2 { font-family: var(--font-family-display); font-weight: 800; font-size: 32px; line-height: 1.18; letter-spacing: -0.008em; color: var(--color-brand-black); margin: 0; }
.h3 { font-family: var(--font-family-display); font-weight: 800; font-size: 19px; line-height: 1.3; color: var(--color-brand-black); margin: 0; }
.body { font-size: 16px; line-height: 1.55; color: var(--color-brand-ink-700); font-weight: 500; margin: 0; }
.small { font-size: 13.5px; line-height: 1.55; color: var(--color-brand-ink-500); font-weight: 500; margin: 0; }
.label {
  font-family: var(--font-family-display); font-size: 11.5px; line-height: 1.45; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-brand-ink-500); margin: 0 0 12px;
}
.mono-label { font: 500 11px/1.4 var(--font-family-mono); letter-spacing: 0.04em; color: var(--color-brand-violet-500); }
.prose { max-width: 70ch; }
strong { color: var(--color-brand-black); font-weight: 700; }

/* Endnote markers: superscript anchors, top-aligned, global sizing rule */
.sup {
  font-size: calc(0.34em + 3.5px);
  vertical-align: text-top;
  line-height: 1;
  letter-spacing: 0;
}
.sup a { color: var(--color-brand-magenta-ink); font-weight: 700; }
.sup a:hover, .sup a:focus-visible { text-decoration: underline; }

/* ---------- 2. COMPONENTS (desktop canonical) ---------- */

/* Nav */
.navbar {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--color-border-subtle);
}
.navbar__inner { display: flex; align-items: center; gap: 22px; min-height: 68px; }
.brand { display: flex; align-items: baseline; gap: 8px; font: 600 14px/1 var(--font-family-wordmark); color: var(--color-brand-ink-500); }
.brand:hover { color: var(--color-brand-ink-500); }
.brand .carrie { font-size: 28px; }
.brand__suffix { position: relative; top: -0.2em; }
.navlink { font: 600 13.5px/1.2 var(--font-family-display); color: var(--color-brand-ink-700); padding-bottom: 3px; }
.navlink:hover { color: var(--color-brand-magenta-ink); }
.navlink[aria-current="page"] { color: var(--color-brand-magenta-ink); border-bottom: 2px solid var(--color-brand-magenta); }
.navbar__spacer { flex: 1; }
.navlink--utility { color: var(--color-brand-magenta-ink); }
.kicker { margin-top: 14px; font-weight: 600; font-size: 14px; display: inline-block; }
.nav-toggle { display: none; }
.nav-menu { display: contents; }

/* Buttons, chips, bullets */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--color-brand-magenta); color: #fff; border: none; cursor: pointer;
  font: 700 14.5px/1 var(--font-family-display); padding: 15px 22px; border-radius: var(--radius-md);
  white-space: nowrap; transition: background var(--motion-fast) var(--easing-standard);
}
.btn:hover { background: #B507B8; color: #fff; }
.btn--nav { padding: 12px 18px; font-size: 13.5px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--color-brand-violet-700); border: 1px solid var(--color-border-strong);
  font: 700 14px/1 var(--font-family-display); padding: 14px 18px; border-radius: var(--radius-md);
  white-space: nowrap; transition: background var(--motion-fast) var(--easing-standard);
}
.btn-ghost:hover { background: var(--color-brand-violet-100); color: var(--color-brand-violet-700); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  border: 1px solid var(--color-border-subtle); border-radius: var(--radius-pill); background: #fff;
  font: 600 13px/1.35 var(--font-family-body); color: var(--color-brand-ink-700);
}
a.chip:hover { background: var(--color-brand-violet-100); color: var(--color-brand-ink-700); }
.chip--strong { font-weight: 700; border-color: var(--color-border-strong); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.bullet { border-left: 4px solid var(--color-brand-magenta); padding: 4px 0 4px 16px; }
.lift { transition: box-shadow var(--motion-fast) var(--easing-standard); }
.lift:hover { box-shadow: var(--shadow-float); }

/* Sections */
.sec { padding: 88px 0; }

/* Canvas gradient fades smoothly into the white section below it.
   The fade is an overlay above the section's background but below its
   content (negative z-index inside an isolated stacking context), so
   the canonical --gradient-canvas token itself never changes. */
.canvas-bg { position: relative; isolation: isolate; }
.canvas-bg::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: min(180px, 38%);
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--color-surface-0));
  z-index: -1;
  pointer-events: none;
}

/* Fold discipline (1440×900, desktop): each homepage section occupies one
   full viewport band with content centered — whitespace absorbs the slack,
   so grouped elements never straddle a viewport boundary and every section
   reads complete in one viewport. */
@media (min-width: 1100px) {
  body.home main > .sec {
    min-height: 100vh;
    min-height: 100svh;
    display: flex; flex-direction: column; justify-content: center;
    /* top padding clears the 69px sticky nav when a section top sits on a band boundary */
    padding-top: 72px; padding-bottom: 32px;
  }
  body.home main > .sec--hero {
    min-height: calc(100vh - 69px);
    min-height: calc(100svh - 69px);
  }
  /* auto inline margins suppress flex stretching — restore full width */
  body.home main > .sec > .container { width: 100%; }
}
.sec--hero { padding: 72px 0 64px; }
.sec--compact { padding: 56px 0; }
.sec--tint { background: var(--color-surface-1); }
.grid-2 { display: grid; gap: 44px; align-items: center; }
.grid-2 > * { min-width: 0; } /* let tracks shrink below content (waveform, tables) */
.grid-2--wideleft { grid-template-columns: 1.25fr 1fr; }
.grid-2--wideright { grid-template-columns: 1fr 1.3fr; }
.grid-2--right14 { grid-template-columns: 1fr 1.4fr; }
.grid-2--even { grid-template-columns: 1fr 1fr; }
.grid-2--book { grid-template-columns: 1fr 1.15fr; }
.grid-2--top { align-items: start; }
.grid-advisors { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* Hero moments */
.moments { display: flex; flex-direction: column; gap: 8px; }
.moment {
  background: var(--color-surface-1); border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md); padding: 10px 18px;
  transition: all var(--motion-fast) var(--easing-standard);
}
.moment .mono-label { display: none; }
.moment p { font: 500 13px/1.5 var(--font-family-body); color: var(--color-brand-ink-500); margin: 0; }
.moment.is-active {
  background: #fff; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow-float);
}
.moment.is-active .mono-label { display: block; }
.moment.is-active p { font: 600 15px/1.5 var(--font-family-body); color: var(--color-brand-ink-700); margin-top: 4px; }
/* Dots keep a 7px visual mark inside a 24px hit target (WCAG 2.2 target size) */
.dots { display: flex; gap: 2px; justify-content: center; }
.dot {
  position: relative; width: 24px; height: 24px; border: none; padding: 0; cursor: pointer;
  background: transparent; border-radius: var(--radius-pill);
}
.dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 7px; height: 7px; border-radius: var(--radius-pill);
  background: var(--color-border-strong); transition: all var(--motion-fast) var(--easing-standard);
}
.dot.is-active::before { width: 18px; background: var(--color-brand-magenta); }

/* Closed-loop diagram (homepage) */
.loop { position: relative; width: 100%; max-width: 1050px; aspect-ratio: 1050 / 480; margin: 24px auto 0; }
.loop__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.loop-node {
  position: absolute; transform: translate(-50%, -50%);
  background: #fff; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-md);
  padding: 12px 14px; box-shadow: var(--shadow-card); cursor: pointer; text-align: left;
  font-family: var(--font-family-body);
  transition: border var(--motion-fast) var(--easing-standard), box-shadow var(--motion-fast) var(--easing-standard);
}
.loop-node__row { display: flex; gap: 9px; align-items: flex-start; }
.loop-node__title { font: 700 13.5px/1.3 var(--font-family-body); color: var(--color-brand-ink-700); margin: 0; }
.loop-node__gloss { display: none; font: 500 12px/1.45 var(--font-family-body); color: var(--color-brand-ink-500); margin: 3px 0 0; }
.loop-node.is-active { border: 1.5px solid var(--color-brand-magenta); box-shadow: var(--shadow-float); }
.loop-node.is-active .loop-node__gloss { display: block; }
.num {
  flex: none; width: 24px; height: 24px; border-radius: var(--radius-pill);
  background: var(--color-brand-violet-100); color: var(--color-brand-violet-700);
  font: 700 11px/24px var(--font-family-mono); text-align: center;
  transition: all var(--motion-fast) var(--easing-standard);
}
.is-active > .loop-node__row .num, .num.is-active { background: var(--color-brand-magenta); color: #fff; }
.loop-node--n1 { left: 50%;    top: 15.63%; width: 260px; }
.loop-node--n2 { left: 84.19%; top: 32.92%; width: 220px; }
.loop-node--n3 { left: 84.19%; top: 67.08%; width: 220px; }
.loop-node--n4 { left: 50%;    top: 84.38%; width: 250px; }
.loop-node--n5 { left: 15.81%; top: 67.08%; width: 230px; }
.loop-node--n6 { left: 15.81%; top: 32.92%; width: 230px; }
.loop__quote {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 300px;
  text-align: center; background: #fff; border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-float);
}
.loop__quote-text { font-size: 16px; line-height: 1.45; font-weight: 600; font-style: italic; color: var(--color-brand-ink-700); margin: 0; }

/* Mini loop (How Carrie works) */
.loop-how { display: grid; grid-template-columns: 280px 1fr; gap: 40px; align-items: start; }
.miniloop { position: relative; width: 280px; height: 240px; }
.miniloop__num { position: absolute; transform: translate(-50%, -50%); display: flex; }
.miniloop__center { position: absolute; left: 140px; top: 120px; transform: translate(-50%, -50%); text-align: center; width: 150px; }
.loop-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.loop-list__item { display: flex; gap: 10px; }
.loop-stepper { display: none; }

/* Vertical stepper (mobile pattern, per the 390px artboard) */
.step { display: flex; gap: 12px; align-items: flex-start; position: relative; padding-bottom: 18px; }
.step::before { content: ""; position: absolute; left: 12px; top: 28px; bottom: 2px; width: 1.5px; background: var(--color-border-strong); }
.step:last-child { padding-bottom: 0; }
.step:last-child::before { display: none; }

/* Audio player */
.player {
  display: flex; align-items: center; gap: 16px;
  background: var(--color-surface-1); border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg); padding: 18px 20px;
}
.player__btn {
  flex: none; width: 48px; height: 48px; border-radius: var(--radius-pill);
  background: var(--color-brand-magenta); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 14px; padding: 0;
  transition: background var(--motion-fast) var(--easing-standard);
}
.player__btn:hover { background: #B507B8; }
.player__wave { flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; height: 40px; overflow: hidden; }
.player__bar { flex: none; width: 4px; border-radius: 2px; align-self: center; background: var(--color-brand-violet-300); transition: background var(--motion-fast) linear; }
.player__bar.is-played { background: var(--color-brand-magenta); }
.player__time { font: 500 12.5px/1 var(--font-family-mono); color: var(--color-brand-ink-500); white-space: nowrap; }

/* Stat cards / stat rows */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card { border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 20px 22px; }
.stat-value { font-family: var(--font-family-display); font-weight: 800; font-size: 42px; line-height: 1.1; letter-spacing: -0.01em; color: var(--color-brand-black); }
.stat-value--m { font-size: 34px; }
.stat-inline { font-family: var(--font-family-display); font-weight: 800; font-size: 34px; line-height: 1.15; letter-spacing: -0.01em; color: var(--color-brand-black); }
.stat-row { display: flex; gap: 28px; }
.cohort {
  display: inline-block; padding: 4px 10px; border-radius: var(--radius-pill);
  font: 700 10px/1.3 var(--font-family-display); letter-spacing: 0.06em; text-transform: uppercase;
}
.cohort--c { background: var(--color-brand-violet-100); color: var(--color-brand-violet-700); }
.cohort--p { background: var(--color-surface-2); color: var(--color-brand-ink-500); }

/* Safety panel */
.safety { display: flex; flex-direction: column; gap: 10px; }
.safety__item { display: flex; gap: 12px; align-items: flex-start; border-radius: 0 var(--radius-md) var(--radius-md) 0; padding: 14px 18px; }
.safety__item p { font-size: 14px; line-height: 1.55; color: var(--color-brand-ink-700); font-weight: 500; margin: 0; }
.safety__item--program  { background: var(--color-surface-1);           border-left: 4px solid var(--color-brand-violet-700); }
.safety__item--critical { background: var(--color-severity-critical-bg); border-left: 4px solid var(--color-severity-critical-ink); }
.safety__item--elevated { background: var(--color-severity-elevated-bg); border-left: 4px solid var(--color-severity-elevated-ink); }
.safety__item--stable   { background: var(--color-severity-stable-bg);   border-left: 4px solid var(--color-severity-stable-ink); }

/* Ecosystem panel */
.eco { border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-lg); margin-top: 16px; overflow: hidden; }
.eco__ehr { background: var(--color-brand-violet-100); border-bottom: 1px solid var(--color-border-strong); padding: 14px 24px; text-align: center; }
.eco__ehr-title { font: 800 16px/1.4 var(--font-family-display); color: var(--color-brand-black); margin: 0; }
.eco__ehr-title span { font: 500 12.5px/1.4 var(--font-family-body); color: var(--color-brand-ink-500); }
.eco__arrows { display: grid; grid-template-columns: 1fr 54px 190px 54px 1fr; padding: 12px 24px 0; }
.eco__updown { grid-column: 3; display: flex; justify-content: center; gap: 14px; }
.eco__updown > div { text-align: center; color: var(--color-brand-magenta); font-size: 18px; line-height: 1; }
.eco__updown span { display: block; max-width: 88px; font: 500 9.5px/1.4 var(--font-family-mono); color: var(--color-brand-violet-500); margin-top: 3px; }
.eco__main { display: grid; grid-template-columns: 1fr 54px 190px 54px 1fr; align-items: center; padding: 8px 24px 16px; }
.eco__arrow { text-align: center; color: var(--color-brand-magenta); font-size: 20px; }
.eco__hub { width: 150px; height: 150px; border-radius: var(--radius-pill); background: var(--gradient-carrie-node); margin: 0 auto; display: flex; align-items: center; justify-content: center; filter: var(--elevation-float); }
.cat {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border: 1px solid var(--color-border-subtle); border-radius: 10px; background: #fff;
  font: 600 12.5px/1.35 var(--font-family-body); color: var(--color-brand-ink-700);
}
.cat-col { display: flex; flex-direction: column; gap: 7px; }
.eco-mobile { display: none; }

/* EHR logo rail */
.logo-rail { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--color-border-subtle); }
.logo-rail__row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.logo-rail__mark {
  min-width: 130px; height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle); background: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 700 13.5px/1 var(--font-family-display); color: var(--color-brand-ink-700); letter-spacing: -0.01em;
}

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  font-family: var(--font-family-display); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--color-brand-ink-500); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--color-border-strong);
}
.table td { padding: 11px 12px; border-top: 1px solid var(--color-border-subtle); vertical-align: top; color: var(--color-brand-ink-700); }
.table td.td-strong { font-weight: 700; color: var(--color-brand-black); }
.table td.td-title { color: var(--color-brand-violet-700); font-weight: 600; }
.table td.td-metric { font-weight: 800; font-family: var(--font-family-display); font-size: 15px; }
.table td .small { font-size: 13px; }
.table .qual { font-weight: 500; font-size: 12px; color: var(--color-brand-ink-500); font-family: var(--font-family-body); }

/* Card grids (governance, security, programs) */
.cards { display: grid; gap: 14px; }
.cards--2 { grid-template-columns: 1fr 1fr; }
.cards--3 { grid-template-columns: 1fr 1fr 1fr; }
.card { border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 18px 20px; }
.card__title { font-weight: 700; color: var(--color-brand-black); font-size: 16px; margin: 0; }
.card p + p, .card .small { margin-top: 5px; }

/* Programs strip (health systems) */
.strip { border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.strip__head { background: var(--color-brand-violet-100); padding: 14px 22px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.strip__head .h2 { font-size: 20px; }
.strip__body { padding: 18px 22px 20px; }

/* Modeled math */
.math { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1.2fr; gap: 10px; align-items: center; margin-top: 24px; }
.math--worked { grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1.35fr; }
.math__op { color: var(--color-brand-ink-500); font-size: 18px; text-align: center; }
.math__num {
  display: block; font-family: var(--font-family-display); font-weight: 800;
  font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; color: var(--color-brand-ink-700);
  text-transform: none; margin-bottom: 2px;
}
.math__out .math__num { color: var(--color-brand-violet-700); }
.ph {
  border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-surface-1);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--color-brand-ink-500); font: 600 11.5px/1.5 var(--font-family-display);
  letter-spacing: 0.06em; text-transform: uppercase; padding: 12px;
}
.math .ph { height: 92px; }
.math__out {
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: var(--color-brand-violet-100);
  height: 92px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px;
}
.math__out p { color: var(--color-brand-violet-700); font-weight: 700; font-size: 13.5px; line-height: 1.45; margin: 0; }

/* Triptych (specialty) */
.triptych { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.triptych .card { padding: 22px; box-shadow: var(--shadow-card); }
.icon-tile {
  width: 48px; height: 48px; border-radius: var(--radius-md);
  background: var(--color-brand-violet-100); color: var(--color-brand-magenta);
  display: flex; align-items: center; justify-content: center;
}
.triptych .h3 { margin-top: 14px; font-size: 20px; }
.triptych__sub { font-weight: 700; color: var(--color-brand-violet-700); font-size: 13.5px; margin: 4px 0 0; }

/* Path columns (specialty) */
.path { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.path > div { padding-top: 14px; }
.path__p1 { border-top: 3px solid var(--color-brand-violet-300); }
.path__p2 { border-top: 3px solid var(--color-brand-violet-500); }
.path__p3 { border-top: 3px solid var(--color-brand-magenta); }

/* Program package carousel (buyer pages) — CSS scroll-snap, no autoplay.
   Without JS (no .js class on <html>) the track renders as stacked cards. */
.carousel { position: relative; margin-top: 26px; }
.carousel__track { list-style: none; margin: 0; padding: 4px; display: grid; gap: 14px; }
.js .carousel__track {
  grid-auto-flow: column;
  grid-auto-columns: min(440px, 86%);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px;
  padding-bottom: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
.js .carousel__track > * { scroll-snap-align: start; }
.carousel__nav { display: none; }
.js .carousel__nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.carousel__btn {
  width: 40px; height: 40px; border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong); background: #fff;
  color: var(--color-brand-violet-700); font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--motion-fast) var(--easing-standard);
}
.carousel__btn:hover { background: var(--color-brand-violet-100); }
.carousel__btn:disabled { opacity: 0.35; cursor: default; background: #fff; }
.carousel__btn[hidden] { display: none; }

/* Program package card */
.pcard {
  background: #fff; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 12px;
  scroll-margin-top: 90px;
}
.pcard:target { border-color: var(--color-brand-magenta); box-shadow: var(--shadow-float); }
.pcard__author { font: 700 13px/1.45 var(--font-family-body); color: var(--color-brand-violet-700); margin: 0; }
.pcard__k {
  font-family: var(--font-family-display); font-size: 11px; line-height: 1.45; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-brand-ink-500); margin: 0 0 3px;
}
.pcard__row { margin: 0; }
.pcard__row .small { font-size: 13px; }
.pcard__foot {
  margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--color-border-subtle);
  font: 600 11.5px/1.6 var(--font-family-body); color: var(--color-brand-ink-500);
}

/* Form */
.form-card { border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-card); }
.form-stack { display: flex; flex-direction: column; gap: 18px; }
.field {
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); background: #fff;
  padding: 12px 14px; font: 500 14px/1.4 var(--font-family-body); color: var(--color-brand-ink-700);
  width: 100%;
}
.field::placeholder { color: var(--color-brand-ink-500); opacity: 1; }
.field.is-error { border: 1.5px solid var(--color-severity-critical-ink); }
textarea.field { resize: vertical; min-height: 84px; }
.radio { display: flex; align-items: center; gap: 8px; font: 600 14px/1.35 var(--font-family-body); color: var(--color-brand-ink-700); cursor: pointer; }
.radio input { accent-color: #CD08D1; width: 16px; height: 16px; margin: 0; }
.err { display: none; font: 500 12px/1.4 var(--font-family-body); color: var(--color-severity-critical-ink); margin: 5px 0 0; }
.err.is-on { display: block; }
.confirm { display: none; flex-direction: column; align-items: center; gap: 10px; padding: 28px 0; text-align: center; }
.confirm.is-on { display: flex; }
.confirm__check {
  width: 48px; height: 48px; border-radius: var(--radius-pill);
  background: var(--color-severity-stable-bg); color: var(--color-severity-stable-ink);
  display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700;
}
form.is-done .form-stack { display: none; }

/* Footer */
.foot { padding: 40px 0 44px; background: var(--color-surface-1); border-top: 1px solid var(--color-border-subtle); }
.foot__row { display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap; margin-bottom: 18px; }
.foot__row .navlink { font-size: 13px; }
.endnotes { font-size: 12px; line-height: 1.8; color: var(--color-brand-ink-500); margin: 0; }
.endnotes a { color: var(--color-brand-magenta-ink); }
.foot__cta { display: flex; align-items: center; gap: 16px; }
.foot__cta .endnotes { flex: 1; }
.foot__legal { margin-top: 16px; }

/* Legal pages (terms, privacy): long-form reading */
.legal-body { max-width: 70ch; }
.legal-body h2 {
  font-family: var(--font-family-display); font-weight: 800; font-size: 20px; line-height: 1.3;
  color: var(--color-brand-black); margin: 40px 0 0; scroll-margin-top: 90px;
}
.legal-body p { margin: 12px 0 0; }
.legal-body ul { margin: 12px 0 0; padding-left: 24px; }
.legal-body li { margin: 6px 0 0; }
.legal-body li::marker { color: var(--color-brand-magenta); }

/* Emergency band (For patients) */
.emergency { background: var(--color-severity-critical-bg); }
.emergency__lead { font-weight: 700; font-size: 17px; color: var(--color-severity-critical-ink); margin: 0; }

/* Larger reading type (For patients) */
.readable .body { font-size: 17px; }
.readable .h3 { font-size: 20px; }

/* ============================================================
   3. TABLET LAYER — @media (max-width: 1099px)
   Interpolates between the desktop canon and the 390px artboard.
   ============================================================ */
@media (max-width: 1099px) {
  .h1 { font-size: 44px; }
  .h1--page { font-size: 38px; }
  .h2 { font-size: 28px; }
  .sec { padding: 72px 0; }
  .sec--hero { padding: 56px 0; }

  /* Nav collapses below full desktop width */
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center;
    border: 1px solid var(--color-border-strong); background: #fff; border-radius: var(--radius-sm);
    width: 42px; height: 36px; cursor: pointer; padding: 0;
  }
  .nav-toggle span { width: 16px; height: 2px; background: var(--color-brand-ink-700); border-radius: 2px; }
  .nav-menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--color-border-subtle);
    flex-direction: column; gap: 14px; padding: 18px 32px 22px; box-shadow: var(--shadow-float);
  }
  .nav-menu.is-open { display: flex; }

  .grid-2 { gap: 32px; }
  .grid-2--wideleft, .grid-2--wideright, .grid-2--right14, .grid-2--even, .grid-2--book { grid-template-columns: 1fr; }
  .grid-advisors { grid-template-columns: 1fr 1fr; }
  .loop-how { grid-template-columns: 1fr; }
  .loop-how .miniloop { margin-inline: auto; }

  /* Loop: ellipse gives way to the vertical stepper below 1000px */
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .triptych { grid-template-columns: 1fr; }
  .cards--3 { grid-template-columns: 1fr 1fr; }
  .math { grid-template-columns: 1fr auto 1fr; }
  .math--worked { grid-template-columns: 1fr; }
  .math__op--eq { grid-column: 1 / -1; }
  .math__out { grid-column: 1 / -1; }
}
@media (max-width: 999px) {
  .loop { display: none; }
  .loop-stepper { display: flex; flex-direction: column; margin-top: 24px; }
  .loop-stepper .loop-node__gloss { display: block; }
  .eco { display: none; }
  .eco-mobile { display: block; border: 1.5px solid var(--color-border-strong); border-radius: 14px; overflow: hidden; margin-top: 24px; }
  .eco-mobile__ehr { background: var(--color-brand-violet-100); padding: 12px 16px; text-align: center; }
  .eco-mobile__grid { padding: 14px 16px 16px; display: grid; grid-template-columns: 22px 1fr 22px; align-items: center; }
  .eco-mobile__label-out { grid-column: 1 / 3; grid-row: 1; justify-self: start; color: var(--color-brand-magenta); }
  .eco-mobile__label-in { grid-column: 2 / 4; grid-row: 1; justify-self: end; color: var(--color-brand-magenta); }
  .eco-mobile__rail-l {
    grid-column: 1; grid-row: 2 / 5; align-self: stretch; margin: 8px -88px 46px 9px;
    border-left: 1.5px solid var(--color-brand-magenta); border-bottom: 1.5px solid var(--color-brand-magenta);
    border-bottom-left-radius: 10px; position: relative;
  }
  .eco-mobile__rail-l::after {
    content: ""; position: absolute; right: -3px; bottom: -5.2px; width: 0; height: 0;
    border-top: 4.5px solid transparent; border-bottom: 4.5px solid transparent; border-left: 7px solid var(--color-brand-magenta);
  }
  .eco-mobile__rail-r {
    grid-column: 3; grid-row: 2 / 5; align-self: stretch; margin: 8px 9px 46px -88px;
    border-right: 1.5px solid var(--color-brand-magenta); border-bottom: 1.5px solid var(--color-brand-magenta);
    border-bottom-right-radius: 10px; position: relative;
  }
  .eco-mobile__rail-r::after {
    content: ""; position: absolute; right: -5.2px; top: -3px; width: 0; height: 0;
    border-left: 4.5px solid transparent; border-right: 4.5px solid transparent; border-bottom: 7px solid var(--color-brand-magenta);
  }
  .eco-mobile__block { grid-column: 2; display: flex; flex-direction: column; gap: 8px; align-items: center; }
  .eco-mobile__block--up { grid-row: 2; padding-bottom: 8px; }
  .eco-mobile__block--down { grid-row: 6; }
  .eco-mobile__chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .eco-mobile__chips .chip { font-size: 11.5px; padding: 6px 11px; }
  .eco-mobile__down-arrow { grid-column: 2; justify-self: center; color: var(--color-brand-magenta); font-size: 16px; padding: 4px 0; }
  .eco-mobile__down-arrow--a { grid-row: 3; }
  .eco-mobile__down-arrow--b { grid-row: 5; }
  .eco-mobile__hub {
    grid-column: 2; grid-row: 4; justify-self: center;
    width: 96px; height: 96px; border-radius: var(--radius-pill);
    background: var(--gradient-carrie-node); display: flex; align-items: center; justify-content: center;
    filter: var(--elevation-float);
  }
}

/* ============================================================
   4. MOBILE LAYER — @media (max-width: 699px) · 390px artboard
   ============================================================ */
@media (max-width: 699px) {
  .container { padding-inline: 22px; }
  .h1 { font-size: 34px; }
  .h1--page { font-size: 30px; }
  .h2 { font-size: 24px; }
  .sec { padding: 52px 0; }
  .sec--hero { padding: 36px 0 44px; }
  .brand .carrie { font-size: 26px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-row { flex-direction: column; gap: 18px; }
  .cards--2, .cards--3 { grid-template-columns: 1fr; }
  .path { grid-template-columns: 1fr; }
  .btn, .btn-ghost { width: 100%; justify-content: center; }
  .btn--nav { width: auto; }
  .hero-ctas { flex-direction: column; align-items: stretch; }
  .form-card { padding: 20px; }
  .foot__cta { flex-direction: column; align-items: flex-start; }
  .loop-list { grid-template-columns: 1fr; }
  .grid-advisors { grid-template-columns: 1fr; }
  .logo-rail__mark { min-width: 0; flex: 1 1 40%; }
}

/* Tables become cards under 640px (per the mobile spec) */
@media (max-width: 639px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; }
  .table--cards tr {
    border: 1px solid var(--color-border-subtle); border-radius: 14px;
    padding: 14px 16px; margin-bottom: 8px;
  }
  .table--cards td { border: none; padding: 2px 0; }
  .table--cards td[data-label]::before {
    content: attr(data-label);
    display: block; font-family: var(--font-family-display); font-size: 10px; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--color-brand-ink-500); font-weight: 700; margin-bottom: 1px;
  }
  .table--cards td.td-metric { font-size: 22px; }
}

/* ---------- 5. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  /* Cycling stops (JS also respects this); every card and gloss renders expanded. */
  .loop-node__gloss { display: block; }
  .moment { background: #fff; border: 1px solid var(--color-border-strong); border-radius: var(--radius-lg); padding: 16px 18px; }
  .moment .mono-label { display: block; }
  .moment p { font: 600 15px/1.5 var(--font-family-body); color: var(--color-brand-ink-700); margin-top: 4px; }
  .dots { display: none; }
}
