/* Nerdy-but-readable: dark default, monospace UI chrome, readable content.
   Lightweight (no frameworks) for fast Core Web Vitals + ad viewability. */

:root,
[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #11161f;
  --surface-2: #161c27;
  --text: #d7dde7;
  --muted: #8a93a3;
  --accent: #6cf2c9;       /* terminal mint */
  --accent-ink: #04261d;
  --border: #1d2531;
  --link: #8ab4f8;
}

[data-theme="light"] {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1f29;
  --muted: #5a6472;
  --accent: #0a7f5f;
  --accent-ink: #ffffff;
  --border: #e3e7ee;
  --link: #1a5fd0;
}

* { box-sizing: border-box; }

html { color-scheme: dark light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono,
.kicker,
.wordmark,
.nav,
.card .source,
.fineprint .mono {
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

a { color: var(--link); }

/* ---- header ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}
.wordmark .prompt { color: var(--accent); }
.wordmark .cursor { color: var(--muted); animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.toggle {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px; height: 32px;
  cursor: pointer;
  font-size: 0.95rem;
}
.toggle:hover { border-color: var(--accent); }

/* ---- hero ---- */
.hero {
  max-width: 720px;            /* same column as the story list so they align */
  margin: 0 auto;
  padding: 3rem 1.25rem 1.5rem;
}
.kicker { color: var(--accent); font-size: 0.8rem; margin: 0 0 0.75rem; }
.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.lede { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }
.lede em { color: var(--text); font-style: normal; border-bottom: 1px dashed var(--accent); }

/* ---- grid ---- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 600px); /* narrower cards... */
  justify-content: start;                  /* ...left-aligned with the hero text */
  gap: 1.5rem;
  max-width: 720px;                        /* same column as hero → left edges align */
  margin: 1rem auto 0;
  padding: 1rem 1.25rem 2rem;
}
.status { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 2rem 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }

.card video {
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  object-fit: cover;
  display: block;
}

.card .meta { padding: 0.75rem 0.85rem 0.9rem; }
.card .title { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.card .title a { color: var(--text); text-decoration: none; }
.card .title a:hover { color: var(--accent); }
.card .source {
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Story cards on the homepage feed (picture + summary + research link) */
.story-card { text-decoration: none; color: inherit; }
.card-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.ctx-download {
  display: inline-block;
  margin: 0 1.15rem 1.1rem;
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 0.74rem;
  color: var(--muted);
  text-decoration: none;
}
.ctx-download:hover { color: var(--accent); }
.article .attribution {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.7rem 1rem;
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.article .attribution strong { color: var(--text); }
.article .download { font-size: 0.85rem; margin: -0.5rem 0 1.5rem; }
.article .download a { color: var(--accent); text-decoration: none; }
.story-card .card-img,
.story-card .card-anim {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}
.story-card .meta { padding: 1rem 1.15rem 1.25rem; }
.story-card .title { margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.story-card .summary { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.8rem; }
.story-card .readmore {
  color: var(--accent);
  font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  font-size: 0.78rem;
}

/* Research (wiki) page */
.article .hero-img,
.article .hero-anim {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
  display: block;
  margin: 0 0 1.5rem;
}
#related { margin-top: 2.5rem; border-top: 1px solid var(--border); padding-top: 1.2rem; }
#related h2 { font-size: 1.1rem; }
#related ul { padding-left: 1.2rem; }
#related a { color: var(--link); }

/* Reserve ad space to avoid layout shift (CLS hurts viewability + SEO) */
.ad-card { min-height: 320px; display: flex; align-items: center; justify-content: center; }
.ad-card ins { width: 100%; }

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 2rem 1rem 3rem;
  color: var(--muted);
}
.site-footer .nav { justify-content: center; }
.fineprint { font-size: 0.78rem; margin-top: 0.6rem; }

/* ---- home: the daily digest ---- */
.digest-home { max-width: 760px; }
.digest-home .kicker { margin-bottom: 1rem; }
.digest-hero-img {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
  display: block;
  margin: 0 0 1.5rem;
}
.digest-body { line-height: 1.7; }
.digest-body h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -0.02em; margin: 0 0 1rem; }
.digest-body h2 { margin-top: 1.8rem; font-size: 1.25rem; }
.digest-body a { color: var(--link); }
.archive { margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 1.2rem; }
.archive-title { font-size: 1.05rem; }
.archive-list { list-style: none; padding: 0; }
.archive-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.archive-list a { color: var(--text); text-decoration: none; }
.archive-list a:hover { color: var(--accent); }
.archive-date { color: var(--muted); font-size: 0.8rem; font-family: ui-monospace, Menlo, monospace; }

/* tighter header on small screens so the wordmark + 2 links + toggle fit one row */
@media (max-width: 480px) {
  .site-header { padding: 0.8rem 0.9rem; gap: 0.5rem; }
  .nav { gap: 0.7rem; font-size: 0.8rem; }
}

/* ---- article / privacy pages (.prose) ---- */
.prose { max-width: 720px; margin: 0 auto; padding: 1.5rem 1.25rem; line-height: 1.65; }
.prose h1 { letter-spacing: -0.02em; }
.prose h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.prose a { color: var(--link); }
.prose ul { padding-left: 1.2rem; }
