/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand: Medical-grade teal — trustworthy, calm, clinical */
  --c-primary: #0d9488;
  --c-primary-dark: #0f766e;
  --c-primary-light: #ccfbf1;
  --c-primary-subtle: #f0fdfa;

  /* Surfaces (Stripe/Cal-inspired clean whites) */
  --c-bg: #fafafa;
  --c-surface: #ffffff;
  --c-surface-raised: #f9fafb;
  --c-text: #111827;
  --c-text-secondary: #374151;
  --c-text-muted: #6b7280;
  --c-border: #e5e7eb;
  --c-border-strong: #d1d5db;

  /* Semantic (health data) */
  --c-green: #059669;
  --c-yellow: #d97706;
  --c-orange: #ea580c;
  --c-red: #dc2626;

  /* System */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --max-w: 960px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Layout ===== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* ===== Header ===== */
.site-header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-logo {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.site-logo::before {
  content: '';
  width: 24px;
  height: 24px;
  background: var(--c-primary);
  border-radius: 6px;
  flex-shrink: 0;
}
.site-nav { display: flex; gap: 0.25rem; align-items: center; }
.site-nav a {
  color: var(--c-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-xs);
  transition: color 0.15s, background 0.15s;
}
.site-nav a:hover {
  color: var(--c-text);
  background: var(--c-surface-raised);
}
.site-nav a[aria-current="page"] {
  color: var(--c-primary-dark);
  background: var(--c-primary-light);
  font-weight: 600;
}
.site-nav a[aria-current="page"]::after { display: none; }

/* Hamburger (mobile) */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  cursor: pointer;
  width: 32px;
  height: 24px;
  position: relative;
  z-index: 110;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--c-text);
  border-radius: 2px;
  position: absolute;
  transition: all 0.3s;
}
.nav-toggle-label span { top: 50%; transform: translateY(-50%); }
.nav-toggle-label span::before { content: ''; top: -8px; }
.nav-toggle-label span::after { content: ''; top: 8px; }
.nav-toggle:checked + .nav-toggle-label span { background: transparent; }
.nav-toggle:checked + .nav-toggle-label span::before { top: 0; transform: rotate(45deg); background: var(--c-text); }
.nav-toggle:checked + .nav-toggle-label span::after { top: 0; transform: rotate(-45deg); background: var(--c-text); }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 3.5rem 1.5rem 3rem;
  background: var(--c-surface);
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 2.5rem;
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  color: var(--c-text);
  letter-spacing: -0.03em;
}
.hero p {
  color: var(--c-text-muted);
  font-size: 1.0625rem;
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.65;
}

/* Trust badges */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.badge-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--c-surface);
  color: var(--c-text-secondary);
  padding: 0.5rem 0.875rem;
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-xs);
}
.badge-icon { font-size: 0.875rem; }

/* Feature cards grid (homepage) */
.feature-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.feature-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--c-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-xs);
}
.feature-card:hover {
  border-color: var(--c-primary);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  font-size: 1.5rem;
  margin-bottom: 0.625rem;
  display: block;
}
.feature-card h3 {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}
.feature-card p {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
  line-height: 1.5;
}

/* ===== Card / Panel ===== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* ===== Form Elements ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.25rem; }
.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-group input,
.form-group select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}
.form-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}
.form-row .form-group { flex: 1; }

/* Radio/toggle buttons */
.toggle-group {
  display: flex;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--c-surface-raised);
}
.toggle-group input[type="radio"] { display: none; }
.toggle-group label {
  flex: 1;
  padding: 0.5rem 1rem;
  text-align: center;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  text-transform: none;
  letter-spacing: 0;
  color: var(--c-text-muted);
}
.toggle-group input:checked + label {
  background: var(--c-primary);
  color: white;
  font-weight: 600;
}

/* ===== Results Table ===== */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.results-table th,
.results-table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
}
.results-table th {
  font-weight: 600;
  color: var(--c-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.results-table .pct-cell {
  font-weight: 700;
  font-size: 1rem;
}
.results-table .aap-badge {
  display: inline-block;
  background: var(--c-green);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
  text-transform: uppercase;
}

/* Percentile color coding */
.pct-normal { color: var(--c-green); }
.pct-watch { color: var(--c-yellow); }
.pct-concern { color: var(--c-orange); }

/* ===== Chart Container ===== */
.chart-section { margin: 1.5rem 0; }
.chart-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.chart-wrap {
  position: relative;
  width: 100%;
  height: 350px;
}

/* ===== Interpretation Box ===== */
.interp-box {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}
.interp-box.normal {
  background: #f0fdf4;
  border-left: 4px solid var(--c-green);
}
.interp-box.watch {
  background: #fefce8;
  border-left: 4px solid var(--c-yellow);
}
.interp-box.concern {
  background: #fff7ed;
  border-left: 4px solid var(--c-orange);
}

/* ===== Disclaimer ===== */
.disclaimer {
  font-size: 0.8125rem;
  color: var(--c-text-muted);
  padding: 1.25rem;
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  margin-top: 2.5rem;
  text-align: center;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--c-text);
  color: rgba(255,255,255,0.65);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.5rem;
}
.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 0.75rem;
}
.footer-col a {
  display: block;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  transition: color 0.15s;
}
.footer-col a:hover { color: #ffffff; }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.35);
}

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
  height: 40px;
}
.btn-primary {
  background: var(--c-primary);
  color: white;
}
.btn-primary:hover {
  background: var(--c-primary-dark);
}
.btn-outline {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
}
.btn-outline:hover {
  background: var(--c-surface-raised);
  border-color: var(--c-border-strong);
}

/* ===== Visit History ===== */
.visit-list { list-style: none; margin: 0.5rem 0; }
.visit-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.875rem;
}
.visit-item .visit-date { font-weight: 600; }
.visit-item .visit-remove {
  color: var(--c-text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  border: none;
  background: none;
  padding: 0.25rem;
}
.visit-item .visit-remove:hover { color: var(--c-red); }

/* ===== FAQ Section ===== */
.faq-section {
  margin: 3rem 0 2rem;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.faq-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.faq-item { border-bottom: 1px solid var(--c-border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.875rem 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--c-text);
}
.faq-q::after { content: '+'; font-size: 1.125rem; color: var(--c-text-muted); font-weight: 400; }
.faq-item.open .faq-q::after { content: '−'; }
.faq-a {
  display: none;
  padding: 0 0 1rem;
  color: var(--c-text-muted);
  font-size: 0.9375rem;
  line-height: 1.65;
}
.faq-item.open .faq-a { display: block; }

/* ===== Section Spacing ===== */
.section { margin: 2rem 0; }
.section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* ===== Inline badges (AAP recommended, etc.) ===== */
.badge-aap,
.badge-rec {
  display: inline-block;
  background: var(--c-green);
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  margin-left: 0.375rem;
  vertical-align: middle;
  text-transform: uppercase;
}

/* Percentile color classes (results table cells) */
.p-normal { color: var(--c-green); font-weight: 700; }
.p-watch  { color: var(--c-yellow); font-weight: 700; }
.p-concern { color: var(--c-orange); font-weight: 700; }

/* Results summary line */
.results-summary {
  font-size: 0.9375rem;
  color: var(--c-text-muted);
  margin-bottom: 0.5rem;
}

/* SEO content section */
.content-section {
  margin: 2.5rem 0 1.5rem;
  line-height: 1.7;
}
.content-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.content-section h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}
.content-section p {
  margin-bottom: 0.75rem;
  color: var(--c-text);
}
.content-section ul {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}
.content-section li {
  margin-bottom: 0.375rem;
  font-size: 0.9375rem;
}

/* Active nav link */
.site-nav a[aria-current="page"] {
  color: var(--c-primary-dark);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle-label { display: block; }
  .site-nav {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    background: var(--c-surface);
    flex-direction: column;
    padding: 4rem 2rem 2rem;
    gap: 0.25rem;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    transition: right 0.3s ease;
    z-index: 105;
  }
  .nav-toggle:checked ~ .site-nav { right: 0; }
  .site-nav a {
    font-size: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--c-border);
    border-radius: 0;
    width: 100%;
  }
  .site-nav a:hover { background: transparent; }
  .site-nav a[aria-current="page"] { background: transparent; }
  .hero h1 { font-size: 1.75rem; }
  .hero { padding: 2.5rem 1.25rem 2rem; margin: 0 -1.25rem; }
  .feature-cards { grid-template-columns: 1fr 1fr; }
  .container { padding: 0 1.25rem; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .trust-badges { gap: 0.5rem; }
  .badge-item { font-size: 0.75rem; padding: 0.375rem 0.625rem; }
}
@media (max-width: 400px) {
  .form-grid { grid-template-columns: 1fr; }
  .feature-cards { grid-template-columns: 1fr; }
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .btn, .visit-remove, .form-group { display: none; }
  .card { border: none; box-shadow: none; padding: 0; }
  body { background: white; }
}
