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

:root {
  --text:        #d0e4f8;
  --text-muted:  #7a9ab8;
  --bg:          #0d1117;
  --bg-code:     #121a24;
  --accent:      #4a90d8;
  --accent-light:#12202e;
  --border:      #2a3a4a;
  --tag-bg:      #162435;
  --tag-text:    #9ab8d8;
  --max-width:   1100px;
  --font-body:   Georgia, 'Times New Roman', serif;
  --font-mono:   'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 18px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

/* ─── Layout ───────────────────────────────────────────────────────────── */
main, footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

/* ─── Site Nav ─────────────────────────────────────────────────────────── */
.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.nav-brand {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--accent); text-decoration: none; }

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

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.active { color: var(--accent); font-weight: 600; }

/* ─── Tags ─────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  border-radius: 3px;
  margin-right: 0.4rem;
}

/* ─── Article ──────────────────────────────────────────────────────────── */
article {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.article-meta { margin-bottom: 1rem; }

h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  font-weight: 700;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 2rem;
}

/* ─── Sections & Headings ──────────────────────────────────────────────── */
section { margin-top: 2.5rem; }

h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--accent-light);
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

p { margin-top: 0.9rem; }

/* ─── Links ────────────────────────────────────────────────────────────── */
a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* ─── Code ─────────────────────────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-code);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-top: 1rem;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* ─── Figures ──────────────────────────────────────────────────────────── */
figure {
  margin: 1.5rem 0;
  text-align: center;
}

figure img,
figure video {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

figcaption {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ─── Tables ───────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin-top: 1rem;
}

th {
  background: var(--accent-light);
  border-bottom: 2px solid var(--accent);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }

/* ─── Blockquote ───────────────────────────────────────────────────────── */
blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  background: var(--accent-light);
  border-radius: 0 4px 4px 0;
}

/* ─── Math (MathJax) ───────────────────────────────────────────────────── */
.MJX-TEX { font-size: 1rem; }

/* ─── Landing Page — Hero ───────────────────────────────────────────────── */
.hero {
  padding: 3.5rem 1.5rem 2.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.hero-tags { margin-bottom: 1.25rem; }

.hero h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero .subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
}

.btn {
  display: inline-block;
  padding: 0.55em 1.3em;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-ui);
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.8; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { border: 1.5px solid var(--accent); color: var(--accent); }

/* ─── Landing Page — Feature Grid ──────────────────────────────────────── */
.features {
  max-width: var(--max-width);
  margin: 2rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--accent-light);
  border-radius: 6px;
  padding: 1.25rem;
  font-family: var(--font-ui);
}

.feature-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.feature-card p {
  font-size: 0.88rem;
  color: var(--text);
  margin: 0;
  line-height: 1.5;
}

/* ─── Landing Page — Callout ────────────────────────────────────────────── */
.callout {
  max-width: var(--max-width);
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}

.callout-box {
  border-left: 4px solid var(--accent);
  background: var(--accent-light);
  padding: 1.25rem 1.5rem;
  border-radius: 0 6px 6px 0;
}

.callout-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.callout-box p {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

/* ─── Landing Page — Visual Sections ───────────────────────────────────── */
.visual-section {
  max-width: var(--max-width);
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
}

.visual-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--accent-light);
  font-family: var(--font-body);
}

.visual-section p { margin-top: 0.75rem; }

/* ─── Report Placeholder ────────────────────────────────────────────────── */
.report-placeholder {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 2rem 0;
  color: var(--text-muted);
}

.report-placeholder h3 {
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.report-placeholder p { margin-top: 0.5rem; }
.report-placeholder code { font-size: 0.82rem; }

.report-placeholder ul {
  margin: 0.5rem 0 0 1.25rem;
  line-height: 1.8;
}

/* ─── Wide figure scroll container (tech tree, large diagrams) ─────────── */
.figure-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--accent-light);
}

.figure-scroll figure {
  margin: 0;
  min-width: 900px;
}

.figure-scroll figure img {
  max-width: none;
  width: 1800px;
  border: none;
  border-radius: 0;
  display: block;
}

.figure-scroll figcaption {
  padding: 0.5rem 1rem;
  min-width: 1800px;
}

/* ─── Mermaid diagrams ─────────────────────────────────────────────────── */
pre.mermaid {
  background: transparent;
  border: none;
  border-left: none;
  padding: 0.5rem 0;
  margin: 1.5rem 0;
  overflow-x: auto;
  text-align: center;
}

/* ─── Editorial / SUG annotation notes ─────────────────────────────────── */
.editorial-note {
  background: #1a1200;
  border-left: 3px solid #ca8a04;
  border-radius: 0 4px 4px 0;
  padding: 0.65rem 1rem;
  margin: 1rem 0;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: #d4a800;
  font-style: italic;
}

/* ─── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  html { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .hero h1 { font-size: 1.8rem; }
  .features { grid-template-columns: 1fr; }
  .nav-links { gap: 1rem; }
}
