/* ======= Longevity OS ======= */
:root {
  --bg: #F7F6F2;
  --surface: #FBFBF9;
  --surface-alt: #EFEDE6;
  --border: #D4D1CA;
  --text: #28251D;
  --text-muted: #7A7974;
  --text-faint: #BAB9B4;
  --primary: #01696F;
  --primary-hover: #0C4E54;
  --primary-tint: #E3EEEE;
  --warning: #964219;
  --error: #A12C7B;
  --success: #437A22;

  --real: #437A22;
  --real-bg: #EAF3DE;
  --mixed: #964219;
  --mixed-bg: #FBEDDF;
  --lore: #A12C7B;
  --lore-bg: #F7E1EE;

  --font-display: 'Gambarino', 'Satoshi', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(40, 37, 29, 0.04), 0 2px 6px rgba(40, 37, 29, 0.03);
  --shadow-md: 0 4px 18px rgba(40, 37, 29, 0.06);

  --max: 1240px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; }
a { color: var(--primary); text-decoration: none; transition: color 120ms ease; }
a:hover { color: var(--primary-hover); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 32px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 32px;
  background: rgba(247, 246, 242, 0.88);
  backdrop-filter: saturate(1.1) blur(10px);
  -webkit-backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: 1px solid var(--border);
}
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--primary); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.logo:hover { text-decoration: none; }
.site-header nav { display: flex; gap: 28px; }
.site-header nav a { color: var(--text); font-size: 14px; font-weight: 500; }
.site-header nav a:hover { text-decoration: none; color: var(--primary); }

@media (max-width: 760px) {
  .site-header nav { display: none; }
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(1, 105, 111, 0.08), transparent 70%),
    radial-gradient(800px 400px at -10% 30%, rgba(218, 113, 1, 0.05), transparent 70%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero-inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.eyebrow {
  display: inline-block; padding: 6px 12px;
  background: var(--primary-tint); color: var(--primary);
  border-radius: 100px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 28px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
  max-width: 18ch;
}
.hero h1 em { font-family: var(--font-display); font-style: italic; color: var(--primary); }
.lede {
  font-size: clamp(18px, 1.4vw, 21px);
  line-height: 1.55;
  max-width: 62ch;
  color: var(--text);
  margin: 0 0 32px;
}
.lede strong { font-weight: 700; color: var(--text); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 52px; }
.btn {
  display: inline-block; padding: 13px 22px;
  border-radius: 100px;
  font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
  transition: all 160ms ease;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: var(--bg); }
.btn-primary:hover { background: var(--primary-hover); color: var(--bg); text-decoration: none; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); text-decoration: none; border-color: var(--text-faint); }
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; margin: 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
  max-width: 760px;
}
.hero-stats div { padding-right: 24px; }
.hero-stats dt { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.hero-stats dd {
  margin: 6px 0 0; font-family: var(--font-display); font-size: 44px;
  font-weight: 400; line-height: 1; color: var(--text); font-feature-settings: "tnum" 1, "lnum" 1;
}
@media (max-width: 720px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 20px 0; }
}

/* Sections */
.section { padding: 88px 0; border-bottom: 1px solid var(--border); }
.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--primary); margin-bottom: 14px;
}
.section h2 {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -0.02em; line-height: 1.08;
  margin: 0 0 16px; max-width: 22ch;
}
.section-lede { font-size: 18px; color: var(--text-muted); max-width: 70ch; margin: 0 0 40px; }

/* Briefing */
.briefing { background: var(--surface); }
.brief-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 860px) { .brief-grid { grid-template-columns: 1fr; } }
.brief-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px;
}
.brief-tag {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--primary); text-transform: uppercase; margin-bottom: 14px;
}
.brief-card h3 {
  font-family: var(--font-display); font-size: 26px; line-height: 1.2;
  font-weight: 400; letter-spacing: -0.01em; margin: 0 0 14px;
}
.brief-card h3 em { font-style: italic; color: var(--primary); }
.brief-card p { color: var(--text); margin: 0; }

/* Filter bar */
.filter-bar { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 8px; }
.chip {
  padding: 6px 14px; font-size: 13px; font-weight: 500;
  background: transparent; border: 1px solid var(--border);
  border-radius: 100px; color: var(--text); cursor: pointer;
  transition: all 140ms ease; font-family: inherit;
}
.chip:hover { border-color: var(--text-faint); background: var(--surface); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left; padding: 14px 16px; font-weight: 700; font-size: 12px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border); background: var(--surface);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 140ms ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-tint); }
.data-table td { padding: 16px; vertical-align: middle; }
.col-rank { width: 40px; font-family: var(--font-display); font-size: 18px; color: var(--text-muted); }
.intervention-name { font-weight: 600; font-size: 15px; display: block; }
.intervention-cat { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.badge {
  display: inline-block; padding: 4px 10px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; border-radius: 4px; text-transform: uppercase;
}
.badge-REAL { background: var(--real-bg); color: var(--real); }
.badge-MIXED { background: var(--mixed-bg); color: var(--mixed); }
.badge-LORE { background: var(--lore-bg); color: var(--lore); }

.dot-strip { display: inline-flex; gap: 3px; align-items: center; }
.dot-strip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.dot-strip .dot.on { background: var(--primary); }

.bar-container { display: flex; align-items: center; gap: 10px; }
.bar-value { font-family: var(--font-display); font-size: 16px; min-width: 28px; text-align: right; }
.bar-track { flex: 1; height: 6px; background: var(--surface-alt); border-radius: 100px; overflow: hidden; min-width: 60px; max-width: 120px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #4a9ea4); border-radius: 100px; }

/* Don't Fool Yourself */
.dfy { background: var(--surface); }
.dfy-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 900px) { .dfy-grid { grid-template-columns: 1fr; } }
.dfy-col {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 28px; border-top-width: 6px;
}
.dfy-col.REAL { border-top-color: var(--real); }
.dfy-col.MIXED { border-top-color: var(--mixed); }
.dfy-col.LORE { border-top-color: var(--lore); }
.dfy-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.dfy-title { font-family: var(--font-display); font-size: 26px; font-weight: 400; letter-spacing: -0.01em; }
.dfy-title.REAL { color: var(--real); }
.dfy-title.MIXED { color: var(--mixed); }
.dfy-title.LORE { color: var(--lore); }
.dfy-count { font-size: 28px; font-family: var(--font-display); color: var(--text-muted); font-feature-settings: "tnum" 1; }
.dfy-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 20px; }
.dfy-list { list-style: none; padding: 0; margin: 0; }
.dfy-list li {
  padding: 14px 0; border-top: 1px solid var(--border);
}
.dfy-list li:first-child { border-top: none; padding-top: 4px; }
.dfy-name { font-weight: 600; margin-bottom: 4px; }
.dfy-why { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }

/* Detail cards */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.detail-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; cursor: pointer;
  transition: all 160ms ease;
}
.detail-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--text-faint); }
.detail-card-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; margin-bottom: 10px; }
.detail-card h4 { font-family: var(--font-display); font-size: 22px; font-weight: 400; margin: 0; letter-spacing: -0.01em; }
.detail-card-cat { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; margin-bottom: 14px; }
.detail-card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.detail-card-stat { }
.detail-card-stat-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.detail-card-stat-value { font-weight: 600; font-size: 14px; margin-top: 2px; }

/* Protocol */
.protocol { background: var(--surface); }
.protocol-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 1020px) { .protocol-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .protocol-grid { grid-template-columns: 1fr; } }
.protocol-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px;
}
.tier-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 16px; }
.tier-1 { border-left: 4px solid var(--real); }
.tier-1 .tier-label { color: var(--real); }
.tier-2 { border-left: 4px solid var(--primary); }
.tier-2 .tier-label { color: var(--primary); }
.tier-3 { border-left: 4px solid var(--mixed); }
.tier-3 .tier-label { color: var(--mixed); }
.tier-4 { border-left: 4px solid var(--lore); }
.tier-4 .tier-label { color: var(--lore); }
.protocol-card ul { padding: 0; margin: 0 0 14px; list-style: none; }
.protocol-card li { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.protocol-card li:last-child { border-bottom: none; }
.tier-note { font-size: 12.5px; color: var(--text-muted); margin: 10px 0 0; line-height: 1.5; }

/* Papers */
.papers-list { display: grid; gap: 16px; }
.paper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: start;
}
@media (max-width: 700px) { .paper { grid-template-columns: 1fr; gap: 12px; } }
.paper-meta { font-size: 12px; font-weight: 700; color: var(--primary); letter-spacing: 0.06em; text-transform: uppercase; }
.paper h4 { font-family: var(--font-display); font-size: 24px; font-weight: 400; letter-spacing: -0.01em; margin: 0 0 4px; line-height: 1.2; }
.paper h4 a { color: var(--text); }
.paper h4 a:hover { color: var(--primary); text-decoration: none; }
.paper-authors { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; font-style: italic; }
.paper p { margin: 0; font-size: 15px; }

/* Footer */
.site-footer {
  background: var(--text); color: var(--bg);
  padding: 56px 0 32px;
  border-bottom: none;
}
.site-footer .logo { color: var(--bg); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
@media (max-width: 700px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } }
.footer-label { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.footer-note { font-size: 13px; color: var(--text-faint); max-width: 50ch; margin-top: 14px; }
.site-footer a { color: var(--bg); text-decoration: underline; text-underline-offset: 3px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 37, 29, 0.55); backdrop-filter: blur(3px); }
.modal-panel {
  position: relative; background: var(--bg); border-radius: var(--radius-lg);
  width: min(720px, 92vw); max-height: 86vh; overflow-y: auto;
  padding: 44px; box-shadow: 0 24px 80px rgba(0,0,0,0.22);
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--surface-alt); color: var(--text);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { background: var(--border); }
.modal h3 { font-family: var(--font-display); font-size: 34px; font-weight: 400; letter-spacing: -0.02em; margin: 0 0 6px; }
.modal-cat { font-size: 12px; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; margin-bottom: 20px; }
.modal-row { display: grid; grid-template-columns: 140px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.modal-row:first-of-type { border-top: none; }
.modal-row strong { color: var(--text); font-weight: 600; }
.modal-key { font-weight: 600; color: var(--text-muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 2px; }
.modal-notes { margin-top: 20px; padding: 18px; background: var(--surface); border-radius: var(--radius); border-left: 3px solid var(--primary); font-size: 14.5px; }
.modal-notes strong { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; }

/* Selection */
::selection { background: var(--primary); color: var(--bg); }

/* ========== v1.2: Brain-first, Organ Matrix ========== */

.section-fine { font-size: 13px; color: var(--text-muted); margin-top: 18px; font-style: italic; }

/* Brain section */
.brain-section { background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); }
.brain-list { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--border); }
.brain-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 18px 10px; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.15s ease;
}
.brain-row:hover { background: var(--surface); }
.brain-row-main { display: flex; gap: 16px; flex: 1; align-items: flex-start; }
.brain-score {
  display: inline-block; width: 36px; height: 36px; border-radius: 8px;
  flex-shrink: 0; margin-top: 2px; position: relative;
}
.brain-score::after {
  content: ''; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.brain-score-3 { background: var(--primary); }
.brain-score-2 { background: color-mix(in srgb, var(--primary) 55%, var(--bg)); }
.brain-score-1 { background: color-mix(in srgb, var(--primary) 25%, var(--bg)); }
.brain-score-3::after { content: '3'; color: var(--bg); font-weight: 700; font-size: 15px; }
.brain-score-2::after { content: '2'; color: var(--text); font-weight: 700; font-size: 15px; }
.brain-score-1::after { content: '1'; color: var(--text-muted); font-weight: 600; font-size: 15px; }
.brain-name { font-weight: 700; font-size: 16px; color: var(--text); margin-bottom: 4px; }
.brain-finding { font-size: 14px; color: var(--text-muted); line-height: 1.5; }

/* Organ coverage section */
.organ-section { background: var(--surface); }
.organ-summary {
  display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 28px;
}
.organ-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
}
.organ-chip-name { color: var(--text); }
.organ-chip-count {
  background: var(--primary); color: var(--bg);
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.organ-matrix-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg);
}
.organ-table {
  border-collapse: collapse; width: 100%; min-width: 880px;
  font-size: 13px;
}
.organ-table thead {
  background: var(--surface-alt);
  position: sticky; top: 0; z-index: 2;
}
.organ-table th {
  padding: 14px 6px; text-align: center;
  font-weight: 600; font-size: 11px; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.organ-th-intervention { text-align: left !important; padding-left: 18px !important; min-width: 210px; }
.organ-label { display: inline-block; transform-origin: center; }
.organ-table tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; }
.organ-table tbody tr:hover { background: var(--surface); }
.organ-intervention-cell {
  padding: 14px 18px; vertical-align: middle;
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.organ-name { font-weight: 600; color: var(--text); }
.organ-verdict { flex-shrink: 0; }
.organ-cell {
  text-align: center; padding: 12px 6px;
  font-weight: 700; font-size: 13px;
  border-left: 1px solid color-mix(in srgb, var(--border) 60%, var(--bg));
}
.organ-cell-0 { color: var(--text-faint); background: transparent; }
.organ-cell-1 { background: color-mix(in srgb, var(--primary) 14%, var(--bg)); color: var(--text); }
.organ-cell-2 { background: color-mix(in srgb, var(--primary) 40%, var(--bg)); color: var(--text); }
.organ-cell-3 { background: var(--primary); color: var(--bg); }

/* Detail card additions */
.detail-card-organs {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
  font-weight: 500;
}

/* Modal organ grid */
.modal-organs { padding: 14px 0; border-top: 1px solid var(--border); }
.modal-organs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 8px; }
.modal-organ-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--surface); border-radius: 6px;
  font-size: 13px;
}
.modal-organ-name { color: var(--text); font-weight: 500; }
.modal-organ-cell { width: 24px; height: 24px; border-radius: 4px; padding: 0; line-height: 24px; border: none; font-size: 12px; }

@media (max-width: 720px) {
  .brain-row { flex-direction: column; gap: 10px; }
  .organ-table { font-size: 11px; }
  .organ-intervention-cell { padding: 10px 12px; }
}

/* v1.2 — trademark mark on brand */
.logo .tm {
  font-size: 0.5em;
  font-weight: 500;
  vertical-align: super;
  margin-left: 0.15em;
  letter-spacing: 0.02em;
  opacity: 0.75;
}
