/* ============================================================
   PocketDoc — Nick's Health Resource Site
   Design system inspired by Function Health
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;500;600;700;800&family=PT+Serif:ital,wght@0,400;0,700;1,400&display=swap');

/* ── CSS Variables ── */
:root {
  /* Colors */
  --bg:           #F5EEE1;
  --surface:      #FEF9EF;
  --surface-alt:  #F0E8D8;
  --border:       #E5D9C8;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted:   #9A9080;
  --accent:       #E8845A;
  --accent-hover: #D4704A;
  --accent-light: #FAE8DC;
  --nav-glass:    rgba(245, 238, 225, 0.88);

  /* Status colors */
  --green:        #4A9B6F;
  --green-bg:     #EAF5EF;
  --yellow:       #C8920A;
  --yellow-bg:    #FEF7E0;
  --red:          #C94040;
  --red-bg:       #FDEAEA;

  /* Typography */
  --font-sans:    'Open Sans', system-ui, sans-serif;
  --font-serif:   'PT Serif', Georgia, serif;

  /* Spacing */
  --section-pad:  80px;
  --max-width:    860px;
  --nav-height:   64px;

  /* Radius */
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    20px;

  /* Shadow */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg:    0 8px 24px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-hover);
}

/* ── Typography ── */
h1, h2, h3 {
  font-family: var(--font-serif);
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(36px, 5vw, 52px); font-weight: 700; }
h2 { font-size: clamp(26px, 4vw, 34px); font-weight: 700; }
h3 { font-size: clamp(18px, 3vw, 22px); font-weight: 400; font-style: italic; }

h4 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

p {
  color: var(--text-secondary);
  max-width: 620px;
}

strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ── Layout ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: var(--section-pad) 0;
}

section:nth-child(even) {
  background-color: var(--surface);
}

.section-label {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  display: block;
}

.section-header {
  margin-bottom: 48px;
}

.section-header h2 {
  margin-bottom: 12px;
}

.section-header p {
  font-size: 17px;
  line-height: 1.7;
}

/* ── Navigation ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: var(--nav-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
  padding-bottom: 2px;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
  border-radius: 2px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
  outline: none;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav overlay */
.nav-mobile {
  display: none;
  position: fixed;
  inset: var(--nav-height) 0 0 0;
  background: var(--bg);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.nav-mobile.open {
  display: flex;
}

.nav-mobile a {
  font-family: var(--font-serif);
  font-size: 28px;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-mobile a:hover {
  color: var(--accent);
}

/* ── Hero ── */
.hero {
  padding: 96px 0 80px;
}

.hero-eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: block;
}

.hero h1 {
  margin-bottom: 20px;
  max-width: 700px;
}

.hero-sub {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 560px;
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--surface-alt);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Labs intro read-more toggle ── */
.labs-intro-more {
  overflow: hidden;
}

.labs-intro-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.01em;
}

.labs-intro-toggle:hover {
  opacity: 0.75;
}

.labs-intro-arrow {
  font-size: 11px;
  transition: transform 0.2s;
}

.labs-intro-toggle[aria-expanded="true"] .labs-intro-arrow {
  transform: rotate(180deg);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

.card h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  font-style: normal;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.card p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
  margin-bottom: 12px;
}

.card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.affiliate-badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: uppercase;
}

/* ── Disclaimer banner ── */
.disclaimer {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 40px;
}

/* ── Labs Section ── */
.labs-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
}

.panel-tabs {
  display: flex;
  gap: 8px;
}

.panel-tab {
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.toggle-btn-group {
  display: flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

/* Labs table — Full Guide */
.labs-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.labs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}

.labs-table thead th {
  background: var(--surface-alt);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.labs-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.labs-table tbody tr:last-child {
  border-bottom: none;
}

.labs-table tbody tr:hover {
  background: var(--accent-light);
}

.labs-table td {
  padding: 10px 12px;
  vertical-align: top;
  line-height: 1.5;
}

/* # column — just a number, keep it tight */
.labs-table td:first-child,
.labs-table th:first-child {
  width: 36px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Lab name — fixed width so Why It Matters gets breathing room */
.labs-table td:nth-child(2),
.labs-table th:nth-child(2) {
  width: 30%;
  color: var(--green);
  font-weight: 600;
}

/* Code column — short monospace number */
.labs-table td:nth-child(3),
.labs-table th:nth-child(3) {
  width: 72px;
  font-family: monospace;
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Why it matters — gets all remaining space */
.labs-table td:nth-child(4) {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

/* Labs — For Your Doctor view */
.doctor-view {
  display: none;
}

.doctor-view.visible {
  display: block;
}

.full-view.hidden {
  display: none;
}

.doctor-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.doctor-header h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  font-style: normal;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.doctor-header p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
}

.doctor-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.doctor-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.doctor-list-item:last-child {
  border-bottom: none;
}

.doctor-list-item strong {
  font-size: 15px;
}

.doctor-list-item code {
  font-family: monospace;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-radius: 4px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.icd-code {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
  white-space: nowrap;
}

.icd-code::before {
  content: '(e.g. ';
  font-size: 11px;
  opacity: 0.8;
}

.icd-code::after {
  content: ')';
  font-size: 11px;
  opacity: 0.8;
}

/* ── Frequency badges (one-time / infrequent tests) ── */
.freq-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-sans);
  font-style: normal;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 2px 5px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

.freq-badge.once {
  background: #e8f4fd;
  color: #2471a3;
  border: 1px solid #aed6f1;
}

.freq-badge.infrequent {
  background: #f4f6f7;
  color: #626567;
  border: 1px solid #cacfd2;
}

.print-btn-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Supplements Section ── */
.supplement-card {
  display: flex;
  flex-direction: column;
}

.supplement-card .card-price {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-top: auto;
  padding-top: 12px;
}

.fullscript-banner {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.fullscript-banner .text h4 {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.fullscript-banner .text p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
}

/* ── Product Recs Section ── */
.product-category {
  margin-bottom: 48px;
}

.product-category:last-child {
  margin-bottom: 0;
}

.product-category h4 {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* ── Where to Buy Section ── */
.buy-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.buy-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.buy-item-icon {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}

.buy-item-content h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 700;
  font-style: normal;
  margin-bottom: 4px;
}

.buy-item-content p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
  margin-bottom: 8px;
}

/* ── Lab Interpreter Section ── */
.interpreter-gate {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.interpreter-gate h3 {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  font-style: normal;
  margin-bottom: 8px;
}

.interpreter-gate p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
  margin: 0 auto 24px;
}

.password-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.password-input-wrap input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}

.password-input-wrap input:focus {
  border-color: var(--accent);
}

.password-error {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  display: none;
}

.password-error.visible {
  display: block;
}

/* Interpreter form */
.interpreter-form {
  display: none;
  max-width: 600px;
  margin: 0 auto;
}

.interpreter-form.visible {
  display: block;
}

.privacy-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.privacy-note-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  margin-bottom: 20px;
  background: var(--surface);
  position: relative;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-icon {
  font-size: 36px;
  margin-bottom: 12px;
  display: block;
}

.upload-area p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: none;
  margin-bottom: 4px;
}

.upload-area small {
  font-size: 13px;
  color: var(--text-muted);
}

.upload-filename {
  font-size: 14px;
  color: var(--green);
  font-weight: 600;
  margin-top: 8px;
  display: none;
}

.upload-filename.visible {
  display: block;
}

/* Loading state */
.interpreter-loading {
  display: none;
  text-align: center;
  padding: 48px 0;
}

.interpreter-loading.visible {
  display: block;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.interpreter-loading p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: none;
  text-align: center;
}

/* Results */
.interpreter-results {
  display: none;
}

.interpreter-results.visible {
  display: block;
}

.results-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.urgent-flags {
  background: var(--red-bg);
  border: 1px solid #F5C0C0;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.urgent-flags h4 {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.urgent-flags ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.urgent-flags li {
  font-size: 14px;
  color: var(--red);
  font-weight: 600;
}

.results-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

/* Accordion result card */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.result-card-header:hover {
  background: var(--surface-alt);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }

.result-name {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.result-value {
  font-size: 14px;
  font-weight: 600;
}

.result-value.green { color: var(--green); }
.result-value.yellow { color: var(--yellow); }
.result-value.red { color: var(--red); }

.result-range {
  font-size: 13px;
  color: var(--text-muted);
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.status-badge.green { background: var(--green-bg); color: var(--green); }
.status-badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.status-badge.red { background: var(--red-bg); color: var(--red); }

.accordion-arrow {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.result-card.open .accordion-arrow {
  transform: rotate(180deg);
}

.result-card-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}

.result-card.open .result-card-body {
  display: block;
}

.result-card-body p {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: none;
  margin-top: 14px;
  line-height: 1.7;
}

.results-footer {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.results-footer strong {
  display: block;
  font-size: 15px;
  margin-bottom: 6px;
}

.bring-to-doctor {
  margin-top: 20px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Lab Accordion ── */
.lab-accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: var(--surface);
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
  gap: 16px;
}

.accordion-trigger:hover {
  background: var(--surface-alt);
}

.accordion-trigger.open {
  border-bottom: 1px solid var(--border);
}

.accordion-trigger-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.accordion-icon {
  font-size: 24px;
  color: var(--accent);
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.accordion-title {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.accordion-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.accordion-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.accordion-trigger.open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  background: var(--bg);
  padding: 24px;
}

.labs-view-bar {
  margin-bottom: 24px;
}

.labs-context-note {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 28px;
  max-width: none;
}

.day-group {
  margin-bottom: 32px;
}

.day-group:last-child {
  margin-bottom: 0;
}

.day-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.labs-full-view,
.labs-doctor-view {
  display: block;
}

.labs-full-view[hidden],
.labs-doctor-view[hidden] {
  display: none;
}

.doctor-day-divider {
  padding: 10px 20px;
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

/* ── Footer ── */
footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.footer-logo span {
  color: var(--accent);
}

.footer-note {
  font-size: 13px;
  color: var(--text-muted);
  max-width: none;
  text-align: right;
}

/* ── Utilities ── */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
  :root {
    --section-pad: 56px;
  }

  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .hero {
    padding: 64px 0 56px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .fullscript-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .buy-item {
    flex-direction: column;
    gap: 12px;
  }

  .interpreter-gate {
    padding: 28px 20px;
  }

  .upload-area {
    padding: 28px 20px;
  }

  .result-card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .result-range {
    width: 100%;
    padding-left: 22px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-note {
    text-align: left;
  }

  /* Doctor view on mobile — optimized */
  .doctor-list-item {
    padding: 14px 16px;
  }

  .doctor-list-item strong {
    font-size: 16px;
  }

  /* Labs table — reflow to stacked cards on mobile */
  .labs-table-wrap {
    border: none;
    box-shadow: none;
    overflow-x: visible;
  }

  .labs-table thead {
    display: none;
  }

  .labs-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--surface);
  }

  .labs-table tbody tr:hover {
    background: var(--surface);
  }

  .labs-table td {
    display: block;
    padding: 0;
    border: none;
    white-space: normal;
    min-width: unset;
  }

  /* Hide the # column */
  .labs-table td:first-child {
    display: none;
  }

  /* Lab name */
  .labs-table td:nth-child(2) {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
  }

  /* ICD-10 code */
  .labs-table td:nth-child(3) {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
  }

  .labs-table td:nth-child(3)::before {
    content: 'Code: ';
  }

  /* Why it matters */
  .labs-table td:nth-child(4) {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
  }

  /* Toggle buttons — stack on very small screens */
  .toggle-btn-group {
    flex-wrap: wrap;
  }

  .toggle-btn {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 7px 10px;
  }
}

@media print {
  /* ── Hide all page chrome ── */
  .nav, .nav-mobile, .hero,
  #start-here, #supplements, #recs, #where-to-buy, #lab-interpreter, footer {
    display: none !important;
  }

  /* ── Hide labs section UI chrome ── */
  .section-header, .labs-intro-more, .labs-intro-toggle,
  .accordion-trigger, .labs-view-bar, .labs-full-view, .print-btn-wrap {
    display: none !important;
  }

  /* ── Hide whichever accordion panel is closed ── */
  .accordion-body[hidden] {
    display: none !important;
  }

  /* ── Show the open accordion panel, remove overflow clipping ── */
  .accordion-body:not([hidden]) {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* ── Always show doctor view (regardless of toggle state) ── */
  .labs-full-view {
    display: none !important;
  }

  .labs-doctor-view {
    display: block !important;
  }

  /* ── Base reset — collapse all top spacing ── */
  body, main {
    background: white;
    color: black;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 11px;
  }

  #labs {
    padding: 0 !important;
    margin: 0 !important;
  }

  .lab-accordion {
    margin-top: 0 !important;
  }

  .container {
    max-width: none;
    padding: 0 20px;
    margin: 0 !important;
  }

  /* ── Doctor header ── */
  .doctor-header {
    background: none;
    border: none;
    border-bottom: 2px solid #000;
    border-radius: 0;
    padding: 8px 0;
    margin-bottom: 4px;
  }

  .doctor-header h3 {
    font-size: 13px;
    margin-bottom: 2px;
  }

  .doctor-header p {
    font-size: 10px;
    margin: 0;
  }

  /* ── Doctor list ── */
  .doctor-list {
    border: none;
    box-shadow: none;
    border-radius: 0;
  }

  .doctor-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    border-bottom: 1px solid #ddd;
    gap: 8px;
    page-break-inside: avoid;
  }

  .doctor-list-item strong {
    font-size: 10px;
    flex: 1;
  }

  .doctor-list-item code {
    font-size: 10px;
    padding: 1px 5px;
    background: #f0f0f0;
    border-radius: 3px;
    flex-shrink: 0;
  }

  .icd-code {
    font-size: 9px;
    border: none;
    padding: 0;
    color: #666;
    flex-shrink: 0;
  }

  .doctor-day-divider {
    font-size: 9px;
    font-weight: 700;
    padding: 4px 0 2px;
    background: none;
    border-bottom: 1px solid #bbb;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
}
