/* Clear Cut Coverage — site design system (see DESIGN.md)
   Loaded first on every page. Tokens, base type, shared chrome, home feed. */

/* ---------- Fonts ---------- */
@font-face{font-family:"Newsreader";font-style:normal;font-weight:400 700;font-display:swap;src:url(/fonts/newsreader-latin.woff2) format("woff2")}
@font-face{font-family:"Newsreader";font-style:italic;font-weight:400 700;font-display:swap;src:url(/fonts/newsreader-latin-italic.woff2) format("woff2")}
@font-face{font-family:"Inter";font-style:normal;font-weight:400 700;font-display:swap;src:url(/fonts/inter-latin.woff2) format("woff2")}

/* ---------- Tokens ---------- */
:root {
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* paper (light) */
  --bg: #f7f5f0;
  --surface: #fffdf9;
  --surface-2: #efece5;
  --ink: #1b1a18;
  --ink-2: #4b4945;
  --ink-3: #7d7a73;
  --rule: #dcd8ce;
  --rule-strong: #1b1a18;
  --focus: #2e5d8c;

  --liberal: #2e5d8c;
  --neutral: #8f6f23;
  --conservative: #a33a2c;
  --liberal-tint: rgba(46, 93, 140, .10);
  --neutral-tint: rgba(143, 111, 35, .12);
  --conservative-tint: rgba(163, 58, 44, .10);

  --positive: #2f6b3a;
  --negative: #a33a2c;

  --max-w: 1280px;
  --gutter: 20px;
  --radius: 4px;
  --shadow-pop: 0 12px 32px rgba(20, 18, 12, .18);

  --masthead-h: 56px;
  --bottom-nav-h: 56px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171614;
  --surface: #1f1d1a;
  --surface-2: #2a2724;
  --ink: #ece8df;
  --ink-2: #c4bfb4;
  --ink-3: #8f8a80;
  --rule: #363330;
  --rule-strong: #ece8df;
  --focus: #8db0d8;
  --liberal: #8db0d8;
  --neutral: #d2b15c;
  --conservative: #e07b6c;
  --liberal-tint: rgba(141, 176, 216, .14);
  --neutral-tint: rgba(210, 177, 92, .14);
  --conservative-tint: rgba(224, 123, 108, .14);
  --positive: #7fc08a;
  --negative: #e07b6c;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.wrap { max-width: var(--max-w); margin: 0 auto; padding-inline: var(--gutter); }

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  padding: 8px 12px; background: var(--ink); color: var(--bg);
  font: 500 .875rem var(--font-sans); border-radius: var(--radius); text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- Icons ---------- */
.icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}
.icon--flip { transform: scaleX(-1); }

/* Lean dots and chips */
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3); flex: none; vertical-align: middle;
}
.dot--liberal { background: var(--liberal); }
.dot--neutral { background: var(--neutral); }
.dot--conservative { background: var(--conservative); }

.lean {
  --lean-c: var(--ink-3);
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 .75rem/1.4 var(--font-sans); color: var(--ink-3); white-space: nowrap;
}
.lean::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lean-c); flex: none; }
.lean--liberal { --lean-c: var(--liberal); }
.lean--neutral { --lean-c: var(--neutral); }
.lean--conservative { --lean-c: var(--conservative); }

/* ---------- Buttons, tools, fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  font: 500 .875rem var(--font-sans); color: var(--ink);
  background: transparent; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 16px; height: 16px; }

.btn--text {
  height: auto; padding: 0; border: 0; background: none;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.btn--text:hover { background: none; color: var(--ink-2); }

.tool {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 0; border-radius: var(--radius);
  color: var(--ink);
}
.tool:hover { background: var(--surface-2); }
.tool__count {
  position: absolute; top: 3px; right: 3px;
  font: 600 .625rem/1 var(--font-sans); color: var(--ink-3);
}
.tool.is-on { color: var(--liberal); }

.field {
  display: block; width: 100%; height: 36px; padding: 0 12px;
  font: 400 .875rem var(--font-sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.field::placeholder { color: var(--ink-3); }
.field:focus { border-color: var(--ink-3); }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg); border-bottom: 1px solid var(--rule-strong);
}
.masthead__inner {
  max-width: var(--max-w); margin: 0 auto; padding-inline: var(--gutter);
  height: var(--masthead-h);
  display: flex; align-items: center; gap: 28px;
}
.masthead__brand {
  font: 600 1.5rem/1 var(--font-serif); letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.masthead__nav { display: flex; align-items: center; gap: 20px; }
.masthead__nav a {
  font: 500 .875rem/1 var(--font-sans); color: var(--ink-2); text-decoration: none;
  padding: 6px 0;
}
.masthead__nav a:hover { color: var(--ink); }
.masthead__nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px;
}
.masthead__tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.masthead__menu { display: none; }

/* theme toggle shows the icon for the theme you would switch to */
.icon--sun { display: none; }
:root[data-theme="dark"] .icon--sun { display: block; }
:root[data-theme="dark"] .icon--moon { display: none; }

/* Search */
.search {
  display: flex; align-items: center; gap: 8px;
  width: 220px; height: 34px; margin: 0 8px 0 0; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 999px;
  color: var(--ink-3);
}
.search:focus-within { border-color: var(--ink-3); color: var(--ink-2); }
.search input {
  flex: 1; min-width: 0; height: 100%; padding: 0; margin: 0;
  background: none; border: 0; outline: none;
  font: 400 .875rem var(--font-sans); color: var(--ink);
}
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-decoration { -webkit-appearance: none; }

/* ---------- Dateline ---------- */
.dateline { border-bottom: 1px solid var(--rule); }
.dateline__inner {
  max-width: var(--max-w); margin: 0 auto; padding: 12px var(--gutter);
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.dateline__date { font: italic 400 1.0625rem/1.3 var(--font-serif); color: var(--ink); }
.dateline__status { font: 500 .75rem/1.3 var(--font-sans); color: var(--ink-3); white-space: nowrap; }

/* ---------- Section tabs ---------- */
.sections { display: flex; gap: 28px; border-bottom: 1px solid var(--rule); }
.tab {
  padding: 14px 0 11px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  font: 500 .875rem/1 var(--font-sans); color: var(--ink-2);
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab.active[data-category="liberal"] { border-bottom-color: var(--liberal); }
.tab.active[data-category="neutral"] { border-bottom-color: var(--neutral); }
.tab.active[data-category="conservative"] { border-bottom-color: var(--conservative); }

/* ---------- Columns and stories ---------- */
.columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding-top: 24px; }
.columns > .column { padding: 0 24px; min-width: 0; }
.columns > .column:first-child { padding-left: 0; }
.columns > .column:last-child { padding-right: 0; }
.columns > .column + .column { border-left: 1px solid var(--rule); }

.columns--single { grid-template-columns: minmax(0, 1fr); }
.column--single { max-width: 800px; padding-top: 8px; }

.column__title {
  margin: 0; padding: 10px 0;
  font: 500 .75rem/1 var(--font-sans); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink);
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule);
}
.column[data-lean="liberal"] .column__title, .column__title--liberal { color: var(--liberal); border-top-color: var(--liberal); }
.column[data-lean="neutral"] .column__title, .column__title--neutral { color: var(--neutral); border-top-color: var(--neutral); }
.column[data-lean="conservative"] .column__title, .column__title--conservative { color: var(--conservative); border-top-color: var(--conservative); }

.stories { list-style: none; margin: 0; padding: 0; }
.stories__empty { padding: 24px 0; font: italic 400 1rem var(--font-serif); color: var(--ink-3); }

.story {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px;
  grid-template-areas: "img img" "title title" "meta actions";
  align-items: center;
  padding: 14px 0; border-top: 1px solid var(--rule);
}
.story:first-child { border-top: 0; }
.story__img { grid-area: img; display: block; margin-bottom: 12px; }
.story__img img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  border-radius: var(--radius); background: var(--surface-2);
}
.story__title { grid-area: title; margin: 0 0 6px; font: 500 1.0625rem/1.3 var(--font-serif); }
.story__title a { color: var(--ink); text-decoration: none; }
.story__title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.story--lead .story__title { font-size: 1.4rem; line-height: 1.2; }
.story__meta {
  grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; min-width: 0;
  font: 500 .75rem/1.4 var(--font-sans); color: var(--ink-3);
}
.story__meta > * + *::before { content: "\00B7"; margin: 0 8px; color: var(--ink-3); }
.story__source { white-space: nowrap; }
.story__time { white-space: nowrap; }
.story__actions { grid-area: actions; display: flex; align-items: center; gap: 2px; margin: -5px -5px -5px 0; }
@media (hover: hover) and (min-width: 769px) {
  .story__actions { opacity: 0; transition: opacity .12s; }
  .story:hover .story__actions, .story:focus-within .story__actions { opacity: 1; }
}

/* single-column lead: image sits beside the text */
.column--single .story--lead.story--has-img {
  grid-template-columns: 240px minmax(0, 1fr) auto;
  grid-template-areas: "img title title" "img meta actions";
  align-items: start;
}
.column--single .story--lead.story--has-img .story__img { margin: 0; align-self: start; }
.column--single .story--lead.story--has-img .story__actions { align-self: center; }

.action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  background: none; border: 0; border-radius: var(--radius);
  color: var(--ink-3); text-decoration: none;
}
.action .icon { width: 16px; height: 16px; }
.action:hover { color: var(--ink); background: var(--surface-2); }
.action.copied { color: var(--positive); }
.action--compare { width: auto; padding: 0 7px; gap: 5px; font: 500 .75rem/1 var(--font-sans); }

/* search results */
.results {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  padding: 18px 0 4px; font: 500 .875rem/1.3 var(--font-sans); color: var(--ink-3);
}
.results__back {
  display: inline-flex; align-items: center; gap: 6px; padding: 0;
  background: none; border: 0; color: var(--ink);
  font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.results__back .icon { width: 16px; height: 16px; }
.results__count strong { color: var(--ink); font-weight: 500; }
.results__empty { padding: 32px 0; font: italic 400 1.0625rem var(--font-serif); color: var(--ink-3); }

/* load state */
.loading { text-align: center; padding: 28px 0; font: 500 .75rem/1 var(--font-sans); color: var(--ink-3); min-height: 1em; }
.sentinel { height: 1px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 6px;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 6px 6px 6px 14px;
  background: var(--ink); color: var(--bg); border-radius: 999px;
  font: 500 .875rem/1 var(--font-sans); white-space: nowrap;
}
.toast .icon { width: 16px; height: 16px; margin-right: 4px; }
.toast__btn {
  padding: 8px 10px; background: none; border: 0; border-radius: 999px; color: inherit; font: inherit;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.toast__btn:hover { background: rgba(255, 255, 255, .12); }
.toast__close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; background: none; border: 0; border-radius: 50%; color: inherit; opacity: .8;
}
.toast__close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.toast :focus-visible { outline-color: var(--bg); }

/* ---------- Newsletter ---------- */
.newsletter { margin-top: 40px; border-top: 1px solid var(--rule-strong); }
.newsletter__inner {
  max-width: var(--max-w); margin: 0 auto; padding: 40px var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 48px; align-items: start;
}
.newsletter__title { font: 500 1.6rem/1.2 var(--font-serif); margin-bottom: 8px; }
.newsletter__lede { font: 400 1.0625rem/1.5 var(--font-serif); color: var(--ink-2); max-width: 48ch; }
.newsletter__form { display: flex; gap: 8px; max-width: 480px; }
.newsletter__form .field { flex: 1; }
.newsletter__msg { margin-top: 10px; font: 500 .75rem/1.4 var(--font-sans); color: var(--ink-3); min-height: 1.4em; }
.newsletter__msg.is-ok { color: var(--positive); }
.newsletter__msg.is-err { color: var(--negative); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule-strong); }
.site-footer__inner {
  max-width: var(--max-w); margin: 0 auto; padding: 32px var(--gutter) 28px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px 48px; align-items: start;
}
.site-footer__brand { display: inline-block; font: 600 1.25rem/1 var(--font-serif); letter-spacing: -.01em; color: var(--ink); text-decoration: none; margin-bottom: 10px; }
.site-footer__about p { font: 400 .875rem/1.55 var(--font-sans); color: var(--ink-2); max-width: 48ch; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 6px; }
.site-footer__nav a {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 .875rem/1 var(--font-sans); color: var(--ink-2); text-decoration: none;
}
.site-footer__nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer__nav .icon { width: 14px; height: 14px; }
.site-footer__legal {
  grid-column: 1 / -1; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--rule);
  font: 400 .75rem/1.4 var(--font-sans); color: var(--ink-3);
}

/* ---------- Saved-articles drawer ---------- */
.readlater-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(400px, 100%);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--rule);
  transform: translateX(100%); transition: transform .2s ease;
  visibility: hidden;
}
.readlater-panel.open { transform: none; visibility: visible; }
.rl-header {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--masthead-h); padding: 0 var(--gutter); border-bottom: 1px solid var(--rule-strong); flex: none;
}
.rl-header h2 { font: 500 1.25rem/1 var(--font-serif); }
.rl-list { overflow-y: auto; padding: 0 var(--gutter) 24px; }
.rl-item { padding: 12px 0; border-top: 1px solid var(--rule); }
.rl-item:first-child { border-top: 0; }
.rl-item__title { display: block; font: 500 1rem/1.3 var(--font-serif); color: var(--ink); text-decoration: none; }
.rl-item__title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.rl-item-source { margin-top: 4px; font: 500 .75rem/1.4 var(--font-sans); color: var(--ink-3); }
.rl-remove {
  margin-top: 6px; padding: 0; background: none; border: 0;
  font: 500 .75rem/1.4 var(--font-sans); color: var(--ink-3);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.rl-remove:hover { color: var(--ink); }
.rl-empty { padding: 28px 0; font: italic 400 1rem/1.5 var(--font-serif); color: var(--ink-3); }

/* ---------- Tooltip (push bell) ---------- */
.tooltip {
  position: fixed; z-index: 80; max-width: 280px; padding: 8px 12px;
  background: var(--ink); color: var(--bg); border-radius: var(--radius);
  font: 500 .8125rem/1.4 var(--font-sans);
  transition: opacity .3s;
}
.tooltip.is-fading { opacity: 0; }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .masthead__inner { gap: 20px; }
  .masthead__nav { gap: 16px; }
  .search { width: 180px; }
  .columns > .column { padding: 0 16px; }
  .story--lead .story__title { font-size: 1.25rem; }
  .column--single .story--lead.story--has-img { grid-template-columns: 200px minmax(0, 1fr) auto; }
}

@media (max-width: 768px) {
  body { padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); }

  .masthead__inner { gap: 12px; }
  .masthead__brand { font-size: 1.25rem; }
  .masthead__menu { display: inline-flex; }
  .masthead__nav {
    display: none; position: absolute; top: var(--masthead-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 4px var(--gutter) 8px; background: var(--bg); border-bottom: 1px solid var(--rule-strong);
  }
  .masthead__nav.open { display: flex; }
  .masthead__nav a { padding: 12px 0; border-top: 1px solid var(--rule); font-size: 1rem; }
  .masthead__nav a:first-child { border-top: 0; }
  .masthead__nav a[aria-current="page"] { text-decoration: none; }

  .search { display: none; }
  .search.is-open {
    display: flex; position: absolute; top: var(--masthead-h); left: 0; right: 0;
    width: auto; height: 44px; margin: 0; padding: 0 var(--gutter);
    border-radius: 0; border-width: 0 0 1px; border-color: var(--rule-strong);
  }

  .dateline__date { font-size: 1rem; }
  .sections { gap: 20px; overflow-x: auto; scrollbar-width: none; }
  .sections::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; }

  .columns { grid-template-columns: 1fr; padding-top: 8px; }
  .columns > .column { padding: 0; }
  .columns > .column + .column { border-left: 0; margin-top: 24px; }
  .column--single { max-width: none; }
  .column--single .story--lead.story--has-img {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "img img" "title title" "meta actions";
  }
  .column--single .story--lead.story--has-img .story__img { margin-bottom: 12px; }
  .story--lead .story__title { font-size: 1.3rem; }

  .toast { bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom, 0px)); }

  .newsletter__inner, .site-footer__inner { grid-template-columns: 1fr; }
  .newsletter__inner { padding-block: 32px; }
  .site-footer__nav { padding-top: 0; }

  .readlater-panel { width: 100%; border-left: 0; }

  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bg); border-top: 1px solid var(--rule);
  }
  .bottom-nav__item {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 0; background: none; border: 0; text-decoration: none;
    font: 500 .6875rem/1 var(--font-sans); color: var(--ink-3);
  }
  .bottom-nav__item.is-active { color: var(--ink); }
  .bottom-nav__item .icon { width: 20px; height: 20px; }
}
