/* ==========================================================================
   RO Water Check — v5 Modern Clean Design System
   Self-hosted fonts (SIL OFL): Inter, Inter Tight, JetBrains Mono
   ========================================================================== */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-var-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("/assets/fonts/inter-tight-latin.woff2") format("woff2"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/assets/fonts/jetbrains-mono-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --ink: #0a0e1a;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #4b5563;
  --bg: #f8fafc;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-alt: rgba(248, 250, 252, 0.9);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --accent-vibrant: #06b6d4;
  --accent-soft: #f0f9ff;
  --ok: #10b981; --ok-text: #065f46; --ok-bg: #d1fae5; --ok-border: #6ee7b7;
  --warn: #f59e0b; --warn-text: #92400e; --warn-bg: #fef3c7; --warn-border: #fcd34d;
  --bad: #ef4444; --bad-text: #991b1b; --bad-bg: #fee2e2; --bad-border: #fca5a5;
  --r-xl: 24px; --r-lg: 20px; --r-md: 16px; --r-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 4px rgba(15, 23, 42, .02);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .08);
  --shadow-lg: 0 4px 16px rgba(15, 23, 42, .08), 0 16px 48px rgba(15, 23, 42, .12);
  --shadow-accent: 0 4px 16px rgba(14, 165, 233, .15), 0 8px 32px rgba(6, 182, 212, .1);
  --max-w: 1180px;
  --font-sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Inter Tight", "Inter", ui-sans-serif, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.68;
  color: var(--text);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 20% 10%, rgba(6, 182, 212, 0.25) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(168, 85, 247, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 60%);
  animation: gradientShift 20s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 100% 70% at 50% 20%, #000 20%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 100% 70% at 50% 20%, #000 20%, transparent 85%);
}
body.nav-open { overflow: hidden; }

img { max-width: 100%; }
.num, .tabular { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-alt); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line); }
a { color: var(--accent-dark); text-decoration-color: rgba(3, 105, 161, .3); text-decoration-thickness: 1.5px; text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
::selection { background: rgba(2, 132, 199, .15); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 300; border-radius: 8px; }
.skip-link:focus { left: 12px; top: 12px; }

.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ---------- Header: Modern Glass Floating Bar ---------- */
.site-header { position: sticky; top: 0; z-index: 100; padding: 16px 16px 0; }
.header-shell {
  max-width: var(--max-w); margin: 0 auto; height: 64px; padding: 0 12px 0 20px;
  display: flex; align-items: center; gap: 16px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid rgba(15, 23, 42, .06);
  border-radius: 999px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  transition: box-shadow 0.3s ease;
}
.header-shell:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .5) inset;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -.025em; flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand svg { display: block; border-radius: 8px; }
.site-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.site-nav a { color: var(--text-muted); text-decoration: none; font-size: .875rem; font-weight: 500; padding: 6px 12px; border-radius: 999px; white-space: nowrap; transition: color .15s, background-color .15s; }
.site-nav a:hover { color: var(--ink); background: var(--surface-alt); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-alt); font-weight: 600; }
.header-cta {
  flex-shrink: 0; text-decoration: none; color: #fff; font-weight: 600; font-size: .875rem;
  padding: 10px 20px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-vibrant) 0%, var(--accent) 100%);
  box-shadow: 0 2px 8px rgba(14, 165, 233, .2), 0 4px 16px rgba(6, 182, 212, .15);
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.header-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity .2s;
}
.header-cta:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, .3), 0 8px 24px rgba(6, 182, 212, .2);
}
.header-cta:hover::before { opacity: 1; }
.header-cta:active { transform: translateY(0); }
.nav-toggle { display: none; flex-shrink: 0; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; position: relative; }
.nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after { position: absolute; left: 11px; width: 16px; height: 1.5px; background: var(--ink); border-radius: 2px; content: ""; transition: transform .2s, opacity .2s; }
.nav-toggle .bars { top: 19px; }
.nav-toggle .bars::before { left: 0; top: -5px; }
.nav-toggle .bars::after { left: 0; top: 5px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-5px) rotate(-45deg); }

.mobile-nav { display: none; }
@media (max-width: 1080px) {
  .site-nav { display: none; }
  .header-cta { margin-left: auto; }
  .nav-toggle { display: inline-block; }
  .mobile-nav.open {
    display: block; position: fixed; inset: 78px 16px auto 16px; max-height: calc(100vh - 96px); overflow-y: auto;
    background: rgba(255, 255, 255, .98); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--line-strong); border-radius: 20px; padding: 14px; box-shadow: 0 24px 48px -12px rgba(15,23,42,.18);
  }
  .mnav-group p { margin: 10px 10px 6px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); font-weight: 700; }
  .mnav-group a { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; font-size: .94rem; }
  .mnav-group a .ico { color: var(--accent); flex-shrink: 0; }
  .mnav-group a:hover, .mnav-group a[aria-current="page"] { background: var(--surface-alt); color: var(--ink); font-weight: 600; }
}
@media (max-width: 420px) {
  .header-cta { padding: 7px 12px; font-size: .8rem; }
  .brand span { font-size: .94rem; }
}

/* ---------- Hero: Modern Gradient Canvas with Mesh ---------- */
.hero { position: relative; background: transparent; border-bottom: 1px solid var(--line); overflow: hidden; isolation: isolate; }
.hero-bg {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 20% 10%, rgba(6, 182, 212, .12) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(14, 165, 233, .1) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(59, 130, 246, .08) 0%, transparent 60%),
    linear-gradient(135deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .025) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(90% 80% at 50% 20%, #000 15%, transparent 85%);
  mask-image: radial-gradient(90% 80% at 50% 20%, #000 15%, transparent 85%);
}

.hero-page { padding: 52px 0 48px; }
.hero-page .container { max-width: 960px; }
.hero-page h1 { max-width: 24ch; }
.hero-page .lead { font-size: clamp(1.04rem, 1.5vw, 1.16rem); max-width: 66ch; }
.hero-404 { min-height: 60vh; display: flex; align-items: center; }

.crumbs { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--text-soft); margin-bottom: 16px; }
.crumbs a { color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

.chips { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { margin: 0; font-size: .78rem; font-weight: 550; color: var(--text-muted); padding: 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }

/* Home hero */
.hero-home { padding: 64px 0 56px; }
.hero-home .hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; margin: 0; }
.hero-home h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -.045em;
  margin-bottom: 20px;
  color: var(--ink);
  background: linear-gradient(135deg, #0a0e1a 0%, #1e293b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-home .lead { font-size: 1.125rem; color: var(--text-muted); line-height: 1.7; }
.hero-media {
  margin: 24px 0 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .08);
  background: var(--surface-solid);
  box-shadow: var(--shadow-md);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-media:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.hero-media img { width: 100%; height: 220px; object-fit: cover; display: block; }
.hero-media figcaption {
  padding: 12px 16px;
  font-size: .8rem;
  line-height: 1.5;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, .5);
  backdrop-filter: blur(8px);
}

.stat-strip {
  list-style: none;
  margin: 52px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(16px);
  overflow: hidden;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, .8) inset;
}
.stat-strip li {
  margin: 0;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(15, 23, 42, .08);
  transition: background .2s ease;
}
.stat-strip li:hover {
  background: rgba(14, 165, 233, .04);
}
.stat-strip li:last-child { border-right: 0; }
.stat-strip strong {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink);
  letter-spacing: -.03em;
  font-weight: 750;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-strip strong.num { font-family: var(--font-display); }
.stat-strip span { font-size: .82rem; color: var(--text-soft); font-weight: 500; }

@media (max-width: 960px) {
  .hero-home .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-home .hero-grid > div:first-child { order: 1; }
  .hero-home .hero-grid > div:last-child { order: 2; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip li:nth-child(2) { border-right: 0; }
  .stat-strip li:nth-child(-n+2) { border-bottom: 1px solid rgba(15, 23, 42, .08); }
}
@media (max-width: 640px) {
  .hero-page { padding: 40px 0 36px; }
  .hero-home { padding: 40px 0 32px; }
  .stat-strip { margin-top: 36px; grid-template-columns: 1fr; }
  .stat-strip li { padding: 16px 20px; }
  .stat-strip li { border-right: 0 !important; border-bottom: 1px solid rgba(15, 23, 42, .08); }
  .stat-strip li:last-child { border-bottom: 0; }
  .form-grid { grid-template-columns: 1fr !important; }
}

/* ---------- Typography ---------- */
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); }
h1 { margin: 0 0 14px; font-size: clamp(1.9rem, 3.8vw, 2.9rem); line-height: 1.08; letter-spacing: -.035em; font-weight: 750; }
h2 { margin: 52px 0 14px; font-size: clamp(1.38rem, 2.2vw, 1.78rem); line-height: 1.2; letter-spacing: -.025em; font-weight: 700; }
h3 { margin: 26px 0 8px; font-size: 1.12rem; line-height: 1.35; letter-spacing: -.015em; font-weight: 700; }
p { margin: 0 0 15px; }
.lead { font-size: 1.08rem; color: var(--text-muted); margin-bottom: 20px; max-width: 68ch; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent-dark);
  background: linear-gradient(135deg, rgba(14, 165, 233, .08) 0%, rgba(6, 182, 212, .12) 100%);
  border: 1px solid rgba(14, 165, 233, .2);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(14, 165, 233, .08);
}
.kicker { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: 6px; }
.meta-note { font-size: .85rem; color: var(--text-soft); }

/* ---------- Page layout + TOC ---------- */
.page-layout { display: grid; grid-template-columns: minmax(0, 1fr) 224px; gap: 56px; padding-top: 24px; padding-bottom: 72px; }
.prose { min-width: 0; }
.prose > h2:first-child, .prose > .hero-grid:first-child, .prose > figure:first-child { margin-top: 32px; }
.prose h2 { padding-top: 12px; border-top: 1px solid var(--line); }
.prose > h2:first-child { border-top: 0; padding-top: 0; }
.prose ul, .prose ol { margin: 0 0 20px; padding-left: 0; list-style: none; }
.prose li { position: relative; margin-bottom: 9px; padding-left: 24px; }
.prose ul > li::before { content: ""; position: absolute; left: 6px; top: .74em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.prose ol { counter-reset: step; }
.prose ol > li { counter-increment: step; padding-left: 36px; min-height: 26px; }
.prose ol > li::before { content: counter(step); position: absolute; left: 0; top: .14em; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-family: var(--font-mono); font-size: .76rem; font-weight: 600; color: var(--ink); background: var(--surface-alt); border: 1px solid var(--line); }
.prose strong { color: var(--ink); font-weight: 650; }

.toc { position: sticky; top: 94px; align-self: start; margin-top: 32px; padding-left: 16px; border-left: 1px solid var(--line); }
.toc-title { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--text-soft); margin-bottom: 10px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a { display: block; position: relative; padding: 5px 0; font-size: .83rem; line-height: 1.4; color: var(--text-soft); text-decoration: none; transition: color .15s; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); font-weight: 600; }
.toc a.active::before { content: ""; position: absolute; left: -17px; top: 5px; bottom: 5px; width: 2px; border-radius: 2px; background: var(--ink); }
@media (max-width: 1080px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { display: none; }
}

/* ---------- Cards, precision meter, forms ---------- */
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 32px; align-items: start; margin: 32px 0; }
.hero-grid > * { min-width: 0; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; gap: 24px; } }

.card {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.card:hover {
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, .6) inset;
  transform: translateY(-2px);
}
.card-title { margin: 0 0 18px; font-size: 1.2rem; font-weight: 750; letter-spacing: -.025em; color: var(--ink); }
@media (max-width: 540px) { .card { padding: 20px; border-radius: 18px; } }

.calc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.calc-head .card-title { margin: 0; }
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .7rem;
  font-weight: 650;
  color: var(--ok-text);
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, .12);
}
.live-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Modern Gradient Meter Bar */
.meter-bar {
  padding: 18px 20px;
  margin-bottom: 20px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(248, 250, 252, .9) 0%, rgba(241, 245, 249, .95) 100%);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .04), 0 0 0 1px rgba(255, 255, 255, .5) inset;
  --pct: 94.1;
  --mc: var(--ok);
}
.meter-bar[data-status="borderline"] { --mc: var(--warn); }
.meter-bar[data-status="action_needed"], .meter-bar[data-status="error"] { --mc: var(--bad); }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.meter-readout { display: flex; align-items: baseline; gap: 8px; }
.meter-readout .num {
  font-size: 2rem;
  font-weight: 750;
  line-height: 1;
  background: linear-gradient(135deg, var(--ink) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.meter-unit { font-size: .85rem; font-weight: 650; color: var(--text-muted); }
.meter-scale-labels { display: flex; gap: 14px; font-size: .72rem; font-weight: 650; color: var(--text-soft); }
.meter-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .06);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, .08);
}
.meter-fill {
  height: 100%;
  width: calc(var(--pct) * 1%);
  background: linear-gradient(90deg, var(--mc) 0%, color-mix(in srgb, var(--mc) 85%, white) 100%);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.2,.7,.2,1), background .3s;
  box-shadow: 0 0 8px color-mix(in srgb, var(--mc) 40%, transparent);
}

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; gap: 0; } }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.field input, .field select {
  width: 100%; height: 46px; padding: 0 14px; font: inherit; font-size: .94rem; color: var(--ink);
  background: rgba(255, 255, 255, .9);
  border: 1.5px solid rgba(15, 23, 42, .12);
  border-radius: var(--r-sm);
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 2px 4px rgba(15, 23, 42, .02);
}
.field input[type="number"] { font-family: var(--font-mono); font-weight: 550; }
.field select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field input:hover, .field select:hover {
  border-color: rgba(15, 23, 42, .24);
  box-shadow: 0 4px 8px rgba(15, 23, 42, .04);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, .12), 0 4px 12px rgba(15, 23, 42, .06);
  background: rgba(255, 255, 255, 1);
}
.field input.has-unit { padding-right: 64px; }
.unit-tag { position: absolute; right: 8px; font-size: .72rem; font-weight: 600; color: var(--text-soft); background: rgba(248, 250, 252, .9); border: 1px solid var(--line); padding: 3px 8px; border-radius: 7px; pointer-events: none; font-family: var(--font-mono); }

/* Quick Entry Cards */
.quick-entry { margin-top: 32px; }
.quick-title { font-size: .88rem; font-weight: 650; color: var(--text-muted); margin-bottom: 12px; }
.quick-cards { display: grid; grid-template-columns: 1fr; gap: 10px; }
.quick-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .75);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  font-size: .9rem;
  font-weight: 550;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(15, 23, 42, .03);
}
.quick-card:hover {
  background: rgba(255, 255, 255, .95);
  border-color: var(--accent);
  color: var(--ink);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, .12);
}
.quick-icon {
  flex-shrink: 0;
  color: var(--accent);
  transition: transform .25s;
}
.quick-card:hover .quick-icon {
  transform: scale(1.1);
}
@media (max-width: 640px) {
  .quick-entry { margin-top: 24px; }
  .quick-card { padding: 12px 14px; font-size: .85rem; }
}

.btn-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; margin-top: 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: all .2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, .2) 0%, transparent 100%);
  opacity: 0;
  transition: opacity .2s;
}
.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(0.98); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--ink) 0%, #1e293b 100%);
  box-shadow: 0 2px 8px rgba(10, 14, 26, .2), 0 4px 16px rgba(10, 14, 26, .12);
}
.btn-primary:hover {
  color: #fff;
  box-shadow: 0 4px 12px rgba(10, 14, 26, .3), 0 8px 24px rgba(10, 14, 26, .16);
  transform: translateY(-2px);
}
.btn-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, .9);
  border-color: rgba(15, 23, 42, .12);
  box-shadow: 0 2px 4px rgba(15, 23, 42, .04);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 1);
  color: var(--ink);
  border-color: rgba(15, 23, 42, .2);
  box-shadow: 0 4px 8px rgba(15, 23, 42, .08);
  transform: translateY(-1px);
}
.btn-ghost {
  color: var(--text-soft);
  background: transparent;
  margin-left: auto;
  padding: 0 12px;
  border: none;
}
.btn-ghost:hover {
  color: var(--ink);
  background: rgba(15, 23, 42, .06);
}
@media (max-width: 440px) { .btn-row { flex-wrap: wrap; } .btn-ghost { margin-left: 0; } }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Results */
.result-box {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: var(--r-md);
  border: 1.5px solid;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  font-size: .92rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
  animation: slideIn .3s ease-out;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.result-box.status-healthy {
  background: linear-gradient(135deg, var(--ok-bg) 0%, rgba(255, 255, 255, .95) 100%);
  border-color: var(--ok-border);
  color: var(--ok-text);
}
.result-box.status-borderline, .result-box.status-tds_creep_caution, .result-box.status-remineralized_caution, .result-box.status-retest_anomaly {
  background: linear-gradient(135deg, var(--warn-bg) 0%, rgba(255, 255, 255, .95) 100%);
  border-color: var(--warn-border);
  color: var(--warn-text);
}
.result-box.status-action_needed, .result-box.status-error {
  background: linear-gradient(135deg, var(--bad-bg) 0%, rgba(255, 255, 255, .95) 100%);
  border-color: var(--bad-border);
  color: var(--bad-text);
}
.result-headline {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -.02em;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-headline::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.result-box.status-healthy .result-headline::before { background: var(--ok); }
.result-box.status-borderline .result-headline::before,
.result-box.status-tds_creep_caution .result-headline::before,
.result-box.status-remineralized_caution .result-headline::before,
.result-box.status-retest_anomaly .result-headline::before { background: var(--warn); }
.result-box.status-action_needed .result-headline::before,
.result-box.status-error .result-headline::before { background: var(--bad); }
.result-box p:last-of-type { margin-bottom: 0; }
.result-box ul { margin: 10px 0 0; padding-left: 0; list-style: none; }
.result-box li { position: relative; padding-left: 24px; margin-bottom: 8px; line-height: 1.6; }
.result-box li::before {
  content: "→";
  position: absolute;
  left: 4px;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  opacity: 1;
}

/* ---------- Figures ---------- */
.editorial-figure, .diagram-figure {
  margin: 36px 0;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all .3s ease;
}
.editorial-figure:hover, .diagram-figure:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.editorial-figure img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-alt); }
.editorial-figure figcaption, .diagram-caption {
  margin: 0;
  padding: 14px 20px;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text-muted);
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, .6);
  backdrop-filter: blur(8px);
}
.editorial-figure figcaption strong, .diagram-caption strong { color: var(--ink); font-weight: 650; }
.diagram-figure { padding: 0; }
.diagram-figure svg { display: block; width: 100%; height: auto; padding: 28px 24px 20px; background: #ffffff; }

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 20px 0 30px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 13px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th {
  background: linear-gradient(135deg, rgba(248, 250, 252, .95) 0%, rgba(241, 245, 249, .98) 100%);
  backdrop-filter: blur(8px);
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
td:first-child { font-weight: 600; color: var(--ink); }
td.num { font-weight: 600; color: var(--accent-dark); white-space: nowrap; font-family: var(--font-mono); }
tbody tr { transition: background-color .2s; }
tbody tr:hover { background: rgba(14, 165, 233, .03); }
tr:last-child td { border-bottom: 0; }

/* ---------- Callouts ---------- */
.callout {
  position: relative;
  margin: 24px 0;
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(14, 165, 233, .06) 0%, rgba(6, 182, 212, .08) 100%);
  backdrop-filter: blur(8px);
  border-left: 4px solid var(--accent);
  font-size: .92rem;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(14, 165, 233, .08);
}
.callout p { margin: 0; line-height: 1.6; }
.callout strong { color: var(--ink); font-weight: 650; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 20px 0; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Bento / related ---------- */
.related { padding: 72px 0; background: transparent; border-top: 1px solid rgba(15, 23, 42, .08); }
.is-home .related { border-top: 0; padding: 64px 0 24px; }
.section-head { margin-bottom: 28px; max-width: 600px; }
.section-head h2 { margin: 0; border: 0; padding: 0; }
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 26px;
  min-height: 180px;
  text-decoration: none;
  color: var(--text);
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: var(--r-lg);
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
}
.tile:hover {
  color: var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  background: rgba(255, 255, 255, .95);
}
.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(14, 165, 233, .1) 0%, rgba(6, 182, 212, .12) 100%);
  border: 1px solid rgba(14, 165, 233, .2);
  margin-bottom: 10px;
  transition: transform .3s;
}
.tile:hover .tile-icon {
  transform: scale(1.1) rotate(-5deg);
}
.tile-tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); }
.tile-title { font-family: var(--font-display); font-size: 1.08rem; font-weight: 750; letter-spacing: -.018em; line-height: 1.25; color: var(--ink); }
.tile-desc { font-size: .86rem; line-height: 1.55; color: var(--text-muted); }
.tile-arrow {
  position: absolute;
  right: 20px;
  top: 22px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .92rem;
  color: var(--text-soft);
  background: rgba(15, 23, 42, .04);
  transition: all .3s;
}
.tile:hover .tile-arrow {
  transform: translate(4px, -4px);
  color: var(--accent);
  background: rgba(14, 165, 233, .12);
}
@media (max-width: 960px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .bento { grid-template-columns: 1fr; } .tile { min-height: 0; padding: 20px 22px; } .related { padding: 52px 0; } }

/* ---------- Visual Field Guide Gallery ---------- */
.visual-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0 36px; }
.visual-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-1); transition: border-color .18s, transform .18s, box-shadow .18s; }
.visual-card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-2); text-decoration: none; }
.visual-thumb { aspect-ratio: 16 / 9; background: var(--surface-alt); overflow: hidden; border-bottom: 1px solid var(--line); }
.visual-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.visual-card:hover .visual-thumb img { transform: scale(1.03); }
.visual-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.visual-tag { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-dark); }
.visual-title { font-family: var(--font-display); font-size: .96rem; font-weight: 700; line-height: 1.28; color: var(--ink); }
.visual-desc { font-size: .8rem; line-height: 1.45; color: var(--text-muted); }
@media (max-width: 900px) { .visual-gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .visual-gallery { grid-template-columns: 1fr; } }

/* ---------- Footer: Light Architectural ---------- */
.site-footer { background: var(--surface-alt); border-top: 1px solid var(--line); color: var(--text-muted); padding: 56px 0 48px; font-size: .88rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr .8fr; gap: 36px; }
.footer-brand p { margin: 14px 0 0; max-width: 36ch; }
.footer-brand .meta-note { color: var(--text-soft); font-size: .8rem; }
.footer-heading { margin: 4px 0 12px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink); }
.footer-col a { display: block; color: var(--text-muted); text-decoration: none; padding: 4px 0; }
.footer-col a:hover { color: var(--ink); }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

@media print {
  .site-header, .nav-toggle, .btn-row, .toc, .related { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
