/* Newsdesk. The world: a wire desk's carbon-copy set. Carbon-violet rail and ink on white copy paper; canary and pink
   flimsies mark news sources and competitors; the editor's red pencil is kept for the one reversed plate (the outlier);
   blue pencil marks what is new. One family, Archivo, from wide to condensed. See DESIGN.md. */

@font-face {
  font-family: 'Archivo';
  src: url('fonts/archivo-latin-var.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------------------------------------ tokens */

:root {
  --paper: #fbfbfd;
  --paper-2: #f2f1f7;
  --paper-3: #e9e7f2;
  --ink: #1b1830;
  --ink-2: #4e4a66;
  --ink-3: #666280;
  --visited: #6a6585;
  --rule: #e4e2ee;
  --rule-strong: #cbc7dc;

  --carbon: #2a2178;
  --carbon-hi: #3a2f97;
  --carbon-ink: #f4f2ff;
  --carbon-ink-2: #c3bdf0;
  --carbon-rule: rgb(244 242 255 / 0.16);
  --rail-alert: #ffc0d4;

  --accent: #3b2fb0;
  --accent-ink: #ffffff;
  --accent-tint: #ecebfb;

  --canary: #fff1a8;
  --canary-ink: #5c4a00;
  --pink: #ffdbe8;
  --pink-ink: #8a1149;

  --red: #c8102e;
  --red-ink: #b3122f;
  --blue: #1f5fcf;
  --gold: #b58300;
  --late: #8a5f00;
  --fresh: #24734a;

  --shadow: 0 6px 24px rgb(27 24 48 / 0.16), 0 1px 3px rgb(27 24 48 / 0.12);
  --radius: 6px;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #12101f;
    --paper-2: #1a1730;
    --paper-3: #24203d;
    --ink: #ecebf5;
    --ink-2: #b9b5cf;
    --ink-3: #9a96b3;
    --visited: #8f8aa8;
    --rule: #26223d;
    --rule-strong: #3b3659;
    --carbon: #1c1650;
    --carbon-hi: #2c247a;
    --carbon-ink: #efedff;
    --carbon-ink-2: #b4ade6;
    --accent: #a99fff;
    --accent-ink: #12101f;
    --accent-tint: #242052;
    --canary: #3a3310;
    --canary-ink: #f3df7a;
    --pink: #3d1528;
    --pink-ink: #ff9dc4;
    --red: #d02040;
    --red-ink: #ff7d8f;
    --blue: #86b4ff;
    --gold: #e0b03a;
    --late: #e0b03a;
    --fresh: #5fcf8f;
    --shadow: 0 8px 30px rgb(0 0 0 / 0.5), 0 1px 3px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --paper: #12101f;
  --paper-2: #1a1730;
  --paper-3: #24203d;
  --ink: #ecebf5;
  --ink-2: #b9b5cf;
  --ink-3: #9a96b3;
  --visited: #8f8aa8;
  --rule: #26223d;
  --rule-strong: #3b3659;
  --carbon: #1c1650;
  --carbon-hi: #2c247a;
  --carbon-ink: #efedff;
  --carbon-ink-2: #b4ade6;
  --accent: #a99fff;
  --accent-ink: #12101f;
  --accent-tint: #242052;
  --canary: #3a3310;
  --canary-ink: #f3df7a;
  --pink: #3d1528;
  --pink-ink: #ff9dc4;
  --red: #d02040;
  --red-ink: #ff7d8f;
  --blue: #86b4ff;
  --gold: #e0b03a;
  --late: #e0b03a;
  --fresh: #5fcf8f;
  --shadow: 0 8px 30px rgb(0 0 0 / 0.5), 0 1px 3px rgb(0 0 0 / 0.4);
  color-scheme: dark;
}

/* ------------------------------------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--rule-strong) transparent;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.45;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--accent);
}

::selection { background: var(--canary); color: var(--ink); }

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }

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

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute; left: 0.5rem; top: -3rem; z-index: 100;
  padding: 0.5rem 0.75rem; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 650;
}
.skip:focus { top: 0.5rem; }

.num, .row-nums, .story-n, .rail-count, td.num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------------------------------------ shell */

.app {
  display: grid;
  /* minmax(0, ...): a plain 1fr grows to its widest unbreakable content (a 60-character category name in the top bar)
     and pushed the whole phone page sideways */
  grid-template-columns: minmax(0, 1fr);
  /* rows only as tall as their content: on a phone a short page (Saved, an empty category) otherwise stretched the
     top bar's row and opened a gap above the page */
  align-content: start;
  min-height: 100dvh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; min-width: 0;
  height: calc(3.25rem + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 0.5rem 0;
  background: var(--carbon);
  color: var(--carbon-ink);
}

.place {
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 0; max-width: 100%; height: 2.75rem;
  padding: 0 0.6rem;
  border: 0; border-radius: var(--radius);
  background: transparent; color: inherit;
  font-size: var(--fs-lg); font-weight: 700; font-stretch: 86%;
}
.place:hover { background: var(--carbon-hi); }
.place-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .icon { flex: none; }
.place:focus-visible, .rail :focus-visible { outline-color: var(--carbon-ink); }

/* The rail: the category list. A popover sheet on phones, a fixed column on wide screens. */
.rail {
  display: none;
  flex-direction: column; gap: 1.25rem;
  background: var(--carbon);
  color: var(--carbon-ink);
  padding: 1rem 0.75rem calc(1rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  scrollbar-color: var(--carbon-hi) transparent;
}

.rail:popover-open {
  display: flex;
  position: fixed; inset: 0 auto 0 0;
  width: min(20rem, 88vw); height: 100dvh; max-height: none;
  margin: 0; border: 0;
  box-shadow: var(--shadow);
  transition: translate 0.22s var(--ease), display 0.22s allow-discrete, overlay 0.22s allow-discrete;
  translate: 0 0;
}
@starting-style { .rail:popover-open { translate: -100% 0; } }
.rail::backdrop { background: rgb(12 10 28 / 0.55); }

.rail-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0 0.25rem; }

.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--carbon-ink); text-decoration: none;
  font-size: 1.125rem; font-weight: 760; font-stretch: 78%; letter-spacing: 0.01em;
}
/* the mark: a carbon-copy set fanned out, white original over canary and pink flimsies */
.brand-mark {
  position: relative; flex: none;
  width: 0.85rem; height: 1.1rem; margin: 0.15rem 0.35rem 0 0;
  border-radius: 1.5px;
  background: #fbfbfd;
}
.brand-mark::before, .brand-mark::after {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 1.5px;
}
.brand-mark::before { background: #fff1a8; translate: 0.17rem -0.17rem; }
.brand-mark::after { background: #ff9dc4; translate: 0.34rem -0.34rem; z-index: -2; }
.brand, .place { isolation: isolate; }

.rail-heading {
  padding: 0 0.6rem 0.4rem;
  color: var(--carbon-ink-2);
  font-size: var(--fs-xs); font-weight: 650; font-stretch: 80%;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.rail-list { display: grid; gap: 2px; }
.rail-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  min-height: 2.75rem; padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  color: var(--carbon-ink); text-decoration: none;
}
.rail-link:hover { background: var(--carbon-hi); }
.rail-link[aria-current='page'] { background: var(--paper); color: var(--ink); }
.rail-name { display: grid; min-width: 0; line-height: 1.25; }
.rail-cat {
  display: flex; align-items: center; gap: 0.5rem; min-width: 0;
  font-weight: 620;
}
.rail-cat .icon { flex: none; }
/* the name in its own box: an ellipsis never applies to the loose text of a flex container (it was cut mid-letter) */
.rail-cat-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-owner { color: var(--carbon-ink-2); font-size: var(--fs-xs); }
.rail-link[aria-current='page'] .rail-owner { color: var(--ink-3); }
.rail-count {
  flex: none; min-width: 1.75rem; padding: 0.05rem 0.4rem;
  border-radius: 999px; text-align: center;
  background: var(--carbon-ink); color: var(--carbon);
  font-size: var(--fs-xs); font-weight: 700;
}
.rail-link[aria-current='page'] .rail-count { background: var(--carbon); color: var(--carbon-ink); }
.rail-empty { padding: 0 0.6rem; color: var(--carbon-ink-2); font-size: var(--fs-sm); }

.rail-add {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; min-height: 2.5rem; margin-top: 0.25rem; padding: 0 0.6rem;
  border: 1px dashed var(--carbon-rule); border-radius: var(--radius);
  background: transparent; color: var(--carbon-ink-2);
  font-size: var(--fs-sm); font-weight: 600;
}
.rail-add:hover { color: var(--carbon-ink); border-color: var(--carbon-ink-2); }
.rail-form { display: grid; gap: 0.5rem; margin-top: 0.25rem; }
.rail-form input {
  width: 100%; height: 2.5rem; padding: 0 0.6rem;
  border: 1px solid var(--carbon-ink-2); border-radius: var(--radius);
  background: var(--carbon-hi); color: var(--carbon-ink);
}
.rail-form input::placeholder { color: var(--carbon-ink-2); }
.rail-form-actions { display: flex; gap: 0.5rem; }
.rail-form-msg { color: var(--rail-alert); font-size: var(--fs-sm); font-weight: 600; }
.rail-form-msg:empty { display: none; }
.btn-on-rail { background: var(--carbon-ink); color: var(--carbon); border-color: transparent; }
.btn-on-rail.btn-quiet { background: transparent; color: var(--carbon-ink-2); }
.btn-on-rail:hover { filter: brightness(1.05); background: var(--carbon-ink); }
.btn-on-rail.btn-quiet:hover { color: var(--carbon-ink); background: var(--carbon-hi); }

.rail-foot {
  display: flex; align-items: center; gap: 0.25rem;
  margin-top: auto; padding: 0.75rem 0.25rem 0;
  border-top: 1px solid var(--carbon-rule);
}
.rail-me { display: grid; flex: 1; min-width: 0; padding-left: 0.35rem; line-height: 1.25; }
.rail-me-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem;
  border: 0; border-radius: var(--radius);
  background: transparent; color: var(--carbon-ink-2);
}
.rail-btn:hover { background: var(--carbon-hi); color: var(--carbon-ink); }
/* Sign out, armed: it takes the footer row and says what follows (a second press signs out) */
.rail-signout-text:empty { display: none; }
.rail-signout[data-armed] {
  display: flex; flex: 1; align-items: center; gap: 0.5rem; width: auto; height: auto; min-height: 2.5rem;
  padding: 0.35rem 0.6rem; text-align: start;
  background: var(--red); color: #fff; font-size: var(--fs-sm); font-weight: 650; line-height: 1.3;
}
.rail-signout[data-armed]:hover { background: var(--red); color: #fff; filter: brightness(1.08); }
.rail-signout .icon { flex: none; }
.rail-foot:has(.rail-signout[data-armed]) > :not(.rail-signout) { display: none; }

.main {
  min-width: 0;
  padding: 0 1rem 5rem;
  outline: none;
}

@media (min-width: 960px) {
  /* the rail's colour runs the full page height even where the sticky rail itself ends */
  .app {
    grid-template-columns: 16.5rem minmax(0, 1fr);
    background: linear-gradient(to right, var(--carbon) 16.5rem, var(--paper) 16.5rem);
  }
  .topbar { display: none; }
  #rail {
    display: flex;
    /* inset first: it resets top, and the popover's own styles set inset: 0 */
    inset: auto; position: sticky; top: 0;
    width: auto; height: 100dvh; max-height: none;
    margin: 0; border: 0; box-shadow: none; translate: none;
  }
  .rail-close { display: none; }
  .main { padding: 0 2.5rem 5rem; }
  .main > * { max-width: 76rem; }
}

.boot { display: grid; place-items: center; min-height: 50vh; color: var(--ink-3); }

/* ------------------------------------------------------------------------------------------------ page head and tabs */

.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem 1.5rem;
  padding: 1.25rem 0 1rem;
}
@media (min-width: 960px) { .page-head { padding-top: 2rem; } }
.page-title { min-width: 0; }
.page-head h1 {
  font-size: var(--fs-xl); line-height: 1.15; font-weight: 720; font-stretch: 88%;
  letter-spacing: -0.01em; outline: none;
}
.page-sub { margin-top: 0.3rem; color: var(--ink-2); font-size: var(--fs-sm); }
.since { color: var(--blue); font-weight: 600; }
.page-actions { display: flex; gap: 0.5rem; }
/* phone: the top bar already names the page, so the heading stays for screen readers only */
@media (max-width: 959px) {
  .page-head { flex-wrap: nowrap; align-items: center; padding: 0.75rem 0 0.5rem; }
  .page-head h1 {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .page-sub { margin: 0; }
  .page-actions .btn { min-height: 2.5rem; padding: 0 0.7rem; }
}

.feeds-health { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--red-ink); font-weight: 650; }
.feeds-health:empty { display: none; }

.tabs {
  display: flex; gap: 0.25rem;
  margin: 0 -1rem; padding: 0 1rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 960px) { .tabs { margin: 0; padding: 0; } }
.tab {
  position: relative; flex: none;
  display: inline-flex; align-items: center;
  min-height: 2.75rem; padding: 0 0.75rem;
  color: var(--ink-2); text-decoration: none;
  font-weight: 620;
}
.tab:first-child { padding-left: 0; }
.tab:hover { color: var(--ink); }
.tab[aria-current='page'] { color: var(--ink); }
.tab[aria-current='page']::after {
  content: ''; position: absolute; left: 0.75rem; right: 0.75rem; bottom: -1px;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--carbon);
}
:root[data-theme='dark'] .tab[aria-current='page']::after { background: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .tab[aria-current='page']::after { background: var(--accent); } }
.tab:first-child[aria-current='page']::after { left: 0; }

/* ------------------------------------------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0 0.9rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 620; line-height: 1.2; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--paper-2); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.12); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover { background: var(--paper-2); border-color: transparent; }
.btn-small { min-height: 2.25rem; padding: 0 0.6rem; }
.btn-wide { width: 100%; }
.btn-danger { color: var(--red-ink); }
.btn-danger[data-armed='1'] { background: var(--red); border-color: var(--red); color: #fff; }
.btn.is-current { border-color: var(--ink); }

.field {
  position: relative;
  display: inline-flex; align-items: center;
  min-height: 2.5rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper);
  transition: border-color 0.15s, background-color 0.15s;
}
.field:hover { border-color: var(--ink-3); }
.field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input, .field select {
  appearance: none; -webkit-appearance: none;
  width: 100%; min-height: calc(2.5rem - 2px);
  border: 0; background: transparent; outline: none;
}
.field input::placeholder { color: var(--ink-3); opacity: 1; }
.field-search { flex: 1 1 14rem; padding-left: 0.65rem; color: var(--ink-3); }
.field-search input { padding: 0 0.6rem 0 0.45rem; color: var(--ink); }
.field-search input::-webkit-search-cancel-button { filter: grayscale(1); }
.field-select select { padding: 0 2rem 0 0.7rem; font-size: var(--fs-sm); font-weight: 560; cursor: pointer; }
.field-select .icon { position: absolute; right: 0.6rem; pointer-events: none; color: var(--ink-3); }
.field-select select option { background: var(--paper); color: var(--ink); }
.field[data-set='true'] { border-color: var(--accent); background: var(--accent-tint); }
.field[data-set='true'] select { color: var(--ink); font-weight: 650; }
.field-wide { display: flex; }
.field-feed { max-width: 13rem; }
.field-feed select { width: 100%; text-overflow: ellipsis; }

input[type='text'], input[type='search']:not(.field input), textarea {
  width: 100%; min-height: 2.5rem; padding: 0 0.7rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper); color: var(--ink);
}
input[type='text']:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type='text']::placeholder { color: var(--ink-3); opacity: 1; }

@media (pointer: coarse) {
  .btn, .field, .field input, .field select, input[type='text'] { min-height: 2.75rem; }
  .btn-small { min-height: 2.75rem; }
  /* under 16px, iPhone browsers zoom the page when a text box gets focus */
  input[type='text'], input[type='search'], textarea { font-size: 16px; }
}

.filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.85rem 0;
}
/* phone: search on its own line, the selects share the next one and shrink with an ellipsis */
@media (max-width: 959px) {
  .filters .field-search { flex-basis: 100%; }
  .filters .field-select { flex: 1 1 0; min-width: 0; max-width: none; }
  .filters .field-select select { padding-left: 0.55rem; padding-right: 1.6rem; text-overflow: ellipsis; }
  /* "Clear filters" gets its own line, so the three selects keep their width ("Last 3 days", not "Last …") */
  .filters .filters-clear { flex-basis: 100%; justify-content: flex-start; padding-left: 0; }
  .filters .field-select .icon { right: 0.45rem; }
}
/* small phones (360 px): three selects on one line cut to "Last 14 d…"; two to a line keeps every choice readable */
@media (max-width: 380px) {
  .filters .field-select { flex: 1 1 calc(50% - 0.25rem); }
}
.filters-clear { color: var(--accent); }

/* ------------------------------------------------------------------------------------------------ item rows */

.list { container-type: inline-size; }
.list-note { padding: 0.25rem 0 0.75rem; color: var(--ink-3); font-size: var(--fs-sm); }

.rows { border-top: 1px solid var(--rule); }

/* Phone and narrow: headline first, then one wrapping line of source, age and numbers. */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem;
  grid-template-rows: auto auto 1fr;
  grid-template-areas: 'title thumb' 'meta thumb' 'meta save';
  column-gap: 0.85rem;
  row-gap: 0.35rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}
.row.no-thumb { grid-template-columns: minmax(0, 1fr) 2.75rem; grid-template-rows: auto 1fr; grid-template-areas: 'title save' 'meta save'; }
.row-meta { align-self: start; }

.row-title {
  grid-area: title;
  text-wrap: pretty;            /* DESIGN.md: balance split two-line headlines in the middle and wasted the line */
  font-size: var(--fs-md); line-height: 1.35; font-weight: 620; font-stretch: 96%;
  overflow-wrap: anywhere;
}
.row-link { color: var(--ink); text-decoration: none; }
.row-link:visited { color: var(--visited); }
.row-link:hover { text-decoration: underline; }

.row-meta {
  grid-area: meta;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem;
  color: var(--ink-3); font-size: var(--fs-sm);
}
.row-nums { display: inline-flex; flex-wrap: wrap; gap: 0.6rem; }
.num-views { color: var(--ink-2); font-weight: 600; }

/* the source as a wire slug: condensed caps on its flimsy (canary for news, pink for competitors) */
.slug {
  display: inline-block; max-width: 100%;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  background: var(--canary); color: var(--canary-ink);
  font-size: var(--fs-sm); font-weight: 680; font-stretch: 70%; line-height: 1.35;
  text-transform: uppercase; letter-spacing: 0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slug[data-role='competitor'] { background: var(--pink); color: var(--pink-ink); }

.row-flags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
/* rows keep two type sizes: the headline, and this one for everything around it */
.flag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: var(--fs-sm); font-weight: 680; line-height: 1.35; white-space: nowrap;
}
.flag-basis { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.flag-where { color: var(--ink-3); font-weight: 500; white-space: normal; }
.flag-kind { color: var(--ink-3); }
.flag-new, .flag-rising { color: var(--blue); }
.row-title .flag-new { display: inline-flex; margin-left: 0.5rem; vertical-align: 0.08em; font-stretch: 100%; }
.flag-new::before {
  content: ''; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor;
}
.flag-rising { color: var(--red-ink); }
/* the editor's red pencil: the only reversed plate on any screen */
.flag-outlier {
  padding: 0.05rem 0.4rem; border-radius: 3px;
  background: var(--red); color: #fff;
  font-weight: 720; font-variant-numeric: tabular-nums; letter-spacing: 0.01em;
}

.row-thumb {
  grid-area: thumb; align-self: start;
  border-radius: 4px; overflow: hidden;
  background: var(--paper-3);
  aspect-ratio: 16 / 9;
}
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }

.save {
  grid-area: save; justify-self: end; align-self: end;
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; margin: -0.35rem -0.5rem 0 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-3);
  transition: color 0.15s, background-color 0.15s;
}
.save:hover { background: var(--paper-2); color: var(--ink); }
.save[aria-pressed='true'] { color: var(--gold); }
.save[aria-pressed='true'] .icon { animation: stamp 0.28s var(--ease); }
@keyframes stamp { from { transform: scale(0.7) rotate(-12deg); } to { transform: none; } }
.row:not(.no-thumb) .save { margin: 0 -0.5rem -0.4rem 0; }
.row.no-thumb .save { align-self: start; }

/* Wide: a budget line. source | headline and marks | thumbnail | numbers | star */
@container (min-width: 720px) {
  .row {
    grid-template-columns: 10rem minmax(0, 1fr) 8rem 6.25rem 2.75rem;
    grid-template-areas: 'src title thumb nums save' 'src flags thumb nums save';
    grid-template-rows: auto 1fr;
    column-gap: 1.1rem;
    row-gap: 0.3rem;
    padding: 0.75rem 0;
  }
  .row.no-thumb {
    grid-template-columns: 10rem minmax(0, 1fr) 8rem 6.25rem 2.75rem;
    grid-template-areas: 'src title title nums save' 'src flags flags nums save';
  }
  .row-meta { display: contents; }
  .save, .row:not(.no-thumb) .save { align-self: start; margin: -0.4rem -0.45rem 0 0; }
  .slug { grid-area: src; align-self: start; justify-self: start; margin-top: 0.1rem; }
  .row-flags { grid-area: flags; align-self: start; }
  .row-nums {
    grid-area: nums;
    flex-direction: column; align-items: flex-end; gap: 0.05rem;
    text-align: right; font-size: var(--fs-sm); color: var(--ink-3);
  }
  .num-age { color: var(--ink-2); }
  .save { margin: -0.4rem -0.45rem 0 0; }
}

/* the reports inside a Hot story: tighter, smaller pictures */
.row-compact { padding: 0.6rem 0; }
@container (min-width: 720px) {
  .row-compact { grid-template-columns: 10rem minmax(0, 1fr) 6rem 6.25rem 2.75rem; }
}

.list-foot { padding: 1.25rem 0 0; }
.list-foot .btn-wide { max-width: 24rem; margin: 0 auto; display: flex; }
.list-end { padding: 1rem 0 0; color: var(--ink-3); font-size: var(--fs-sm); text-align: center; }

/* ------------------------------------------------------------------------------------------------ states */

.state {
  display: grid; justify-items: start; gap: 0.75rem;
  max-width: 34rem; padding: 2.5rem 0;
  color: var(--ink-2);
}
.state p { font-size: var(--fs-md); line-height: 1.5; }
.state-error { color: var(--ink); grid-template-columns: auto 1fr; align-items: start; column-gap: 0.6rem; }
.state-error .icon { color: var(--red-ink); margin-top: 0.1rem; }
.state-error .btn { grid-column: 2; }

.skeleton { border-top: 1px solid var(--rule); }
.skeleton-row {
  display: grid; grid-template-columns: 6rem 1fr 4rem; gap: 1rem; align-items: center;
  padding: 1.05rem 0; border-bottom: 1px solid var(--rule);
}
.sk { display: block; height: 0.8rem; border-radius: 3px; background: var(--paper-3); animation: breathe 1.4s ease-in-out infinite; }
.sk-title.sk-w0 { width: 92%; } .sk-title.sk-w1 { width: 74%; } .sk-title.sk-w2 { width: 83%; }
.sk-num { justify-self: end; width: 2.5rem; }
@keyframes breathe { 50% { opacity: 0.55; } }

.note {
  margin: 1.25rem 0 0; padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--canary); color: var(--canary-ink);
  font-size: var(--fs-sm); font-weight: 560;
}

.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 50;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
  box-shadow: var(--shadow);
  font-size: var(--fs-sm); font-weight: 600;
  translate: -50% 1rem; opacity: 0; pointer-events: none;
  transition: translate 0.22s var(--ease), opacity 0.22s var(--ease);
}
.toast[data-show='1'] { translate: -50% 0; opacity: 1; }
.toast[data-kind='error'] { background: var(--red); color: #fff; }

/* ------------------------------------------------------------------------------------------------ hot stories */

.stories { border-top: 1px solid var(--rule); }
.story { border-bottom: 1px solid var(--rule); }
.story > summary {
  display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); column-gap: 0.85rem;
  padding: 1rem 0; cursor: pointer; list-style: none;
}
.story > summary::-webkit-details-marker { display: none; }
.story > summary:hover .story-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }

.story-count { display: grid; justify-items: start; align-content: start; line-height: 1; }
.story-n {
  font-size: 2rem; font-weight: 760; font-stretch: 72%; color: var(--carbon); letter-spacing: -0.01em;
}
:root[data-theme='dark'] .story-n { color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .story-n { color: var(--accent); } }
.story-n-label {
  margin-top: 0.2rem; color: var(--ink-3);
  font-size: var(--fs-xs); font-weight: 650; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.04em;
}
.story-body { display: grid; gap: 0.35rem; min-width: 0; }
.story-title { font-size: var(--fs-lg); line-height: 1.3; font-weight: 650; font-stretch: 94%; }
.story-outlets { color: var(--ink-2); font-size: var(--fs-sm); }
.story-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.85rem; color: var(--ink-3); font-size: var(--fs-sm); }
.story-times { font-variant-numeric: tabular-nums; }
.story-open {
  display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto;
  color: var(--accent); font-weight: 620;
}
.story-open .icon { transition: rotate 0.2s var(--ease); }
.story[open] .story-open .icon { rotate: 180deg; }
.story .when-open, .story[open] .when-closed { display: none; }
.story[open] .when-open { display: inline; }
.story-items { padding: 0 0 0.75rem; }
.story-items .row:last-of-type { border-bottom: 0; }

@container (min-width: 720px) {
  .story > summary { grid-template-columns: 5.5rem minmax(0, 1fr); column-gap: 1.1rem; }
  .story-n { font-size: 2.5rem; }
  .story-items { margin-left: 6.6rem; border-top: 1px dashed var(--rule-strong); }
}

/* the wire-tick strip: 72 hours, now at the right; one tick per report as it moved */
.wire { margin-top: 0.25rem; max-width: 40rem; }
.wire-rule {
  position: relative; height: 1.15rem;
  border-bottom: 1px solid var(--rule-strong);
}
.wire-rule::after {
  content: ''; position: absolute; right: 0; bottom: -1px; width: 2px; height: 1.15rem; background: var(--ink-3);
}
.wire-day { position: absolute; bottom: 0; width: 0; height: 100%; border-left: 1px dashed var(--rule-strong); }
.tick {
  position: absolute; bottom: 0; width: 2px; height: 0.7rem; margin-left: -1px;
  border-radius: 1px 1px 0 0; background: var(--ink-2);
}
.tick[data-role='competitor'] { background: var(--pink-ink); height: 0.95rem; }
.tick-first { height: 1.15rem; background: var(--red); }
.wire-scale {
  display: flex; justify-content: space-between;
  padding-top: 0.2rem; color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------------------------------------ panels, forms */

.feeds-page, .team-page { display: grid; gap: 0.5rem; padding-top: 0.5rem; }
.panel { padding: 1.5rem 0 1rem; border-bottom: 1px solid var(--rule); }
.panel:last-child { border-bottom: 0; }
.panel h2 { font-size: 1.125rem; line-height: 1.25; font-weight: 700; font-stretch: 90%; margin-bottom: 0.85rem; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.panel-head h2 { margin: 0; }
.panel-quiet { color: var(--ink-2); font-size: var(--fs-sm); }
.panel-quiet h2 { color: var(--ink); }
.hint { color: var(--ink-3); font-size: var(--fs-sm); margin-top: 0.35rem; max-width: 60ch; }
.panel > .hint { margin: -0.4rem 0 1rem; }
.label { display: block; margin-bottom: 0.4rem; color: var(--ink); font-size: var(--fs-sm); font-weight: 650; }

.add-feed, .settings-form, .person-form { display: grid; gap: 1rem; max-width: 44rem; }
.add-feed > input { font-size: 1rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.choices legend { padding: 0; }
.choice {
  display: flex; gap: 0.6rem; align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  cursor: pointer;
}
.choice:hover { border-color: var(--ink-3); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }
.choice input { margin: 0.2rem 0 0; accent-color: var(--accent); width: 1.05rem; height: 1.05rem; flex: none; }
.choice-text { display: grid; gap: 0.1rem; font-size: var(--fs-sm); color: var(--ink-2); }
.choice-text strong { color: var(--ink); font-size: var(--fs-md); font-weight: 650; }
.more-field > summary { color: var(--accent); font-size: var(--fs-sm); font-weight: 600; cursor: pointer; width: max-content; }
.more-field[open] > summary { margin-bottom: 0.5rem; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
.form-msg { font-size: var(--fs-sm); color: var(--ink-2); }
.form-msg[data-kind='error'] { color: var(--red-ink); font-weight: 600; }
.form-msg[data-kind='ok'] { color: var(--fresh); font-weight: 600; }
.field-block { display: grid; }

.opml { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.opml .form-msg { flex-basis: 100%; text-align: right; }

.feed-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.75rem; }
.feed-tools .field-search { flex: 1 1 12rem; max-width: 22rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 2.25rem; padding: 0 0.7rem;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  background: var(--paper); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); }
.chip:disabled { opacity: 0.5; }
@media (pointer: coarse) { .chip { min-height: 2.75rem; } }

/* the four feed health states: the same mark everywhere */
.state-mark { display: inline-block; flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; }
.state-mark.state-fresh { background: var(--fresh); }
.state-mark.state-late { border: 2px solid var(--late); }
.state-mark.state-failing { border-radius: 1px; background: var(--red); rotate: 45deg; }
.state-mark.state-paused { border: 2px solid var(--ink-3); background: transparent; }
.state-failing:not(.state-mark) { color: var(--red-ink); }
.state-late:not(.state-mark) { color: var(--late); }
.state-paused:not(.state-mark) { color: var(--ink-3); }

.feed-group + .feed-group { margin-top: 1.25rem; }
.group-title {
  display: flex; align-items: baseline; gap: 0.5rem;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule);
  font-size: var(--fs-sm); font-weight: 700; font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-2);
}
.group-title .count { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.feed { border-bottom: 1px solid var(--rule); }
.feed > summary {
  display: grid; grid-template-columns: 0.75rem minmax(0, 1fr) auto 1rem; grid-template-areas: 'mark name when chev' '. facts facts .';
  align-items: center; column-gap: 0.7rem; row-gap: 0.1rem;
  min-height: 3rem; padding: 0.55rem 0;
  cursor: pointer; list-style: none;
}
.feed > summary::-webkit-details-marker { display: none; }
.feed > summary > .state-mark { grid-area: mark; }
.feed-name { grid-area: name; display: flex; align-items: center; gap: 0.45rem; min-width: 0; font-weight: 620; }
.feed-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-name .icon { flex: none; color: var(--ink-3); }
.feed-facts { grid-area: facts; color: var(--ink-3); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.feed-when { grid-area: when; color: var(--ink-3); font-size: var(--fs-sm); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.feed > summary > .icon { grid-area: chev; color: var(--ink-3); transition: rotate 0.2s var(--ease); }
.feed[open] > summary > .icon { rotate: 180deg; }
.feed > summary:hover .feed-name > span { text-decoration: underline; text-underline-offset: 0.18em; }
@container (min-width: 720px) {
  .feed > summary { grid-template-columns: 0.75rem minmax(0, 1fr) 13rem 6rem 1rem; grid-template-areas: 'mark name facts when chev'; }
  .feed-facts { text-align: right; }
}
.feed-groups { container-type: inline-size; }
.feed-body { display: grid; gap: 0.75rem; padding: 0.25rem 0 1rem 1.45rem; }
.feed-health { font-size: var(--fs-sm); font-weight: 600; }
.feed-health.state-fresh { color: var(--fresh); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25rem 1rem; margin: 0; font-size: var(--fs-sm); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.url { font-variant-numeric: tabular-nums; }
.feed-edit { display: grid; gap: 0.6rem; }
.inline-form { display: flex; gap: 0.5rem; max-width: 30rem; }
.feed-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }

.danger-zone { display: grid; gap: 0.5rem; justify-items: start; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px dashed var(--rule-strong); }
.danger-zone p { color: var(--ink-3); font-size: var(--fs-sm); }
.danger-zone .btn { max-width: 100%; white-space: normal; text-align: start; }

/* ------------------------------------------------------------------------------------------------ team */

.link-box {
  display: grid; gap: 0.6rem; max-width: 44rem; margin: 1rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--canary); color: var(--canary-ink);
}
.link-box-title { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; color: var(--ink); }
:root[data-theme='dark'] .link-box-title { color: var(--canary-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .link-box-title { color: var(--canary-ink); } }
.link-box .hint { color: var(--canary-ink); margin: 0; }
.link-input { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.link-box .btn-quiet { color: var(--canary-ink); }
.link-box .btn-quiet:hover { background: rgb(0 0 0 / 0.06); }

.table-wrap { container-type: inline-size; }
.team-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.team-table th, .team-table td { padding: 0.7rem 0.75rem 0.7rem 0; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--rule); }
.team-table thead th { color: var(--ink-3); font-weight: 650; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; font-stretch: 80%; }
.team-table .num { text-align: right; }
.team-table tbody th { font-weight: 400; }
.person { display: block; font-size: var(--fs-md); font-weight: 650; }
.role-tag { color: var(--ink-3); font-size: var(--fs-xs); font-weight: 600; }
.role-tag[data-role='owner'] { color: var(--accent); }
.status { font-weight: 600; }
.status-on { color: var(--fresh); }
.status-wait { color: var(--late); }
.status-off { color: var(--ink-3); }
tr[data-off='1'] .person { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.actions { text-align: right; white-space: nowrap; }

@container (max-width: 640px) {
  .team-table thead { display: none; }
  .team-table, .team-table tbody, .team-table tr, .team-table th, .team-table td { display: block; }
  .team-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1rem; padding: 0.85rem 0; border-bottom: 1px solid var(--rule); }
  .team-table th, .team-table td { padding: 0; border: 0; }
  .team-table tbody th { grid-column: 1 / -1; }
  .team-table td[data-label]::before { content: attr(data-label); display: block; color: var(--ink-3); font-size: var(--fs-xs); }
  .team-table .num { text-align: left; }
  .team-table .actions { grid-column: 1 / -1; text-align: left; white-space: normal; display: flex; flex-wrap: wrap; gap: 0.4rem; }
}

/* ------------------------------------------------------------------------------------------------ signed out */

.signed-out { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem 1rem; }
.signin { display: grid; gap: 1rem; max-width: 30rem; }
.signin h1 { font-size: var(--fs-xl); line-height: 1.2; font-weight: 720; font-stretch: 88%; }
.signin p { color: var(--ink-2); }
.brand-solo { color: var(--carbon); }
.brand-solo .brand-mark { background: var(--carbon); }
.panel-quiet > .hint { margin: 0.35rem 0 0; }
:root[data-theme='dark'] .brand-solo { color: var(--carbon-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .brand-solo { color: var(--carbon-ink); } }
.noscript { padding: 2rem 1rem; }

/* ------------------------------------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
