/* ─────────────────────────────────────────────────────────────────────────
   Design tokens
───────────────────────────────────────────────────────────────────────── */
:root {
  --bg:            #faf6f1;
  --surface:       #ffffff;
  --surface-warm:  #f5efe7;
  --border:        #e8e0d5;
  --border-light:  #f0e9e0;

  --text:          #1c1917;
  --text-muted:    #78716c;
  --text-faint:    #a8a29e;

  --accent:        #c2956b;
  --accent-hover:  #a97852;

  /* Status: OPTIMAL */
  --opt-bg:        #f0fdf4;
  --opt-border:    #bbf7d0;
  --opt-text:      #15803d;
  --opt-dot:       #22c55e;

  /* Status: LOW */
  --low-bg:        #fffbeb;
  --low-border:    #fde68a;
  --low-text:      #92400e;
  --low-dot:       #f59e0b;

  /* Status: HIGH */
  --high-bg:       #fef2f2;
  --high-border:   #fecaca;
  --high-text:     #b91c1c;
  --high-dot:      #ef4444;

  /* Status: BORDERLINE */
  --border-bg:     #faf5ff;
  --border-bdr:    #e9d5ff;
  --border-text:   #7c3aed;
  --border-dot:    #a855f7;

  /* Status: N/A */
  --na-bg:         #f5f5f4;
  --na-border:     #e7e5e4;
  --na-text:       #78716c;
  --na-dot:        #a8a29e;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  18px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:     0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);

  --max-w: 1360px;
  --pad-x: clamp(1rem, 4vw, 2.5rem);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }

button { font-family: inherit; cursor: pointer; border: none; }

input, select { font-family: inherit; }

code {
  font-family: 'Menlo', 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--surface-warm);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────
   Navigation
───────────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 246, 241, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

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

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--text);
  color: var(--bg);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}

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

/* ─────────────────────────────────────────────────────────────────────────
   Hero
───────────────────────────────────────────────────────────────────────── */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3.5rem var(--pad-x) 2.5rem;
}

.hero-eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ─────────────────────────────────────────────────────────────────────────
   Main layout
───────────────────────────────────────────────────────────────────────── */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x) 5rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   Top grid (Video · Updates)
───────────────────────────────────────────────────────────────────────── */
.top-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

/* Generic card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.card-sublabel {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
  font-style: italic;
}

/* Video */
.video-wrapper {
  margin-top: 0.75rem;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-warm);
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--text-faint);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--surface-warm);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}

.placeholder-icon {
  font-size: 1.75rem;
  opacity: 0.4;
}

/* Mail */
.mail-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-top: 0.25rem;
}

.mail-address {
  font-size: 0.82rem;
  color: var(--text);
  flex: 1;
  line-height: 1.3;
  word-break: break-word;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--text);
  color: var(--bg);
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}

.copy-btn:hover { background: #333; }
.copy-btn.copied { background: var(--opt-text); }

/* Updates */
.tweets-container {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 420px;
  overflow-y: auto;
}

/* Twitter timeline iframe sizing */
.tweets-container iframe {
  width: 100% !important;
  min-height: 400px;
  border-radius: var(--radius-sm);
}

.tweet-placeholder {
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 1rem;
  background: var(--surface-warm);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  line-height: 1.6;
}

.tweet-hint { margin-top: 0.4rem; font-size: 0.78rem; }

/* Twitter embeds override width */
.tweets-container .twitter-tweet { margin: 0 !important; }

/* ─────────────────────────────────────────────────────────────────────────
   Sections
───────────────────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Summary pills */
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.summary-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid;
}

.summary-pill.optimal { background: var(--opt-bg); border-color: var(--opt-border); color: var(--opt-text); }
.summary-pill.low     { background: var(--low-bg); border-color: var(--low-border); color: var(--low-text); }
.summary-pill.high    { background: var(--high-bg); border-color: var(--high-border); color: var(--high-text); }
.summary-pill.borderline { background: var(--border-bg); border-color: var(--border-bdr); color: var(--border-text); }

.summary-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─────────────────────────────────────────────────────────────────────────
   Biomarker grid
───────────────────────────────────────────────────────────────────────── */
.biomarkers-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   Biomarker card
───────────────────────────────────────────────────────────────────────── */
.biomarker-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: box-shadow 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
}

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

/* Colored left accent bar based on status */
.biomarker-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.biomarker-card.status-optimal::before  { background: var(--opt-dot); }
.biomarker-card.status-low::before      { background: var(--low-dot); }
.biomarker-card.status-high::before     { background: var(--high-dot); }
.biomarker-card.status-borderline::before { background: var(--border-dot); }
.biomarker-card.status-na::before       { background: var(--na-dot); }

/* Card header: name + source badge */
.bm-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.bm-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
}

.bm-source {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-warm);
  border: 1px solid var(--border-light);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Card body: value + unit */
.bm-body {
  flex: 1;
  margin-bottom: 0.75rem;
}

.bm-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.bm-unit {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.bm-reference {
  font-size: 0.68rem;
  color: var(--text-faint);
  margin-top: 0.3rem;
}

/* Card footer: change + status badge */
.bm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.bm-change {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.bm-change.up   { color: var(--high-text); }
.bm-change.down { color: var(--opt-text); }

.bm-status {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
}

.bm-status.optimal    { background: var(--opt-bg); border-color: var(--opt-border); color: var(--opt-text); }
.bm-status.low        { background: var(--low-bg); border-color: var(--low-border); color: var(--low-text); }
.bm-status.high       { background: var(--high-bg); border-color: var(--high-border); color: var(--high-text); }
.bm-status.borderline { background: var(--border-bg); border-color: var(--border-bdr); color: var(--border-text); }
.bm-status.na         { background: var(--na-bg); border-color: var(--na-border); color: var(--na-text); }

/* Notes */
.bm-notes {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.5;
  border-top: 1px solid var(--border-light);
  padding-top: 0.5rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   See All link
───────────────────────────────────────────────────────────────────────── */
.see-all-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1.5px solid var(--text);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.see-all-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────────
   Controls (search + filter)
───────────────────────────────────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  color: var(--text-faint);
  pointer-events: none;
}

.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem 0.45rem 2.1rem;
  font-size: 0.85rem;
  color: var(--text);
  width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 149, 107, 0.15);
}

.status-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}

.status-select:focus { border-color: var(--accent); }

/* ─────────────────────────────────────────────────────────────────────────
   Category tabs
───────────────────────────────────────────────────────────────────────── */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}

.tab-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

.tab-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.tab-count {
  background: rgba(255,255,255,0.2);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.tab-btn:not(.active) .tab-count {
  background: var(--surface-warm);
  color: var(--text-faint);
}

/* ─────────────────────────────────────────────────────────────────────────
   Results count
───────────────────────────────────────────────────────────────────────── */
.results-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   Empty state
───────────────────────────────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─────────────────────────────────────────────────────────────────────────
   Footer
───────────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem var(--pad-x);
  max-width: var(--max-w);
  margin: 0 auto;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.8;
}

.footer-disclaimer {
  font-size: 0.72rem;
  color: var(--text-faint);
}

/* ─────────────────────────────────────────────────────────────────────────
   Responsive
───────────────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .biomarkers-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  .top-grid {
    grid-template-columns: 1fr;
  }
  .biomarkers-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .top-grid { grid-template-columns: 1fr; }
  .video-card { grid-column: 1; }
  .biomarkers-grid { grid-template-columns: 1fr; }
  .section-header { flex-direction: column; align-items: flex-start; }
  .controls { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  .bm-value { font-size: 1.5rem; }
  .nav-links { gap: 1rem; }
}
