:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --card: #ffffff;
  --ink: #17161a;
  --muted: #6b6862;
  --line: #e3dfd7;
  --rule: #17161a;
  --accent: #b4400a;
  --accent-soft: #fdf1e7;
  --hot: #c81e1e;
  --sig-bg: #f5f2ec;
  --read-bg: #f2efe9;
  --chip: #efebe3;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05);
  --shadow-lift: 0 4px 16px rgba(11, 11, 11, .09);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;

  /* Ordinal ramp for the taste-profile bars — single blue hue, more = darker.
     Validated: monotone lightness, adjacent ΔL >= 0.06, light end 2.11:1 on white. */
  --r1: #86b6ef;
  --r2: #5598e7;
  --r3: #2a78d6;
  --r4: #1c5cab;
  --r5: #0d366b;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #131217;
    --card: #1c1b21;
    --ink: #ecebe9;
    --muted: #9c9892;
    --line: #302e36;
    --rule: #6a6672;
    --accent: #f0a03c;
    --accent-soft: #2a2318;
    --hot: #f2665f;
    --sig-bg: #25242b;
    --read-bg: #17161c;
    --chip: #2a2932;
    --shadow: none;
    --shadow-lift: 0 4px 16px rgba(0, 0, 0, .45);

    --r1: #184f95;
    --r2: #256abf;
    --r3: #3987e5;
    --r4: #6da7ec;
    --r5: #9ec5f4;
    --grid: #2c2c2a;
    --axis: #383835;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* The hairline that says "publication" before you've read a word. */
body::before {
  content: ""; display: block; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--hot) 60%, var(--accent));
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 24px 90px; }

/* ---------- masthead ---------- */

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-bottom: 14px; margin-bottom: 22px;
  border-bottom: 3px double var(--rule);
}
.brand {
  font-family: var(--serif);
  font-size: 25px; font-weight: 700; letter-spacing: -.01em;
  color: var(--ink); text-transform: none;
}
.controls { display: flex; gap: 8px; align-items: center; }

select, .tab {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 11px; cursor: pointer;
}
.tab[aria-selected="true"] { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tabs { display: flex; gap: 6px; }

/* ---------- digest header ---------- */

header.digest-head { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 46px); line-height: 1.08;
  margin: 4px 0 12px; letter-spacing: -.02em; font-weight: 700; max-width: 27ch;
}
.dateline { color: var(--muted); font-size: 13.5px; letter-spacing: .01em; }
.toc { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.toc a {
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  text-decoration: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 13px; background: var(--card);
  transition: color .13s, border-color .13s;
}
.toc a:hover { color: var(--accent); border-color: var(--accent); }

.lede {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 17px 20px; border-radius: 0 8px 8px 0; margin-bottom: 30px;
  font-size: 16px; line-height: 1.6;
}
.lede b { color: var(--accent); font-family: var(--serif); }

/* ---------- section headers ---------- */

h2 {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink);
  font-weight: 800; margin: 44px 0 16px; padding-top: 12px;
  border-top: 2px solid var(--rule);
}
h2 .h2-text { flex: none; }
h2 .h2-count {
  font-size: 10.5px; letter-spacing: .04em; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-weight: 700;
}
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- item cards ---------- */

.item-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 880px) { .item-grid { grid-template-columns: 1fr 1fr; } }
/* A one-line stub marooned in a grid cell looks broken — let it span instead. */
.item-grid > .item.is-collapsed { grid-column: 1 / -1; }

.item {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 0; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.item:hover { box-shadow: var(--shadow-lift); border-color: #d6d0c4; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .item:hover { border-color: #46434e; }
}
.item.is-lead { margin-bottom: 18px; border-top: 3px solid var(--accent); }

.thumb {
  display: block; width: 100%; height: 190px; object-fit: cover;
  background: var(--chip); border-bottom: 1px solid var(--line);
}
.thumb-fallback {
  height: 104px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.item.is-lead .thumb { height: 340px; }
.item.is-lead .thumb-fallback { height: 150px; font-size: 13px; }

.item-body { padding: 17px 19px 15px; display: flex; flex-direction: column; flex: 1; }
.item.is-lead .item-body { padding: 22px 26px 20px; }

/* A quiet "lead story" flag, set in CSS so the markup stays one card type. */
.item.is-lead .item-body::before {
  content: "Lead story";
  align-self: flex-start;
  font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; font-weight: 800;
  color: var(--card); background: var(--accent);
  border-radius: 3px; padding: 3px 8px; margin-bottom: 12px;
}

.cats { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.cat {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800;
  background: var(--chip); color: var(--muted);
  border-radius: 3px; padding: 3px 7px;
}
.cat.boosted { background: var(--accent-soft); color: var(--accent); }

.item h3 {
  font-family: var(--serif);
  font-size: 20px; line-height: 1.24; margin: 0 0 8px;
  letter-spacing: -.012em; font-weight: 700;
}
.item.is-lead h3 { font-size: clamp(24px, 3vw, 31px); line-height: 1.14; margin-bottom: 11px; }

.meta { font-size: 12px; color: var(--muted); margin-bottom: 11px; }
.meta .src { font-weight: 700; color: var(--ink); letter-spacing: .01em; }

.item p { margin: 0 0 13px; font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.item.is-lead p { font-size: 16.5px; line-height: 1.62; }

.sig {
  background: var(--sig-bg); border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0; padding: 12px 15px;
  font-size: 14px; line-height: 1.55; margin: 0 0 14px;
}
.item.is-lead .sig { font-size: 15px; }
.sig b {
  display: block; font-size: 9.5px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 5px; font-weight: 800;
}

a.read { font-size: 12.5px; color: var(--accent); text-decoration: none; font-weight: 700; letter-spacing: .01em; }
a.read:hover { text-decoration: underline; }

.item-foot { display: flex; align-items: center; gap: 14px; margin-top: auto; padding-top: 2px; }
.item-actions { margin-left: auto; display: flex; gap: 12px; }
.act {
  font-size: 11px; color: var(--muted); background: none; border: 0;
  cursor: pointer; padding: 2px 0; text-decoration: underline; font-family: inherit;
}
.act:hover { color: var(--ink); }
.item:not(.is-read) .act.unread { display: none; }

/* ---------- reactions ---------- */

.reactions {
  display: flex; align-items: center; gap: 8px;
  border-top: 1px solid var(--line); margin-top: 13px; padding-top: 12px;
}
.react {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px 6px 11px; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, color .12s ease;
}
.react-emoji { font-size: 17px; line-height: 1; filter: grayscale(1); opacity: .6; transition: filter .12s, opacity .12s, transform .12s; }
.react:hover { border-color: var(--accent); color: var(--ink); }
.react:hover .react-emoji { filter: none; opacity: 1; transform: scale(1.15); }
.react:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Only the chosen one lights up; the others stay grey so the card reads at a
   glance. Each end gets its own colour and the shrug gets plain ink — a neutral
   vote should not look like an endorsement. */
.react.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.react.on .react-emoji { filter: none; opacity: 1; }
.react-ok.on { border-color: var(--ink); color: var(--ink); background: var(--chip); }
.react-nope.on { border-color: var(--hot); color: var(--hot); background: transparent; }

.reactions.failed::after {
  content: "save failed"; font-size: 11px; color: var(--hot); margin-left: auto;
}

@media (prefers-reduced-motion: reduce) {
  .react, .react-emoji, .item { transition: none; }
  .react:hover .react-emoji { transform: none; }
}

/* ---------- read + collapsed ---------- */

/* Read is a tint plus a quieter title, never a hide. Same principle as the
   ranking: things you've dealt with recede, they don't disappear. */
.item.is-read { background: var(--read-bg); box-shadow: none; }
.item.is-read .item-body h3 { color: var(--muted); font-weight: 600; }
.item.is-read .thumb, .item.is-read .thumb-fallback { opacity: .5; filter: saturate(.6); }

.stub { display: none; }
.item.is-collapsed > :not(.stub) { display: none; }
.item.is-collapsed .stub {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 11px 15px; text-align: left;
  background: none; border: 0; cursor: pointer; font: inherit;
}
.stub:hover { background: var(--chip); }
.stub:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stub-mark { flex: none; font-size: 11px; color: var(--accent); }
.stub-title {
  flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--muted);
  font-family: var(--serif);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stub-score { flex: none; font-size: 14px; }
.stub-chev { flex: none; font-size: 12px; color: var(--muted); }

/* ---------- the wire ---------- */

.wire {
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  box-shadow: var(--shadow); margin-bottom: 32px; overflow: hidden;
}
.wire-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 16px; border-bottom: 2px solid var(--rule);
}
.wire-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--hot); font-weight: 800;
}
.wire-label::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--hot); animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .wire-label::before { animation: none; } }
.wire-meta { font-size: 11px; color: var(--muted); margin-left: auto; }

.wire-item {
  display: flex; align-items: baseline; gap: 12px;
  padding: 9px 16px; text-decoration: none; color: inherit;
  border-bottom: 1px solid var(--line);
}
.wire-list > .wire-item:last-child { border-bottom: 0; }
.wire-item:hover { background: var(--chip); }
.wire-src {
  flex: none; width: 118px; font-size: 10px; font-weight: 800; color: var(--muted);
  letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wire-t { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.4; font-family: var(--serif); }
.wire-item:hover .wire-t { color: var(--accent); }
.wire-ago { flex: none; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wire-item.is-read { opacity: .42; }
.wire-item.is-read .wire-t { font-weight: 400; }
.wire-foot { padding: 9px 16px; border-top: 1px solid var(--line); }

/* ---------- freshness bar / load more / banner ---------- */

.freshness {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 8px;
  padding: 9px 14px; margin-bottom: 26px;
}
.freshness .act { margin-left: auto; white-space: nowrap; }

.load-more {
  display: block; width: 100%; margin: 30px 0 4px;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .04em;
  color: var(--accent); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 18px; cursor: pointer;
  transition: border-color .13s ease, background .13s ease;
}
.load-more:hover { border-color: var(--accent); background: var(--accent-soft); }
.load-more:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Sits under its own section rather than at the end of the page, so it reads as
   "more of this beat" and not "more of everything". */
.load-more.section-more {
  margin: 16px 0 0; padding: 11px 16px; font-size: 12.5px;
  border-style: dashed; letter-spacing: .02em;
}
.load-more.section-more:hover { border-style: solid; }

.banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: 9px; padding: 11px 15px; margin-bottom: 20px;
  font-size: 13.5px; color: var(--ink);
}
.banner-go {
  margin-left: auto; font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--accent); background: var(--card); border: 1px solid var(--accent);
  border-radius: 7px; padding: 5px 12px; cursor: pointer;
}
.banner-go:hover { background: var(--accent); color: var(--card); }

/* ---------- misc ---------- */

.quiet {
  font-size: 13.5px; color: var(--muted); border: 1px dashed var(--line);
  border-radius: 9px; padding: 15px 18px; margin-top: 16px;
}
.notice {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 24px; color: var(--muted); font-size: 15px;
}
footer { margin-top: 54px; padding-top: 18px; border-top: 2px solid var(--rule); font-size: 12px; color: var(--muted); }
footer p { margin: 0 0 7px; }
.hidden { display: none !important; }

/* ---------- taste profile ---------- */

.profile-head { margin-bottom: 26px; }
.profile-head h1 { font-size: clamp(26px, 3.6vw, 36px); }
.hero-row { display: flex; gap: 32px; flex-wrap: wrap; margin: 24px 0 30px; }
.stat .value { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-family: var(--serif); }
.stat .label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 800; margin-top: 7px; }

.chart { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 21px 23px; }
.chart h3 { font-size: 16px; margin: 0 0 5px; font-weight: 700; font-family: var(--serif); }
.chart .sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 74px; gap: 12px; align-items: center; margin-bottom: 9px; }
.bar-label { font-size: 13px; color: var(--ink); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Gridlines every 20% of the 0-100% share, so they line up with the ticks. */
.bar-track { position: relative; height: 20px; background: linear-gradient(to right, var(--grid) 1px, transparent 1px) repeat-x; background-size: 20% 100%; border-left: 1px solid var(--axis); }
.bar-fill { height: 20px; border-radius: 0 4px 4px 0; }
/* Low-confidence rows read as provisional via an outline, not a dimmed fill —
   dimming competed with the ramp and made low shares look more prominent. */
.bar-fill.provisional { background: transparent !important; border: 1.5px solid; border-left: none; }
.bar-value { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-value .n { font-size: 11px; opacity: .75; }
.axis-row { display: grid; grid-template-columns: 170px 1fr 74px; gap: 12px; margin-top: 8px; }
.axis-ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 16px; flex-wrap: wrap; }
.legend .swatches { display: flex; gap: 3px; }
.legend .sw { width: 16px; height: 10px; border-radius: 2px; }

table.ratings { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
table.ratings th, table.ratings td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.ratings th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
table.ratings td.num, table.ratings th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
details.table-view summary { font-size: 13px; color: var(--accent); cursor: pointer; margin-top: 16px; font-weight: 700; }

.effect { margin-top: 22px; border: 1px solid var(--line); border-radius: 10px; padding: 17px 19px; background: var(--card); font-size: 14.5px; }
.effect h3 { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; font-weight: 800; }
.effect ul { margin: 0; padding-left: 18px; }
.effect li { margin-bottom: 6px; }

@media (max-width: 560px) {
  .wrap { padding: 20px 16px 70px; }
  .bar-row, .axis-row { grid-template-columns: 104px 1fr 62px; }
  .bar-label { font-size: 12px; }
  .wire-src { width: 84px; font-size: 9.5px; }
  .item.is-lead .thumb { height: 220px; }
  .react-label { display: none; }
  .react { padding: 7px 12px; }
  .reactions { gap: 6px; }
}
