@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
/* ===== SHARED ARTICLE STYLES — Longevity Ladder ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8fafb;
  --bg-card: #ffffff;
  --text: #1a1d23;
  --text-secondary: #5a6170;
  --text-muted: #8b919e;
  --accent: #0ea571;
  --accent-deep: #0b8c5e;
  --accent-glow: rgba(14, 165, 113, 0.15);
  --border: #e5e9ee;
  --border-light: #f0f2f5;
  --danger: #e11d48;
  --warn: #92400e;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border: #21262d;
    --border-light: #1c2128;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  }
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); margin: 2.5rem 0 1rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
p { color: var(--text-secondary); margin-bottom: 1.1rem; }
strong { color: var(--text); }

/* ===== READING PROGRESS ===== */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-deep), #34d399);
  z-index: 100;
  width: 0%;
  transition: width 0.1s linear;
}

/* ===== NAV ===== */
.nav {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}
.nav-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.nav-back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.nav-back:hover { color: var(--accent); }
.nav-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  white-space: nowrap;
}

/* ===== ARTICLE LAYOUT ===== */
.article { max-width: 860px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.article-meta .pill { color: var(--accent); font-weight: 700; }
.article-lead {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 700px;
}

/* ===== HERO FIGURE ===== */
.hero-figure {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent) 45%, #14b8a6);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-figure::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 50%);
  pointer-events: none;
}
.hero-figure svg { max-width: 100%; height: auto; }

/* ===== HERO EMOJI ROW ===== */
.hero-emoji-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  padding: 26px 0 8px;
  flex-wrap: wrap;
}
.hero-emoji-row span {
  font-size: 66px;
  line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.28));
}
.hero-emoji-row span:only-child {
  font-size: 88px;
}
.hero-emoji-caption {
  text-align: center;
  color: rgba(255,255,255,0.94);
  font-weight: 700;
  font-size: 14px;
  margin: 16px 0 2px;
}
@media (max-width: 640px) {
  .hero-emoji-row { gap: 18px; padding: 16px 0 4px; }
  .hero-emoji-row span { font-size: 44px; }
}

/* ===== PULL QUOTE ===== */
.pull-quote {
  border-left: 4px solid var(--accent);
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}
.pull-quote cite {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: normal;
}

/* ===== CALLOUT BOX ===== */
.callout {
  background: var(--accent-glow);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}
.callout h3 { color: var(--accent-deep); font-size: 0.95rem; margin-bottom: 0.5rem; }
.callout p { font-size: 0.9rem; margin-bottom: 0; }
.callout p + p { margin-top: 0.6rem; }

/* ===== STAT CARDS ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.3rem; line-height: 1.4; }
.stat-up { color: var(--danger); }
.stat-down { color: var(--accent); }

/* ===== TABLE ===== */
.table-wrap {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--bg-card);
}
th {
  text-align: left;
  padding: 0.85rem 1rem;
  background: var(--border-light);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  white-space: nowrap;
}
td { padding: 0.85rem 1rem; border-top: 1px solid var(--border-light); color: var(--text-secondary); vertical-align: top; }
td:first-child { font-weight: 600; color: var(--text); }
.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  white-space: nowrap;
}
.badge-severe { background: rgba(225, 29, 72, 0.12); color: var(--danger); }
.badge-moderate { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge-good { background: var(--accent-glow); color: var(--accent); }

/* ===== CHART BLOCK ===== */
.chart-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}
.chart-title { font-weight: 700; margin-bottom: 0.25rem; }
.chart-caption { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1.25rem; }
.chart-block svg { width: 100%; height: auto; display: block; }

/* ===== SYSTEMS GRID ===== */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.system-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.system-emoji { font-size: 1.6rem; margin-bottom: 0.5rem; }
.system-card h3 { font-size: 0.95rem; }
.system-card p { font-size: 0.83rem; margin-bottom: 0; }

/* ===== HABIT BLOCKS ===== */
.habit {
  display: flex;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.habit-num {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-glow);
  color: var(--accent-deep);
  font-weight: 800;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.habit h3 { margin-bottom: 0.3rem; }
.habit p { font-size: 0.92rem; margin-bottom: 0; }
@media (max-width: 640px) {
  .habit { flex-direction: column; gap: 0.75rem; }
}

/* ===== TAKEAWAYS ===== */
.takeaways {
  background: linear-gradient(135deg, var(--accent-deep), var(--accent));
  border-radius: var(--radius);
  padding: 2rem;
  margin: 2.5rem 0;
  color: #fff;
}
.takeaways h2 { color: #fff; margin-top: 0; }
.takeaways ol { padding-left: 1.25rem; }
.takeaways li { margin-bottom: 0.7rem; color: rgba(255,255,255,0.92); font-size: 0.95rem; }
.takeaways li strong { color: #fff; }
.takeaways li::marker { font-weight: 700; color: #a7f3d0; }

/* ===== RELATED ===== */
.related {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.related-card h3 { font-size: 0.9rem; color: var(--text); }
.related-card p { font-size: 0.78rem; margin: 0.3rem 0 0; }

/* ===== SOURCES ===== */
.sources {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.sources strong { color: var(--text-secondary); }
.sources ul { padding-left: 1.2rem; margin-top: 0.4rem; }
.sources li { margin-bottom: 0.35rem; }

/* ===== EVIDENCE SNAPSHOT ===== */
.evidence-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}
.evidence-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.evidence-title { font-weight: 800; font-size: 1.05rem; }
.evidence-stars { color: var(--accent); font-size: 1rem; letter-spacing: 0.15em; white-space: nowrap; }
.evidence-rating-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.evidence-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 640px) { .evidence-cols { grid-template-columns: 1fr; } }
.evidence-col h4 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}
.evidence-col.know h4 { color: var(--accent-deep); }
.evidence-col.unknown h4 { color: var(--warn); }
.evidence-col ul { padding-left: 1.1rem; margin: 0; }
.evidence-col li { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.45rem; }
.evidence-date {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2.5rem 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }
.footer-links { margin: 0.6rem 0 0.4rem; font-size: 0.8rem; }
.footer-links a { margin: 0 0.3rem; }
.footer-links a:hover { text-decoration: underline; }
.footer-note { max-width: 620px; margin: 0.4rem auto 0; font-size: 0.75rem; }

@media (max-width: 640px) {
  .article { padding-top: 2rem; }
  .hero-figure { padding: 1.5rem 1rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .chart-block { padding: 1.25rem; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}


/* ===== EVIDENCE SUB-HEADINGS (h2 semantic, h4 visual) ===== */
.evidence-col h2.evidence-sub { font-size: 0.92rem; margin: 0 0 0.5rem; font-weight: 700; }

/* ===== FOCUS VISIBILITY ===== */
a:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ===== ACTION CHECKLIST ===== */
.checklist-box {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}
.checklist-box h2 { margin-top: 0; }
.checklist { list-style: none; padding-left: 0; margin: 0; }
.checklist li {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.4rem 0; border-bottom: 1px dashed var(--border);
  color: var(--text-secondary); line-height: 1.55;
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before { content: '☐'; font-size: 1.05rem; color: var(--accent); flex-shrink: 0; }
@media print {
  .checklist-box { border: 1px solid #999; box-shadow: none; }
}

/* ==== SITE NAV (shared) ==== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.nav-brand {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.nav-brand-mark { font-size: 1.1rem; }
.nav-brand:hover { color: var(--accent); }
.nav-brand:focus-visible, .nav-btn:focus-visible, .nav-drop-item:focus-visible,
.nav-search input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-search {
  position: relative;
  flex: 1 1 180px;
  min-width: 140px;
  max-width: 340px;
}
.nav-search input {
  width: 100%;
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  max-height: 320px;
  overflow-y: auto;
  z-index: 300;
}
.sr-item {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
}
.sr-item:hover, .sr-item:focus { background: var(--accent-glow); }
.sr-title { display: block; font-size: 0.82rem; font-weight: 700; color: var(--text); }
.sr-meta { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.sr-none { padding: 0.5rem 0.65rem; font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.nav-menu { display: flex; gap: 0.3rem; align-items: center; }
.nav-item { position: relative; }
.nav-btn {
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.nav-btn:hover, .nav-item.open .nav-btn { background: var(--border-light); color: var(--text); }
.nav-caret { font-size: 0.6rem; transition: transform 0.15s; }
.nav-item.open .nav-caret { transform: rotate(180deg); }
.nav-drop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 0.45rem;
  z-index: 300;
}
.nav-drop--pillars { min-width: 400px; }
.nav-item:hover .nav-drop,
.nav-item:focus-within .nav-drop,
.nav-item.open .nav-drop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nav-item:last-child .nav-drop { left: auto; right: 0; }
.nav-drop-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.nav-drop-item span { flex-shrink: 0; }
.nav-drop-item:hover, .nav-drop-item:focus { background: var(--accent-glow); color: var(--accent); }
@media (max-width: 720px) {
  .nav-inner { padding: 0.5rem 0.9rem; gap: 0.6rem; }
  .nav-search { order: 3; flex-basis: 100%; max-width: none; }
  .nav-tag { display: none; }
  .nav-drop, .nav-drop--pillars {
    position: fixed;
    top: 3.3rem;
    left: 0.75rem;
    right: 0.75rem;
    min-width: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-caret { transition: none; }
}
