/* Layout and components, following Sol's Mnemir mocks (design/brand/mnemir/). Every color, size, radius and space
   comes from tokens.css; this file has no colors of its own (a test checks). */

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { html:not([data-theme="light"]) { color-scheme: dark; } }
body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font: var(--text-md)/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd, blockquote, figure { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: var(--focus) solid var(--accent); outline-offset: var(--focus); }
::selection { background: var(--mark); color: var(--mark-ink); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.noscript { padding: var(--s5); }

.icon { width: var(--icon); height: var(--icon); flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.quiet { color: var(--ink-3); font-size: var(--text-sm); }
.bad { color: var(--warn); }
.pad { padding: var(--s5); }
.mono { font-family: var(--font-mono); font-size: var(--text-sm); }
.wrap { overflow-wrap: anywhere; }
.count { margin-left: auto; color: var(--ink-3); font-size: var(--text-xs); font-weight: 400; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.eyebrow { font-size: var(--text-xs); font-weight: var(--weight-strong); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--accent); }

/* ---------- the logo (files in /brand/, used as a stencil and painted in the theme's ink) ---------- */

.brand-mark { display: block; background: currentColor; -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
.brand-mark.brand-text { background: none; font: var(--weight-read) var(--text-xl)/1.2 var(--font-read); }
.lockup { width: var(--lockup-w); max-height: var(--lockup-h); aspect-ratio: 9 / 2; -webkit-mask-position: left center; mask-position: left center; }
.brand { display: block; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-line { font-size: var(--text-sm); color: var(--accent); }

.planet { display: block; width: var(--state-mark); height: var(--state-mark); color: var(--ink); --planet-cut: var(--surface); }
.planet .brand-mark, .planet-svg { display: block; width: 100%; height: 100%; }
.planet-body { fill: currentColor; }
.planet-surface { fill: var(--planet-cut); }
.planet.small { flex: none; width: var(--icon-lg); height: var(--icon-lg); color: var(--accent); --planet-cut: var(--bg); }
/* Sol's motion: the outline and the wing stay still, only the surface drifts. One slow turn in a large empty
   state, then rest; a shorter repeating turn only while feeds are really being checked. */
.planet.drift .planet-surface { animation: surface-drift var(--brand-drift-duration) ease-in-out 1; }
.planet.checking .planet-surface { animation: surface-drift var(--brand-loading-duration) linear infinite; }
@keyframes surface-drift {
  0%, 100% { transform: translate(0, 0) skewY(0); }
  35% { transform: translate(4px, -1px) skewY(3deg); }
  70% { transform: translate(-3px, 1px) skewY(-2deg); }
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: var(--s2) var(--s3);
  border: var(--rule) solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font-size: var(--text-base); white-space: nowrap; text-decoration: none;
  transition: background var(--ease), transform var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent); transform: translateY(-1px); }
.btn.small { min-height: var(--tap-sm); font-size: var(--text-sm); }
.btn.danger { color: var(--warn); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.dashed { border-style: dashed; }
.btn.plain { border-color: transparent; background: transparent; }
.btn.plain:hover { background: var(--surface-2); }
.btn.soft { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-size: inherit; }
.link:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-width: var(--tap); height: var(--tap); padding: 0 var(--s2);
  border: 0; border-radius: var(--radius); background: none; color: var(--ink-2);
  transition: background var(--ease), color var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
.icon-btn[aria-pressed="true"] .icon { fill: currentColor; }

.input {
  width: 100%; min-height: var(--tap); padding: var(--s2) var(--s3);
  border: var(--rule) solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-size: var(--text-base);
}
textarea.input { resize: vertical; line-height: 1.45; display: block; padding: var(--s3); }
.input.small { min-height: var(--tap-sm); padding: var(--s1) var(--s2); }
.input.narrow { width: 5.5rem; }
select.input { padding-right: var(--s5); }
.input::placeholder { color: var(--ink-3); }

.form-row { display: flex; gap: var(--s2); align-items: stretch; flex-wrap: wrap; }
.form-row > .input { flex: 1 1 14rem; }
.form-row > select.input { flex: 0 1 12rem; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.field { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--text-sm); color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: var(--s2); }
.field.inline .input { width: auto; }
.toggle { display: flex; align-items: flex-start; gap: var(--s2); min-height: var(--tap-sm); padding: var(--s1) 0; cursor: pointer; }
.toggle input { width: var(--icon); height: var(--icon); margin: 0.1rem 0 0; accent-color: var(--accent); flex: none; }
.toggle small { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.hint { color: var(--ink-2); font-size: var(--text-sm); line-height: 1.5; margin: var(--s2) 0; max-width: var(--prose-w); }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); border-radius: var(--radius-sm); padding: 0.1em 0.35em; }
kbd { font: var(--text-xs) var(--font-mono); border: var(--rule) solid var(--line-strong); padding: 0 var(--s1); border-radius: var(--s1); }

.chip { display: inline-flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s3); border: var(--rule) solid var(--line-strong); border-radius: var(--radius-pill); background: var(--surface-2); font-size: var(--text-sm); }
.chip a { color: inherit; }
.chip-x { border: 0; background: none; color: var(--ink-3); padding: 0 0 0 var(--s1); font-size: var(--text-md); line-height: 1; }
.chip-x:hover { color: var(--warn); }
.suggest { display: inline-flex; gap: var(--s1); align-items: center; }
.suggest .input { width: 9.5rem; }
@media (hover: hover) and (pointer: fine) { .suggest .input, .composer .input { font-size: var(--text-md); } }

/* ---------- toast, menu, dialog ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--s5) + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, var(--s3)); opacity: 0; pointer-events: none;
  width: max-content; max-width: 90vw; padding: var(--s3) var(--s5);
  border-radius: var(--radius); background: var(--ink); color: var(--bg); font-size: var(--text-sm); box-shadow: var(--shadow);
  transition: opacity var(--ease), transform var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--warn); color: var(--bg); }

.menu {
  position: fixed; z-index: 50; min-width: 13rem; max-width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); overflow: auto;
  padding: var(--s1); border: var(--rule) solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.menu-item { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: 0 var(--s3); border: 0; border-radius: var(--radius-sm); background: none; text-align: left; font-size: var(--text-md); color: var(--ink); }
.menu-item:hover { background: var(--surface-2); }
.menu-item.checked { color: var(--accent); font-weight: var(--weight-strong); }
.menu-item .icon { color: var(--ink-3); }
.menu-rule { height: var(--rule); margin: var(--s1) 0; background: var(--line); }

dialog.modal {
  width: min(90vw, var(--dialog-w)); max-height: calc(100dvh - 2rem); padding: 0; border: var(--rule) solid var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.modal.wide { width: min(90vw, var(--dialog-wide)); }
dialog.modal::backdrop { background: var(--shade); }
.modal-body { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s6); }
.modal-title { display: flex; flex-direction: column; gap: var(--s3); font: var(--weight-read) var(--text-xl)/1.3 var(--font-read); }
.modal-title .input { font-family: var(--font-ui); }
.modal-detail { color: var(--ink-3); font-size: var(--text-xs); line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
.keys { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); align-items: baseline; font-size: var(--text-sm); }
.keys dt { white-space: nowrap; color: var(--ink-2); }

/* ---------- sign-in ---------- */

body.signed-out { overflow: auto; }
body.signed-out .app { display: block; height: auto; }
.signin { width: min(var(--signin-w), calc(100vw - 2 * var(--s4))); margin: 16vh auto var(--s7); display: flex; flex-direction: column; gap: var(--s4); }
.signin .brand-line { margin: calc(var(--s2) * -1) 0 var(--s4); }
.signin-form { display: flex; flex-direction: column; gap: var(--s3); }
.signin-form label { display: flex; flex-direction: column; gap: var(--s2); font-size: var(--text-sm); color: var(--ink-2); }

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

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100dvh; }
.sidebar { display: flex; flex-direction: column; min-height: 0; padding: var(--s6) var(--s4) var(--s4); border-right: var(--rule) solid var(--line); background: var(--surface-2); }
.scrim { display: none; }
.main { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; min-height: 0; }
.main.with-pane { grid-template-columns: var(--queue-w) minmax(0, 1fr); }
.listcol { min-height: 0; overflow-y: auto; overscroll-behavior: contain; container-type: inline-size; container-name: list; background: var(--bg); }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: var(--rule) solid var(--line); background: var(--surface); }
.bottom-nav, .mobile-head { display: none; }

/* sidebar */
.side-head { display: flex; align-items: flex-start; justify-content: space-between; margin: 0 var(--s2); }
.side-close { display: none; }
.sidebar .brand-line { padding: var(--s2); margin-bottom: var(--s5); }
.side-search { display: flex; align-items: center; gap: var(--s2); flex: none; min-height: var(--tap); margin-bottom: var(--s5); padding: 0 var(--s3); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink); }
.side-search-input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: var(--text-sm); }
.side-search-input::placeholder { color: var(--ink); opacity: 1; }
.side-search-input::-webkit-search-cancel-button { display: none; }
.side-search:focus-within { border-color: var(--accent); outline: var(--focus) solid var(--accent); outline-offset: var(--focus); }
.side-search:focus-within kbd { display: none; }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(var(--s2) * -1); padding: 0 var(--s2); display: flex; flex-direction: column; gap: var(--s1); }
.side-title { display: flex; justify-content: space-between; margin: var(--s5) var(--s2) var(--s2); font-size: var(--text-xs); font-weight: 400; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.nav-link { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: var(--s2); border-radius: var(--radius-sm); color: var(--ink-2); font-size: var(--text-md); min-width: 0; }
.nav-link:hover { background: var(--line); text-decoration: none; }
.nav-link.current { background: var(--accent-soft); color: var(--accent); font-weight: var(--weight-strong); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link.left-out .nav-label { color: var(--ink-3); }
.nav-link.flagged .icon { color: var(--warn); }
.side-folder-row { display: flex; align-items: center; border-radius: var(--radius-sm); }
.side-folder-row .nav-link { flex: 1; padding-left: 0; }
.side-folder-row:hover, .side-folder-row.current { background: var(--line); }
.side-folder-row.current { background: var(--accent-soft); }
.side-folder-row .nav-link:hover, .side-folder-row .nav-link.current { background: none; }
/* The folder's own icon opens it; a small chevron in the gutter beside it says so and turns when it is open. */
.side-folder-row { margin-left: calc(var(--s2) * -1); }
.fold { display: inline-flex; align-items: center; justify-content: flex-start; gap: calc(var(--s2) - var(--chevron) / 2); width: calc(var(--s2) + var(--icon) + var(--s2) + var(--s3)); height: var(--tap); padding: 0 var(--s3) 0 0; border: 0; background: none; color: var(--ink-2); border-radius: var(--radius-sm); flex: none; }
.fold .chevron { width: var(--chevron); height: var(--chevron); margin-left: calc(var(--s2) - var(--chevron) / 2); color: var(--ink-3); transition: transform var(--ease); }
.fold[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.side-folder-row.current .fold { color: var(--accent); }
.fold:hover { color: var(--accent); }
.side-feeds { display: flex; flex-direction: column; margin-left: calc(var(--s2) + var(--icon) / 2); padding-left: calc(var(--icon) / 2 + var(--s2)); border-left: var(--rule) solid var(--line-strong); }
.side-feeds .nav-link { min-height: var(--tap-sm); padding: var(--s1) var(--s2); font-size: var(--text-sm); }
.side-feeds .nav-link .icon { width: var(--icon-sm); height: var(--icon-sm); }
.side-foot { flex: none; margin-top: var(--s3); }
.side-links { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s1); padding-bottom: var(--s2); }
.side-links .nav-link { font-size: var(--text-sm); gap: var(--s2); }
.side-status { display: flex; align-items: center; gap: var(--s2); padding-top: var(--s3); border-top: var(--rule) solid var(--line); font-size: var(--text-xs); color: var(--ink-2); }
.side-status a { color: inherit; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-status .icon-btn { margin-left: auto; flex: none; }
.status-dot { width: var(--s2); height: var(--s2); border-radius: var(--radius-pill); background: var(--good); flex: none; }
.status-dot.warn { background: var(--warn); }

/* ---------- a page's top: small label, name, one line ---------- */

.feed-main { max-width: var(--page-w); margin: 0 auto; padding: var(--s7) var(--s7) var(--s6); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-bottom: var(--s6); border-bottom: var(--rule) solid var(--line-strong); }
.masthead > div { min-width: 0; }
.masthead .eyebrow { margin-bottom: var(--s3); }
.masthead h1 { font: var(--weight-read) var(--display)/1.12 var(--font-read); letter-spacing: var(--track-tight); overflow-wrap: anywhere; }
.subhead { margin-top: var(--s3); font-size: var(--text-md); color: var(--ink-2); }
.masthead .btn { flex: none; }
.masthead.no-rule { border-bottom: 0; padding-bottom: var(--s2); }

.list-part { display: contents; }
.queue-title { display: none; }
.feed-tools { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4) 0; border-bottom: var(--rule) solid var(--line); margin-bottom: var(--s4); background: var(--bg); }
.filter-controls { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.filter-btn { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: var(--s2) var(--s3) var(--s2) 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font-size: var(--text-sm); white-space: nowrap; }
.filter-btn .icon { width: var(--icon-sm); height: var(--icon-sm); }
.filter-btn:hover { color: var(--accent); }
.view-controls { display: flex; flex: none; padding: var(--s1); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.view-btn { display: flex; align-items: center; justify-content: center; min-height: calc(var(--tap) - var(--s2)); padding: var(--s2) var(--s4); border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font-size: var(--text-sm); }
.view-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--lift); font-weight: var(--weight-strong); }
/* The line above the rows: always exactly one touch-target high, whatever it is saying, so a feed check never
   pushes the rows down or lets them spring back. */
.feed-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); height: var(--tap); margin-bottom: var(--s1); overflow: hidden; font-size: var(--text-sm); white-space: nowrap; }
.slot-label { font-weight: var(--weight-strong); color: var(--ink); }
.slot-status { display: inline-flex; align-items: center; gap: var(--s2); min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
.slot-status.bad { color: var(--warn); }
.slot-count { color: var(--ink-3); font-size: var(--text-xs); overflow: hidden; text-overflow: ellipsis; }
.slot-actions { display: inline-flex; gap: var(--s2); flex: none; }
@container list (min-width: 600px) {
  .feed-tools { position: sticky; top: 0; z-index: 5; }
}

/* ---------- lists ---------- */

.pull { height: 0; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; color: var(--ink-3); font-size: var(--text-sm); }
.pull.show { padding-bottom: var(--s2); }
.pull.ready { color: var(--accent); }
.list-end { padding: var(--s6) 0; }
.quiet-footer { text-align: center; font: var(--text-md) var(--font-read); color: var(--ink-2); }
.skeletons { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5) var(--s4); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--surface); }
.skeletons p { font: var(--weight-read) var(--text-xl)/1.3 var(--font-read); }
.skeleton { width: 100%; height: var(--s5); border-radius: var(--radius-sm); background: var(--surface-2); }
.skeleton.short { width: 65%; }

.row { position: relative; border-bottom: var(--rule) solid var(--line); background: var(--surface); touch-action: pan-y; }
.row-link { position: relative; z-index: 1; display: flex; gap: var(--s4); padding: var(--s4); border-left: var(--rule-strong) solid transparent; background: var(--surface); color: inherit; transition: background var(--ease); }
.row-link:hover { text-decoration: none; background: var(--surface-2); }
.row-link.settle { transition: transform var(--ease); }
.row.cursor .row-link { border-left-color: var(--line-strong); }
.row.open .row-link { background: var(--accent-soft); border-left-color: var(--accent); }
.row-body { flex: 1; min-width: 0; }
.row-src { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s1); font-size: var(--text-xs); line-height: 1.3; color: var(--ink-2); }
.row-pub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dot { width: var(--dot); height: var(--dot); border-radius: var(--radius-pill); background: var(--accent); flex: none; }
.row-age { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: var(--s2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.row-title { font-size: var(--text-lg); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); overflow-wrap: anywhere; }
.row:not(.unread) .row-title { color: var(--ink-2); }
.row-snip { margin-top: var(--s1); color: var(--ink-2); font-size: var(--text-sm); line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
.row-snip:empty { display: none; }
.row-snip mark, .rel-pick mark { background: var(--mark); color: var(--mark-ink); }
.row-meta { display: none; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3); margin-top: var(--s3); font-size: var(--text-xs); color: var(--ink-3); }
.saved-label { color: var(--accent); font-weight: 600; }
.badges { display: inline-flex; align-items: center; gap: var(--s2); }
.badge { display: inline-flex; align-items: center; gap: 0.1rem; }
.badge .icon { width: var(--icon-sm); height: var(--icon-sm); }
.badge.star { color: var(--star); }
.badge.star .icon { fill: currentColor; }

.row-actions { position: absolute; z-index: 2; right: var(--s3); top: 50%; transform: translateY(-50%); display: none; padding: 0 var(--s1); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--surface); }
@media (hover: hover) and (pointer: fine) {
  .row:hover .row-actions, .row:focus-within .row-actions { display: flex; }
}
.row-actions .icon-btn { min-width: var(--tap-sm); height: var(--tap-sm); }

.swipe-under { position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between; padding: 0 var(--s4); color: var(--bg); font-size: var(--text-sm); font-weight: 600; background: var(--ink-3); }
.row.swiping .swipe-under { display: flex; }
.swipe-save, .swipe-read { display: inline-flex; align-items: center; gap: var(--s2); visibility: hidden; }
.row.swipe-right .swipe-save, .row.swipe-left .swipe-read { visibility: visible; }
.row.swiping.armed .swipe-under { background: var(--accent); color: var(--accent-ink); }

/* List: dense. Source and age, the title, one line of summary. */
.view-list .row-title { font-size: var(--text-md); line-height: 1.35; }
@container list (min-width: 600px) {
  .view-list .row-title { font-size: var(--text-lg); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .view-list .row-snip { display: block; white-space: nowrap; text-overflow: ellipsis; }
}

/* Magazine: picture, title, summary. */
.thumb { position: relative; flex: none; overflow: hidden; border-radius: var(--radius-sm); background: var(--surface-2); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A row with no picture (or one that failed to load) has no tile and keeps no room for one: its text takes the
   whole width. */
.view-magazine .row.no-art .row-link { padding: var(--s4) var(--s4) var(--s4) calc(var(--s4) - var(--rule-strong)); }
.view-magazine .row-link, .view-cards .row-link { align-items: flex-start; }
.view-magazine .row-link { gap: var(--s3); padding: var(--s4) var(--s3) var(--s4) 0; }
.view-magazine .thumb { width: var(--thumb-phone); aspect-ratio: 1 / 1; }
.view-magazine .row-snip { -webkit-line-clamp: 2; }
.view-magazine .row-meta, .view-cards .row-meta { display: flex; }
.view-magazine .badge.kept, .view-cards .badge.kept { display: none; }
@container list (min-width: 600px) {
  .view-magazine .row-link { gap: var(--s5); padding: var(--s5) var(--s3) var(--s5) 0; }
  .view-magazine .row.no-art .row-link { padding-block: var(--s5); }
  .view-magazine .thumb { width: calc(var(--thumb-w) * 1.5); aspect-ratio: 5 / 3; align-self: center; }
  .view-magazine .row-title { font-size: var(--text-xl); }
  .view-magazine .row-snip { margin-top: var(--s2); font-size: var(--text-md); }
}

/* Cards: an image-led grid. */
.rows.view-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.view-cards .row { border: var(--rule) solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.view-cards .row-link { display: block; padding: 0; border-left: 0; }
.view-cards .row.open { border-color: var(--accent); }
.view-cards .row.cursor { border-color: var(--line-strong); }
.view-cards .row.open.cursor { border-color: var(--accent); }
.view-cards .thumb { width: 100%; aspect-ratio: 2 / 1; border-radius: 0; }
.view-cards .row-body { padding: var(--s4); }
.view-cards .row-title { font-size: var(--text-xl); }
.view-cards .row-snip { -webkit-line-clamp: 3; }
.view-cards .row-actions { top: var(--s3); transform: none; }
@container list (min-width: 600px) {
  .rows.view-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-cards .thumb { aspect-ratio: 5 / 3; }
}
@container list (min-width: 960px) {
  .rows.view-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- quiet moments: empty, loading, recovery ---------- */

.state { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); padding: var(--s6); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--surface); }
.state h2 { font: var(--weight-read) var(--text-xl)/1.3 var(--font-read); }
.state p { max-width: 30rem; font-size: var(--text-md); line-height: 1.5; color: var(--ink-2); }
.state small { font-size: var(--text-xs); color: var(--ink-3); }
.state .state-motto { font: italic var(--text-md)/1.5 var(--font-read); color: var(--ink-3); }
.state-glyph { color: var(--accent); }
.state-glyph .icon { width: var(--text-2xl); height: var(--text-2xl); }
.state.warning { border-color: var(--warn); background: var(--warn-soft); }
.state.warning h2 { color: var(--warn); }
.state.spaced { margin-bottom: var(--s5); }
.state .feed-error { font-size: var(--text-sm); line-height: 1.5; }
.state .last-ok { font-size: var(--text-xs); }
.state.inline { padding: var(--s5); margin-bottom: var(--s5); }
.state.inline h2 { font-size: var(--text-lg); }
.state .btn-row { margin-top: 0; }
.state.warning .planet { --planet-cut: var(--warn-soft); }

/* ---------- the reader pane ---------- */

.pane-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--bar-h); padding: var(--s2) var(--s5); border-bottom: var(--rule) solid var(--line); flex: none; font-size: var(--text-sm); }
.pane-bar > div { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.pane-bar .btn { min-height: var(--tap-sm); font-size: var(--text-sm); }
.pane-bar .icon-btn { min-width: var(--tap-sm); height: var(--tap-sm); }
.reader-position { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-bar .back-label, .pane-bar .narrow-only { display: none; }
.pane-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; outline: none; }
.reading { --reading-pad: var(--s7); max-width: calc(var(--read-measure) + var(--reading-pad) * 2); margin: 0 auto; padding: var(--reading-pad); }
.article-source { display: flex; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s5); font-size: var(--text-xs); font-weight: var(--weight-strong); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.article-source a { color: inherit; }
.article-source span:last-child { flex: none; color: var(--ink-3); font-weight: 400; letter-spacing: 0.02em; }
.reading-title { font: var(--weight-read) var(--headline)/1.1 var(--font-read); letter-spacing: var(--track-tight); overflow-wrap: anywhere; text-wrap: balance; }
.reading-title a { color: inherit; }
.byline { display: flex; justify-content: space-between; gap: var(--s3); margin: var(--s5) 0; font-size: var(--text-xs); color: var(--ink-3); }

.player { width: 100%; margin-bottom: var(--s5); }
.notices:empty { display: none; }

.reading-body { max-width: var(--read-measure); font: var(--read-size)/var(--read-leading) var(--font-read); font-optical-sizing: auto; overflow-wrap: break-word; }
.reading-body > * + * { margin-top: var(--s5); }
/* articles often arrive wrapped in a div or two: blocks inside them need the same breathing room */
.reading-body * + :where(p, ul, ol, dl, blockquote, figure, pre, hr, table, h1, h2, h3, h4, h5, h6, .embed, .table-wrap) { margin-top: var(--s5); }
.reading-body :where(li, blockquote, td, th, figure) > :where(p, ul, ol):first-child { margin-top: 0; }
.reading-body p, .reading-body li { hanging-punctuation: first; }
.reading-body h1, .reading-body h2, .reading-body h3, .reading-body h4 { font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; margin-top: 1.6em; }
.reading-body h1, .reading-body h2 { font-size: 1.3em; }
.reading-body h3, .reading-body h4, .reading-body h5, .reading-body h6 { font-size: 1.1em; }
.reading-body img, .reading-body video { display: block; max-width: 100%; height: auto; margin-inline: auto; background: var(--surface-2); }
.reading-body figure { margin: var(--s6) 0; }
.reading-body figcaption { margin-top: var(--s2); color: var(--ink-3); font: var(--text-xs)/1.5 var(--font-ui); }
.reading-body blockquote { margin-block: var(--s6); padding-left: var(--s5); border-left: var(--rule-strong) solid var(--accent); font-size: var(--text-xl); line-height: 1.5; color: var(--ink-2); }
.reading-body ul, .reading-body ol { padding-left: 1.4em; }
.reading-body li + li { margin-top: 0.35em; }
.reading-body pre { overflow-x: auto; padding: var(--s3) var(--s4); border-radius: var(--radius-sm); background: var(--surface-2); font: 0.7em/1.5 var(--font-mono); }
.reading-body pre code { background: none; padding: 0; font-size: inherit; }
.reading-body hr { border: 0; border-top: var(--rule) solid var(--line); margin: var(--s6) 0; }
.reading-body a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 0.15em; }
.reading-body audio { width: 100%; }
.table-wrap { overflow-x: auto; }
.reading-body table { border-collapse: collapse; font: var(--text-sm)/1.4 var(--font-ui); }
.reading-body th, .reading-body td { padding: var(--s2) var(--s3); border: var(--rule) solid var(--line); text-align: left; vertical-align: top; }
.embed { position: relative; aspect-ratio: 16 / 9; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
mark.hl { background: var(--mark); color: var(--mark-ink); cursor: pointer; padding: 0 0.08em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark.hl.flash { outline: var(--focus) solid var(--star); }

.sel-bar { position: fixed; z-index: 40; display: flex; gap: var(--s1); padding: var(--s1); border: var(--rule) solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }

/* "Your thoughts": rating, tags, feelings, notes, highlights, related */
.annotations { margin-top: var(--s7); padding-top: var(--s6); border-top: 2px solid var(--accent); font-size: var(--text-md); }
.annotation-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.annotation-heading h2 { font-size: var(--text-xl); font-weight: 600; }
.annotation-heading > span { font-size: var(--text-xs); color: var(--ink-3); }
.rating-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding-bottom: var(--s4); }
.rating-row > span, .tag-row > .row-label, .reaction-row > .row-label { font-size: var(--text-sm); color: var(--ink-2); }
.stars { display: flex; }
.star-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--star); }
.star-btn .icon { width: var(--icon-lg); height: var(--icon-lg); stroke-width: 1.4; }
.star-btn.on .icon { fill: currentColor; }
.star-btn:hover { background: var(--surface-2); }
.tag-row, .reaction-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s4); }
.tag-row > .row-label, .reaction-row > .row-label { margin-right: var(--s2); }
.reaction-row { margin-bottom: var(--s6); }
.annotations h3 { margin: var(--s6) 0 var(--s3); font-size: var(--text-md); font-weight: var(--weight-strong); }
.annotations h3 span { margin-left: var(--s2); font-size: var(--text-xs); font-weight: 400; color: var(--ink-3); }
.note, .highlight, .related { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s3); }
.note { margin-bottom: var(--s3); padding: var(--s4); border-left: var(--rule-strong) solid var(--accent); border-radius: var(--radius-sm); background: var(--bg); line-height: 1.6; }
.note-meta { flex: 1 1 0; min-width: 0; font-size: var(--text-xs); color: var(--ink-3); }
.note-tools { display: inline-flex; flex-wrap: wrap; gap: var(--s2) var(--s3); font-size: var(--text-xs); }
.note-body { flex: 1 1 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .note-meta, .note .note-tools { margin-bottom: var(--s2); }
.note .note-body { order: 2; }
.thought-note .note-body { font-style: italic; }
.note-label { display: block; margin: var(--s4) 0 var(--s2); font-size: var(--text-sm); color: var(--ink-2); }
.composer .btn-row { margin-top: var(--s2); }
.highlight { margin-bottom: var(--s3); padding: var(--s4); border-left: var(--rule-strong) solid var(--star); background: var(--bg); }
.hl-quote { flex: 1 1 100%; font: var(--text-lg)/1.6 var(--font-read); cursor: pointer; overflow-wrap: anywhere; }
.highlight .note-body { margin-top: var(--s2); }
.highlight .note-meta, .highlight .note-tools { margin-top: var(--s3); }
.related { padding: var(--s3) 0; border-bottom: var(--rule) solid var(--line); }
.rel-link { flex: 1 1 100%; color: var(--accent); }
.related .note-meta, .related .note-tools { margin-top: var(--s1); }
.related + .composer, .annotations h3 + .composer { margin-top: var(--s3); }
.rel-results { display: flex; flex-direction: column; margin-top: var(--s2); }
.rel-pick { display: flex; flex-direction: column; gap: 0.1rem; padding: var(--s2) var(--s3); border: 0; border-bottom: var(--rule) solid var(--line); background: none; text-align: left; }
.rel-pick:hover { background: var(--surface-2); }
.rel-pick span { color: var(--ink-3); font-size: var(--text-xs); }
.annotation-foot { margin: var(--s5) 0 var(--s6); font-size: var(--text-xs); color: var(--ink-3); }

/* ---------- pages ---------- */

.page { display: flex; flex-direction: column; gap: var(--s5); margin-top: var(--s5); }
.panel { padding: var(--s5); border: var(--rule) solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.panel h2 { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); font-size: var(--text-lg); font-weight: 600; }
.panel h2 a { color: inherit; }
.panel h2 .count { margin-left: var(--s2); }
.panel h3 { margin: var(--s5) 0 var(--s2); font-size: var(--text-md); font-weight: var(--weight-strong); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin-bottom: var(--s5); }
.panel-heading h2 { margin: 0; }
.panel-heading > span { font-size: var(--text-xs); color: var(--ink-3); text-align: right; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: var(--s5); }
.summary-line { margin-bottom: var(--s4); color: var(--ink-2); }
.plain-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.plain-list li { overflow-wrap: anywhere; }
.tag-warn, .tag-quiet { display: inline-flex; align-items: center; gap: 0.2rem; margin-left: var(--s2); padding: 0.05rem var(--s2); border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 400; white-space: nowrap; }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-quiet { background: var(--surface-2); color: var(--ink-2); }
.tag-warn .icon, .tag-quiet .icon { width: var(--icon-sm); height: var(--icon-sm); }
.notice { margin-bottom: var(--s4); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--text-sm); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.notice p { flex: 1 1 14rem; }
.notice.warn { background: var(--warn-soft); }
p.notice { display: block; }

.folder-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.folder-head h2 { margin: 0; align-items: baseline; flex-wrap: wrap; }
.folder-tools { display: flex; flex: none; }
.folder-tools .icon-btn { min-width: var(--tap-sm); height: var(--tap-sm); }
.feed-controls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; margin: var(--s2) 0; }
.feed { border-top: var(--rule) solid var(--line); }
.feed summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; cursor: pointer; list-style: none; }
.feed summary::-webkit-details-marker { display: none; }
.feed summary::before { content: "›"; color: var(--ink-3); width: 0.8rem; flex: none; transition: transform var(--ease); }
.feed[open] summary::before { transform: rotate(90deg); }
.feed-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.feed-facts { color: var(--ink-3); font-size: var(--text-xs); white-space: nowrap; }
.feed-body { padding: 0 0 var(--s4) 1.4rem; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s1) var(--s4); font-size: var(--text-sm); margin-bottom: var(--s3); }
.facts dt { color: var(--ink-3); }

.more-list { display: flex; flex-direction: column; border: var(--rule) solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.more-link { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); color: var(--ink); border-bottom: var(--rule) solid var(--line); }
.more-link:last-child { border-bottom: 0; }
.more-link:hover { background: var(--surface-2); text-decoration: none; }
.more-link span { flex: 1; font-weight: 600; }
.more-link small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--text-sm); }
.more-link .chev { color: var(--ink-3); }

.search-form { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s5) 0 var(--s2); }
/* "Clear filters" sits at the end of the Filters line itself, so it is in reach without scrolling to the results */
.filter-line { position: relative; }
.filter-line > .btn { position: absolute; top: 0; right: 0; }
.filters summary { width: max-content; cursor: pointer; color: var(--ink-2); font-size: var(--text-sm); padding: var(--s1) 0; }
.filters summary .count { margin-left: var(--s2); color: var(--accent); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: var(--s3); padding: var(--s2) 0; align-items: end; }

/* Insights */
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
.metric { padding: var(--s5); border: var(--rule) solid var(--line); border-top: var(--rule-strong) solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); }
.metric > span { display: block; font-size: var(--text-sm); color: var(--ink-2); }
.metric > strong { display: block; font: 500 var(--figure)/1.4 var(--font-read); letter-spacing: -0.04em; font-variant-numeric: lining-nums; }
.metric em { margin-left: var(--s2); font: var(--text-lg) var(--font-ui); letter-spacing: 0; color: var(--ink-3); }
.metric > small { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.insight-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--s5); align-items: start; }
/* a panel ends its own padding after its last line: no trailing gap, no stretching to match its neighbour */
.panel > :last-child, .panel > :last-child > :last-child { margin-bottom: 0; }
.panel > .ranking:last-child, .panel > .more-rows:last-child > .ranking:last-child { border-bottom: 0; padding-bottom: 0; }
.show-more { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); margin-top: var(--s2); padding: 0; border: 0; background: none; color: var(--accent); font-size: var(--text-sm); }
.show-more:hover { text-decoration: underline; }
.show-more .icon { width: var(--icon-sm); height: var(--icon-sm); }
.more-patterns > summary { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); cursor: pointer; list-style: none; font-size: var(--text-lg); font-weight: 600; }
.more-patterns > summary::-webkit-details-marker { display: none; }
.more-patterns > summary .icon { width: var(--icon-sm); height: var(--icon-sm); color: var(--ink-3); transition: transform var(--ease); }
.more-patterns[open] > summary .icon { transform: rotate(90deg); }
.more-patterns > summary small { margin-left: auto; font-size: var(--text-xs); font-weight: 400; color: var(--ink-3); }
.more-patterns > .insight-grid { margin-top: var(--s3); }
.bars { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); height: var(--chart-h); padding: var(--s3) var(--s2) 0; border-bottom: var(--rule) solid var(--line); }
.bar-column { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; flex: 1; min-width: 0; gap: var(--s2); height: 100%; font-size: var(--text-xs); color: var(--ink-2); }
.bar { width: 100%; min-height: var(--s1); background: var(--accent-soft); border-top: 2px solid var(--accent); }
.bar.none { border-top-color: var(--line); min-height: 0; }
.bar-column:last-child .bar { background: var(--accent); }
.bar-column small { padding-bottom: var(--s2); font-size: var(--text-xs); white-space: nowrap; }
.chart-foot { margin-top: var(--s4); font-size: var(--text-xs); line-height: 1.5; color: var(--ink-3); }
.ranking { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-bottom: var(--rule) solid var(--line); }
.ranking > div { min-width: 0; }
.ranking strong { display: block; font-size: var(--text-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking small { display: block; margin-top: var(--s1); font-size: var(--text-xs); color: var(--ink-3); }
.ranking > span { color: var(--accent); font-size: var(--text-md); white-space: nowrap; }
.save-category { margin: var(--s4) 0; }
.panel-heading + .save-category { margin-top: 0; }
.save-category > div:first-child { display: flex; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); font-size: var(--text-sm); }
.save-category > div:first-child span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-category > div:first-child strong { flex: none; font-variant-numeric: tabular-nums; }
.track { height: var(--s2); border-radius: var(--radius-pill); background: var(--surface-2); overflow: hidden; }
.track > div { height: 100%; background: var(--accent); }
.feeling-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s4) var(--s5); padding: var(--s4) 0; }
.feeling-grid:last-child { padding-bottom: 0; }
.feeling-grid strong { font: 500 var(--text-xl) var(--font-read); text-transform: capitalize; }
.feeling-grid span { display: block; margin-top: var(--s3); font-size: var(--text-xs); color: var(--ink-3); }
.five-star a { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) 0; border-top: var(--rule) solid var(--line); color: var(--ink); }
.five-star a:hover { text-decoration: none; color: var(--accent); }
.five-star .stars-line { display: inline-flex; gap: 0.1rem; color: var(--star); flex: none; }
.five-star .stars-line .icon { width: var(--icon-sm); height: var(--icon-sm); fill: currentColor; }
.five-star strong { font-size: var(--text-md); font-weight: 600; min-width: 0; }
.five-star small { margin-left: auto; font-size: var(--text-xs); color: var(--ink-3); flex: none; }
.unopened { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s5) 0; }
.unopened h2 { font-size: var(--text-lg); font-weight: 600; }
.unopened p { margin-top: var(--s2); font-size: var(--text-sm); color: var(--ink-2); }
.unopened .btn { white-space: nowrap; font-size: var(--text-sm); }
.unopened p { line-height: 1.5; }
.unopened .plain-list { margin-top: var(--s3); font-size: var(--text-sm); }
.page-foot { padding: var(--s4) 0; border-top: var(--rule) solid var(--line); font-size: var(--text-xs); line-height: 1.5; color: var(--ink-3); }

/* ---------- the list beside an open article (laptop): a quiet queue ---------- */

@media (min-width: 1200px) {
  .main.with-pane .listcol { border-right: 0; }
  .main.with-pane .feed-main { padding: 0 0 var(--s4); }
  .main.with-pane .masthead, .main.with-pane .feed-tools, .main.with-pane .feed-heading, .main.with-pane .search-form { display: none; }
  .main.with-pane .queue-title { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: var(--s3) var(--s2) var(--s3) var(--s4); background: var(--bg); font-size: var(--text-sm); }
  .queue-back { display: flex; align-items: center; gap: var(--s2); min-width: 0; min-height: var(--tap-sm); font-weight: var(--weight-strong); color: var(--ink); }
  .queue-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .queue-count { margin-left: auto; flex: none; font-size: var(--text-xs); color: var(--ink-3); }
  .queue-count .link { min-height: var(--tap-sm); }
  .queue-count .link.bad { color: var(--warn); }
  .queue-title .icon-btn { min-width: var(--tap-sm); height: var(--tap-sm); }
  .main.with-pane .listcol .state, .main.with-pane .listcol .skeletons { margin: var(--s3); }
  .main.with-pane .rows { display: block; }
  .main.with-pane .rows .row { border: 0; border-bottom: var(--rule) solid var(--line); border-radius: 0; background: transparent; }
  .main.with-pane .rows .row-link { display: block; padding: var(--s5) var(--s4); border-left: var(--rule-strong) solid transparent; background: transparent; }
  .main.with-pane .rows .row-link:hover { background: var(--surface-2); }
  .main.with-pane .rows .row.cursor .row-link { border-left-color: var(--line-strong); }
  .main.with-pane .rows .row.open .row-link { background: var(--accent-soft); border-left-color: var(--accent); }
  .main.with-pane .rows .thumb, .main.with-pane .rows .row-meta { display: none; }
  .main.with-pane .rows .badge.kept { display: inline-flex; }
  .main.with-pane .rows .row-src { margin-bottom: var(--s2); }
  .main.with-pane .rows .row-title { font-size: var(--text-md); }
  .main.with-pane .rows .row-snip { min-height: 0; margin-top: var(--s2); font-size: var(--text-sm); -webkit-line-clamp: 2; }
  .main.with-pane .rows .row-actions { display: none; }
  .main.with-pane .quiet-footer { padding: 0 var(--s4); font-size: var(--text-sm); }
}

/* ---------- mid widths: a narrower sidebar; the article takes the whole main column ---------- */

@media (min-width: 900px) and (max-width: 1199px) {
  .app { grid-template-columns: calc(var(--sidebar-w) - 2rem) minmax(0, 1fr); }
  .lockup { width: calc(var(--lockup-w) - 1.5rem); }
  .nav-link { font-size: var(--text-sm); }
  .main.with-pane { grid-template-columns: minmax(0, 1fr); }
  .main.with-pane .listcol { display: none; }
  .pane { border-left: 0; }
  .feed-main { padding: var(--s6); }
  .reading { --reading-pad: var(--s6); }
  .insight-grid { grid-template-columns: 1fr; }
}

/* ---------- phone ---------- */

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .main, .main.with-pane { grid-template-columns: minmax(0, 1fr); grid-row: 1; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(var(--drawer-w), 88vw); border-right: 0; box-shadow: var(--shadow);
    padding-top: calc(var(--s5) + env(safe-area-inset-top)); padding-bottom: calc(var(--s4) + env(safe-area-inset-bottom));
    transform: translateX(-105%); transition: transform var(--ease); visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: var(--shade); }
  body.nav-open .scrim { display: block; }
  .side-close { display: inline-flex; margin: calc(var(--s2) * -1) calc(var(--s2) * -1) 0 0; }
  .side-search-input { font-size: var(--text-base); }
  .side-search kbd { display: none; }
  .side-feeds .nav-link { min-height: var(--tap); font-size: var(--text-md); }

  .mobile-head { display: flex; align-items: center; justify-content: space-between; min-height: var(--bar-h); padding: var(--s2) var(--s2) var(--s2) var(--s4); padding-top: calc(var(--s2) + env(safe-area-inset-top)); border-bottom: var(--rule) solid var(--line); background: var(--surface); }
  .mobile-head .lockup { width: var(--lockup-w-phone); max-height: calc(var(--lockup-h) - 1rem); }
  .mobile-tools { display: flex; gap: var(--s2); }

  .bottom-nav {
    grid-row: 2; display: flex; min-height: var(--nav-h); border-top: var(--rule) solid var(--line-strong); background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom); position: relative; z-index: 22;
  }
  .tab { flex: 1; min-height: calc(var(--nav-h) - var(--rule)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); padding: 0; border: 0; background: none; color: var(--ink-2); font-size: var(--text-xs); }
  .tab:hover { text-decoration: none; }
  .tab.current { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
  .tab .icon { width: var(--icon-lg); height: var(--icon-lg); }

  .feed-main { padding: var(--s6) var(--s4) var(--s6); }
  .masthead { align-items: flex-start; gap: var(--s2); padding-bottom: var(--s5); }
  .masthead h1 { font-size: var(--display-phone); }
  .masthead .eyebrow { margin-bottom: var(--s2); }
  .subhead { font-size: var(--text-sm); line-height: 1.5; }
  .masthead .btn { margin-top: var(--s6); padding: var(--s2); min-width: var(--tap); }
  .masthead .btn span { display: none; }
  .masthead .btn .icon { width: var(--icon-lg); height: var(--icon-lg); }
  .feed-tools { display: block; margin-bottom: var(--s2); padding: var(--s2) 0 var(--s4); }
  .filter-controls { justify-content: space-between; padding-bottom: var(--s2); }
  .view-btn { flex: 1; min-height: var(--tap); padding: var(--s2); }
  .feed-heading { margin-bottom: 0; }
  .slot-actions .btn { padding-inline: var(--s2); }
  .row-link { padding: var(--s4) var(--s3); }
  .state { padding: var(--s5); }

  .pane { position: fixed; inset: 0 0 calc(var(--nav-h) + env(safe-area-inset-bottom)) 0; z-index: 20; border-left: 0; }
  .pane-bar { min-height: calc(var(--bar-h-phone) + env(safe-area-inset-top)); padding: var(--s2) var(--s3); padding-top: calc(var(--s2) + env(safe-area-inset-top)); gap: var(--s2); }
  .pane-bar .btn { min-height: var(--tap); padding: var(--s2); }
  .pane-bar .icon-btn { min-width: var(--tap); height: var(--tap); }
  .pane-bar .back-label, .pane-bar .narrow-only { display: inline-flex; }
  .pane-bar .wide-only, .reader-position { display: none; }
  .reading { --reading-pad: var(--s5); padding: var(--s6) var(--reading-pad) var(--s7); }
  .reading-title { font-size: var(--headline-phone); }
  .article-source { letter-spacing: 0.03em; }
  .byline { display: block; line-height: 1.6; }
  .byline span { display: block; }
  .reading-body blockquote { padding-left: var(--s4); }
  .reading-body figure { margin-inline: calc(var(--s5) * -1); }
  .reading-body figcaption { padding-inline: var(--s5); }
  .rating-row { column-gap: var(--s2); }
  .rating-row > span:first-child { width: 100%; }

  /* The 44px touch contract: on a phone every control that stands alone is at least 44px high, icon-only and
     remove controls at least 44 by 44, with 8px between neighbours and 13px labels on the small actions.
     Nothing gets there with an invisible, overlapping hit area. */
  .btn.small, .input.small { min-height: var(--tap); }
  .btn.small, .link, .note-tools { font-size: var(--text-sm); }
  .input.small { padding: var(--s2) var(--s3); font-size: var(--text-base); }
  .link { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); }
  .toggle { min-height: var(--tap); align-items: center; }
  .toggle input { margin-top: 0; }
  .filters summary { min-height: var(--tap); line-height: calc(var(--tap) - var(--s2)); }
  .folder-tools { gap: var(--s2); }
  .folder-tools .icon-btn { min-width: var(--tap); height: var(--tap); }
  .folder-head { flex-wrap: wrap; }
  .side-status a { display: inline-flex; align-items: center; min-height: var(--tap); }
  .rel-pick { min-height: var(--tap); justify-content: center; }
  .unopened .plain-list a { display: inline-flex; align-items: center; min-height: var(--tap); }
  /* Your thoughts: each label on its own line, chips that can be removed with a thumb, actions on their own line */
  .tag-row, .reaction-row { gap: var(--s2); }
  .tag-row > .row-label, .reaction-row > .row-label { flex: 1 1 100%; margin-right: 0; }
  .chip.removable { min-height: var(--tap); padding: 0 0 0 var(--s3); gap: var(--s2); }
  .chip.removable a { display: inline-flex; align-items: center; min-height: var(--tap); }
  .chip-x { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; font-size: var(--text-lg); }
  .annotations .suggest { display: flex; flex: 1 1 100%; gap: var(--s2); }
  .annotations .suggest .input { flex: 1; width: auto; min-width: 0; }
  .note .note-meta, .highlight .note-meta, .related .note-meta { flex: 1 1 100%; }
  .note-tools { flex: 1 1 100%; order: 3; gap: var(--s2); }
  .note .note-tools { margin: var(--s1) 0 calc(var(--s2) * -1); }
  .highlight .note-tools, .related .note-tools { margin-top: 0; }
  .highlight .note-tools { margin-bottom: calc(var(--s2) * -1); }
  .rel-link { display: flex; align-items: center; min-height: var(--tap); }
  .annotations { margin-top: var(--s6); padding-top: var(--s5); }

  .panel { padding: var(--s4); }
  .panel-heading h2 { font-size: var(--text-md); }
  .metrics { grid-template-columns: 1fr; gap: 0; border: var(--rule) solid var(--line); background: var(--surface); }
  .metric { display: grid; grid-template-columns: 1fr auto; align-items: center; padding: var(--s4); border: 0; border-top: var(--rule-strong) solid var(--accent); border-radius: 0; }
  .metric > strong { grid-column: 2; grid-row: 1 / 3; font-size: var(--text-2xl); }
  .metric > small { grid-column: 1; margin-top: var(--s1); }
  .insight-grid { grid-template-columns: 1fr; gap: var(--s4); }
  .bars { gap: var(--s1); height: var(--chart-h-phone); padding-inline: 0; }
  .bar-column small.sparse { visibility: hidden; }
  .feeling-grid strong { font-size: var(--text-lg); }
  .five-star a { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
  .five-star small { margin-left: 0; }
  .unopened { display: block; }
  .unopened .btn { margin-top: var(--s4); }
  .feed summary { flex-direction: column; gap: 0.1rem; position: relative; padding-left: 1.2rem; }
  .feed summary::before { position: absolute; left: 0; top: var(--s3); }
  .feed-body { padding-left: 0; }
  .feed-facts { white-space: normal; }
  .suggest .input { width: 8rem; }
  .toast { bottom: calc(var(--nav-h) + var(--s3) + env(safe-area-inset-bottom)); }
}

/* The narrowest phones: Back, Saved, Mark read and the menu still share one line, with their words. */
@media (max-width: 359px) {
  .pane-bar { padding-inline: var(--s2); }
  .pane-bar .btn { padding-inline: var(--s1); gap: var(--s1); }
}

/* Reduced motion: nothing drifts, fades, lifts or slides. The planet rests in its drawn pose. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn.primary:hover { transform: none !important; }
}
