/* Metagra — static digest site. No frameworks; readable first.
   Light is the default palette; [data-theme="dark"] on <html> overrides it.
   Both are applied pre-paint by the inline script in base.html. */

:root {
  --ink: #1c2330;
  --muted: #5b6678;
  --paper: #f7f8fa;
  --card: #ffffff;
  --line: #dde3ec;
  --accent: #4e7cff;
  --accent-ink: #2c54c4;
  --tag-bg: #e8eefc;
  --shadow: 0 1px 2px rgba(20, 30, 50, 0.05), 0 4px 14px rgba(20, 30, 50, 0.05);
  --header: #1c2330;
  --header-ink: #ffffff;
  --header-nav: #c9d4e8;
}

html[data-theme="dark"] {
  --ink: #e6ebf5;
  --muted: #9aa7bd;
  --paper: #11151c;
  --card: #1a2029;
  --line: #2a323f;
  --accent: #6d93ff;
  --accent-ink: #9db8ff;
  --tag-bg: #243049;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.35);
  --header: #0c0f15;
  --header-ink: #ffffff;
  --header-nav: #aebbd4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--header);
}

.site-header .brand {
  color: var(--header-ink);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.site-header nav { flex: 1; }

.site-header nav a {
  color: var(--header-nav);
  text-decoration: none;
  margin-right: 1.1rem;
}

.site-header nav a:hover { color: #fff; text-decoration: underline; }

.theme-toggle {
  background: transparent;
  color: var(--header-nav);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

main {
  max-width: 58rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 { font-size: 1.9rem; line-height: 1.25; margin: 0.4rem 0 0.6rem; }
h2 { font-size: 1.25rem; margin: 1.8rem 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; line-height: 1.35; }

a { color: var(--accent-ink); }

.edition-line { color: var(--muted); margin: 0; font-size: 0.9rem; }

.summary { font-size: 1.08rem; color: var(--ink); }

.prose p { margin: 0.4rem 0 0; }

.viz .chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  max-height: 24rem;
  box-shadow: var(--shadow);
}

pre.mermaid {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  overflow-x: auto;
}

ol.findings {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

li.finding {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
  transition: background 0.2s ease, border-color 0.2s ease;
}

li.finding p { margin: 0.35rem 0; }

.headline-link {
  color: var(--ink);
  text-decoration: none;
}

.headline-link:hover { color: var(--accent-ink); text-decoration: underline; }

/* TL;DR feed: punchy takeaway + a concept diagram that explains the article. */
.finding .tldr {
  font-size: 1.06rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0.2rem 0 0.7rem;
}

figure.concept {
  margin: 0.7rem 0 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 0.6rem 0.5rem;
}

figure.concept pre.mermaid {
  display: flex;
  justify-content: center;
}

figure.concept figcaption {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  text-align: center;
  margin-top: 0.4rem;
}

.meta-pointer {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1.4rem;
}

.rank {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 0 0.45rem;
  margin-right: 0.35rem;
  font-size: 0.9rem;
}

.kind {
  display: inline-block;
  margin-left: 0.4rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  margin: 0 0.3rem 0.25rem 0;
  font-size: 0.8rem;
}

.tag.latest { background: #def3e6; color: #1d7a45; }
html[data-theme="dark"] .tag.latest { background: #14361f; color: #5fd391; }

.tag.fallback { background: #fdeccd; color: #8a5a12; }
html[data-theme="dark"] .tag.fallback { background: #3a2c10; color: #e0b167; }

.sources { color: var(--muted); font-size: 0.9rem; }
.sources-label { font-weight: 600; }

ul.archive { list-style: none; padding: 0; }

ul.archive li {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line);
}

ul.archive .archive-title { flex: 1; }

.meta { color: var(--muted); font-size: 0.85rem; }

.empty {
  background: #fff8e6;
  border: 1px solid #eadfb5;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: #6b5b1e;
}

html[data-theme="dark"] .empty {
  background: #2a2410;
  border-color: #4a3f15;
  color: #d8c98a;
}

.site-footer {
  max-width: 58rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
