:root {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #2d5a8e;
  --border: #e2e2de;
  --max-width: 1000px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', Georgia, serif;
  font-size: 18px;
  line-height: 1.8;
  padding: 0 1.5rem;
}

/* ── Nav ── */
nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 0 1rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
}

nav a {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

nav a:first-child {
  color: var(--text);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  margin-right: auto;
  font-weight: 600;
}

nav a:hover { color: var(--accent); }

/* ── Post list (index) ── */
.post-list h1 {
  max-width: var(--max-width);
  margin: 0 auto 2.5rem;
  font-family: 'Lora', serif;
  font-size: 1.6rem;
  font-weight: 600;
}

.post-item {
  max-width: var(--max-width);
  margin: 0 auto 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child { border-bottom: none; }

.post-item-meta {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.post-item a {
  font-family: 'Lora', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.post-item a:hover { color: var(--accent); }

.post-item p {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.4rem;
  margin-bottom: 0;
}

/* ── Article ── */
article {
  max-width: var(--max-width);
  margin: 0 auto;
  padding-bottom: 3rem;
}

.post-meta {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
  letter-spacing: 0.02em;
}

h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.subtitle {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

p { margin-bottom: 1.4rem; }

h2 {
  font-family: 'Lora', serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 2.8rem;
  margin-bottom: 0.8rem;
}

h3 {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-top: 3rem;
  margin-bottom: 0.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration: none; }

/* ── Lists ── */
article ul,
article ol {
  margin: 0 0 1.4rem 0;
  padding-left: 1.75rem;
}

article li {
  margin-bottom: 0.7rem;
  line-height: 1.75;
}

article li:last-child { margin-bottom: 0; }

article li > p { margin-bottom: 0; }

/* Tighten gap when a list immediately follows a heading */
article h2 + ul, article h2 + ol,
article h3 + ul, article h3 + ol {
  margin-top: 0.5rem;
}

/* ── Callout ── */
.callout {
  background: #f0f4f9;
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 2rem 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #2a2a2a;
}

.callout-title {
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.callout p {
  margin-bottom: 0.4rem;
}

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

/* ── Code ── */
code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: #efefec;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.25rem 1.5rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

pre.bibtex {
  background: #f5f5f2;
  color: var(--text);
  border: 1px solid var(--border);
}

pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* ── Figure ── */
figure {
  margin: 2rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--border);
}

figcaption {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.6rem;
  font-style: italic;
}

/* ── References ── */
.references-section {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.references-section h2 {
  margin-top: 0;
}

/* ── Interactive viz (wider than article) ── */
.viz-section {
  max-width: 1200px;
  margin: 3rem auto;
}

.viz-section h2 {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

.viz-section > p {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.viz-toolbar {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.viz-btn {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.viz-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

.viz-frame-wrapper {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 1rem;
}

.viz-frame-wrapper iframe {
  display: block;
  width: 100%;
  height: 850px;
  border: none;
}

/* ── Misc ── */
.closing-note {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ── Footer ── */
footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  body { font-size: 17px; }
  .viz-frame-wrapper iframe { height: 600px; }
}

/* ── Snapshot reading guide ── */
.snapshot-guide {
  background: #f0f4f9;
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #2a2a2a;
}

.snapshot-guide ul {
  margin: 0.4rem 0 0.5rem 0;
  padding-left: 1.25rem;
}

.snapshot-guide li {
  margin-bottom: 0.2rem;
  line-height: 1.5;
}

.snapshot-guide-title {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ── Snapshot iframe ── */
.snapshot {
  margin: 1.5rem 0;
  text-align: left;
}

.snapshot-frame {
  display: block;
  width: 100%;
  height: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* Layer transition labels in Results section */
.layer-label {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  margin: 2.5rem 0 0.5rem;
  border-top: 1px solid #eee;
  padding-top: 1.25rem;
}
