/* ==========================================================================
   Creatinine Clearance Calculator — Design System
   Premium clinical aesthetic: midnight navy + signature blue (#3c93ff) + clinical teal
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* Ink / dark surfaces */
  --ink-900: #05090f;
  --ink-850: #070d16;
  --ink-800: #0a121d;
  --ink-700: #0e1929;
  --ink-600: #142335;
  --ink-500: #1c2f45;

  /* Light surfaces */
  --paper: #ffffff;
  --paper-tint: #f7f9fb;
  --paper-tint-2: #eef3f7;
  --line: #e3eaf0;
  --line-strong: #cdd8e2;

  /* Text */
  --text-900: #0b1622;
  --text-700: #33475b;
  --text-500: #5b7185;
  --text-on-dark: #eaf2f8;
  --text-on-dark-dim: #a3b8ca;

  /* Brand — signature blue is the primary accent; teal stays as its cool complement */
  --teal-400: #35e0c4;
  --teal-500: #17c3aa;
  --teal-600: #0d9c8b;
  --teal-700: #0a7a6e;
  --gold-300: #bcdcff;
  --gold-400: #3c93ff;
  --gold-500: #2f7fe0;
  --gold-600: #1f63b8;
  --azure-400: #62b6ff;
  --azure-500: #2f8fe8;

  /* Status */
  --ok: #16a34a;
  --ok-soft: #e7f7ed;
  --mild: #65a30d;
  --mild-soft: #f1f8e4;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --high: #ea580c;
  --high-soft: #fdeee3;
  --crit: #dc2626;
  --crit-soft: #fdeaea;

  /* Gradients */
  --grad-gold: linear-gradient(135deg, #bcdcff 0%, #3c93ff 45%, #1f63b8 100%);
  --grad-teal: linear-gradient(135deg, #4defd0 0%, #17c3aa 55%, #0a7a6e 100%);
  --grad-dark: radial-gradient(1200px 620px at 78% -12%, #14364a 0%, transparent 62%),
               radial-gradient(900px 520px at 10% 8%, #12283f 0%, transparent 58%),
               linear-gradient(180deg, #070d16 0%, #0a1421 60%, #070d16 100%);

  /* Type */
  --font-display: "Poppins", "Segoe UI", Arial, sans-serif;
  --font-body: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Space & shape */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(11, 22, 34, .06), 0 2px 8px rgba(11, 22, 34, .05);
  --shadow-md: 0 4px 12px rgba(11, 22, 34, .07), 0 14px 34px rgba(11, 22, 34, .07);
  --shadow-lg: 0 10px 24px rgba(11, 22, 34, .09), 0 30px 70px rgba(11, 22, 34, .12);
  --shadow-glow: 0 0 0 1px rgba(53, 224, 196, .22), 0 18px 60px rgba(13, 156, 139, .22);
  --maxw: 1200px;
  --maxw-prose: 76ch;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="dark"] {
  --paper: #0a121d;
  --paper-tint: #101b29;
  --paper-tint-2: #142335;
  --line: #213246;
  --line-strong: #2a4057;
  --text-900: #eaf2f8;
  --text-700: #c3d5e4;
  --text-500: #8ea5b8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .24), 0 8px 18px rgba(0, 0, 0, .18);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .28), 0 18px 40px rgba(0, 0, 0, .24);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, .34), 0 30px 80px rgba(0, 0, 0, .3);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.72;
  color: var(--text-700);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  margin: 0;
}
img, video { display: block; max-width: 100%; height: auto; }
svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: var(--teal-700); text-decoration-color: rgba(13, 156, 139, .35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
ul, ol { padding-left: 1.15rem; }
li + li { margin-top: .45rem; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 3px solid var(--teal-500); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgba(60, 147, 255, .35); color: var(--text-900); }

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  color: var(--text-900);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 5.2vw, 3.65rem); letter-spacing: -.028em; font-weight: 700; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); letter-spacing: -.022em; }
h3 { font-size: clamp(1.22rem, 2.1vw, 1.5rem); }
h4 { font-size: 1.08rem; font-family: var(--font-body); font-weight: 700; letter-spacing: -.01em; }
p { text-wrap: pretty; }

/* ---------- 3. Layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }
.wrap--narrow { max-width: 900px; }
.section { padding-block: clamp(2.4rem, 4.5vw, 4.2rem); position: relative; }
.section--tint { background: var(--paper-tint); border-block: 1px solid var(--line); }
.section--dark { background: var(--grad-dark); color: var(--text-on-dark-dim); }
.section--dark h2, .section--dark h3, .section--dark h4 { color: #fff; }
.section--dark a { color: var(--teal-400); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stack > * + * { margin-top: 1.05rem; }

.section-head { max-width: 760px; margin-bottom: clamp(1.4rem, 2.6vw, 2.1rem); }
.section-head--center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-body); font-size: .74rem; font-weight: 700;
  letter-spacing: .19em; text-transform: uppercase; color: var(--gold-600);
  margin-bottom: .9rem;
}
.eyebrow::before {
  content: ""; width: 28px; height: 2px; border-radius: 2px; background: var(--grad-gold);
}
.section--dark .eyebrow { color: var(--gold-400); }
.section-head p { font-size: 1.09rem; margin-top: 1rem; color: var(--text-500); }
.section--dark .section-head p { color: var(--text-on-dark-dim); }
.section-head--center p { margin-inline: auto; }

/* ---------- 4. Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .92rem 1.6rem; border-radius: var(--r-pill);
  font-weight: 650; font-size: .97rem; letter-spacing: -.005em;
  text-decoration: none; border: 1px solid transparent;
  transition: transform .22s var(--ease-out), box-shadow .22s var(--ease), background .22s var(--ease), color .2s var(--ease);
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--gold {
  background: var(--grad-gold); color: #ffffff;
  box-shadow: 0 6px 18px rgba(47, 127, 224, .32), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn--gold:hover { box-shadow: 0 12px 30px rgba(47, 127, 224, .42), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn--teal {
  background: var(--grad-teal); color: #032b26;
  box-shadow: 0 6px 18px rgba(13, 156, 139, .3), inset 0 1px 0 rgba(255, 255, 255, .32);
}
.btn--teal:hover { box-shadow: 0 12px 32px rgba(13, 156, 139, .42); }
.btn--ghost-light { border-color: rgba(255, 255, 255, .22); color: #fff; background: rgba(255, 255, 255, .05); }
.btn--ghost-light:hover { background: rgba(255, 255, 255, .11); border-color: rgba(255, 255, 255, .34); }
.btn--ghost { border-color: var(--line-strong); color: var(--text-900); background: #fff; }
.btn--ghost:hover { border-color: var(--teal-500); color: var(--teal-700); }
.btn--sm { padding: .6rem 1.05rem; font-size: .86rem; }
.btn--block { width: 100%; }

.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .42rem .85rem; border-radius: var(--r-pill);
  font-size: .8rem; font-weight: 600; letter-spacing: -.005em;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .13);
  color: var(--text-on-dark);
}
.chip svg { width: 15px; height: 15px; flex: none; color: var(--teal-400); }
.chip-row { display: flex; flex-wrap: wrap; gap: .55rem; }

.badge {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .46rem 1rem .46rem .78rem; border-radius: var(--r-pill);
  font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: rgba(60, 147, 255, .11); border: 1px solid rgba(60, 147, 255, .3);
  color: var(--gold-300);
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--teal-400);
  box-shadow: 0 0 0 4px rgba(53, 224, 196, .18); animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(53, 224, 196, .2); }
  50% { box-shadow: 0 0 0 8px rgba(53, 224, 196, 0); }
}

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(7, 13, 22, .82);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  transition: background .3s var(--ease), border-color .3s var(--ease);
}
.site-header.is-scrolled { background: rgba(5, 9, 15, .95); border-bottom-color: rgba(60, 147, 255, .2); }
.header-inner {
  display: flex; align-items: center; gap: .75rem;
  min-height: 72px; position: relative;
  overflow: visible;
}
.header-actions {
  display: flex; align-items: center; gap: .55rem;
  flex: none; margin-left: auto; z-index: 6;
}

.brand {
  display: flex; align-items: center; gap: .65rem; text-decoration: none;
  flex: 1 1 auto; min-width: 0;
  position: relative; z-index: 6;
}
.brand-logo {
  display: block; width: 44px; height: 44px; flex: none; object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(60, 147, 255, .28), 0 0 18px rgba(53, 224, 196, .12);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(150deg, rgba(53, 224, 196, .2), rgba(60, 147, 255, .18));
  border: 1px solid rgba(60, 147, 255, .32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name {
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  color: #fff; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-name b { color: var(--gold-400); font-weight: 600; }
.brand-sub {
  font-size: .6rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-on-dark-dim); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Hidden by default — only desktop shows inline nav (prevents logo overlap) */
.nav {
  display: none;
  align-items: center; gap: .05rem;
  flex: 1 1 auto; min-width: 0; justify-content: flex-end;
}
.nav > a {
  padding: .5rem .52rem; border-radius: var(--r-sm); text-decoration: none;
  font-size: .84rem; font-weight: 550; color: var(--text-on-dark-dim); white-space: nowrap;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav > a:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.header-cta { flex: none; }
.nav-dropdown { position: relative; flex: none; }
.nav-dropdown-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .55rem; border-radius: var(--r-sm);
  font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-400); white-space: nowrap; background: transparent; border: 0; cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.nav-dropdown-toggle svg {
  width: 14px; height: 14px; flex: none;
  transition: transform .2s var(--ease);
}
.nav-dropdown-toggle:hover,
.nav-dropdown.is-open .nav-dropdown-toggle,
.nav-dropdown:hover .nav-dropdown-toggle { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-dropdown.is-open .nav-dropdown-toggle svg,
.nav-dropdown:hover .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu {
  position: absolute; top: calc(100% + .2rem); right: 0; min-width: 230px;
  padding: .35rem 0; border-radius: 8px;
  background: #1a2a3a; border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  pointer-events: none; z-index: 70;
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s var(--ease);
}
.nav-dropdown-menu::before {
  content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  opacity: 1; visibility: visible; transform: none; pointer-events: auto;
}
.nav-dropdown-menu a {
  display: block; width: 100%; padding: .85rem 1.15rem; border-radius: 0;
  font-size: .95rem; font-weight: 700; color: #fff; text-decoration: none; white-space: nowrap;
  border-bottom: 1px dashed rgba(255, 255, 255, .28); background: transparent;
}
.nav-dropdown-menu a:last-child { border-bottom: 0; }
.nav-dropdown-menu a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-dropdown-menu a[aria-current="page"] { color: var(--teal-400); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: .45rem; flex: none;
  padding: .58rem .78rem; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06); color: #fff;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); transform: translateY(-1px); }
.theme-toggle-label { font-size: .82rem; font-weight: 650; letter-spacing: .01em; }
.theme-icon { width: 17px; height: 17px; flex: none; }
.theme-icon--moon { display: none; }
html[data-theme="dark"] .theme-icon--sun { display: none; }
html[data-theme="dark"] .theme-icon--moon { display: block; }
.nav-toggle {
  display: grid; width: 44px; height: 44px; border-radius: 12px; flex: none;
  border: 1px solid rgba(255, 255, 255, .16); color: #fff; place-items: center;
  background: rgba(255, 255, 255, .06);
}
.nav-toggle svg { width: 22px; height: 22px; }
.nav-toggle .icon-close, .nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.header-cta { display: none; }

/* Mobile / tablet / most desktops: hamburger panel only (no logo overlap) */
.nav.is-open {
  display: flex;
  position: fixed;
  top: 72px; left: 0; right: 0; width: 100%;
  flex-direction: column; align-items: stretch;
  gap: .15rem; padding: 1rem clamp(1.1rem, 4vw, 2.5rem) 1.5rem;
  background: rgba(5, 9, 15, .98); backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  max-height: calc(100vh - 72px); overflow-y: auto; z-index: 60;
  margin: 0; justify-content: flex-start;
}
.nav.is-open > a {
  padding: .78rem .9rem; font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.nav.is-open .nav-dropdown { width: 100%; }
.nav.is-open .nav-dropdown-toggle {
  width: 100%; justify-content: space-between; padding: .78rem .9rem; font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}
.nav.is-open .nav-dropdown-menu {
  position: static; min-width: 0; margin: .15rem 0 .4rem;
  opacity: 1; visibility: visible; transform: none;
  pointer-events: none; display: none; box-shadow: none;
  background: rgba(26, 42, 58, .95);
}
.nav.is-open .nav-dropdown-menu::before { display: none; }
.nav.is-open .nav-dropdown:hover .nav-dropdown-menu,
.nav.is-open .nav-dropdown:focus-within .nav-dropdown-menu {
  display: none; pointer-events: none;
}
.nav.is-open .nav-dropdown.is-open .nav-dropdown-menu {
  display: grid; pointer-events: auto;
}


/* ---------- 6. Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad-dark);
  padding-block: clamp(2.6rem, 5vw, 4.6rem) clamp(3rem, 6vw, 5rem);
  color: var(--text-on-dark-dim);
  isolation: isolate;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; width: min(620px, 140vw); height: min(620px, 140vw);
  right: -180px; top: -230px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(53, 224, 196, .17) 0%, transparent 66%);
  filter: blur(24px);
}
/* Stacked hero: badge -> H1 -> one-line lead -> calculator -> supporting stat row */
.hero-stack {
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(1.8rem, 4vw, 2.6rem);
}
.hero-copy { max-width: 700px; text-align: center; }
.hero-copy .badge { margin-bottom: .2rem; }
.hero h1 { color: #fff; margin-block: 1.05rem .9rem; }
.hero h1 .accent {
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  font-size: clamp(1.05rem, 1.8vw, 1.2rem); color: #c3d5e4;
  max-width: 62ch; margin-inline: auto;
}
.hero-lead strong { color: #fff; font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 1.6rem; }

/* Compact supporting stat row directly under the calculator */
.hero-substats {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .6rem clamp(.9rem, 3vw, 2rem); width: 100%;
}
.hero-substats .stat {
  display: inline-flex; align-items: baseline; gap: .4rem;
  font-size: .86rem; color: var(--text-on-dark-dim); font-weight: 550;
}
.hero-substats .stat b {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: #fff;
}
.hero-substats .stat b em {
  font-style: normal; background: var(--grad-teal);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-substats .sep { color: rgba(255, 255, 255, .22); }

/* ---------- 7. Calculator card ---------- */
.calc-card {
  width: 100%; max-width: 900px; margin-inline: auto;
  background: linear-gradient(168deg, rgba(21, 39, 58, .96) 0%, rgba(10, 19, 31, .98) 100%);
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: var(--r-xl);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .09);
  overflow: hidden;
  position: relative;
}
.calc-card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold-400) 22%, var(--teal-400) 78%, transparent);
  opacity: .85;
}
.calc-head {
  padding: 1.35rem clamp(1.1rem, 2.6vw, 1.9rem) 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.calc-head h2 {
  font-size: 1.24rem; color: #fff; margin: 0; letter-spacing: -.02em;
  display: flex; align-items: center; gap: .6rem;
}
.calc-head h2 svg { width: 22px; height: 22px; color: var(--gold-400); flex: none; }
.calc-head .privacy-note {
  margin-left: auto; font-size: .74rem; color: #7f97ac;
  display: inline-flex; align-items: center; gap: .35rem;
}
.calc-head .privacy-note svg { width: 13px; height: 13px; color: var(--teal-400); }

.calc-body { padding: clamp(1.1rem, 2.6vw, 1.9rem); }

/* Field grid */
.field-grid { display: grid; gap: 1.05rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { min-width: 0; }
.field--full { grid-column: 1 / -1; }
@media (max-width: 560px) { .field-grid { grid-template-columns: minmax(0, 1fr); } }

.field > label, .field-label {
  display: flex; align-items: center; gap: .4rem; margin-bottom: .48rem;
  font-size: .81rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: #9fb6c9;
}
.field-label .hint-btn {
  width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .24); color: #9fb6c9; font-size: .64rem;
  font-weight: 700; line-height: 1; flex: none; transition: .2s var(--ease);
}
.field-label .hint-btn:hover { background: var(--teal-500); border-color: var(--teal-500); color: #04241f; }

.input-shell {
  display: flex; align-items: stretch; border-radius: 14px; overflow: hidden;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.input-shell:focus-within {
  border-color: var(--teal-400); background: rgba(53, 224, 196, .07);
  box-shadow: 0 0 0 4px rgba(53, 224, 196, .15);
}
.input-shell.is-invalid { border-color: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, .16); }
.input-shell input, .input-shell select {
  flex: 1 1 auto; min-width: 0; padding: .82rem .95rem;
  background: transparent; border: 0; color: #fff;
  font-size: 1.06rem; font-weight: 550; font-variant-numeric: tabular-nums;
}
.input-shell input:focus, .input-shell select:focus { outline: none; }
.input-shell input::placeholder { color: #6e869c; font-weight: 400; }
.input-shell input::-webkit-outer-spin-button,
.input-shell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input-shell input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.input-suffix {
  display: grid; place-items: center; padding-inline: .85rem;
  font-size: .84rem; font-weight: 600; color: #8ba4b9;
  background: rgba(255, 255, 255, .04); border-left: 1px solid rgba(255, 255, 255, .1);
  white-space: nowrap;
}

/* Segmented control */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12); }
.seg--sm { padding: 3px; border-radius: 11px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  flex: 1 1 0; text-align: center; padding: .62rem .5rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600; color: #9fb6c9; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  white-space: nowrap; min-width: 0;
}
.seg--sm label { padding: .38rem .55rem; font-size: .8rem; }
.seg label:hover { color: #fff; }
.seg input:checked + label {
  background: linear-gradient(150deg, rgba(255, 255, 255, .96), rgba(226, 238, 245, .92));
  color: #08131f; box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.seg input:focus-visible + label { outline: 3px solid var(--teal-400); outline-offset: 2px; }
.seg label svg { width: 15px; height: 15px; }

/* Select shell */
.select-shell { position: relative; }
.select-shell::after {
  content: ""; position: absolute; right: 1rem; top: 50%; width: 9px; height: 9px;
  border-right: 2px solid #9fb6c9; border-bottom: 2px solid #9fb6c9;
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select-shell select {
  width: 100%; appearance: none; -webkit-appearance: none;
  padding: .82rem 2.4rem .82rem .95rem; border-radius: 14px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .14);
  color: #fff; font-size: .99rem; font-weight: 550;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.select-shell select:focus { outline: none; border-color: var(--teal-400); box-shadow: 0 0 0 4px rgba(53, 224, 196, .15); }
.select-shell select option { background: #0e1929; color: #fff; }

.field-note { font-size: .78rem; color: #7f97ac; margin-top: .4rem; line-height: 1.5; }
.field-note strong { color: var(--teal-400); font-weight: 600; }
.error-text { font-size: .78rem; color: #fca5a5; margin-top: .38rem; display: none; }
.input-shell.is-invalid ~ .error-text, .error-text.is-shown { display: block; }

/* Advanced options */
.calc-advanced {
  margin-top: 1.1rem; border-top: 1px dashed rgba(255, 255, 255, .13); padding-top: 1rem;
}
.calc-advanced > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .5rem;
  font-size: .85rem; font-weight: 650; color: var(--teal-400); letter-spacing: .01em;
}
.calc-advanced > summary::-webkit-details-marker { display: none; }
.calc-advanced > summary::before {
  content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg);
  transition: transform .25s var(--ease); flex: none;
}
.calc-advanced[open] > summary::before { transform: rotate(45deg); }
.advanced-body { margin-top: 1rem; display: grid; gap: .85rem; }

.switch-row {
  display: flex; align-items: flex-start; gap: .75rem; cursor: pointer;
  padding: .7rem .85rem; border-radius: 12px;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .09);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.switch-row:hover { border-color: rgba(53, 224, 196, .34); background: rgba(53, 224, 196, .05); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-visual {
  width: 40px; height: 23px; border-radius: 999px; flex: none; margin-top: 1px;
  background: rgba(255, 255, 255, .16); position: relative; transition: background .22s var(--ease);
}
.switch-visual::after {
  content: ""; position: absolute; inset: 3px auto 3px 3px; width: 17px; border-radius: 50%;
  background: #fff; transition: transform .24s var(--ease-out);
}
.switch-row input:checked + .switch-visual { background: var(--grad-teal); }
.switch-row input:checked + .switch-visual::after { transform: translateX(17px); }
.switch-row input:focus-visible + .switch-visual { outline: 3px solid var(--teal-400); outline-offset: 3px; }
.switch-copy { font-size: .88rem; color: #c3d5e4; line-height: 1.5; }
.switch-copy b { display: block; color: #fff; font-weight: 600; font-size: .9rem; }
.switch-copy span { font-size: .79rem; color: #8ba4b9; }

.calc-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: .7rem;
  margin-top: 1.35rem;
  align-items: stretch;
}
.calc-actions .btn {
  white-space: nowrap;
  min-height: 48px;
  padding-inline: 1.15rem;
}
.calc-actions .btn--gold { width: 100%; }
.calc-actions .btn svg { flex: none; }
@media (max-width: 560px) {
  .calc-actions { grid-template-columns: 1fr 1fr; }
  .calc-actions .btn--gold { grid-column: 1 / -1; }
}


/* Guidance banner inside calculator */
.guide-banner[hidden] { display: none !important; }
.guide-banner {
  display: none; gap: .7rem; align-items: flex-start; margin-top: 1.1rem;
  padding: .85rem 1rem; border-radius: 14px; font-size: .87rem; line-height: 1.55;
  background: rgba(60, 147, 255, .1); border: 1px solid rgba(60, 147, 255, .28);
  color: #e8d5ae;
}
.guide-banner.is-shown {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: normal;
}
/* Keep icon + one text block; never let raw <b>/text nodes become skinny flex columns */
.guide-banner.is-shown > svg { flex: 0 0 auto; }
.guide-banner.is-shown > span,
.guide-banner.is-shown > div,
.guide-banner.is-shown > p {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}
.guide-banner svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--gold-400); }
.guide-banner b { color: var(--gold-300); }
.guide-banner button {
  color: var(--teal-400); font-weight: 650; text-decoration: underline;
  text-underline-offset: 3px; font-size: .87rem;
}
@media (max-width: 560px) {
  .guide-banner {
    font-size: .86rem;
    padding: .8rem .9rem;
  }
}

/* ---------- 8. Results ---------- */
.results {
  border-top: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(180deg, rgba(6, 12, 20, .6), rgba(6, 12, 20, .95));
  padding: clamp(1.2rem, 2.6vw, 1.9rem);
}
.results[hidden] { display: none; }
.result-hero { display: flex; align-items: center; gap: clamp(1rem, 3vw, 1.8rem); flex-wrap: wrap; }
.gauge-wrap { position: relative; width: 168px; height: 168px; flex: none; }
.gauge-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.gauge-track { fill: none; stroke: rgba(255, 255, 255, .09); stroke-width: 13; stroke-linecap: round; }
.gauge-fill {
  fill: none; stroke-width: 13; stroke-linecap: round;
  stroke: url(#gaugeGrad);
  transition: stroke-dashoffset .95s var(--ease-out), stroke .5s var(--ease);
  filter: drop-shadow(0 0 10px rgba(53, 224, 196, .45));
}
.gauge-center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.gauge-value {
  font-family: var(--font-display); font-size: 2.55rem; font-weight: 600; color: #fff;
  letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums;
}
.gauge-unit { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: #8ba4b9; font-weight: 650; margin-top: .3rem; }

.result-summary { flex: 1 1 260px; min-width: 0; }
.result-summary .kicker {
  font-size: .73rem; letter-spacing: .17em; text-transform: uppercase;
  color: var(--gold-400); font-weight: 700; margin-bottom: .5rem;
}
.stage-pill {
  display: inline-flex; align-items: center; gap: .5rem; padding: .45rem 1rem;
  border-radius: var(--r-pill); font-size: .87rem; font-weight: 700; margin-bottom: .7rem;
}
.stage-pill .sp-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.stage-pill[data-tone="ok"] { background: rgba(22, 163, 74, .16); color: #6ee7a8; border: 1px solid rgba(22, 163, 74, .35); }
.stage-pill[data-tone="mild"] { background: rgba(132, 204, 22, .15); color: #bef264; border: 1px solid rgba(132, 204, 22, .32); }
.stage-pill[data-tone="warn"] { background: rgba(217, 119, 6, .16); color: #fcd34d; border: 1px solid rgba(217, 119, 6, .35); }
.stage-pill[data-tone="high"] { background: rgba(234, 88, 12, .16); color: #fdba74; border: 1px solid rgba(234, 88, 12, .35); }
.stage-pill[data-tone="crit"] { background: rgba(220, 38, 38, .16); color: #fca5a5; border: 1px solid rgba(220, 38, 38, .38); }
.result-interpretation { font-size: .96rem; color: #c3d5e4; line-height: 1.62; }
.result-interpretation strong { color: #fff; }

/* Metric tiles */
.metric-grid {
  display: grid; gap: .7rem; margin-top: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.metric {
  padding: .85rem .95rem; border-radius: 14px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .1);
  transition: border-color .2s var(--ease), transform .2s var(--ease-out);
}
.metric:hover { border-color: rgba(53, 224, 196, .3); transform: translateY(-2px); }
.metric .m-lbl {
  font-size: .7rem; letter-spacing: .09em; text-transform: uppercase;
  color: #8ba4b9; font-weight: 650; display: flex; align-items: center; gap: .35rem;
}
.metric .m-val {
  font-family: var(--font-display); font-size: 1.42rem; font-weight: 600; color: #fff;
  letter-spacing: -.025em; margin-top: .28rem; font-variant-numeric: tabular-nums;
}
.metric .m-val small { font-size: .62em; color: #9fb6c9; font-weight: 500; margin-left: .18rem; font-family: var(--font-body); }
.metric.is-primary { background: rgba(53, 224, 196, .09); border-color: rgba(53, 224, 196, .3); }

/* Formula visualizer */
.formula-viz {
  margin-top: 1.4rem; padding: 1.15rem clamp(.9rem, 2.4vw, 1.4rem); border-radius: 18px;
  background: linear-gradient(140deg, rgba(60, 147, 255, .09), rgba(53, 224, 196, .06));
  border: 1px solid rgba(60, 147, 255, .24);
  overflow-x: auto;
}
.formula-viz .fv-title {
  font-size: .73rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-400); font-weight: 700; margin-bottom: .95rem;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.formula-viz .fv-title span { color: #7f97ac; letter-spacing: .02em; text-transform: none; font-weight: 500; font-size: .78rem; }
.fv-equation {
  display: flex; align-items: center; gap: .7rem; flex-wrap: nowrap;
  font-family: var(--font-mono); font-size: .95rem; color: #eaf2f8; min-width: max-content;
}
.fv-frac { display: inline-flex; flex-direction: column; align-items: center; gap: .3rem; }
.fv-num, .fv-den { display: flex; align-items: center; gap: .32rem; white-space: nowrap; padding-inline: .3rem; }
.fv-bar { width: 100%; height: 2px; background: rgba(255, 255, 255, .4); border-radius: 2px; }
.fv-tok {
  padding: .2rem .48rem; border-radius: 7px; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .13); font-variant-numeric: tabular-nums;
  transition: background .3s var(--ease), border-color .3s var(--ease), transform .3s var(--ease-out);
}
.fv-tok.is-live { background: rgba(53, 224, 196, .2); border-color: rgba(53, 224, 196, .48); color: #b8fff2; }
.fv-tok.is-pop { animation: tokPop .45s var(--ease-out); }
@keyframes tokPop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.fv-op { color: #8ba4b9; }
.fv-result {
  padding: .28rem .7rem; border-radius: 9px; font-weight: 700;
  background: var(--grad-gold); color: #ffffff; border: 0;
}
.fv-legend { margin-top: .95rem; font-size: .8rem; color: #9fb6c9; line-height: 1.6; }
.fv-legend code {
  font-family: var(--font-mono); font-size: .88em; padding: .1rem .35rem; border-radius: 5px;
  background: rgba(255, 255, 255, .09); color: #cfe4f0;
}

.result-tools { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.3rem; }
.tool-btn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem;
  border-radius: var(--r-pill); font-size: .84rem; font-weight: 620;
  border: 1px solid rgba(255, 255, 255, .16); color: #c3d5e4;
  transition: .2s var(--ease);
}
.tool-btn:hover { border-color: var(--teal-400); color: #fff; background: rgba(53, 224, 196, .1); }
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn.is-done { border-color: var(--teal-500); color: var(--teal-400); }

.disclaimer-inline {
  margin-top: 1.2rem; padding: .8rem 1rem; border-radius: 12px; font-size: .81rem;
  line-height: 1.6; color: #9fb6c9;
  background: rgba(255, 255, 255, .035); border-left: 3px solid var(--gold-500);
}
.disclaimer-inline b { color: var(--gold-300); }

/* Equation comparison table (inside results) */
.eq-compare { margin-top: 1.4rem; }
.eq-compare h4 {
  font-size: .73rem; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold-400); font-weight: 700; margin-bottom: .8rem; font-family: var(--font-body);
}
.eq-table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .1); }
.eq-table { font-size: .88rem; min-width: 460px; }
.eq-table th, .eq-table td { padding: .68rem .9rem; text-align: left; }
.eq-table thead th {
  font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: #8ba4b9;
  font-weight: 650; background: rgba(255, 255, 255, .05); border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.eq-table tbody tr + tr td { border-top: 1px solid rgba(255, 255, 255, .07); }
.eq-table td:first-child { color: #eaf2f8; font-weight: 550; }
.eq-table td .eq-note { display: block; font-size: .76rem; color: #7f97ac; font-weight: 400; }
.eq-table td.num { font-variant-numeric: tabular-nums; color: #fff; font-weight: 650; white-space: nowrap; }
.eq-table tbody tr.is-primary { background: rgba(53, 224, 196, .08); }
.eq-table tbody tr.is-primary td:first-child { color: var(--teal-400); }

/* ---------- 9. Trust strip ---------- */
.trust-strip {
  background: var(--ink-900); border-bottom: 1px solid rgba(255, 255, 255, .07);
  padding-block: 1.1rem;
}
.trust-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: .7rem clamp(1rem, 3vw, 2.4rem);
}
.trust-item {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .83rem;
  color: #93aabf; font-weight: 550;
}
.trust-item svg { width: 17px; height: 17px; color: var(--gold-400); flex: none; }

/* ---------- 10. Cards / features ---------- */
.card-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 660px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.6rem; box-shadow: var(--shadow-sm);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease), border-color .3s var(--ease);
  position: relative; overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: var(--grad-teal); opacity: 0; transition: opacity .3s var(--ease);
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: rgba(23, 195, 170, .3); }
.card:hover::after { opacity: 1; }
.card-icon {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(145deg, rgba(23, 195, 170, .13), rgba(60, 147, 255, .16));
  border: 1px solid rgba(23, 195, 170, .22); margin-bottom: 1.05rem;
}
.card-icon svg { width: 25px; height: 25px; color: var(--teal-700); }
.card h3 { font-size: 1.16rem; margin-bottom: .55rem; }
.card p { font-size: .95rem; color: var(--text-500); }
.section--dark .card {
  background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .1);
  box-shadow: none; color: var(--text-on-dark-dim);
}
.section--dark .card:hover { background: rgba(255, 255, 255, .06); border-color: rgba(53, 224, 196, .32); }
.section--dark .card p { color: var(--text-on-dark-dim); }
.section--dark .card-icon {
  background: linear-gradient(145deg, rgba(53, 224, 196, .16), rgba(60, 147, 255, .14));
  border-color: rgba(53, 224, 196, .28);
}
.section--dark .card-icon svg { color: var(--teal-400); }

/* ---------- 11. Interactive: How it works stepper ---------- */
.how-layout { display: grid; gap: clamp(1.6rem, 4vw, 3rem); align-items: start; }
@media (min-width: 980px) { .how-layout { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); } }

.step-list { display: grid; gap: .7rem; }
.step-item {
  display: flex; gap: 1rem; align-items: flex-start; width: 100%; text-align: left;
  padding: 1.1rem 1.15rem; border-radius: var(--r-md);
  background: rgba(255, 255, 255, .03); border: 1px solid rgba(255, 255, 255, .09);
  transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease-out);
  position: relative;
}
.step-item:hover { background: rgba(255, 255, 255, .06); transform: translateX(3px); }
.step-item[aria-selected="true"] {
  background: linear-gradient(120deg, rgba(53, 224, 196, .12), rgba(60, 147, 255, .07));
  border-color: rgba(53, 224, 196, .38);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
}
.step-item[aria-selected="true"]::before {
  content: ""; position: absolute; left: -1px; top: 14%; bottom: 14%; width: 3px;
  border-radius: 3px; background: var(--grad-teal);
}
.step-num {
  width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 1.02rem; font-weight: 600;
  background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); color: #cfe4f0;
  transition: .25s var(--ease);
}
.step-item[aria-selected="true"] .step-num {
  background: var(--grad-gold); color: #ffffff; border-color: transparent;
  box-shadow: 0 4px 14px rgba(47, 127, 224, .35);
}
.step-text h3 { font-size: 1.06rem; color: #fff; margin-bottom: .28rem; font-family: var(--font-body); font-weight: 650; }
.step-text p { font-size: .9rem; color: var(--text-on-dark-dim); line-height: 1.6; }

.diagram-stage {
  background: linear-gradient(165deg, rgba(20, 38, 56, .78), rgba(7, 13, 22, .92));
  border: 1px solid rgba(255, 255, 255, .11); border-radius: var(--r-xl);
  padding: clamp(1rem, 2.5vw, 1.7rem);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .07);
  position: relative; overflow: hidden;
}
.diagram-stage::before {
  content: ""; position: absolute; width: 340px; height: 340px; right: -120px; top: -140px;
  border-radius: 50%; background: radial-gradient(circle, rgba(53, 224, 196, .14), transparent 68%);
  pointer-events: none;
}
.diagram-caption {
  margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: .9rem; color: var(--text-on-dark-dim); line-height: 1.62; min-height: 4.6em;
}
.diagram-caption b { color: var(--gold-300); }
.diagram-caption .dc-title {
  display: block; color: #fff; font-weight: 650; margin-bottom: .3rem;
  font-size: .95rem;
}

/* SVG diagram styling */
.flow-svg { width: 100%; height: auto; }
.flow-svg .node-box {
  fill: rgba(255, 255, 255, .05); stroke: rgba(255, 255, 255, .18); stroke-width: 1.4;
  transition: fill .35s var(--ease), stroke .35s var(--ease);
}
.flow-svg .node-lbl { fill: #cfe4f0; font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.flow-svg .node-sub { fill: #7f97ac; font-family: var(--font-body); font-size: 8.6px; }
.flow-svg g.node.is-active .node-box {
  fill: rgba(53, 224, 196, .16); stroke: rgba(53, 224, 196, .72); stroke-width: 2;
  filter: drop-shadow(0 0 12px rgba(53, 224, 196, .4));
}
.flow-svg g.node.is-active .node-lbl { fill: #fff; }
.flow-svg .link { stroke: rgba(255, 255, 255, .2); stroke-width: 2; fill: none; }
.flow-svg .link.is-active { stroke: rgba(60, 147, 255, .8); stroke-width: 2.6; }
.flow-svg .particle { fill: var(--teal-400); }

/* ---------- 12. Kidney filtration lab (interactive) ---------- */
.lab-layout { display: grid; gap: clamp(1.4rem, 3.5vw, 2.6rem); align-items: center; }
@media (min-width: 980px) { .lab-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }

.kidney-stage {
  border-radius: var(--r-xl); padding: clamp(.9rem, 2.4vw, 1.5rem);
  background: radial-gradient(120% 110% at 30% 8%, #16394d 0%, #08131f 62%);
  border: 1px solid rgba(255, 255, 255, .11);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.kidney-svg { width: 100%; height: auto; overflow: visible; }
.kidney-svg .vessel { fill: none; stroke-linecap: round; }
.kidney-svg .vessel-in { stroke: #f26d6d; stroke-width: 9; opacity: .8; }
.kidney-svg .vessel-out { stroke: #5b8fd6; stroke-width: 8; opacity: .78; }
.kidney-svg .tubule { fill: none; stroke: rgba(60, 147, 255, .55); stroke-width: 7; stroke-linecap: round; }
.kidney-svg .capsule {
  fill: rgba(255, 255, 255, .05); stroke: rgba(255, 255, 255, .28); stroke-width: 1.6;
}
.kidney-svg .glomerulus { stroke: #f26d6d; stroke-width: 3.4; fill: none; opacity: .9; }
.kidney-svg .lbl { fill: #a3b8ca; font-family: var(--font-body); font-size: 11.5px; font-weight: 600; }
.kidney-svg .lbl-strong { fill: #fff; font-family: var(--font-body); font-size: 12.5px; font-weight: 650; }
.kidney-svg .lead-line { stroke: rgba(255, 255, 255, .25); stroke-width: 1; stroke-dasharray: 3 3; }
.kidney-svg .cr-dot { fill: var(--gold-400); }
.kidney-svg .blood-dot { fill: #ff9a9a; }
.kidney-svg .hotspot {
  fill: transparent; cursor: pointer; stroke: transparent; stroke-width: 12;
}
.kidney-svg .hotspot:hover ~ .capsule, .kidney-svg .hotspot:focus ~ .capsule { stroke: var(--teal-400); }

.lab-controls { display: grid; gap: 1.2rem; }
.lab-slider-group { }
.lab-slider-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-bottom: .55rem;
}
.lab-slider-head .lsl {
  font-size: .78rem; letter-spacing: .11em; text-transform: uppercase;
  color: #9fb6c9; font-weight: 650;
}
.lab-slider-head .lsv {
  font-family: var(--font-display); font-size: 1.3rem; color: #fff; font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.lab-slider-head .lsv small { font-size: .55em; color: #8ba4b9; font-family: var(--font-body); font-weight: 500; }

input[type="range"].lux-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 30px;
  background: transparent; cursor: pointer;
}
input[type="range"].lux-range::-webkit-slider-runnable-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #35e0c4 0%, #a3d95a 32%, #e5c07b 58%, #ea580c 80%, #dc2626 100%);
  border: 1px solid rgba(255, 255, 255, .16);
}
input[type="range"].lux-range::-moz-range-track {
  height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, #35e0c4 0%, #a3d95a 32%, #e5c07b 58%, #ea580c 80%, #dc2626 100%);
  border: 1px solid rgba(255, 255, 255, .16);
}
input[type="range"].lux-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; margin-top: -9px;
  background: radial-gradient(circle at 34% 30%, #fff, #dce9f2 58%, #a9bfd0);
  border: 2px solid #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .45), 0 0 0 6px rgba(53, 224, 196, .16);
  transition: box-shadow .2s var(--ease), transform .12s var(--ease);
}
input[type="range"].lux-range::-webkit-slider-thumb:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 0 9px rgba(53, 224, 196, .22); }
input[type="range"].lux-range::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff, #dce9f2 58%, #a9bfd0);
  border: 2px solid #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .45);
}
.range-scale {
  display: flex; justify-content: space-between; font-size: .7rem; color: #7f97ac;
  font-variant-numeric: tabular-nums; margin-top: -.2rem;
}

.lab-readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: .65rem;
}
.lab-readout .lr {
  padding: .8rem .9rem; border-radius: 13px;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .1);
}
.lab-readout .lr-lbl { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: #8ba4b9; font-weight: 650; }
.lab-readout .lr-val {
  font-family: var(--font-display); font-size: 1.3rem; color: #fff; font-weight: 600;
  margin-top: .22rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.lab-status {
  padding: .95rem 1.1rem; border-radius: 14px; font-size: .92rem; line-height: 1.6;
  border-left: 3px solid var(--teal-400); background: rgba(53, 224, 196, .08); color: #c3d5e4;
}
.lab-status b { color: #fff; }
.lab-presets { display: flex; flex-wrap: wrap; gap: .5rem; }
.preset-btn {
  padding: .5rem .9rem; border-radius: var(--r-pill); font-size: .82rem; font-weight: 620;
  border: 1px solid rgba(255, 255, 255, .16); color: #c3d5e4; transition: .2s var(--ease);
}
.preset-btn:hover, .preset-btn[aria-pressed="true"] {
  border-color: var(--gold-400); color: var(--gold-300); background: rgba(60, 147, 255, .12);
}

/* ---------- 13. Prose / article ---------- */
.prose { width: 100%; max-width: var(--maxw-prose); min-width: 0; }
.prose > * + * { margin-top: 1.15rem; }
.prose h2 { margin-top: 3rem; }
.prose h3 { margin-top: 2.3rem; }
.prose h4 { margin-top: 1.8rem; }
.prose h2 + p, .prose h3 + p, .prose h4 + p { margin-top: .85rem; }
.prose p, .prose li { font-size: 1.055rem; }
.prose,
.prose p,
.prose li,
.prose h2,
.prose h3,
.prose h4 { overflow-wrap: break-word; word-break: normal; }
.prose .example-steps li { overflow-wrap: break-word; word-break: normal; }
.prose strong { color: var(--text-900); font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.35rem; }
.prose li::marker { color: var(--teal-600); font-weight: 700; }
.prose blockquote {
  margin-block: 1.6rem; padding: 1.15rem 1.4rem; border-radius: var(--r-md);
  background: var(--paper-tint); border-left: 4px solid var(--gold-400);
  font-size: 1.03rem; color: var(--text-700);
}
.prose blockquote p + p { margin-top: .7rem; }
.prose-wide { max-width: none; }

.content-layout { display: grid; grid-template-columns: 1fr; gap: clamp(1.4rem, 3vw, 2.2rem); align-items: start; max-width: 780px; margin-inline: auto; }
.content-layout > * { min-width: 0; }

/* Table of contents */
.toc {
  display: none !important;
  position: sticky; top: 96px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm);
}
.toc h2 {
  font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-600);
  font-family: var(--font-body); font-weight: 700; margin-bottom: .9rem;
}
.toc ol { list-style: none; padding: 0; counter-reset: toc; }
.toc li { margin-top: 0; counter-increment: toc; }
.toc li + li { border-top: 1px solid var(--line); }
.toc a {
  display: flex; gap: .6rem; padding: .55rem 0; font-size: .89rem; font-weight: 550;
  color: var(--text-700); text-decoration: none; line-height: 1.42;
  transition: color .2s var(--ease), padding-left .2s var(--ease);
}
.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono); font-size: .74rem; color: var(--gold-500); flex: none; padding-top: .12rem;
}
.toc a:hover, .toc a.is-current { color: var(--teal-700); padding-left: .25rem; }
.toc a.is-current { font-weight: 700; }
@media (max-width: 1039px) {
  .toc { position: static; order: -1; }
  .toc ol { columns: 2; column-gap: 1.6rem; }
  .toc li + li { border-top: 0; }
  .toc a { padding: .38rem 0; break-inside: avoid; }
}
@media (max-width: 560px) { .toc ol { columns: 1; } }

/* Data tables */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); background: var(--paper); margin-block: 1.6rem;
  -webkit-overflow-scrolling: touch;
}
.data-table { font-size: .94rem; }
.data-table:not(.data-table--stack) { min-width: 520px; }
.data-table caption {
  caption-side: top; display: table-caption; text-align: left;
  width: 100%; max-width: 100%; box-sizing: border-box;
  padding: 1rem 1.1rem .3rem;
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-600); font-weight: 700;
  line-height: 1.45; white-space: normal; word-break: normal;
  overflow-wrap: break-word;
}
.data-table th, .data-table td { padding: .8rem 1.1rem; text-align: left; vertical-align: top; }
.data-table thead th {
  background: var(--ink-800); color: #fff; font-family: var(--font-body); font-weight: 650;
  font-size: .82rem; letter-spacing: .04em; white-space: nowrap;
}
.data-table thead th:first-child { border-top-left-radius: 0; }
.data-table tbody tr + tr { border-top: 1px solid var(--line); }
.data-table tbody tr:nth-child(even) { background: var(--paper-tint); }
.data-table tbody tr:hover { background: rgba(23, 195, 170, .06); }
.data-table td:first-child { font-weight: 620; color: var(--text-900); }
.data-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Card-stack tables on phone / tablet */
@media (max-width: 900px) {
  .table-wrap:has(.data-table--stack) {
    border: 0; background: transparent; box-shadow: none; overflow: visible;
  }
  .data-table--stack,
  .data-table--stack tbody,
  .data-table--stack tr,
  .data-table--stack td { display: block; width: 100%; max-width: 100%; }
  .data-table--stack {
    min-width: 0 !important; width: 100%; font-size: .92rem;
  }
  .data-table--stack > caption {
    display: block;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 0 .85rem;
    margin: 0;
    font-size: .8rem;
    letter-spacing: .04em;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: none;
  }
  .data-table--stack thead { display: none; }
  .data-table--stack tbody { display: grid; gap: .8rem; }
  .data-table--stack tr {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--paper);
    box-shadow: var(--shadow-sm);
  }
  .data-table--stack tbody tr + tr { border-top: 0; }
  .data-table--stack tbody tr:nth-child(even) { background: var(--paper); }
  .data-table--stack tbody tr:hover { background: var(--paper); }
  .data-table--stack td {
    padding: .72rem .9rem;
    border-top: 1px solid var(--line);
    white-space: normal;
  }
  .data-table--stack td.num { white-space: normal; }
  .data-table--stack td:first-child {
    border-top: 0;
    background: var(--paper-tint);
  }
  .data-table--stack td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: .28rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gold-600);
  }
  .data-table--stack .tone-tag {
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }
}
.tone-tag {
  display: inline-flex; align-items: center; gap: .38rem; padding: .22rem .6rem;
  border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; white-space: nowrap;
}
.tone-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tone-tag[data-tone="ok"] { background: var(--ok-soft); color: #15803d; }
.tone-tag[data-tone="mild"] { background: var(--mild-soft); color: #4d7c0f; }
.tone-tag[data-tone="warn"] { background: var(--warn-soft); color: #b45309; }
.tone-tag[data-tone="high"] { background: var(--high-soft); color: #c2410c; }
.tone-tag[data-tone="crit"] { background: var(--crit-soft); color: #b91c1c; }
.table-note { font-size: .85rem; color: var(--text-500); margin-top: -.9rem; margin-bottom: 1.6rem; }
.scroll-hint { display: none; font-size: .78rem; color: var(--text-500); margin-top: -1.2rem; margin-bottom: 1.4rem; }
@media (max-width: 620px) { .scroll-hint { display: block; } }

/* Formula callout block */
.formula-block {
  margin-block: 1.7rem; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--paper);
}
.formula-block .fb-head {
  padding: .8rem 1.2rem; background: var(--ink-800); color: #fff;
  font-size: .78rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 700;
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap;
}
.formula-block .fb-head svg { width: 16px; height: 16px; color: var(--gold-400); }
.formula-block .fb-head .fb-tag {
  margin-left: auto; font-size: .68rem; letter-spacing: .06em; padding: .18rem .55rem;
  border-radius: var(--r-pill); background: rgba(60, 147, 255, .18); color: var(--gold-300);
  text-transform: none; font-weight: 650;
}
.formula-block .fb-body { padding: 1.3rem 1.2rem; overflow-x: auto; }
.math-eq {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  font-family: var(--font-mono); font-size: 1rem; color: var(--text-900);
  min-width: max-content; margin-inline: auto; flex-wrap: nowrap;
}
.math-eq .m-frac { display: inline-flex; flex-direction: column; align-items: center; gap: .3rem; }
.math-eq .m-num, .math-eq .m-den { padding-inline: .5rem; white-space: nowrap; }
.math-eq .m-bar { width: 100%; height: 2px; background: var(--text-900); }
.math-eq .var { color: var(--teal-700); font-weight: 700; }
.math-eq .const { color: var(--gold-600); font-weight: 700; }
.formula-block .fb-foot {
  padding: .9rem 1.2rem; background: var(--paper-tint); border-top: 1px solid var(--line);
  font-size: .87rem; color: var(--text-500);
}
.formula-block .fb-foot dl { display: grid; gap: .45rem; margin: 0; }
.formula-block .fb-foot dl > div { display: flex; gap: .55rem; align-items: baseline; }
.formula-block .fb-foot dt {
  font-family: var(--font-mono); font-weight: 700; color: var(--text-900); flex: none;
  font-size: .85rem;
}
.formula-block .fb-foot dd { margin: 0; }

/* Worked example */
.example-box {
  margin-block: 1.8rem; border-radius: var(--r-lg); border: 1px solid rgba(23, 195, 170, .28);
  background: linear-gradient(160deg, rgba(23, 195, 170, .06), rgba(60, 147, 255, .05));
  padding: 1.4rem clamp(1.1rem, 3vw, 1.6rem); max-width: 100%; overflow: hidden;
}
.example-box h4 {
  display: flex; align-items: center; gap: .55rem; margin: 0 0 .9rem;
  font-size: 1rem; color: var(--text-900);
}
.example-box h4 svg { width: 19px; height: 19px; color: var(--teal-600); }
.example-steps { list-style: none; padding: 0; counter-reset: exs; display: grid; gap: .9rem; }
.example-steps li {
  counter-increment: exs; display: flex; flex-direction: row; flex-wrap: nowrap;
  gap: .85rem; align-items: flex-start; margin: 0 !important;
  font-size: .97rem; line-height: 1.65; width: 100%; max-width: 100%;
  overflow-wrap: break-word; word-break: normal;
}
.example-steps li::before {
  content: counter(exs); flex: 0 0 27px; width: 27px; height: 27px; border-radius: 9px;
  display: grid; place-items: center; font-family: var(--font-body); font-size: .82rem;
  font-weight: 700; background: var(--ink-800); color: var(--gold-400); margin-top: .12rem;
}
.ex-step-body {
  flex: 1 1 auto; min-width: 0; max-width: 100%; width: auto;
  overflow-wrap: break-word; word-break: normal; hyphens: none;
}
.ex-step-title {
  display: inline; color: var(--text-900); font-weight: 700; margin-right: .25rem;
}
.example-steps code {
  display: inline; font-family: var(--font-mono); font-size: .88em;
  background: rgba(11, 22, 34, .07); padding: .12rem .38rem; border-radius: 5px;
  color: var(--text-900); white-space: normal; overflow-wrap: break-word; word-break: break-word;
}
.example-answer {
  margin-top: 1.1rem; padding: .9rem 1.1rem; border-radius: 12px; background: var(--ink-800);
  color: #fff; font-weight: 620; font-size: 1rem; display: flex; align-items: center;
  gap: .7rem; flex-wrap: wrap;
}
.example-answer .ea-val {
  font-family: var(--font-display); font-size: 1.5rem; letter-spacing: -.02em;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Key takeaway */
.takeaway {
  display: flex; gap: 1rem; align-items: flex-start; margin-block: 1.7rem;
  padding: 1.15rem 1.3rem; border-radius: var(--r-md);
  background: var(--ink-800); color: #cfe4f0;
}
.takeaway svg { width: 22px; height: 22px; flex: none; color: var(--gold-400); margin-top: 2px; }
.takeaway b { color: #fff; }
.takeaway p { font-size: .97rem; line-height: 1.65; }

/* Comparison split */
.vs-grid { display: grid; gap: 1.1rem; margin-block: 1.8rem; }
@media (min-width: 720px) { .vs-grid { grid-template-columns: 1fr 1fr; } }
.vs-card {
  border-radius: var(--r-lg); padding: 1.5rem; border: 1px solid var(--line);
  background: var(--paper); box-shadow: var(--shadow-sm);
}
.vs-card.is-a { border-top: 4px solid var(--teal-500); }
.vs-card.is-b { border-top: 4px solid var(--gold-400); }
.vs-card h3 { font-size: 1.1rem; margin-bottom: .3rem; }
.vs-card .vs-tag {
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  color: var(--text-500); display: block; margin-bottom: .9rem;
}
.vs-card ul { padding-left: 1.2rem; font-size: .94rem; }

/* ---------- 14. FAQ ---------- */
.faq-list { display: grid; gap: .7rem; max-width: 880px; }
.faq-item {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper);
  overflow: hidden; transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.faq-item[open] { border-color: rgba(23, 195, 170, .38); box-shadow: var(--shadow-sm); }
.faq-item > summary {
  list-style: none; cursor: pointer; padding: 1.05rem 3rem 1.05rem 1.25rem;
  font-weight: 650; font-size: 1.01rem; color: var(--text-900); position: relative;
  font-family: var(--font-body); line-height: 1.5;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; position: absolute; right: 1.25rem; top: 1.45rem;
  width: 11px; height: 11px; border-right: 2.2px solid var(--teal-600);
  border-bottom: 2.2px solid var(--teal-600); transform: rotate(45deg);
  transition: transform .28s var(--ease-out);
}
.faq-item[open] > summary::after { transform: rotate(-135deg); top: 1.55rem; }
.faq-item > summary:hover { background: var(--paper-tint); }
.faq-body { padding: 0 1.25rem 1.25rem; font-size: .99rem; color: var(--text-700); }
.faq-body > * + * { margin-top: .8rem; }

/* ---------- 15. Author / E-E-A-T ---------- */
.author-box {
  display: grid; gap: 1.2rem; padding: clamp(1.3rem, 3vw, 2rem);
  border-radius: var(--r-lg); background: var(--paper); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); margin-top: 2.6rem;
}
@media (min-width: 640px) { .author-box { grid-template-columns: auto 1fr; align-items: start; } }
.author-avatar {
  width: 96px; height: 96px; border-radius: 22px; flex: none; object-fit: cover;
  border: 1px solid rgba(60, 147, 255, .3);
  box-shadow: var(--shadow-sm);
}
.author-meta .a-name { font-family: var(--font-display); font-size: 1.2rem; color: var(--text-900); font-weight: 600; }
.author-meta .a-role { font-size: .85rem; color: var(--gold-600); font-weight: 650; letter-spacing: .04em; margin-top: .1rem; }
.author-meta p { font-size: .95rem; margin-top: .7rem; color: var(--text-500); }
.review-meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid var(--line); font-size: .84rem; color: var(--text-500);
}
.review-meta span { display: inline-flex; align-items: center; gap: .4rem; }
.review-meta svg { width: 15px; height: 15px; color: var(--teal-600); }

.byline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.1rem;
  font-size: .84rem; color: var(--text-500); margin-bottom: 1.6rem;
  padding-bottom: 1.1rem; border-bottom: 1px solid var(--line);
}
.byline span { display: inline-flex; align-items: center; gap: .42rem; }
.byline svg { width: 15px; height: 15px; color: var(--gold-500); }
.byline b { color: var(--text-900); font-weight: 650; }

/* References */
.ref-list { list-style: none; padding: 0; counter-reset: ref; display: grid; gap: .8rem; }
.ref-list li {
  counter-increment: ref; display: flex; gap: .8rem; margin: 0; font-size: .92rem;
  color: var(--text-on-dark-dim); line-height: 1.6;
}
.ref-list li::before {
  content: counter(ref) "."; flex: none; font-family: var(--font-mono); font-weight: 700;
  color: var(--gold-400); min-width: 1.5rem;
}
.ref-list cite { font-style: italic; color: #cfe4f0; }

/* Disclaimer block */
.disclaimer-block {
  border-radius: var(--r-lg); padding: clamp(1.3rem, 3vw, 1.8rem);
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(60, 147, 255, .26);
  border-left: 4px solid var(--gold-500);
}
.disclaimer-block h3 { display: flex; align-items: center; gap: .6rem; font-size: 1.1rem; margin-bottom: .7rem; }
.disclaimer-block h3 svg { width: 21px; height: 21px; color: var(--gold-400); }
.disclaimer-block p { font-size: .95rem; line-height: 1.68; }
.disclaimer-block p + p { margin-top: .8rem; }

/* ---------- 16. CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden; text-align: center;
  padding-block: clamp(3rem, 6vw, 5rem);
  background: radial-gradient(900px 420px at 50% 0%, #17384c 0%, transparent 65%), var(--ink-900);
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: var(--text-on-dark-dim); max-width: 58ch; margin: 1rem auto 0; font-size: 1.06rem; }
.cta-band .btn { margin-top: 1.8rem; }

/* ---------- 17. Footer ---------- */
.site-footer { background: var(--ink-900); color: #93aabf; padding-block: clamp(2.6rem, 5vw, 4rem) 1.6rem; }
.footer-grid { display: grid; gap: 2.2rem; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; } }
.footer-brand .brand { margin-bottom: 1rem; }
.footer-brand p { font-size: .9rem; max-width: 38ch; line-height: 1.7; }
.footer-social {
  display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.15rem;
  align-items: center;
}
.footer-social a {
  width: 40px; height: 40px; min-width: 40px; min-height: 40px;
  border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
  overflow: hidden; flex: none; line-height: 0;
}
.footer-social a:hover {
  background: rgba(60, 147, 255, .18); border-color: rgba(60, 147, 255, .4); transform: translateY(-2px);
}
.footer-social svg {
  width: 18px !important; height: 18px !important; max-width: 18px; max-height: 18px;
  flex: none; display: block;
}
.footer-col h3 {
  font-size: .74rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold-400);
  font-family: var(--font-body); font-weight: 700; margin-bottom: .9rem;
}
.footer-col ul { list-style: none; padding: 0; }
.footer-col li { margin-top: 0; }
.footer-col li + li { margin-top: .55rem; }
.footer-col a { color: #93aabf; text-decoration: none; font-size: .91rem; transition: color .2s var(--ease); }
.footer-col a:hover { color: var(--teal-400); }
.footer-bottom {
  margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid rgba(255, 255, 255, .09);
  display: flex; flex-wrap: wrap; gap: .8rem 1.6rem; align-items: center;
  font-size: .84rem; color: #7f97ac;
}
.footer-bottom p { margin-right: auto; }
.footer-legal { font-size: .8rem; color: #6e869c; margin-top: 1.2rem; line-height: 1.65; max-width: 90ch; }

@media (max-width: 640px) {
  .wrap { padding-inline: 1rem; }
  .header-inner { gap: .7rem; }
  .brand-logo { width: 40px; height: 40px; }
  .brand-text { min-width: 0; }
  .brand-name { font-size: .96rem; }
  .brand-sub { font-size: .58rem; letter-spacing: .12em; }
  .theme-toggle { padding: .62rem .72rem; }
  .theme-toggle-label { display: none; }
  #guide .wrap,
  #guide .content-layout,
  #guide .prose {
    width: 100%;
    max-width: none;
    min-width: 0;
    margin-inline: 0;
  }
  #guide .content-layout { gap: 1rem; }
  .hero { padding-block: 2.1rem 2.8rem; overflow: hidden; }
  .hero::after { right: -40%; top: -35%; width: 90vw; height: 90vw; }
  .hero-stack { gap: 1.35rem; width: 100%; max-width: 100%; }
  .hero h1 { margin-block: .6rem .7rem; }
  .hero-lead { font-size: .98rem; }
  .hero-substats { gap: .5rem .9rem; }
  .hero-substats .sep { display: none; }

  .calc-card { border-radius: 22px; width: 100%; max-width: 100%; }
  .calc-head { padding-inline: 1rem; }
  .calc-body { padding-inline: 1rem; }
  .results { padding: 1rem; }
  .result-hero { gap: 1rem; }
  .gauge-wrap { width: 142px; height: 142px; margin-inline: auto; }
  .gauge-value { font-size: 2.1rem; }
  .metric-grid { grid-template-columns: 1fr; }

  /* Unit toggles under the number field — prevents cramped / clipped mobile inputs */
  .input-shell {
    flex-wrap: wrap;
  }
  .input-shell > input,
  .input-shell > select {
    flex: 1 1 100%;
    width: 100%;
  }
  .input-shell .input-suffix {
    flex: 1 1 100%;
    width: 100%;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding: .4rem .45rem;
    justify-items: stretch;
  }
  .input-shell .input-suffix .seg,
  .input-shell .input-suffix .seg--sm {
    width: 100%;
  }

  .prose > * + * { margin-top: 1rem; }
  .prose h2 { margin-top: 2.1rem; }
  .prose h3 { margin-top: 1.7rem; }
  .prose h2,
  .prose h3,
  .prose h4 { max-width: 100%; }
  .prose p, .prose li { font-size: .98rem; line-height: 1.72; }
  .byline { gap: .55rem; }
  .takeaway,
  .example-answer,
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .takeaway,
  .example-box,
  .formula-block .fb-body,
  .formula-block .fb-foot { padding-inline: 1rem; }
  .example-steps li { gap: .7rem; }
  .example-box h4 { align-items: flex-start; }

  .formula-block .fb-head {
    padding: .8rem 1rem;
    gap: .45rem;
    letter-spacing: .08em;
  }
  .formula-block .fb-head .fb-tag {
    margin-left: 0;
  }
  .math-eq {
    font-size: .82rem;
    gap: .5rem;
  }
  .formula-viz { padding: .95rem; }
  .fv-equation { font-size: .84rem; }

  .step-item { padding: .95rem 1rem; gap: .75rem; }
  .step-text h3 { font-size: 1rem; }
  .step-text p { font-size: .88rem; }
  .diagram-stage { padding: .9rem; border-radius: 20px; }
  .diagram-caption { min-height: 0; }

  .lab-layout { gap: 1rem; }
  .lab-readout { grid-template-columns: 1fr 1fr; }
  .lab-readout .lr-val { font-size: 1.1rem; }

  .vs-card { padding: 1.2rem; }
  .faq-item > summary { padding: .95rem 2.8rem .95rem 1rem; font-size: .96rem; }
  .faq-body { padding: 0 1rem 1rem; font-size: .94rem; }

  .author-box { padding: 1.1rem; }
  .footer-grid { gap: 1.4rem; }
  .footer-bottom { gap: .45rem; }
  .footer-bottom p { margin-right: 0; }
  .footer-legal { font-size: .76rem; }

  .to-top {
    width: 42px;
    height: 42px;
    right: .85rem;
    bottom: .85rem;
  }
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: auto;
    max-width: none;
    transform: translateY(16px);
    padding: .75rem 1rem;
    font-size: .84rem;
    border-radius: 14px;
  }
  .toast.is-shown { transform: translateY(0); }
}

/* ---------- Legal pages ---------- */
.legal-hero {
  background: var(--grad-dark); color: var(--text-on-dark-dim);
  padding-block: clamp(2.4rem, 5vw, 3.8rem);
}
.legal-hero h1 { color: #fff; margin-top: .4rem; }
.legal-hero p { max-width: 62ch; margin-top: .9rem; font-size: 1.05rem; }
.legal-meta {
  display: flex; flex-wrap: wrap; gap: .55rem 1.2rem; margin-top: 1.1rem;
  font-size: .86rem; color: #8ba4b9;
}
.legal-content { max-width: 820px; margin-inline: auto; }
.legal-content h2 { margin-top: 2.2rem; font-size: clamp(1.3rem, 2.4vw, 1.7rem); }
.legal-content h3 { margin-top: 1.5rem; font-size: 1.08rem; }
.legal-content p, .legal-content li { font-size: 1.02rem; color: var(--text-700); }
.legal-content > * + * { margin-top: 1rem; }
.legal-content ul { padding-left: 1.2rem; }
.legal-note {
  margin-top: 1.4rem; padding: 1rem 1.15rem; border-radius: 14px;
  background: var(--paper-tint); border: 1px solid var(--line); color: var(--text-500); font-size: .95rem;
}
.contact-cards {
  display: grid; gap: 1rem; margin-top: 1.2rem;
}
@media (min-width: 720px) {
  .contact-cards { grid-template-columns: repeat(3, 1fr); }
}
.contact-card {
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm);
}
.contact-card h3 { margin: 0; font-size: 1.02rem; }
.contact-card p { margin-top: .45rem; font-size: .94rem; color: var(--text-500); }
.contact-card a {
  display: inline-block; margin-top: .75rem; font-size: .92rem; font-weight: 650;
  color: var(--gold-500); word-break: break-word;
}
.contact-card a:hover { color: var(--teal-500); }

/* Back to top */
.to-top {
  position: fixed; right: clamp(1rem, 3vw, 2rem); bottom: clamp(1rem, 3vw, 2rem); z-index: 55;
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad-gold); color: #ffffff; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease-out);
}
.to-top.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  z-index: 90; padding: .8rem 1.3rem; border-radius: var(--r-pill);
  background: var(--ink-800); color: #fff; font-size: .9rem; font-weight: 600;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(53, 224, 196, .35);
  opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease-out);
  display: flex; align-items: center; gap: .55rem;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 17px; height: 17px; color: var(--teal-400); }

/* ---------- 18. Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}
.reveal[data-delay="1"].is-in { transition-delay: .08s; }
.reveal[data-delay="2"].is-in { transition-delay: .16s; }
.reveal[data-delay="3"].is-in { transition-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 19. Print ---------- */
@media print {
  .site-header, .nav, .to-top, .hero::before, .hero::after, .cta-band,
  .site-footer, .trust-strip, .calc-actions, .result-tools, .toc,
  .section--dark .diagram-stage, .kidney-stage, .lab-controls { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .hero, .section, .section--dark, .calc-card, .results {
    background: #fff !important; color: #000 !important; box-shadow: none !important;
    border-color: #bbb !important;
  }
  .hero h1, .section--dark h2, .section--dark h3, .gauge-value, .metric .m-val,
  .calc-head h2, .result-interpretation, .eq-table td, .fv-equation { color: #000 !important; }
  .hero h1 .accent, .example-answer .ea-val { -webkit-text-fill-color: #000; color: #000; }
  .metric, .formula-viz, .eq-table-wrap { border-color: #bbb !important; }
  .section { padding-block: 1rem; page-break-inside: avoid; }
  a { text-decoration: none; color: #000; }
}

/* ---------- BUN / Creatinine Ratio page ---------- */
.bun-spectrum {
  margin-top: 1.2rem; padding: 1.1rem 1.15rem; border-radius: 16px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1);
}
.bun-spectrum-track {
  position: relative; height: 14px; border-radius: 999px; overflow: visible;
  background: linear-gradient(90deg, #ea580c 0%, #ea580c 25%, #16a34a 25%, #16a34a 50%, #3c93ff 50%, #3c93ff 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.bun-spectrum-marker {
  position: absolute; top: 50%; width: 18px; height: 18px; margin-left: -9px;
  border-radius: 50%; transform: translateY(-50%);
  background: #fff; border: 3px solid var(--gold-400);
  box-shadow: 0 0 0 4px rgba(60, 147, 255, .25);
  transition: left .45s var(--ease-out), border-color .3s var(--ease);
  z-index: 2;
}
.bun-spectrum-marker[data-tone="ok"] { border-color: #16a34a; }
.bun-spectrum-marker[data-tone="warn"] { border-color: #ea580c; }
.bun-spectrum-marker[data-tone="high"] { border-color: #3c93ff; }
.bun-spectrum-labels {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem;
  margin-top: .75rem; font-size: .78rem; color: #9fb4c6; font-weight: 650;
}
.bun-spectrum-labels span:nth-child(1) { color: #fdba74; }
.bun-spectrum-labels span:nth-child(2) { color: #86efac; text-align: center; }
.bun-spectrum-labels span:nth-child(3) { color: #93c5fd; text-align: right; }
.bun-visual-grid {
  display: grid; gap: 1.1rem;
}
@media (min-width: 760px) {
  .bun-visual-grid { grid-template-columns: 1.1fr 1fr; align-items: stretch; }
}
.bun-diagram {
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--paper);
  padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm);
}
.bun-diagram h3 { margin: 0 0 .55rem; font-size: 1.05rem; }
.bun-diagram p { margin: 0; font-size: .92rem; color: var(--text-500); }
.bun-diagram svg { width: 100%; height: auto; margin-top: .9rem; display: block; }
.cause-grid {
  display: grid; gap: 1rem;
}
@media (min-width: 720px) {
  .cause-grid { grid-template-columns: 1fr 1fr; }
}
.cause-card {
  border-radius: 18px; border: 1px solid var(--line); background: var(--paper);
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow-sm);
}
.cause-card h3 { margin: 0 0 .35rem; font-size: 1.08rem; }
.cause-card .cause-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: .28rem .65rem; border-radius: 999px; margin-bottom: .7rem;
}
.cause-card.is-high .cause-badge { background: rgba(60, 147, 255, .12); color: var(--gold-600); }
.cause-card.is-low .cause-badge { background: rgba(234, 88, 12, .1); color: #c2410c; }
.cause-card ul { margin: .55rem 0 0; padding-left: 1.15rem; font-size: .94rem; }
.quick-answer {
  margin: 1.2rem 0 1.6rem; padding: 1.1rem 1.2rem; border-radius: 16px;
  border: 1px solid rgba(60, 147, 255, .28); background: rgba(60, 147, 255, .07);
}
.quick-answer h2 { font-size: 1.15rem; margin: 0 0 .45rem; }
.quick-answer p { margin: 0; color: var(--text-700); font-size: 1rem; }
.chart-bars {
  display: grid; gap: .7rem; margin-top: 1rem;
}
.chart-bar-row { display: grid; grid-template-columns: 110px 1fr auto; gap: .7rem; align-items: center; }
.chart-bar-row span { font-size: .86rem; font-weight: 650; color: var(--text-700); }
.chart-bar-row b { font-variant-numeric: tabular-nums; font-size: .86rem; color: var(--text-900); }
.chart-bar {
  height: 12px; border-radius: 999px; background: var(--paper-tint-2); overflow: hidden;
}
.chart-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--grad-gold);
}
@media (max-width: 560px) {
  .chart-bar-row { grid-template-columns: 1fr; gap: .3rem; }
  .bun-spectrum-labels { font-size: .7rem; }
}

/* Free water deficit calculator */
.fwd-metrics {
  display: grid;
  gap: .75rem;
  margin: 1.15rem 0 .85rem;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) {
  .fwd-metrics { grid-template-columns: 1fr 1fr; }
}
.fwd-metric {
  border: 1px solid var(--line);
  background: var(--paper-tint);
  border-radius: 14px;
  padding: .85rem 1rem;
  display: grid;
  gap: .35rem;
}
.fwd-metric span {
  font-size: .75rem;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-500);
}
.fwd-metric b {
  font-size: .95rem;
  font-weight: 650;
  color: var(--text-900);
  line-height: 1.35;
}
.fwd-rate-note {
  margin: 0 0 1rem;
  font-size: .92rem;
  color: var(--text-700);
  line-height: 1.45;
}
.worked-example {
  margin: 1rem 0 1.4rem;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}
.worked-example p { margin: 0 0 .7rem; }
.worked-example ul { margin: 0 0 .7rem; padding-left: 1.15rem; }
@media (max-width: 560px) {
  .fwd-metric b { font-size: .9rem; }
}
