/* ══════════════════════════════════════════════════════════
   Excitatory Brain — Design System
   Dark, clinical, data-forward
   ══════════════════════════════════════════════════════════ */

:root {
  --bg: #0a0a0f;
  --bg2: #0e0e14;
  --surface: rgba(255,255,255,0.03);
  --surface-hover: rgba(122,162,247,0.06);
  --card: #12121a;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(122,162,247,0.25);
  --text: #e8e8f4;
  --text2: rgba(232,232,244,0.55);
  --dim: rgba(232,232,244,0.3);
  --excitatory: #ff3366;
  --inhibitory: #00ff88;
  --modulatory: #4488ff;
  --stress: #ffaa00;
  --therapeutic: #73daca;
  --accent: #7aa2f7;
  --accent2: #bb9af7;
  --red: #f7768e;
  --green: #9ece6a;
  --glow-excitatory: rgba(255,51,102,0.12);
  --glow-inhibitory: rgba(0,255,136,0.12);
  --glow-modulatory: rgba(68,136,255,0.12);
}

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

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', -apple-system, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Typography ─────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 300; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.15; }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 500; margin-bottom: 0.6rem; color: var(--accent); }
h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }

p { margin-bottom: 1rem; color: var(--text2); }
strong { font-weight: 600; color: var(--text); }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #a9c2ff; }

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  background: rgba(255,255,255,0.05);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Navigation ─────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 2rem; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--excitatory);
  text-decoration: none;
}
.nav-links { display: flex; gap: 1.2rem; list-style: none; flex-wrap: wrap; }
.nav-links a {
  font-size: 0.72rem; font-weight: 400;
  color: var(--text2); text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--excitatory); }

/* ── Layout ─────────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 2rem;
}

.page-content {
  padding-top: 80px;
  padding-bottom: 80px;
}

/* ── Hero (index page) ──────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--excitatory);
  margin-bottom: 1.5rem;
}
.hero h1 strong {
  font-weight: 500;
  background: linear-gradient(140deg, #ffffff 20%, var(--excitatory) 60%, var(--stress));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  margin-top: 1.2rem;
  font-size: 0.95rem; color: var(--text2);
  max-width: 600px; line-height: 1.7;
}

/* ── Section Labels ─────────────────────────────── */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--accent);
  display: flex; align-items: center; gap: 1rem;
  margin: 3rem 0 1.5rem;
}
.section-label::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* ── Section Cards (index navigation) ───────────── */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.8rem;
  text-decoration: none; color: inherit;
  display: block;
  transition: background 0.25s, border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.section-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.section-card .num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; letter-spacing: 0.15em;
  color: var(--excitatory); margin-bottom: 0.5rem;
}
.section-card .title {
  font-weight: 600; font-size: 0.95rem;
  color: var(--text); margin-bottom: 0.4rem;
}
.section-card .desc {
  font-size: 0.8rem; color: var(--text2); line-height: 1.6;
}

/* ── Pathway Diagram ────────────────────────────── */
#pathway-container {
  width: 100%;
  min-height: 600px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}
#pathway-container svg {
  width: 100%; height: 100%;
}

.pathway-node {
  cursor: pointer;
  transition: filter 0.2s;
}
.pathway-node:hover { filter: brightness(1.3); }

.node-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  fill: var(--text);
  pointer-events: none;
}

/* ── Info Panel ─────────────────────────────────── */
.info-panel {
  position: fixed; top: 56px; right: 0;
  width: 340px; height: calc(100vh - 56px);
  background: var(--card);
  border-left: 1px solid var(--border);
  padding: 2rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  z-index: 90;
}
.info-panel.open { transform: translateX(0); }
.info-panel .close-btn {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none;
  color: var(--text2); font-size: 1.2rem;
  cursor: pointer;
}
.info-panel h3 { color: var(--text); font-size: 1.1rem; margin-bottom: 0.8rem; }
.info-panel .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; color: var(--text2);
  margin-bottom: 1rem;
}
.info-panel .receptor-list {
  list-style: none; margin-bottom: 1rem;
}
.info-panel .receptor-list li {
  font-size: 0.82rem; color: var(--text2);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.info-panel .source-link {
  display: inline-block; margin-top: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
}

/* ── Data Tables ────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin: 1.5rem 0;
}
.data-table th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
}
.data-table tr:hover td { background: var(--surface-hover); }
.data-table td:first-child { color: var(--text); font-weight: 500; }

/* ── Plot Containers ────────────────────────────── */
.plot-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
}
.plot-container .plot-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem; letter-spacing: 0.1em;
  color: var(--accent); margin-bottom: 1rem;
  text-transform: uppercase;
}
.plot-container .plot-source {
  font-size: 0.7rem; color: var(--dim);
  margin-top: 0.8rem; font-style: italic;
}

/* ── Cascade Steps ──────────────────────────────── */
.cascade {
  position: relative;
  padding-left: 2rem;
  margin: 2rem 0;
}
.cascade::before {
  content: '';
  position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--excitatory), var(--stress), var(--inhibitory));
}
.cascade-step {
  position: relative;
  padding: 1rem 0 1rem 1.5rem;
}
.cascade-step::before {
  content: '';
  position: absolute; left: -2rem; top: 1.4rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--excitatory);
  border: 2px solid var(--bg);
}
.cascade-step .step-region {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; color: var(--dim);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.cascade-step .step-label {
  font-weight: 500; color: var(--text);
  font-size: 0.9rem;
}
.cascade-step .step-detail {
  font-size: 0.8rem; color: var(--text2);
  margin-top: 0.3rem;
}

/* ── Compound Badge ─────────────────────────────── */
.compound-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 2px;
  text-decoration: none;
  color: var(--text2);
  transition: border-color 0.2s, background 0.2s;
}
.compound-badge:hover {
  border-color: var(--border-hover);
  background: var(--surface-hover);
}
.compound-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* ── Content Sections ───────────────────────────── */
.content-section {
  margin: 3rem 0;
}
.content-section p {
  max-width: 720px;
}

/* ── Callout Boxes ──────────────────────────────── */
.callout {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: 0 8px 8px 0;
}
.callout.warning { border-left-color: var(--stress); }
.callout.danger { border-left-color: var(--excitatory); }
.callout.success { border-left-color: var(--inhibitory); }

.callout p { margin-bottom: 0.5rem; }
.callout p:last-child { margin-bottom: 0; }

/* ── Chemical Legend ────────────────────────────── */
.legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: var(--surface);
  border-radius: 8px;
}
.legend-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.75rem; color: var(--text2);
}
.legend-item .swatch {
  width: 12px; height: 12px;
  border-radius: 3px;
}

/* ── Footer ─────────────────────────────────────── */
footer {
  text-align: center; padding: 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; color: var(--dim);
  border-top: 1px solid var(--border);
}
footer a { color: var(--text2); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* ── Print ──────────────────────────────────────── */
@media print {
  .nav, .info-panel { display: none; }
  body { background: white; color: #111; }
  .page-content { padding-top: 0; }
  .plot-container, .section-card { break-inside: avoid; }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .section-grid { grid-template-columns: 1fr; }
  .container { padding: 0 1.2rem; }
  .info-panel { width: 100%; }
  .data-table { font-size: 0.72rem; }
  .data-table th, .data-table td { padding: 0.5rem 0.6rem; }
}
