/* ---------- tokens ---------- */
:root {
  --paper: #eef1f4;
  --surface: #f8fafb;
  --ink: #16202b;
  --muted: #56626f;
  --rule: #cbd3dc;
  --reported: #2f5d8a;
  --inference: #a8651a;
  --focus: #2f5d8a;

  --serif: "Newsreader", "Iowan Old Style", "Charter", Georgia, serif;
  --sans: "Public Sans", "Segoe UI", system-ui, sans-serif;

  --measure: 68ch;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.125rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121820;
    --surface: #18202a;
    --ink: #e3e8ee;
    --muted: #93a0ad;
    --rule: #2a3440;
    --reported: #7fa7d1;
    --inference: #e0a458;
    --focus: #7fa7d1;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--reported); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.site-name {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.kinds { display: flex; gap: 0.25rem; }

.kinds button {
  font: inherit;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
}

.kinds button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.date-pick { margin-left: auto; }

.date-pick select {
  font: inherit;
  font-size: var(--step--1);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.35rem 0.5rem;
}

/* ---------- page ---------- */
.page {
  max-width: calc(var(--measure) + 3rem);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.status { color: var(--muted); }

.digest-head h1 {
  margin: 0;
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.digest-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: var(--step--1);
}

.overview {
  font-family: var(--serif);
  font-size: var(--step-2);
  line-height: 1.45;
  margin: 1.5rem 0 3rem;
  max-width: 60ch;
}

h2 {
  font-size: var(--step-1);
  margin: 0 0 1rem;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}

/* ---------- events ---------- */
.points { list-style: none; margin: 0 0 3rem; padding: 0; }

.point { padding: 1.25rem 0; border-bottom: 1px solid var(--rule); }
.point:last-child { border-bottom: 0; }

.point-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
}

.point-title {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.3;
}

.category {
  font-size: var(--step--1);
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0 0.6rem;
}

.what {
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  margin: 0.5rem 0;
}

.framing {
  margin: 0.75rem 0;
  padding-left: 0.85rem;
  border-left: 3px solid var(--rule);
  color: var(--muted);
  font-size: var(--step--1);
}
.framing-label { font-weight: 600; color: var(--ink); }

.headlines summary {
  cursor: pointer;
  font-size: var(--step--1);
  color: var(--muted);
  padding: 0.25rem 0;
}
.headlines summary:hover { color: var(--ink); }

.headlines ul {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: var(--step--1);
}

.headlines li {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.75rem;
  padding: 0.35rem 0;
}

.hl-source { color: var(--muted); overflow-wrap: anywhere; }

/* ---------- connections ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-size: var(--step--1);
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.legend-item::before {
  content: "";
  display: inline-block;
  width: 2rem;
  vertical-align: middle;
  margin-right: 0.5rem;
  border-top: 2px solid var(--reported);
}
.legend-item.inference::before { border-top: 2px dashed var(--inference); }

.connections { list-style: none; margin: 0; padding: 0; }

.connection { padding: 0.9rem 0; }

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-weight: 600;
  font-size: var(--step--1);
}

.pair .node:last-child { text-align: left; }

.wire {
  height: 0;
  border-top: 2px solid var(--reported);
  position: relative;
}
.wire::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -6px;
  border: 5px solid transparent;
  border-left: 7px solid var(--reported);
  border-right: 0;
}

.connection.inference .wire { border-top-style: dashed; border-top-color: var(--inference); }
.connection.inference .wire::after { border-left-color: var(--inference); }

.relation {
  margin: 0.35rem 0 0;
  font-family: var(--serif);
  line-height: 1.55;
}

.warn {
  font-family: var(--sans);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--inference);
}

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .date-pick { margin-left: 0; width: 100%; }
  .date-pick select { width: 100%; }
  .overview { font-size: var(--step-1); }
  .headlines li { grid-template-columns: 1fr; gap: 0.1rem; }
  .pair { grid-template-columns: 1fr; }
  .wire { width: 2rem; transform: rotate(90deg); margin: 0.6rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
