@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&family=Instrument+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface2: #f0eeea;
  --border: #e0ddd7;
  --border-light: #c8c4bc;
  --text: #1a1916;
  --text-muted: #5c5852;
  --text-faint: #9c9890;
  --accent: #2a5fd4;
  --accent-soft: #e8eefb;
  --green: #1d7a42;
  --green-soft: #e8f5ee;
  --amber: #8a5000;
  --amber-soft: #fef3e2;
  --rose: #c0284a;
  --rose-soft: #fdeaee;
  --teal: #0d7070;
  --teal-soft: #e5f5f5;
  --purple: #6b3fd4;
  --purple-soft: #f0ebfb;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-sans: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
}

/* ── TOPBAR ── */
.site-header {
  grid-column: 1 / -1;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.site-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-right: 32px;
  flex-shrink: 0;
}

.logo-icon {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}

.logo-text {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo-text span { color: var(--text-muted); font-style: italic; }

/* Top nav links */
.top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.top-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.top-nav a:hover { background: var(--surface2); color: var(--text); }
.top-nav a.active { background: var(--accent-soft); color: var(--accent); }
.top-nav a .nav-icon { font-size: 14px; }

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Global search in header */
.global-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  min-width: 190px;
  cursor: text;
  transition: border-color 0.12s;
}
.global-search:focus-within { border-color: var(--accent); }
.global-search input {
  border: none; background: transparent; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 12px; width: 100%;
}
.global-search input::placeholder { color: var(--text-faint); }

.header-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 14px 4px;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  transition: all 0.1s ease;
  border-left: 2px solid transparent;
  line-height: 1.3;
}
.sidebar a:hover { color: var(--text); background: var(--surface2); border-left-color: var(--border-light); }
.sidebar a.active { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 500; }
.sidebar a.hidden { display: none; }

.nav-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.no-results { display: none; padding: 6px 14px; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

/* ── MAIN ── */
main {
  overflow-y: auto;
  height: calc(100vh - 56px);
}

/* ── PAGE HERO ── */
.page-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 44px 52px 36px;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(42,95,212,0.05) 0%, transparent 70%);
  pointer-events: none;
}
.page-hero-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.page-hero h1 {
  font-family: var(--font-serif);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 10px;
}
.page-hero p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 520px;
}

/* ── CONTENT ── */
.content { padding: 0 52px 70px; }

/* ── SECTION ── */
.wiki-section { padding-top: 50px; }
.section-header { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 5px; }
.section-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; margin-top: 3px; }
.icon-blue   { background: var(--accent-soft); }
.icon-green  { background: var(--green-soft); }
.icon-amber  { background: var(--amber-soft); }
.icon-teal   { background: var(--teal-soft); }
.icon-purple { background: var(--purple-soft); }
.section-title { font-family: var(--font-serif); font-size: 1.7rem; font-weight: 400; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.section-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.section-divider { width: 100%; height: 1px; background: var(--border); margin: 14px 0 24px; }

/* ── CARDS ── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 17px 19px; transition: border-color 0.15s, box-shadow 0.15s; position: relative; }
.card:hover { border-color: var(--border-light); box-shadow: 0 2px 9px rgba(0,0,0,0.06); }
.card-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.card h3 { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.card-accent { position: absolute; top: 0; left: 0; width: 3px; height: 100%; border-radius: 9px 0 0 9px; }

/* ── INFO BOX ── */
.info-box { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 17px 21px; margin-bottom: 18px; }
.info-box-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.info-box-header h4 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); color: var(--text-muted); }

/* ── TIMELINE ── */
.timeline { position: relative; padding-left: 23px; margin-bottom: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 15px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--border-light); border: 2px solid var(--surface); }
.timeline-item.complete::before { background: var(--green); }
.timeline-item.active::before  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-date  { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.05em; margin-bottom: 2px; }
.tl-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.tl-body  { font-size: 12px; color: var(--text-muted); }

/* ── DATA TABLE ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--font-mono); margin-bottom: 18px; }
.data-table th { text-align: left; padding: 7px 11px; background: var(--surface2); color: var(--text-muted); font-weight: 500; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.07em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 6px 11px; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.val-highlight { color: var(--accent); font-weight: 500; }

/* ── PILLS ── */
.pill { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 10.5px; font-family: var(--font-mono); font-weight: 500; }
.pill-done    { background: var(--green-soft);  color: var(--green);  border: 1px solid #a8d4b8; }
.pill-active  { background: var(--accent-soft); color: var(--accent); border: 1px solid #b8ccf5; }
.pill-scrapped{ background: var(--rose-soft);   color: var(--rose);   border: 1px solid #e0a8b8; }

/* ── CALLOUTS ── */
.callout { border-left: 3px solid; padding: 11px 15px; border-radius: 0 7px 7px 0; margin-bottom: 16px; font-size: 13px; }
.callout-blue  { border-color: var(--accent); background: var(--accent-soft); color: var(--text-muted); }
.callout-green { border-color: var(--green);  background: var(--green-soft);  color: var(--text-muted); }
.callout-amber { border-color: var(--amber);  background: var(--amber-soft);  color: var(--text-muted); }
.callout strong { color: var(--text); }

/* ── EQ BOX ── */
.eq-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 11px 16px; font-family: var(--font-mono); font-size: 12px; color: var(--teal); margin-bottom: 14px; overflow-x: auto; }

/* ── STATS ── */
.stats-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; flex: 1; min-width: 110px; }
.stat-val { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 500; line-height: 1.1; margin-bottom: 3px; }
.stat-label { font-size: 10.5px; color: var(--text-muted); }

/* ── PROSE ── */
.prose { max-width: 680px; font-size: 14px; line-height: 1.75; color: var(--text-muted); margin-bottom: 18px; }
.prose strong { color: var(--text); font-weight: 500; }

/* ── GRID 2 ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

/* ── FLOW ── */
.flow { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.flow-node { background: var(--surface2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 11px; font-size: 11px; font-family: var(--font-mono); color: var(--text-muted); text-align: center; min-width: 84px; }
.flow-arrow { color: var(--text-faint); padding: 0 5px; font-size: 13px; }
.flow-node.active-node { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ── ANNOTATION ROWS ── */
.annotation-row { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.annotation-row:last-child { border-bottom: none; }
.ann-symbol { font-family: var(--font-mono); color: var(--teal); min-width: 68px; flex-shrink: 0; }
.ann-name   { color: var(--text); flex: 1; }
.ann-val    { font-family: var(--font-mono); color: var(--text-muted); font-size: 11px; flex-shrink: 0; }

/* ── DOI LINKS ── */
a.doi { font-family: var(--font-mono); font-size: 11px; color: var(--accent); text-decoration: none; }
a.doi:hover { text-decoration: underline; }

/* ── ORCiD LINKS ── */
a.orcid { font-family: var(--font-mono); font-size: 11px; color: var(--accent); text-decoration: none; }
a.orcid:hover { text-decoration: underline; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.footnote { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 4px; }

/* ── CHIPS ── */
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-family: var(--font-mono); font-weight: 500; border: 1px solid; }
.chip-blue   { color: var(--accent); border-color: #b8ccf5; background: var(--accent-soft); }
.chip-green  { color: var(--green);  border-color: #a8d4b8; background: var(--green-soft); }
.chip-amber  { color: var(--amber);  border-color: #e0c070; background: var(--amber-soft); }
.chip-teal   { color: var(--teal);   border-color: #90cccc; background: var(--teal-soft); }
.chip-purple { color: var(--purple); border-color: #bca8e8; background: var(--purple-soft); }
