:root {
  --bg: #fbfaf7;
  --text: #1c1b19;
  --muted: #5f5b53;
  --rule: #ddd8cc;
  --accent: #8a1c1c;
  --panel: #f2efe7;
  --draft: #8a5a00;
  --draft-bg: #fdf3dc;
  --sans: -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* Dark: the system setting, unless the reader picked a theme with the ◐ button (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161513;
    --text: #ece8de;
    --muted: #a39d90;
    --rule: #34312b;
    --accent: #e07a6a;
    --panel: #201e1b;
    --draft: #f0c060;
    --draft-bg: #2c2412;
  }
}
:root[data-theme="dark"] {
  --bg: #161513;
  --text: #ece8de;
  --muted: #a39d90;
  --rule: #34312b;
  --accent: #e07a6a;
  --panel: #201e1b;
  --draft: #f0c060;
  --draft-bg: #2c2412;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.65 Georgia, "Times New Roman", serif;
}

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

.masthead, main, footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}
main.wide, .masthead, footer { max-width: 1400px; padding: 0 32px; }

/* Masthead */
.preview-bar {
  background: var(--draft-bg);
  color: var(--draft);
  font: 600 13px/1.4 var(--sans);
  text-align: center;
  padding: 6px 16px;
  border-bottom: 1px solid var(--draft);
}
.masthead {
  position: relative;
  text-align: center;
  padding-top: 24px;
  padding-bottom: 0;
}
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.masthead-date, .tagline {
  margin: 0;
  font: 13px/1.4 var(--sans);
  color: var(--muted);
}
.brand {
  display: inline-block;
  margin: 6px 0 4px;
  color: var(--text);
  font-size: 52px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
  text-decoration: none;
}
.masthead nav {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--text);
  border-bottom: 3px double var(--text);
}
nav a {
  font: 600 13px/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  text-decoration: none;
}
nav a:hover { color: var(--accent); }

/* Shared labels */
.kicker, .section-title, .credits h2, .sources h2, .draft-panel h2 {
  font: 700 12px/1.4 var(--sans);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.kicker { color: var(--accent); margin: 0 0 6px; }
.section-title {
  color: var(--muted);
  margin: 40px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.story-meta, .byline, .source-host, .source-articles, footer, .tags {
  font-family: var(--sans);
  font-size: 13px;
}
.story-meta { margin: 0; color: var(--muted); }
.story-meta a { color: var(--muted); }
.multi {
  color: var(--accent);
  font-weight: 700;
}
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--draft-bg);
  color: var(--draft);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Front page */
.story-headline { color: var(--text); text-decoration: none; }
.story-headline:hover { color: var(--accent); }
.story-dek { margin: 8px 0 10px; color: var(--muted); }

.lead {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 0 32px;
  text-align: center;
}
.lead h1 { margin: 0; font-size: 44px; line-height: 1.12; letter-spacing: -0.5px; }
.lead .story-dek { font-size: 21px; }

.region { scroll-margin-top: 16px; }
.region-title {
  margin: 48px 0 0;
  padding: 8px 0 6px;
  border-top: 3px solid var(--text);
  border-bottom: 1px solid var(--rule);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 32px;
}
.card { padding: 20px 0; border-bottom: 1px solid var(--rule); }
.card h3 { margin: 0; font-size: 22px; line-height: 1.25; }
.card-top { grid-column: span 2; }
.card-top h3 { font-size: 30px; }
.card-top .story-dek { font-size: 18px; }
.kicker a { color: inherit; text-decoration: none; }
.card .story-dek { font-size: 16px; line-height: 1.5; }

.source-strip ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 16px 0 0;
  margin: 0;
  font: 15px/1.4 var(--sans);
}
.source-strip a { color: var(--text); text-decoration: none; }
.source-strip a:hover { color: var(--accent); }

/* Article page */
.headline { font-size: 40px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.5px; }
article > .kicker { margin-top: 40px; }
.dek { font-size: 21px; color: var(--muted); margin: 0 0 12px; }
.byline { color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 16px; }
.byline a { color: var(--muted); }

.pull-quote {
  margin: 32px 0;
  padding: 8px 0 8px 24px;
  border-left: 3px solid var(--accent);
  font-size: 22px;
  font-style: italic;
}
.pull-quote p { margin: 0; }
.pull-quote cite { display: block; margin-top: 8px; font-size: 15px; color: var(--muted); }

.credits, .sources, .draft-panel {
  margin: 32px 0;
  padding: 16px 24px;
  background: var(--panel);
  border-radius: 6px;
  font-size: 16px;
}
.credits h2, .sources h2 { color: var(--muted); margin: 0 0 8px; }
.sources ul { margin: 0; padding-left: 20px; }

.draft-panel {
  background: var(--draft-bg);
  border: 1px solid var(--draft);
  font: 14px/1.5 var(--sans);
}
.draft-panel h2 { color: var(--draft); margin: 0 0 8px; }
.draft-panel ul { padding-left: 20px; margin: 8px 0; }
.draft-panel li { margin: 4px 0; }
.draft-panel li.flag-hold strong { color: var(--accent); }
.gate { margin: 8px 0 0; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.review-actions button {
  font: 600 14px/1 var(--sans);
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--draft);
  background: transparent;
  color: var(--draft);
  cursor: pointer;
}
.review-actions .btn-approve { background: var(--draft); border-color: var(--draft); color: var(--bg); }
.review-actions button:disabled { opacity: 0.5; cursor: wait; }
.review-status { color: var(--text); }
.rework-note { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--draft); background: var(--bg); }

/* Reject dialog */
.reject-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.reject-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.reject-dialog h2 { margin: 0 0 16px; font: 700 18px/1.3 var(--sans); }
.reject-options { display: grid; gap: 8px; }
.btn-option {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  font: 15px/1.4 var(--sans);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: pointer;
}
.btn-option:hover, .btn-option:focus-visible { border-color: var(--draft); }
.btn-option span { color: var(--muted); font-size: 13px; }
.btn-discard strong { color: var(--accent); }
.reject-note { display: grid; gap: 6px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.reject-note textarea {
  width: 100%;
  padding: 8px 10px;
  font: 15px/1.4 var(--sans);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  resize: vertical;
}
.reject-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.btn-cancel {
  padding: 8px 14px;
  font: 600 14px/1 var(--sans);
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}

/* Undo toast (bottom left, like Gmail) */
.toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px 14px;
  overflow: hidden;
  border-radius: 8px;
  background: #1c1b19;  /* fixed dark toast in both themes */
  color: #f5f2ea;
  font: 14px/1.4 var(--sans);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}
.toast[hidden] { display: none; }
.toast-error { background: #8a1c1c; }
.toast-undo {
  padding: 4px 8px;
  font: 700 14px/1 var(--sans);
  color: #f0c060;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.toast-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: #f0c060;
  transform-origin: left;
}
@keyframes toast-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 24px 0; padding: 0; list-style: none; font: 14px/1.4 var(--sans); }
.tags a { display: inline-block; padding: 3px 10px; border: 1px solid var(--rule); border-radius: 12px; color: var(--muted); text-decoration: none; }
.tags a:hover { color: var(--accent); border-color: var(--accent); }
.tags a span { color: var(--muted); opacity: 0.7; font-size: 12px; }

/* Sources page */
.source-list { list-style: none; padding: 0; }
.source-list li { padding: 20px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.source-list h2 { margin: 0; font-size: 24px; }
.source-list h2 a { color: var(--text); text-decoration: none; }
.source-host { margin: 4px 0; color: var(--muted); }
.source-articles { color: var(--muted); }

.empty, .intro { color: var(--muted); }

footer {
  margin-top: 56px;
  padding-top: 16px;
  padding-bottom: 48px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
}

/* Front page: sections on the left, sidebar on the right */
.front {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 0 40px;
  align-items: start;
}
.sidebar {
  position: sticky;
  top: 24px;
  margin-top: 48px;
  padding-left: 24px;
  border-left: 1px solid var(--rule);
  font-family: var(--sans);
}
.sidebar .section-title { margin: 0 0 4px; }
.side-block + .side-block { margin-top: 28px; }
.side-list { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.35; }
.side-list li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.side-list a { color: var(--text); text-decoration: none; font-weight: 600; }
.side-list a:hover { color: var(--accent); }
.sidebar .tags { margin: 10px 0 0; font-size: 13px; }
.side-note { margin: 28px 0 0; font-size: 13px; color: var(--muted); }
.side-note a { text-decoration: none; font-weight: 600; }

/* Article page: reading progress and related stories */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; pointer-events: none; }
.read-progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.related { margin-top: 24px; }
.related-grid { grid-template-columns: repeat(2, 1fr); }
.related .card h3 { font-size: 19px; }

/* Dossier: a tag with enough articles, shown as a timeline (newest first) */
.timeline { list-style: none; margin: 24px 0 0; padding: 0; max-width: 760px; }
.tl-item { position: relative; padding: 0 0 28px 32px; border-left: 2px solid var(--rule); }
.tl-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 10px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rule);
  border: 2px solid var(--bg);
}
.tl-day::before { background: var(--accent); top: 6px; }
.tl-item:last-child { border-left-color: transparent; }
.tl-date { margin: 0 0 10px; font: 700 12px/1.4 var(--sans); text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); }
.tl-body h3 { margin: 0; font-size: 24px; line-height: 1.25; }
.tl-body .story-dek { font-size: 17px; line-height: 1.5; }
.dossier-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.dossier {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--sans);
}
.dossier:hover { border-color: var(--accent); }
.dossier-name { font-size: 20px; font-weight: 700; font-family: Georgia, "Times New Roman", serif; }
.dossier:hover .dossier-name { color: var(--accent); }
.dossier-count { font-size: 13px; color: var(--muted); }
.dossier-latest { font-size: 14px; line-height: 1.4; margin-top: 6px; }

/* Themen page */
.viz { margin-bottom: 24px; }
.viz-frame { margin-top: 16px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); overflow: hidden; }
.viz-frame svg { display: block; width: 100%; height: auto; font: 11px/1.2 var(--sans); }
.viz-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; align-items: start; }
.viz-columns > section { min-width: 0; } /* let the heat table scroll inside its column instead of widening the page */
.chord-frame { max-width: 640px; }
.viz-panel { margin-top: 16px; }
.viz-panel .section-title { margin-top: 24px; }
.viz-panel .section-title a { font-weight: 600; text-transform: none; letter-spacing: 0; margin-left: 8px; text-decoration: none; }
.heat-wrap { margin-top: 16px; overflow-x: auto; }
.heat { border-collapse: separate; border-spacing: 3px; font: 13px/1.3 var(--sans); }
.heat th { font-weight: 600; text-align: left; white-space: nowrap; }
.heat-row { padding-right: 8px; }
.heat-row a, .heat-col a { color: var(--text); text-decoration: none; }
.heat-row a:hover, .heat-col a:hover { color: var(--accent); }
.heat-col { height: 120px; vertical-align: bottom; padding: 0; }
.heat-col div { transform: rotate(-60deg); transform-origin: left bottom; width: 26px; white-space: nowrap; }
.heat td { width: 30px; height: 28px; padding: 0; background: var(--panel); border-radius: 3px; }
.heat td button { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 3px; font: 600 12px/1 var(--sans); color: var(--text); cursor: pointer; }
.heat td button:hover { outline: 2px solid var(--text); }
.chord-label { fill: var(--text); font-size: 12px; }
.ribbons path { fill-opacity: 0.7; stroke: var(--bg); stroke-width: 0.5px; cursor: pointer; transition: fill-opacity 0.2s; }
.ribbons path.dim { fill-opacity: 0.08; }
#chord-caption { min-height: 1.6em; text-align: center; font: 15px/1.6 var(--sans); }

@media (max-width: 1100px) {
  .front .story-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  main.wide, .masthead, footer { padding: 0 16px; }
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .masthead nav { flex-wrap: wrap; gap: 8px 20px; }
  .front { grid-template-columns: 1fr; }
  .sidebar { position: static; margin-top: 32px; padding: 24px 0 0; border-left: 0; border-top: 3px solid var(--text); }
  .dossier-grid { grid-template-columns: repeat(2, 1fr); }
  .viz-columns { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .brand { font-size: 30px; }
  .masthead nav { gap: 16px; }
  .lead { text-align: left; padding-top: 28px; }
  .lead h1 { font-size: 32px; }
  .story-grid, .front .story-grid, .related-grid { grid-template-columns: 1fr; }
  main.wide, .masthead, footer { padding: 0 16px; }
  .card-top { grid-column: auto; }
  .theme-toggle { top: 20px; right: 12px; width: 26px; height: 26px; font-size: 15px; } /* sits beside the date line, clear of the brand */
  .dossier-grid { grid-template-columns: 1fr; }
  .tl-body h3 { font-size: 21px; }
  .card-top h3 { font-size: 24px; }
  .headline { font-size: 30px; }
}

/* Feeds page */
.feed-list { list-style: none; padding: 0; }
.feed-list li { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.feed-list h2 { margin: 0; font-size: 24px; }
.feed-list h2 a { color: var(--text); text-decoration: none; }
.feed-url { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 0; font: 14px/1.4 var(--sans); }
.feed-url code { overflow-wrap: anywhere; color: var(--muted); }
.copy-feed {
  padding: 6px 10px;
  font: 600 13px/1 var(--sans);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
}

/* Review preview: released articles, collapsed */
.released { margin: 40px 0 0; font: 15px/1.5 var(--sans); }
.released summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.released ul { padding-left: 20px; }
.released li { margin: 6px 0; }

/* Front page: link to the full section */
.region-title a { color: inherit; text-decoration: none; }
.more { margin: 12px 0 0; font: 600 15px/1.4 var(--sans); }
.more a { text-decoration: none; }
h1.region-title { margin-top: 8px; }

/* Search */
.search-form input {
  width: 100%;
  padding: 12px 14px;
  font: 18px/1.3 var(--sans);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.search-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.result-list { padding-left: 20px; font: 16px/1.5 var(--sans); }
.result-list li { margin: 8px 0; }
.tag-index { margin-top: 40px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.listing-label { margin-top: 36px; }
