/* AX-NEWS — design system and pages (2026-10 rework).
 *
 * One stylesheet for every page built on templates/base.html. Colours are
 * tokens: dark by default (the AXIOM night blue), light under
 * [data-theme="light"]. The feed has six views (cards, magazine, micro,
 * list, mosaic, timeline), chosen by a class on #feed.
 */

@font-face { font-family: "Inter"; src: url("../fonts/inter-latin.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --bg: #060a13;
  --bg-glow: radial-gradient(1200px 600px at 70% -10%, rgba(76, 110, 255, .16), transparent 60%),
             radial-gradient(900px 500px at -10% 10%, rgba(139, 92, 246, .10), transparent 60%);
  --surface: #0c1324;
  --surface-2: #111a30;
  --surface-3: #17213c;
  --overlay: rgba(3, 6, 14, .66);
  --line: rgba(148, 163, 184, .13);
  --line-2: rgba(148, 163, 184, .24);
  --text: #e9eef8;
  --text-2: #b9c3d7;
  --muted: #8491a9;
  --accent: #5b8cff;
  --accent-2: #8b5cf6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(91, 140, 255, .14);
  --focus: #9db8ff;
  --pos: #34d399;
  --neg: #fb923c;
  --vneg: #f87171;
  --break: #c084fc;
  --warn: #fbbf24;
  --ok: #34d399;
  --err: #f87171;

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 18px 40px -18px rgba(0, 0, 0, .75), 0 2px 6px rgba(0, 0, 0, .35);
  --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, .8);
  --ring: 0 0 0 3px rgba(91, 140, 255, .35);

  --topbar-h: 64px;
  --rail-l: 252px;
  --rail-r: 304px;
  --gap: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-glow: radial-gradient(1200px 600px at 70% -10%, rgba(76, 110, 255, .10), transparent 60%),
             radial-gradient(900px 500px at -10% 10%, rgba(139, 92, 246, .06), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f3f5fa;
  --surface-3: #e9edf5;
  --overlay: rgba(15, 23, 42, .38);
  --line: rgba(15, 23, 42, .09);
  --line-2: rgba(15, 23, 42, .16);
  --text: #0c1424;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #2f63f6;
  --accent-2: #7c3aed;
  --accent-soft: rgba(47, 99, 246, .10);
  --focus: #2f63f6;
  --pos: #059669;
  --neg: #ea580c;
  --vneg: #dc2626;
  --break: #9333ea;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-2: 0 18px 40px -22px rgba(15, 23, 42, .28), 0 2px 6px rgba(15, 23, 42, .06);
  --shadow-3: 0 30px 80px -24px rgba(15, 23, 42, .35);
  --ring: 0 0 0 3px rgba(47, 99, 246, .25);
  color-scheme: light;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.55 var(--font-ui);
  color: var(--text);
  background: var(--bg-glow), var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ── Buttons, inputs, chips ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 8px 24px -10px rgba(91, 140, 255, .8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--err); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: rgba(91, 140, 255, .45); color: var(--accent); }

.input, .select, textarea.input {
  height: 42px; width: 100%; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 96px; padding: 10px 14px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--ring); }
.input::placeholder { color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .count { font-size: 11.5px; opacity: .7; font-variant-numeric: tabular-nums; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.tag.link:hover { background: var(--accent-soft); color: var(--accent); }
.tag.topic { background: color-mix(in srgb, var(--topic, var(--accent)) 18%, transparent); color: color-mix(in srgb, var(--topic, var(--accent)) 75%, var(--text)); }
.tag.translated { background: rgba(139, 92, 246, .14); color: var(--break); }
.tag.mine { background: rgba(236, 72, 153, .14); color: #f472b6; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.s-breakthrough { --s: var(--break); } .s-very_positive, .s-positive { --s: var(--pos); }
.s-negative { --s: var(--neg); } .s-very_negative { --s: var(--vneg); } .s-neutral { --s: var(--muted); }
.sentiment { display: inline-flex; align-items: center; gap: 6px; color: var(--s); font-size: 12px; font-weight: 600; }
.sentiment .dot { background: var(--s); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s) 20%, transparent); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-1); }

.avatar {
  --h: 220; width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font: 700 12px/1 var(--font-display);
  color: hsl(var(--h) 90% 88%); background: linear-gradient(135deg, hsl(var(--h) 55% 38%), hsl(calc(var(--h) + 40) 55% 28%));
}
[data-theme="light"] .avatar { color: hsl(var(--h) 70% 22%); background: linear-gradient(135deg, hsl(var(--h) 70% 86%), hsl(calc(var(--h) + 40) 70% 80%)); }
.avatar.lg { width: 40px; height: 40px; border-radius: 12px; font-size: 16px; }

.card-surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.panel h3, .rail h3 { margin: 0 0 12px; font: 600 12px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ── Top bar ──────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 18px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { height: 30px; width: auto; }
.brand .word { font: 700 17px/1 var(--font-display); letter-spacing: .02em; }
.brand .word span { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.search { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { height: 40px; width: 100%; padding: 0 64px 0 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
.search input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
kbd { font: 600 11px/1 var(--font-mono); padding: 4px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); background: var(--surface-2); }
.actions { display: flex; align-items: center; gap: 8px; flex: none; }
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--shadow-3); display: none; z-index: 60;
}
.menu.open .menu-pop { display: block; animation: pop .14s var(--ease); }
.menu-pop a, .menu-pop button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font-size: 14px; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); color: var(--text); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 2px; }
.menu-pop .who { padding: 10px; display: flex; gap: 10px; align-items: center; }
.menu-pop .who b { display: block; font-size: 14px; }
.menu-pop .who small { color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── Shell ────────────────────────────────────────────────────────────── */
.shell {
  display: grid; grid-template-columns: var(--rail-l) minmax(0, 1fr) var(--rail-r);
  gap: var(--gap); max-width: 1640px; margin: 0 auto; padding: 22px 24px 80px;
}
.rail { position: sticky; top: calc(var(--topbar-h) + 22px); align-self: start; max-height: calc(100vh - var(--topbar-h) - 44px); overflow: auto; scrollbar-width: thin; padding-right: 2px; }
.rail-l .group + .group { margin-top: 22px; }
.topic-link {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); font-size: 14px; font-weight: 500; text-align: left;
}
.topic-link:hover { background: var(--surface-2); color: var(--text); }
.topic-link.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--topic, var(--accent)); }
.topic-link .thumb { width: 28px; height: 28px; border-radius: 8px; background-size: cover; background-position: 70% 50%; flex: none; box-shadow: 0 0 0 1px var(--line); }
.topic-link .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-link .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.topic-link .count b { color: var(--accent); font-weight: 600; }
.topic-link .err { color: var(--err); }

/* ── Feed header ──────────────────────────────────────────────────────── */
.feed-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.feed-head h1 { margin: 0; font: 700 clamp(24px, 2.4vw, 32px)/1.1 var(--font-display); letter-spacing: -.01em; }
.feed-head .sub { margin-top: 6px; color: var(--muted); font-size: 14px; }
.feed-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.scope-tabs { margin-bottom: 16px; }
.topics-strip { display: none; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px 6px; scrollbar-width: none; }
.topics-strip::-webkit-scrollbar { display: none; }
.new-pill {
  position: sticky; top: calc(var(--topbar-h) + 12px); z-index: 20; margin: 0 auto 14px; width: max-content;
  display: none; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; font-size: 13.5px;
  box-shadow: 0 12px 30px -10px rgba(91, 140, 255, .9);
}
.new-pill.show { display: flex; animation: pop .2s var(--ease); }

/* ── Article atoms ────────────────────────────────────────────────────── */
.art { position: relative; cursor: pointer; }
.art .src { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.art .src b { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; }
.art .src time { white-space: nowrap; flex: none; }
.art .src .sep { opacity: .5; }
.art .title { margin: 0; font: 600 17px/1.32 var(--font-display); letter-spacing: -.005em; color: var(--text); overflow-wrap: anywhere; }
.art:hover .title { color: color-mix(in srgb, var(--text) 82%, var(--accent)); }
.art .excerpt { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.art.read .title { color: var(--muted); }
.art .meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.art .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.art.kb { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-lg); }
.save-btn { position: relative; z-index: 2; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); }
.save-btn:hover { background: var(--surface-2); color: var(--text); }
.save-btn[aria-pressed="true"] { color: var(--warn); }
.save-btn[aria-pressed="true"] svg { fill: currentColor; }

.media { position: relative; overflow: hidden; background: var(--surface-2); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease), opacity .3s; }
.art:hover .media img { transform: scale(1.035); }
.media.art-fallback img { object-position: 72% 50%; }
.media .label {
  position: absolute; left: 12px; bottom: 10px; z-index: 1;
  font: 700 10.5px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: #fff;
  padding: 6px 8px; border-radius: 6px; background: rgba(5, 9, 20, .55); backdrop-filter: blur(6px);
}
.media.art-fallback::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(6, 10, 19, .2), transparent 60%); }

/* ── View: cards ──────────────────────────────────────────────────────── */
.view-cards .items { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 18px; }
.view-cards .art { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.view-cards .art:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-2); }
.view-cards .media { aspect-ratio: 16 / 9; }
.view-cards .body { display: flex; flex-direction: column; gap: 9px; padding: 14px 16px 12px; flex: 1; }
.view-cards .title { font-size: 16.5px; }
.view-cards .excerpt { font-size: 13.5px; }
.view-cards .meta { margin-top: auto; padding-top: 4px; justify-content: space-between; }

/* ── View: magazine ───────────────────────────────────────────────────── */
.view-magazine .items { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.view-magazine .art { grid-column: span 2; display: flex; flex-direction: column; gap: 10px; }
.view-magazine .art .media { aspect-ratio: 3 / 2; border-radius: var(--radius); }
.view-magazine .art.lead { grid-column: 1 / -1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; align-items: center; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.view-magazine .art.lead .media { aspect-ratio: 16 / 9; border-radius: var(--radius-lg); }
.view-magazine .art.lead .title { font-size: clamp(22px, 2vw, 30px); line-height: 1.16; letter-spacing: -.015em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.view-magazine .art.lead .excerpt { font-size: 16px; -webkit-line-clamp: 4; }
.view-magazine .art.second { grid-column: span 3; }
.view-magazine .art.second .title { font-size: 21px; }
.view-magazine .art .body { display: flex; flex-direction: column; gap: 10px; }
.view-magazine .art:not(.lead):not(.second) .excerpt { display: none; }
.view-magazine .kicker { font: 700 11px/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--topic, var(--accent)); }

/* ── View: micro ──────────────────────────────────────────────────────── */
.view-micro .items { display: grid; gap: 12px; max-width: 760px; margin: 0 auto; }
.view-micro .art {
  display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 16px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  transition: border-color .15s, box-shadow .2s, transform .2s var(--ease);
}
.view-micro .art:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.view-micro .art .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.view-micro .art .title { font-size: 17.5px; }
.view-micro .art .media { width: 112px; height: 112px; border-radius: 14px; align-self: start; }
.view-micro .art .meta { justify-content: space-between; }
.view-micro .art::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--topic, var(--accent)); opacity: .9; }

/* ── View: list ───────────────────────────────────────────────────────── */
.view-list .items { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.view-list .day { padding: 14px 18px 8px; font: 700 11.5px/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.view-list .art { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.view-list .art:hover { background: var(--surface-2); }
.view-list .time { font: 600 12.5px/1 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.view-list .title { font: 500 15px/1.35 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-list .src { justify-content: flex-end; min-width: 0; max-width: 220px; }
.view-list .src b { max-width: 100%; }

/* ── View: mosaic ─────────────────────────────────────────────────────── */
.view-mosaic .items { columns: 4 250px; column-gap: 16px; }
.view-mosaic .art { break-inside: avoid; margin-bottom: 16px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-1); display: block; }
.view-mosaic .art .media { aspect-ratio: var(--ar, 4 / 5); }
.view-mosaic .art .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 7, 15, 0) 30%, rgba(4, 7, 15, .86) 100%); }
.view-mosaic .art .body { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.view-mosaic .art .title { color: #fff; font-size: 17px; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.view-mosaic .art .src, .view-mosaic .art .src b { color: rgba(255, 255, 255, .8); }
.view-mosaic .art .save-btn { position: absolute; top: 10px; right: 10px; background: rgba(5, 9, 20, .5); color: #fff; backdrop-filter: blur(6px); }
.view-mosaic .media .label { top: 12px; bottom: auto; }

/* ── View: timeline ───────────────────────────────────────────────────── */
.view-timeline .items { position: relative; max-width: 840px; margin: 0 auto; padding-left: 92px; }
.view-timeline .items::before { content: ""; position: absolute; left: 70px; top: 6px; bottom: 0; width: 2px; background: linear-gradient(var(--line-2), transparent); }
.view-timeline .hour { position: relative; margin: 26px 0 10px; font: 700 13px/1 var(--font-display); color: var(--text); }
.view-timeline .hour:first-child { margin-top: 4px; }
.view-timeline .hour span { position: absolute; left: -92px; width: 62px; text-align: right; color: var(--muted); font: 600 12px/1 var(--font-mono); top: 1px; }
.view-timeline .hour::before { content: ""; position: absolute; left: -27px; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.view-timeline .art { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.view-timeline .art:hover { border-color: var(--line-2); }
.view-timeline .art .media { width: 76px; height: 54px; border-radius: 10px; }
.view-timeline .art .title { font-size: 15.5px; }
.view-timeline .art .body { display: grid; gap: 5px; min-width: 0; }

/* ── States ───────────────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-card { height: 320px; border-radius: var(--radius-lg); }
.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty h2 { margin: 12px 0 6px; color: var(--text); font: 600 20px/1.2 var(--font-display); }
.empty .art-hero { width: min(420px, 90%); aspect-ratio: 16 / 9; margin: 0 auto; border-radius: var(--radius-lg); background-size: cover; background-position: 70% 50%; opacity: .9; }
.sentinel { height: 40px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

/* ── Right rail ───────────────────────────────────────────────────────── */
.rail-r .panel + .panel { margin-top: 16px; }
.stat-big { font: 700 34px/1 var(--font-display); letter-spacing: -.02em; }
.stat-big + p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.trend { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 7px 4px; border: 0; background: none; border-radius: 9px; color: var(--text-2); font-size: 14px; text-align: left; }
.trend:hover { background: var(--surface-2); color: var(--text); }
.trend .rank { font: 700 12px/1 var(--font-mono); color: var(--muted); }
.trend .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.trend .n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; grid-column: 2 / -1; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 3px; }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; font-size: 13px; color: var(--muted); align-items: center; }

/* ── Reader (drawer) ──────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 80; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity .2s; backdrop-filter: blur(2px); }
.scrim.open { opacity: 1; pointer-events: auto; }
.reader {
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: min(760px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line-2); box-shadow: var(--shadow-3);
  transform: translateX(104%); transition: transform .32s var(--ease); display: flex; flex-direction: column;
}
.reader.open { transform: none; }
.reader-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.reader-bar .grow { flex: 1; }
.reader-body { overflow: auto; padding: 0 0 40px; overscroll-behavior: contain; }
.reader .hero { aspect-ratio: 16 / 8; position: relative; }
.reader .hero img { width: 100%; height: 100%; object-fit: cover; }
.reader .hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, var(--surface)); }
.reader .content { padding: 4px 34px 0; position: relative; margin-top: -40px; }
.reader h1 { margin: 12px 0 14px; font: 700 clamp(24px, 3vw, 32px)/1.16 var(--font-display); letter-spacing: -.015em; }
.reader .byline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.reader .byline b { color: var(--text); }
.reader .lede { font-size: 17.5px; line-height: 1.65; color: var(--text); }
.reader .text p { font-size: 16px; line-height: 1.75; color: var(--text-2); margin: 0 0 14px; }
.reader .cta { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0; }
.reader .ai { margin-top: 26px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.reader .ai .msg { padding: 10px 12px; border-radius: 12px; margin: 8px 0; font-size: 14.5px; white-space: pre-wrap; }
.reader .ai .msg.me { background: var(--accent-soft); }
.reader .ai .msg.bot { background: var(--surface); border: 1px solid var(--line); }

/* ── Toasts, dialogs ──────────────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: var(--shadow-3); animation: pop .18s var(--ease); }
.toast.error { background: var(--err); color: #fff; }

/* ── Account / admin pages ────────────────────────────────────────────── */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 90px; }
.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-head h1 { margin: 0; font: 700 30px/1.1 var(--font-display); letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs button { height: 42px; padding: 0 14px; border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.add-box { padding: 22px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface) 60%); border: 1px solid var(--line-2); border-radius: var(--radius-lg); }
.add-box h2 { margin: 0 0 6px; font: 700 20px/1.2 var(--font-display); }
.add-box p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.add-row { display: flex; gap: 10px; }
.add-row .input { height: 46px; border-radius: 999px; padding: 0 18px; }
.add-row .btn { height: 46px; padding: 0 20px; }
.examples { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.found { display: grid; gap: 10px; margin-top: 16px; }
.found-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.found-item .t { font-weight: 600; }
.found-item .u { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.found-item ul { margin: 6px 0 0; padding-left: 16px; color: var(--text-2); font-size: 13px; }
.kind { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.kind.youtube { color: #ff4d4d; } .kind.reddit { color: #ff6a2b; } .kind.github { color: var(--text); }
.kind.mastodon { color: #8c8dff; } .kind.hackernews { color: #ff8a3d; } .kind.rss { color: #fb923c; }
.src-list { display: grid; gap: 10px; }
.src-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.src-row.off { opacity: .55; }
.src-row .t { font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; }
.src-row .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row .s { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.src-row .s .bad { color: var(--err); }
.src-row .s .good { color: var(--ok); }
.src-row .ops { display: flex; gap: 4px; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s var(--ease); box-shadow: var(--shadow-1); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.option-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.option-card { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); text-align: left; color: var(--text-2); }
.option-card:hover { border-color: var(--line-2); color: var(--text); }
.option-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: var(--ring); color: var(--text); }
.option-card .pic { height: 64px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); }
.option-card b { font-size: 14px; }
.option-card small { color: var(--muted); font-size: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.kpi b { display: block; font: 700 28px/1.1 var(--font-display); }
.kpi span { color: var(--muted); font-size: 13px; }
.alert { padding: 11px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; display: none; }
.alert.show { display: block; }
.alert.err { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.alert.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

/* ── Sign-in ──────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); }
.auth-art { position: relative; background-size: cover; background-position: center; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 7, 15, .1), rgba(4, 7, 15, .65)); }
.auth-art .pitch { position: absolute; left: 48px; bottom: 56px; right: 48px; z-index: 1; color: #fff; max-width: 520px; }
.auth-art .pitch h2 { font: 700 clamp(28px, 3.2vw, 44px)/1.08 var(--font-display); margin: 0 0 12px; letter-spacing: -.02em; }
.auth-art .pitch p { margin: 0; color: rgba(255, 255, 255, .8); font-size: 16px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-card .brand { margin-bottom: 30px; }
.auth-card h1 { margin: 0 0 6px; font: 700 28px/1.15 var(--font-display); }
.auth-card > p { margin: 0 0 22px; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ── Footer, prose ────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 28px 24px 40px; color: var(--muted); font-size: 13px; }
.footer-inner { max-width: 1640px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }
.footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.prose { max-width: 780px; margin: 0 auto; padding: 34px 24px 80px; }
.prose h1 { font: 700 clamp(28px, 3.4vw, 40px)/1.1 var(--font-display); letter-spacing: -.02em; margin: 0 0 14px; }
.prose h2 { font: 700 22px/1.25 var(--font-display); margin: 34px 0 10px; }
.prose h3 { font: 600 17px/1.3 var(--font-display); margin: 24px 0 8px; }
.prose p, .prose li { color: var(--text-2); font-size: 16px; line-height: 1.75; }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; }
.prose code { font-family: var(--font-mono); font-size: .9em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.prose .flow-box { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font: 13.5px/1.9 var(--font-mono); color: var(--text-2); }

/* ── Bottom bar (phones) ──────────────────────────────────────────────── */
.bottombar { display: none; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1360px) {
  .shell { grid-template-columns: var(--rail-l) minmax(0, 1fr); }
  .rail-r { display: none; }
}
@media (max-width: 1020px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-top: 16px; }
  .rail-l { display: none; }
  .topics-strip { display: flex; }
  .nav { display: none; }
  .view-magazine .items { grid-template-columns: repeat(2, 1fr); }
  .view-magazine .art, .view-magazine .art.second { grid-column: span 1; }
  .view-magazine .art.lead { grid-template-columns: 1fr; gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 260px; }
  .auth-art .pitch { left: 24px; right: 24px; bottom: 24px; }
}
@media (max-width: 680px) {
  :root { --topbar-h: 58px; }
  body { font-size: 14.5px; }
  .topbar { gap: 10px; padding: 0 14px; }
  .brand .word { display: none; }
  .search kbd { display: none; }
  .search input { padding-right: 14px; }
  .shell, .page { padding-left: 14px; padding-right: 14px; padding-bottom: 96px; }
  .feed-head { align-items: flex-start; }
  .feed-tools .segmented button span { display: none; }
  .view-cards .items { grid-template-columns: 1fr; }
  .view-magazine .items { grid-template-columns: 1fr; }
  .view-micro .art { grid-template-columns: minmax(0, 1fr) 84px; padding: 14px; }
  .view-micro .art .media { width: 84px; height: 84px; }
  .view-list .art { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .view-list .art .src { display: none; }
  .view-list .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .view-mosaic .items { columns: 2 150px; column-gap: 10px; }
  .view-mosaic .art { margin-bottom: 10px; }
  .view-mosaic .art .title { font-size: 14.5px; }
  .view-timeline .items { padding-left: 64px; }
  .view-timeline .items::before { left: 46px; }
  .view-timeline .hour span { left: -64px; width: 40px; }
  .view-timeline .hour::before { left: -24px; }
  .view-timeline .art { grid-template-columns: 60px minmax(0, 1fr); }
  .view-timeline .art .media { width: 60px; height: 46px; }
  .reader .content { padding: 4px 18px 0; }
  .add-row { flex-direction: column; }
  .bottombar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  }
  .bottombar a { display: grid; place-items: center; gap: 2px; align-content: center; color: var(--muted); font-size: 11px; font-weight: 600; }
  .bottombar a[aria-current="page"] { color: var(--accent); }
  .actions .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Content pages (about, privacy, contact, architecture, landing) ───── */
.prose .page-title { margin-bottom: 8px; }
.prose .page-subtitle, .prose .sub { color: var(--muted); font-size: 17px; margin: 0 0 26px; }
.prose h1 span { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.prose .callout { padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
.prose .contact-card { display: flex; gap: 16px; align-items: flex-start; padding: 18px; margin: 14px 0; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); }
.prose .contact-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 20px; flex: none; }
.prose .contact-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.prose .contact-value { font: 600 17px/1.4 var(--font-display); margin: 2px 0 4px; }
.prose .contact-desc { color: var(--text-2); font-size: 14px; }
.prose .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 26px 0; }
.prose .stat { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); text-align: center; }
.prose .stat-n { font: 700 30px/1 var(--font-display); }
.prose .stat-l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.prose .cats { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.prose .cat { display: inline-flex; height: 30px; align-items: center; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 13px; }
.prose .cta { display: inline-flex; align-items: center; height: 44px; padding: 0 20px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff !important; font-weight: 600; margin-top: 10px; }
.prose .cta:hover { text-decoration: none !important; filter: brightness(1.08); }
.prose .flow-arrow { color: var(--accent); margin: 0 6px; }
@media (max-width: 680px) { .prose .stats { grid-template-columns: 1fr; } }
