/* MedHelix home — tokens, base styles, primitives */

:root {
  /* Ink */
  --ink:        #101722;
  --ink-soft:   #1C2531;
  --ink-muted:  #4B5563;
  --muted:      #6B7280;
  --faint:      #98A2AE;
  --line-faint: #F3F4F5;
  --line:       #EAEBED;
  --line-strong:#DCDEE2;

  /* Paper — cool neutral, matching the app shell */
  --paper:        #FAFAFA;
  --paper-tint:   #F3F4F5;
  --paper-soft:   #F6F7F8;
  --surface:      #FFFFFF;

  /* Accent — brand sky-cyan (matches the logo + app active states) */
  --accent:       #1FA6D6;
  --accent-deep:  #1683AE;
  --accent-tint:  #E3F2FA;
  --accent-soft:  #BFE2F1;

  /* Sage success */
  --sage:         #4E8A5C;
  --sage-tint:    #DCEEDF;

  /* Warm "before" — soft coral, used very sparingly */
  --warm:         #C0727A;
  --warm-tint:    #F6E2E3;

  /* Pastel category tints — the app's soft icon-chip palette */
  --c-sky-bg:    #D9ECF7;  --c-sky-fg:    #2C7FA8;
  --c-amber-bg:  #F6E7D0;  --c-amber-fg:  #BE7E34;
  --c-violet-bg: #E6DCF7;  --c-violet-fg: #6E54B5;
  --c-teal-bg:   #D8ECE8;  --c-teal-fg:   #36857C;
  --c-coral-bg:  #F6DADA;  --c-coral-fg:  #C0666A;
  --c-green-bg:  #DCEEDF;  --c-green-fg:  #4E8A5C;

  /* Type */
  --font-display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif:   "Manrope", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-sans:    "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Type scale (px) — fluid via clamp so headings shrink on small screens */
  --t-display:  clamp(38px, 7vw, 76px);   /* hero */
  --t-h1:       clamp(30px, 5vw, 52px);
  --t-h2:       clamp(25px, 3.6vw, 38px);
  --t-h3:       clamp(21px, 2.6vw, 26px);
  --t-h4:       20px;
  --t-body:     16px;
  --t-small:    14px;
  --t-tiny:     12px;
  --t-eyebrow:  12px;

  /* Shadow scale — multi-layer for depth */
  --shadow-sm: 0 1px 2px rgba(14,22,34,0.03), 0 2px 6px -2px rgba(14,22,34,0.05);
  --shadow-md: 0 1px 2px rgba(14,22,34,0.03), 0 8px 24px -8px rgba(14,22,34,0.10), 0 2px 6px -2px rgba(14,22,34,0.04);
  --shadow-lg: 0 1px 2px rgba(14,22,34,0.04), 0 20px 60px -24px rgba(14,22,34,0.24), 0 8px 24px -12px rgba(14,22,34,0.08);
  --shadow-glow: 0 0 0 1px var(--accent-soft), 0 20px 60px -20px rgba(43,90,126,0.22);

  /* Spacing */
  --gutter:     56px;
  --maxw:       1280px;
  --section-y:  120px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  /* Motion */
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

a { color: inherit; text-decoration: none; }

/* ─── Typography ─── */
.h-display { font-family: var(--font-display); font-size: var(--t-display); font-weight: 700; line-height: 1.04; letter-spacing: -0.03em; }
.h-h1      { font-family: var(--font-display); font-size: var(--t-h1);      font-weight: 700; line-height: 1.08; letter-spacing: -0.026em; }
.h-h2      { font-family: var(--font-display); font-size: var(--t-h2);      font-weight: 700; line-height: 1.14; letter-spacing: -0.022em; }
.h-h3      { font-size: var(--t-h3);      font-weight: 600; line-height: 1.24; letter-spacing: -0.014em; }
.h-h4      { font-size: var(--t-h4);      font-weight: 600; line-height: 1.3;  letter-spacing: -0.01em; }
.body      { font-size: var(--t-body);    font-weight: 400; line-height: 1.6;  color: var(--ink-muted); }
.body-lg   { font-size: 18px;             font-weight: 400; line-height: 1.6;  color: var(--ink-muted); }
.body-sm   { font-size: var(--t-small);   font-weight: 400; line-height: 1.55; color: var(--ink-muted); }
.body-xs   { font-size: var(--t-tiny);    font-weight: 400; line-height: 1.45; color: var(--muted); }
.mono      { font-family: var(--font-mono); font-feature-settings: "tnum", "ss01"; letter-spacing: 0; }

/* Quiet emphasis — no longer italic serif; just a steady accent weight */
.serif-em {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.eyebrow.no-line::before { display: none; }

/* ─── Layout ─── */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section {
  padding: var(--section-y) 0;
}
.section.tight { padding: 80px 0; }
.section.snug  { padding: 64px 0; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease), transform .18s var(--ease);
  white-space: nowrap;
}
.btn--lg { padding: 14px 24px; font-size: 15px; }
.btn--sm { padding: 8px 14px; font-size: 13px; }
.btn--primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn--primary:hover { background: var(--ink-soft); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { border-color: var(--ink); background: rgba(14,22,34,0.025); }
.btn--accent {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.btn--accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-arrow {
  display: inline-block;
  transition: transform .18s var(--ease);
}
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ─── Card ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.card.hoverable:hover {
  border-color: var(--line-strong);
  box-shadow: 0 1px 0 var(--line) inset, 0 8px 24px rgba(14,22,34,0.04);
  transform: translateY(-2px);
}

/* ─── Tag / chip ─── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--paper-tint);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-muted);
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--sage); }

/* ─── Trust strip ─── */
.trust-strip {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-muted);
}
.trust-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--sage);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ─── Subtle dividers ─── */
.hr-soft { border: 0; border-top: 1px solid var(--line); margin: 0; }
.hr-faint { border: 0; border-top: 1px solid var(--line-faint); margin: 0; }

/* ─── Scrollbar (in scroll regions) ─── */
.scroll-y { overflow-y: auto; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

/* ─── Subtle paper grain (overlay on hero / dark surfaces) ─── */
.grain { position: relative; }
.grain::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.45 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.04;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}
.grain-on-dark::after { mix-blend-mode: screen; opacity: 0.06; }

/* ─── Animations ─── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(43,90,126,0.30); }
  100% { box-shadow: 0 0 0 12px rgba(43,90,126,0); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes flow-dash {
  to { stroke-dashoffset: -32; }
}
@keyframes claim-glide {
  0%   { offset-distance: 0%;   opacity: 0; }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
@keyframes counter-pop {
  0%   { transform: translateY(4px); opacity: 0; }
  100% { transform: translateY(0);   opacity: 1; }
}
.fade-up { animation: fade-up .5s var(--ease) both; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes frag-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes frag-ring { 0% { transform: scale(0.6); opacity: 0.5; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes frag-corepulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Data-unification stage — responsive scaling of the fixed px layout */
.frag-wrap { height: 480px; display: flex; align-items: center; justify-content: center; }
.frag-stage { transform: scale(1); transform-origin: center center; }
@media (max-width: 1180px) { .frag-wrap { height: 440px; } .frag-stage { transform: scale(0.9); } }
@media (max-width: 860px)  { .frag-wrap { height: 340px; } .frag-stage { transform: scale(0.66); } }
@media (max-width: 560px)  { .frag-wrap { height: 250px; } .frag-stage { transform: scale(0.46); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes htw-travel { 0% { left: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes htw-grow { from { transform: scaleY(0.08); } to { transform: scaleY(1); } }

/* How-it-works timeline: hide the horizontal spine when cards stack */
@media (max-width: 760px) { .htw-track { display: none !important; } }

/* ─── Range slider thumb (ROI calculator) ─── */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(14,22,34,0.22); cursor: pointer;
  margin-top: -6px; /* center on 6px track */
  transition: transform .15s var(--ease);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; box-sizing: border-box;
  background: var(--surface); border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(14,22,34,0.22); cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; }

/* ─── Form fields (demo modal) ─── */
#demo-modal-root input:focus,
#demo-modal-root select:focus,
#demo-modal-root textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-tint);
}
#demo-modal-root input::placeholder,
#demo-modal-root textarea::placeholder { color: var(--faint); }

/* ─── Selection ─── */
::selection { background: var(--accent-soft); color: var(--ink); }

/* ─── Smooth anchor scrolling ─── */
html { scroll-behavior: smooth; }
[id] { scroll-margin-top: 120px; }

/* ─── Responsive grid utilities ───────────────────────────────────────── */
.rg { display: grid; }
.rg-split       { grid-template-columns: 1fr 1.05fr; }
.rg-explorer    { grid-template-columns: 340px 1fr; }
.rg-2           { grid-template-columns: 1fr 1fr; }
.rg-3           { grid-template-columns: repeat(3, 1fr); }
.rg-4           { grid-template-columns: repeat(4, 1fr); }
.rg-specialty   { grid-template-columns: 0.92fr 1.08fr; }
.rg-econ        { grid-template-columns: 1.55fr 1fr; }
.rg-assist      { grid-template-columns: 0.95fr 1.05fr; }
.rg-outcomes    { grid-template-columns: 1fr 1.1fr; }
.rg-security    { grid-template-columns: 1fr 3fr; }
.rg-footer      { grid-template-columns: 1.5fr repeat(4, 1fr); }
.rg-hitl        { grid-template-columns: auto 1fr auto; }
.rg-fte         { grid-template-columns: 1fr auto 1fr; }
.rg-logos       { grid-template-columns: repeat(6, 1fr); }
.rg-integr      { grid-template-columns: repeat(4, 1fr); }
.rg-integr-split { grid-template-columns: 1fr 1.05fr; }
.rg-integ-stats { grid-template-columns: repeat(4, 1fr); }
.rg-integ-body  { grid-template-columns: 300px 1fr; }
.rg-intspec     { grid-template-columns: 160px 1fr; }
.rg-stat3       { grid-template-columns: repeat(3, 1fr); }

/* Tablet */
@media (max-width: 1000px) {
  .rg-split, .rg-explorer, .rg-specialty, .rg-econ, .rg-assist,
  .rg-outcomes, .rg-security, .rg-hitl, .rg-integr-split, .rg-integ-body { grid-template-columns: 1fr; }
  .rg-4      { grid-template-columns: repeat(2, 1fr); }
  .rg-footer { grid-template-columns: repeat(3, 1fr); }
  .rg-logos  { grid-template-columns: repeat(3, 1fr); row-gap: 20px; }
  .rg-integr { grid-template-columns: repeat(3, 1fr); }
  .rg-hitl   { gap: 16px !important; }
  .rg-hitl > *:last-child { justify-self: start; }
}

/* Mobile */
@media (max-width: 640px) {
  .rg-2, .rg-3, .rg-fte { grid-template-columns: 1fr; }
  .rg-4, .rg-integr { grid-template-columns: repeat(2, 1fr); }
  .rg-integ-stats { grid-template-columns: repeat(2, 1fr); }
  .rg-footer { grid-template-columns: repeat(2, 1fr); }
  .rg-logos  { grid-template-columns: repeat(2, 1fr); }
  .rg-fte    { gap: 18px !important; }
  .rg-fte .fte-arrow { transform: rotate(90deg); }
  .diff-row { grid-template-columns: 1fr !important; }
  .diff-row > div:last-child { border-left: none !important; border-top: 1px solid var(--line); }
}

/* ─── Standardization layer ─── */
.std-row { display: grid; grid-template-columns: 1.2fr 1.15fr 1fr 1fr; }
.std-body-row { transition: background .2s var(--ease); }
.std-body-row:hover { background: rgba(255,255,255,0.04) !important; }
@media (max-width: 860px) {
  /* matrix becomes stacked cards: each cell labeled by its column */
  .std-head { display: none !important; }
  .std-row { grid-template-columns: 1fr; padding: 10px 0; }
  .std-body-row { border-top: 1px solid rgba(255,255,255,0.08); }
  .std-row > div { padding: 7px 18px !important; border-top: none !important; }
  .std-row > div[data-col]::before {
    content: attr(data-col);
    display: block;
    font-family: var(--font-mono);
    font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
    color: rgba(250,250,247,0.4); margin-bottom: 4px;
  }
}
@media (max-width: 420px) {
  .rg-stat3 { grid-template-columns: 1fr; }
}

/* ─── Nav (mobile) ─────────────────────────────────────────────────────── */
.nav-burger { display: none; }
.nav-mobile { display: none; }
@media (max-width: 900px) {
  .nav-links, .nav-actions .nav-signin { display: none !important; }
  .nav-burger { display: inline-flex !important; }
  .subnav { display: none !important; }
}

/* ─── Section padding on small screens (in addition to --gutter/--section-y vars) ─── */
@media (max-width: 1000px) {
  :root { --gutter: 32px; --section-y: 84px; }
  /* release the desktop zoom so breakpoints map to real viewport width */
  #page { zoom: 1 !important; }
}
@media (max-width: 640px) {
  :root { --gutter: 20px; --section-y: 64px; }
}

/* Generic: any explicit 2-col card body that should stack — handled per-component via .rg-* */

