/* ==========================================================================
   MAVTG shared design system, "Apple-style method, our own brand" (REQ-3723)
   One stylesheet for mavtg.com, Kidney Navigator and the CKD app.
   Nothing here copies Apple assets: system font stack, our colors, our logos.
   Opt-in: everything is scoped under .mva so existing pages are unchanged
   until a page adds class="mva" to <body> or a section wrapper.
   Brand switch: <body class="mva mva-kn"> (Kidney Navigator) or "mva mva-mv".
   Large print: add class "mva-large" (type scales 125 percent, Atkinson first).
   CSS only. No inline scripts. Honors prefers-reduced-motion and dark mode.
   ========================================================================== */
/* Fonts: self-hosted, SIL OFL 1.1 (licenses next to the files). Latin subset covers English and Spanish.
   Inter 4 variable has an optical-size axis, so big headlines tighten automatically. Atkinson Hyperlegible Next is
   built for low vision and loads only when large print is on (the browser fetches a font file only when it is used). */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url('/assets/fonts/inter-4-opsz-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('/assets/fonts/atkinson-next-wght-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
.mva {
  --mva-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', sans-serif;
  --mva-ink: #1d1d1f;
  --mva-ink-2: #515154;           /* 7.9:1 on white */
  --mva-bg: #ffffff;
  --mva-bg-2: #f5f5f7;
  --mva-warm: #faf6f1;            /* warm editorial section, light mode */
  --mva-line: rgba(0,0,0,.12);
  --mva-ctl: rgba(0,0,0,.5);        /* borders on controls, 3:1 or better */
  --mva-brand: #0d6fcc;           /* MAVTG blue, 5.1:1 on white */
  --mva-brand-ink: #ffffff;
  --mva-gold: #8a5a00;
  --mva-radius: 28px;
  --mva-radius-sm: 14px;
  --mva-ease: cubic-bezier(.22,.61,.36,1);
  --mva-scale: 1;
  /* type scale 17 / 21 / 28 / 40 / 56 / 80 */
  --mva-t0: calc(17px * var(--mva-scale));
  --mva-t1: calc(21px * var(--mva-scale));
  --mva-t2: calc(28px * var(--mva-scale));
  --mva-t3: clamp(30px, 5vw, calc(40px * var(--mva-scale)));
  --mva-t4: clamp(36px, 7vw, calc(56px * var(--mva-scale)));
  --mva-t5: clamp(44px, 10vw, calc(80px * var(--mva-scale)));
  margin: 0;
  font-family: var(--mva-font);
  font-optical-sizing: auto;
  font-size: var(--mva-t0);
  line-height: 1.47;
  color: var(--mva-ink);
  background: var(--mva-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.mva.mva-kn { --mva-brand: #b3261e; --mva-gold: #8a5a00; }   /* Kidney Navigator red and gold */
.mva.mva-mv { --mva-brand: #0d6fcc; }
.mva.mva-large, html.mva-large-pref .mva {
  --mva-scale: 1.25;
  --mva-font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  --mva-ink: #000; --mva-ink-2: #2b2b2e; --mva-line: rgba(0,0,0,.35);
}
@media (prefers-color-scheme: dark) {
  .mva:not(.mva-light) .mva-warm .mva-tile, .mva:not(.mva-light) .mva-alt .mva-tile { background: var(--mva-bg-2); }   /* raised cards are lighter than the page */
  .mva.mva-large:not(.mva-light), html.mva-large-pref .mva:not(.mva-light) { --mva-ink: #ffffff; --mva-ink-2: #e8e8ea; --mva-line: rgba(255,255,255,.5); }
  .mva:not(.mva-light) {
    --mva-ink: #f5f5f7; --mva-ink-2: #c7c7cc; --mva-bg: #14110e; --mva-bg-2: #1e1a16; --mva-warm: #191510; --mva-ctl: rgba(255,255,255,.55);
    --mva-line: rgba(255,255,255,.2); --mva-brand: #4fadff; --mva-brand-ink: #00131f; --mva-gold: #e0b252;
  }
  .mva.mva-kn:not(.mva-light) { --mva-brand: #ff8a80; --mva-brand-ink: #2a0503; }
}
.mva *, .mva *::before, .mva *::after { box-sizing: border-box; }

/* Headlines: huge, tight, one idea per screen */
.mva h1, .mva h2, .mva h3 { margin: 0; font-weight: 700; letter-spacing: -.022em; line-height: 1.07; text-wrap: balance; }
.mva h1 { font-size: var(--mva-t5); letter-spacing: -.03em; line-height: 1.03; }
.mva h2 { font-size: var(--mva-t4); }
.mva h3 { font-size: var(--mva-t2); line-height: 1.14; }
.mva p { margin: 0; }
.mva .mva-lead { font-size: var(--mva-t1); line-height: 1.38; color: var(--mva-ink-2); max-width: 36em; text-wrap: pretty; }
.mva a { color: var(--mva-brand); }

/* Quiet sticky nav: solid by default; translucent where blur works; fades from clear to solid as you scroll (CSS only) */
.mva .mva-nav {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 max(12px, 3.5vw);
  background: var(--mva-bg);
  border-bottom: 1px solid var(--mva-line);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .mva .mva-nav { background: color-mix(in srgb, var(--mva-bg) 78%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.mva .mva-nav { isolation: isolate; }
.mva .mva-nav::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--mva-bg); border-bottom: 1px solid var(--mva-line); opacity: 0; pointer-events: none; }
.mva .mva-nav.mva-nav-over { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; margin-bottom: -57px; }
.mva .mva-nav.mva-nav-over::before { opacity: 1; }          /* no scroll-driven support: stays solid, always readable */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .mva .mva-nav.mva-nav-over::before { opacity: 0; animation: mva-nav-solid linear both; animation-timeline: scroll(root block); animation-range: 0 140px; }
    @keyframes mva-nav-solid { from { opacity: 0; } to { opacity: 1; } }
  }
}
.mva .mva-nav a, .mva .mva-nav summary {
  color: var(--mva-ink); text-decoration: none; font-size: calc(15px * var(--mva-scale));
  min-height: 44px; min-width: 44px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 10px;
}
.mva .mva-nav a:hover, .mva .mva-nav summary:hover { color: var(--mva-brand); }
.mva .mva-nav .mva-spacer { flex: 1; }
.mva .mva-nav .mva-brandlink { font-weight: 700; letter-spacing: -.01em; padding-left: 0; }
.mva .mva-nav-links { display: flex; gap: 4px; align-items: center; }
.mva .mva-menu { display: none; position: relative; }
.mva .mva-menu summary { list-style: none; font-weight: 600; }
.mva .mva-menu summary::-webkit-details-marker { display: none; }
.mva .mva-drawer {
  position: absolute; right: 0; top: 52px; width: min(88vw, 320px); display: flex; flex-direction: column; gap: 2px; padding: 12px;
  background: var(--mva-bg); border: 1px solid var(--mva-line); border-radius: var(--mva-radius-sm); box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
.mva .mva-drawer .mva-lp { min-height: 48px; width: 100%; justify-content: flex-start; margin-top: 4px; }
.mva .mva-drawer a { justify-content: flex-start; width: 100%; min-height: 48px; font-size: var(--mva-t0); }
@media (prefers-reduced-motion: no-preference) {
  .mva .mva-menu[open] .mva-drawer { animation: mva-drawer .32s var(--mva-ease) both; }
  @keyframes mva-drawer { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
}
@media (max-width: 720px) {
  .mva .mva-tile { min-height: 0; }
  .mva .mva-nav-links { display: none; }
  .mva .mva-menu { display: block; }
}

/* Full-width sections that alternate light and dark */
.mva .mva-section { padding: clamp(56px, 8vw, 96px) max(20px, 5vw); text-align: center; }
.mva .mva-section > * { margin-left: auto; margin-right: auto; }
.mva .mva-section > * + * { margin-top: 20px; }
.mva .mva-section.mva-alt { background: var(--mva-bg-2); }
.mva .mva-section.mva-dark { --mva-ink: #f5f5f7; --mva-ink-2: #c7c7cc; --mva-brand: #4fadff; --mva-line: rgba(255,255,255,.2); background: #0b0906; color: var(--mva-ink); }
.mva.mva-kn .mva-section.mva-dark { --mva-brand: #ff8a80; }
.mva .mva-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Buttons: 44px minimum target, pill shape, one clear primary */
.mva .mva-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 28px;
  border-radius: 980px; border: 1.5px solid var(--mva-brand); background: var(--mva-brand); color: var(--mva-brand-ink);
  font: 600 var(--mva-t0)/1 var(--mva-font); text-decoration: none; cursor: pointer;
  transition: transform .12s var(--mva-ease);
}
.mva .mva-btn:active { transform: scale(.97); }
.mva .mva-btn.mva-ghost { background: transparent; color: var(--mva-brand); }
.mva .mva-btn:focus-visible, .mva .mva-nav a:focus-visible, .mva .mva-nav summary:focus-visible, .mva .mva-footer a:focus-visible, .mva .mva-tile:focus-visible { outline: 3px solid var(--mva-brand); outline-offset: 3px; }

/* Large rounded tiles, concentric radii */
.mva .mva-tiles { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); max-width: 1240px; text-align: left; }
.mva .mva-tile {
  display: flex; flex-direction: column; gap: 10px; padding: clamp(22px, 3vw, 32px); min-height: 200px;
  border-radius: var(--mva-radius); background: var(--mva-bg-2); color: var(--mva-ink); text-decoration: none;
  transition: transform .5s var(--mva-ease);
}
.mva .mva-alt .mva-tile, .mva .mva-warm .mva-tile { background: var(--mva-bg); }
.mva a.mva-tile:hover { transform: scale(1.015); }
.mva .mva-tile p { color: var(--mva-ink-2); }

/* Featured stage: the first tile is the large one, the rest stack beside it (desktop); one column on phones */
.mva .mva-tiles.mva-tiles-feature { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mva .mva-tiles-feature .mva-tile:first-child { grid-column: span 2; grid-row: span 2; justify-content: flex-end; min-height: 420px; }
.mva .mva-tiles-feature .mva-tile:first-child h3 { font-size: var(--mva-t3); }
.mva .mva-tiles-feature .mva-tile:first-child p { font-size: var(--mva-t1); }
@media (max-width: 960px) { .mva .mva-tiles.mva-tiles-feature { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .mva .mva-tiles.mva-tiles-feature { grid-template-columns: 1fr; } .mva .mva-tiles-feature .mva-tile:first-child { grid-column: auto; grid-row: auto; min-height: 0; } }

/* Big numbers: weight, blood pressure, labs. Tabular so columns line up. */
.mva .mva-stat { font-family: var(--mva-font); font-size: var(--mva-t5); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.mva .mva-stat-unit { letter-spacing: 0; font-size: var(--mva-t1); color: var(--mva-ink-2); font-weight: 500; margin-left: .25em; }
.mva .mva-stat-label { color: var(--mva-ink-2); font-size: var(--mva-t0); }

/* Free vs Paid comparison table */
.mva .mva-compare { width: 100%; max-width: 860px; border-collapse: collapse; text-align: left; }
.mva .mva-compare th, .mva .mva-compare td { padding: 14px 12px; border-bottom: 1px solid var(--mva-line); vertical-align: top; }
.mva .mva-compare thead th { font-size: var(--mva-t1); }

/* Sticky action bar: one action per screen on the app */
.mva .mva-actionbar {
  position: sticky; bottom: 0; z-index: 40; display: flex; justify-content: center; gap: 12px;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--mva-bg); border-top: 1px solid var(--mva-line);
}

/* Footer: always links /privacy and /terms */
.mva .mva-footer { padding: 40px max(20px, 5vw); background: var(--mva-bg-2); color: var(--mva-ink-2); font-size: calc(16px * var(--mva-scale)); }
.mva .mva-footer a { color: var(--mva-ink-2); display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; justify-content: center; padding: 0 8px; margin-right: 12px; }


/* Hero with a real app screen or photo; the image is decorative or described by alt text in the page */
.mva .mva-hero { padding: clamp(56px, 8vw, 96px) max(20px, 5vw) clamp(48px, 6vw, 80px); text-align: center; background: var(--mva-warm); }
.mva .mva-hero > * { margin-left: auto; margin-right: auto; }
.mva .mva-hero > * + * { margin-top: 20px; }
.mva .mva-hero-media { display: block; width: min(100%, 460px); height: auto; border-radius: var(--mva-radius); box-shadow: 0 30px 80px rgba(0,0,0,.16); margin-top: clamp(28px, 5vw, 56px); }


/* Sample device screen built from our own tokens (no stock art, no cropped screenshots). Decorative: the page gives it a text label. */
.mva .mva-device { width: min(100%, 360px); margin: clamp(28px, 5vw, 56px) auto 0; padding: 28px 26px 26px; text-align: left; border-radius: 40px;
  background: var(--mva-bg); border: 1px solid var(--mva-line); box-shadow: 0 30px 80px rgba(0,0,0,.14); }
.mva .mva-device-kicker { font-size: calc(14px * var(--mva-scale)); color: var(--mva-ink-2); font-weight: 600; }
.mva .mva-device .mva-stat { font-size: var(--mva-t4); margin-top: 6px; }
.mva .mva-device-spark { display: block; width: 100%; height: 72px; margin: 18px 0 20px; }
.mva .mva-device-spark path { fill: none; stroke: var(--mva-brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mva .mva-device .mva-btn { width: 100%; cursor: default; border-radius: 14px; }   /* 40px outer minus 26px padding */

/* Warm editorial photo tiles (use only with real photography): image on top, short label, wide gutters. Two across on phones. */
.mva .mva-warm { background: var(--mva-warm); }
.mva .mva-ptiles { display: grid; gap: clamp(14px, 2.2vw, 28px); grid-template-columns: repeat(auto-fit, minmax(min(46%, 220px), 1fr)); max-width: 1180px; text-align: left; list-style: none; padding: 0; }
.mva .mva-ptile { display: block; color: var(--mva-ink); text-decoration: none; }
.mva .mva-ptile .mva-ph { display: block; width: 100%; aspect-ratio: 5 / 4; object-fit: cover; border-radius: var(--mva-radius-sm); background: var(--mva-bg-2); transition: transform .6s var(--mva-ease); }
.mva .mva-ptile .mva-ptile-frame { overflow: hidden; border-radius: var(--mva-radius-sm); display: block; }
.mva a.mva-ptile:hover .mva-ph, .mva a.mva-ptile:focus-visible .mva-ph { transform: scale(1.03); }
.mva .mva-ptile strong { display: block; margin-top: 12px; font-size: var(--mva-t1); letter-spacing: -.01em; }
.mva .mva-ptile span.mva-sub { display: block; color: var(--mva-ink-2); font-size: var(--mva-t0); }
.mva .mva-ptile:focus-visible { outline: 3px solid var(--mva-brand); outline-offset: 4px; }

/* Large print and high contrast switch, saved on this device only (mv-apple.js) */
.mva .mva-lp { appearance: none; cursor: pointer; min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 980px; border: 1.5px solid var(--mva-ctl); background: transparent; color: var(--mva-ink); font: 600 calc(14px * var(--mva-scale))/1 var(--mva-font); }
.mva .mva-lp[aria-pressed="true"] { background: var(--mva-ink); color: var(--mva-bg); border-color: var(--mva-ink); }
.mva .mva-lp:focus-visible { outline: 3px solid var(--mva-brand); outline-offset: 3px; }

/* Pricing and comparison components (Phase 2) */
.mva .mva-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mva .mva-brandimg { display: block; height: 40px; width: auto; }
.mva .mva-nav .mva-brandlink { padding: 0; }
.mva .mva-btn.mva-btn-sm { min-height: 44px; padding: 0 18px; font-size: calc(15px * var(--mva-scale)); }
.mva .mva-nav .mva-btn { color: var(--mva-brand-ink); }
.mva .mva-nav .mva-btn:hover { color: var(--mva-brand-ink); }
.mva .mva-plans { max-width: 1100px; margin-top: 28px; }
.mva .mva-plan { background: var(--mva-bg); text-align: left; min-height: 0; }
.mva .mva-plan.mva-best { box-shadow: inset 0 0 0 2px var(--mva-brand); }
.mva .mva-price { font-size: var(--mva-t4); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.mva .mva-price small { font-size: var(--mva-t0); font-weight: 500; letter-spacing: 0; color: var(--mva-ink-2); }
.mva .mva-note { max-width: 44em; color: var(--mva-ink-2); font-size: var(--mva-t0); }
.mva .mva-sbs { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); max-width: 1180px; text-align: left; }
.mva .mva-panel { background: var(--mva-bg); border-radius: var(--mva-radius); padding: clamp(20px, 3vw, 32px); overflow-x: auto; }
.mva .mva-panel h3 { margin-bottom: 14px; }
.mva .mva-sbs .mva-compare { max-width: none; font-size: var(--mva-t0); }
.mva .mva-compare td, .mva .mva-compare thead th:not(:first-child) { text-align: center; white-space: nowrap; }
.mva .mva-compare th[scope="row"] { font-weight: 500; }
.mva .mva-footer p + p { margin-top: 12px; }

/* Accessibility additions from the pricing review */
.mva .mva-skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 12px 18px; border-radius: 10px; background: var(--mva-ink); color: var(--mva-bg); font-weight: 600; text-decoration: none; }
.mva .mva-skip:focus { top: 12px; outline: 3px solid var(--mva-brand); outline-offset: 2px; }
.mva .mva-drawer .mva-btn { min-height: 48px; justify-content: flex-start; }
.mva .mva-plan.mva-best { outline: 2px solid transparent; }
.mva .mva-panel:focus-visible { outline: 3px solid var(--mva-brand); outline-offset: 3px; }

/* Calm motion: fade and 12 to 16 px rise, once per section, CSS only */
/* Below-the-fold sections rise once as they scroll into view. Never used on the hero or the first screen (LCP rule).
   Browsers without scroll-driven animation show the content with no motion. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .mva .mva-rise { animation: mva-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 40%; }
    @keyframes mva-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  }
}
@media (prefers-reduced-motion: reduce) {
  .mva *, .mva *::before, .mva *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .mva .mva-btn, .mva .mva-tile { border: 1px solid CanvasText; }
}

/* Keep sticky-header height out of focus and anchor jumps (WCAG 2.4.11). Only pages that use the system. */
html:has(> body.mva) { scroll-padding-top: 72px; }
