/* Beyond Intelligence: a social news feed. Tokens first (documented in docs/DESIGN.md), then layout, then parts.
   System font stack, light and dark from prefers-color-scheme, motion on transform and opacity only. */

:root {
  color-scheme: light dark;

  /* Surfaces and text. Text on surface and on bg is 4.5:1 or more. */
  --bg: #ffffff;
  --surface: #f4f5f7;
  --surface-2: #eceef2;
  --text: #0f1419;
  --text-2: #2f3640;
  --muted: #5b6470;
  --border: #e5e7eb;
  --border-strong: #cfd3da;

  /* Accent: links, Follow, the active state, "Why it matters". */
  --accent: #1a5fd8;
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --good: #007a4d; /* up, always with a ▲ sign */
  --bad: #c42b1c; /* down, always with a ▼ sign */

  /* The unseen-story ring and the wordmark chip. */
  --ring-a: #f59e0b;
  --ring-b: #d6186c;
  --ring-c: #7c3aed;

  /* Sector palette: ten categories plus the brand slot (11). White text on each is 5:1 or more. */
  --s1: #5b3fd1; /* Foundation models */
  --s2: #0b6b8a; /* AI infra & chips */
  --s3: #2556d9; /* Dev tools & agents */
  --s4: #8f5200; /* Enterprise apps */
  --s5: #c0245f; /* Consumer apps */
  --s6: #2f7d1e; /* Robotics & hardware */
  --s7: #b4321f; /* Health & bio */
  --s8: #0a7a62; /* Fintech */
  --s9: #4b5563; /* Defense & security */
  --s10: #626672; /* Other, and any post without a sector */
  --s11: #1a5fd8; /* brand: briefs and today */
  --sc: var(--s10); /* the sector colour in scope; data-sector="n" sets it */
  --pill-fg-mix: 75%; /* share of the sector colour in pill text */
  --pill-bg-mix: 14%; /* share of the sector colour in pill background */

  /* Size and motion. */
  --bar-h: 52px;
  --tabs-h: 46px;
  --tabbar-h: 56px;
  --col-w: 600px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f;
    --surface: #16181d;
    --surface-2: #1e2128;
    --text: #f3f4f6;
    --text-2: #cfd4dc;
    --muted: #9aa1ad;
    --border: #262a31;
    --border-strong: #3a3f48;
    --accent: #6ea8ff;
    --on-accent: #0b0c0f;
    --good: #4ade9a;
    --bad: #ff8a7a;
    --pill-fg-mix: 35%;
    --pill-bg-mix: 22%;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.sheet-open, body.story-open { overflow: hidden; overscroll-behavior: none; }
html:has(body.sheet-open), html:has(body.story-open) { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 200; padding: 10px 14px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.skip:focus { top: 8px; }

/* Sector colour for anything with data-sector: avatars, pills, media, tiles, stories. */
[data-sector="1"] { --sc: var(--s1); } [data-sector="2"] { --sc: var(--s2); } [data-sector="3"] { --sc: var(--s3); }
[data-sector="4"] { --sc: var(--s4); } [data-sector="5"] { --sc: var(--s5); } [data-sector="6"] { --sc: var(--s6); }
[data-sector="7"] { --sc: var(--s7); } [data-sector="8"] { --sc: var(--s8); } [data-sector="9"] { --sc: var(--s9); }
[data-sector="10"] { --sc: var(--s10); } [data-sector="11"] { --sc: var(--s11); }

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

.shell { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100dvh; }
.col { min-width: 0; width: 100%; max-width: var(--col-w); margin: 0 auto; padding-bottom: calc(var(--tabbar-h) + var(--sab) + 12px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex;
  height: calc(var(--tabbar-h) + var(--sab)); padding-bottom: var(--sab);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px);
  border-top: 1px solid var(--border);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--muted); font-size: 11px; font-weight: 600; transition: color 0.15s; }
.tab.on { color: var(--text); }
.tab-ic { display: grid; place-items: center; transition: transform 0.2s var(--spring); }
.tab:active .tab-ic { transform: scale(0.88); }

.side { display: none; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 88px minmax(0, var(--col-w)); justify-content: center; }
  .col { grid-column: 2; padding-bottom: 40px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .tabbar {
    grid-column: 1; grid-row: 1; position: sticky; top: 0; left: auto; right: auto; bottom: auto; align-self: start;
    flex-direction: column; justify-content: flex-start; gap: 6px; height: 100dvh; padding: 14px 6px;
    border-top: 0; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tab { flex: none; width: 76px; height: 64px; border-radius: 16px; }
}
@media (min-width: 900px) and (hover: hover) { .tab:hover { background: var(--surface); } }
@media (min-width: 1100px) {
  .shell { grid-template-columns: 88px minmax(0, var(--col-w)) 320px; column-gap: 20px; }
  .side { display: block; grid-column: 3; position: sticky; top: 0; align-self: start; height: 100dvh; overflow-y: auto; padding: 12px 0 24px; scrollbar-width: thin; }
}

/* ------------------------------------------------------------ top bar and feed tabs */

.chrome {
  position: sticky; top: 0; z-index: 30; padding-top: var(--sat);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: transform 0.28s var(--ease);
}
.chrome.hide { transform: translateY(calc(-1 * var(--bar-h))); }
body:not([data-view="home"]) .chrome.hide { transform: translateY(calc(-1 * (var(--bar-h) + var(--sat)))); }
.bar { display: flex; align-items: center; height: var(--bar-h); padding: 0 4px 0 4px; gap: 2px; }
/* A root page has no Back button, so its title keeps the 16 px gutter itself. */
#back[hidden] + .bar-title, body[data-view="home"] .bar-title { padding-left: 12px; }
body[data-view="home"] #back { display: none; }
.bar-title { flex: 1; min-width: 0; margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title.is-mark { overflow: visible; }
.wm { font-size: 23px; font-weight: 900; letter-spacing: -0.045em; }
.wm-ai { margin-left: 6px; padding: 2px 6px; border-radius: 6px; vertical-align: 3px; font-size: 11px; font-weight: 900; letter-spacing: 0.05em; color: #fff; background: linear-gradient(135deg, var(--ring-b), var(--ring-c)); }
.bar-actions { display: flex; }
.bar-btn { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.bar-btn.on { color: var(--accent); }
@media (hover: hover) { .bar-btn:hover { background: var(--surface); } }

.feed-tabs { display: none; overflow-x: auto; scrollbar-width: none; }
.feed-tabs::-webkit-scrollbar { display: none; }
body[data-view="home"] .feed-tabs { display: flex; }
.ftab, .ptab { position: relative; flex: 1 0 auto; min-height: var(--tabs-h); padding: 0 16px; border: 0; background: none; color: var(--muted); font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: color 0.15s; }
.ftab[aria-selected="true"], .ptab[aria-selected="true"] { color: var(--text); font-weight: 800; }
.ftab::after, .ptab::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 44px; height: 4px; border-radius: 4px 4px 0 0; background: var(--accent); transform: translateX(-50%) scaleX(0); transition: transform 0.25s var(--spring); }
.ftab[aria-selected="true"]::after, .ptab[aria-selected="true"]::after { transform: translateX(-50%) scaleX(1); }
.ptabs { display: flex; margin-top: 14px; border-bottom: 1px solid var(--border); }
.ptab { flex: 1; padding: 0 8px; }
@media (hover: hover) { .ftab:hover, .ptab:hover { background: var(--surface); } }

/* ------------------------------------------------------------ stories rail */

.rail { display: flex; gap: 12px; overflow-x: auto; padding: 12px 16px 14px; border-bottom: 1px solid var(--border); scrollbar-width: none; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.rail::-webkit-scrollbar { display: none; }
.story { flex: none; width: 74px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: pointer; scroll-snap-align: start; }
.ring { display: block; width: 72px; height: 72px; padding: 3px; border-radius: 50%; background: conic-gradient(from 200deg, var(--ring-a), var(--ring-b), var(--ring-c), var(--ring-a)); transition: transform 0.2s var(--spring); }
.ring.seen { background: var(--border-strong); }
.story:active .ring { transform: scale(0.92); }
.ring > .av, .ring > .cover-av { width: 100%; height: 100%; border: 3px solid var(--bg); font-size: 20px; }
/* Story cover: the lead item's picture over the icon, which stays as the fallback. */
.cover-av { position: relative; display: block; flex: none; overflow: hidden; border-radius: 50%; background: linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #000)); }
.cover-av.sm { width: 32px; height: 32px; }
.cover-av.lg { width: 72px; height: 72px; }
.cover-av > .av.under { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: none; }
.cover-av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story-label { max-width: 74px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story .sk-line { margin: 0; }

/* ------------------------------------------------------------ avatars, pills */

.av { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; background: var(--sc); color: #fff; font-weight: 800; letter-spacing: -0.02em; user-select: none; -webkit-user-select: none; }
.av.sm { width: 32px; height: 32px; font-size: 13px; }
.av.md { width: 44px; height: 44px; font-size: 16px; }
.av.lg { width: 72px; height: 72px; font-size: 22px; }
.av.xl { width: 84px; height: 84px; border: 4px solid var(--bg); font-size: 30px; }
.av-link { display: block; flex: none; border-radius: 50%; }
.av-badge { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; display: grid; place-items: center; overflow: hidden; border: 2px solid var(--bg); border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: 9px; font-weight: 800; letter-spacing: 0; }
.av-badge img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }

.pill { display: inline-block; flex: none; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.5; white-space: nowrap; color: color-mix(in srgb, var(--sc) var(--pill-fg-mix), var(--text)); background: color-mix(in srgb, var(--sc) var(--pill-bg-mix), var(--bg)); }

/* ------------------------------------------------------------ post card */

.post { padding: 12px 16px 2px; border-bottom: 1px solid var(--border); }
.post-head { display: flex; align-items: center; gap: 10px; }
.post-who { min-width: 0; flex: 1; }
.post-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.post-name { min-width: 0; font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.post-name:hover { text-decoration: underline; }
.post-time { flex: none; font-size: 14px; color: var(--muted); }
.post-sub { margin-top: 1px; font-size: 13px; color: var(--muted); }
.top-label { color: var(--accent); font-weight: 800; }
.post-body { padding-top: 10px; cursor: pointer; }
.detail-post .post-body { cursor: default; }
.post-title { font-size: 19px; line-height: 1.25; font-weight: 800; letter-spacing: -0.015em; text-wrap: balance; }
.post-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.post-summary { margin-top: 6px; font-size: 15.5px; line-height: 1.45; color: var(--text-2); }
.post-summary.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more { min-height: 32px; margin-top: 2px; padding: 6px 0; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }
.why { margin-top: 8px; padding-left: 10px; border-left: 3px solid var(--accent); font-size: 14.5px; line-height: 1.4; }
.why-k { color: var(--accent); font-weight: 800; }

.media { position: relative; margin-top: 12px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 16px; background: var(--surface); }
.media-fb { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 18px; color: #fff; background: radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.24), transparent 46%), linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #000)); }
.media-big { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(32px, 10vw, 56px); font-weight: 900; letter-spacing: -0.045em; line-height: 1; word-break: break-word; }
.media-label { margin-top: 6px; font-size: 14px; font-weight: 700; opacity: 0.92; }
.media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media-badge { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); padding: 5px 11px; overflow: hidden; border-radius: 999px; background: rgba(0, 0, 0, 0.74); color: #fff; font-size: 13px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.media:not(.has-img) .media-badge { display: none; }

.facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fact { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.4; }
.fact-k { color: var(--muted); }
a.fact:active { background: var(--surface-2); }
@media (hover: hover) { a.fact:hover { background: var(--surface-2); } }

.actions { display: flex; align-items: center; justify-content: space-between; margin: 4px -10px 0; }
.act { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 22px; background: none; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer; transition: color 0.15s, background 0.15s, transform 0.18s var(--spring); }
.act:active { transform: scale(0.9); }
.act.on { color: var(--accent); }
@media (hover: hover) { .act:hover { color: var(--accent); background: var(--accent-soft); } }

.compact-list { display: grid; gap: 8px; }
.compact { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); transition: background 0.15s; }
.compact:active { background: var(--surface); }
.compact-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.compact-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; font-weight: 700; line-height: 1.3; }
.compact-meta { font-size: 13px; color: var(--muted); }
.block > .compact-list, .article .compact-list { padding: 0; }
.block > .compact-list { padding: 0; }

.sentinel { padding: 18px 16px; }
.end, .empty, .note { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty a { color: var(--accent); font-weight: 700; text-decoration: underline; }
.note { padding: 10px 16px; background: var(--surface); }
.empty-state { display: grid; gap: 10px; justify-items: center; padding: 48px 16px; text-align: center; }
.stamp { padding: 20px 16px 4px; text-align: center; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------ detail, blocks */

.block { padding: 18px 16px 6px; }
.block-title { margin-bottom: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.block-note { margin-left: 6px; font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--muted); }
.block:has(> .ent-list), .block:has(> .trend-list), .block:has(> .grid) { padding-left: 0; padding-right: 0; }
.block:has(> .ent-list) > .block-title, .block:has(> .trend-list) > .block-title, .block:has(> .grid) > .block-title { padding: 0 16px; }
.detail-post { border-bottom: 1px solid var(--border); }
.detail-post .post-title { font-size: 25px; line-height: 1.2; }
.detail-post .post-summary { font-size: 17px; }
.kvs { display: grid; margin: 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.take-preview { margin-bottom: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--text-2); font-size: 15.5px; line-height: 1.45; }
.src-list { display: grid; gap: 8px; }
.src-row { display: grid; gap: 2px; min-height: 56px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; }
.src-row:active { background: var(--surface); }
.src-pub { font-size: 14px; font-weight: 800; }
.src-title { font-size: 15px; line-height: 1.3; color: var(--text-2); }
.src-host { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.dots i.on { background: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--border-strong); border-radius: 22px; background: var(--bg); color: var(--text); font-size: 15px; font-weight: 800; cursor: pointer; transition: transform 0.18s var(--spring), background 0.15s; }
.btn:active { transform: scale(0.96); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.wide { display: flex; width: calc(100% - 32px); margin: 16px; }
.follow-btn { min-width: 104px; margin-bottom: 6px; border-color: var(--text); background: var(--text); color: var(--bg); }
.follow-btn.on { border-color: var(--border-strong); background: var(--bg); color: var(--text); }

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

.cover { height: 124px; background: radial-gradient(circle at 90% 0%, rgba(255, 255, 255, 0.28), transparent 50%), linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 48%, #000)); }
.prof-top { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 16px; margin-top: -44px; }
.prof-name { margin: 8px 16px 0; font-size: 26px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; overflow-wrap: anywhere; }
.prof-sub { margin: 4px 16px 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.prof-stats { margin: 8px 16px 0; font-size: 15px; font-weight: 600; color: var(--text-2); }
.ptab-body { min-height: 120px; }
.round-list { display: grid; }
.round-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.rr-main { display: flex; flex-direction: column; min-width: 0; }
.rr-title { overflow: hidden; font-size: 15px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.rr-meta { font-size: 13px; color: var(--muted); }
.rr-amt { flex: none; font-size: 17px; font-weight: 800; }
.ent-list { display: grid; }
.ent-row { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 16px; }
.ent-row:active { background: var(--surface); }
.ent-main { display: flex; flex-direction: column; min-width: 0; }
.ent-name { overflow: hidden; font-size: 15px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.ent-line { font-size: 13px; color: var(--muted); }

/* 3-column grid: top of the week, portfolios, sector companies. */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.tile { position: relative; display: block; aspect-ratio: 1; overflow: hidden; color: #fff; background: linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 52%, #000)); }
.tile-fb { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 10px; }
.tile-big { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: clamp(18px, 6vw, 30px); font-weight: 900; letter-spacing: -0.04em; line-height: 1; word-break: break-word; }
.tile-label, .tile-name { overflow: hidden; font-size: 12px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.tile > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.company-tile { display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; }
.tile-mono { position: absolute; top: 8px; left: 10px; font-size: clamp(30px, 10vw, 48px); font-weight: 900; letter-spacing: -0.05em; }
.tile-name { font-size: 13px; font-weight: 800; }
.explore-grid .tile:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.explore-grid .tile:first-child .tile-big { font-size: clamp(28px, 10vw, 52px); }
.tile:active { filter: brightness(0.92); }

/* ------------------------------------------------------------ explore */

.searchbar { display: flex; align-items: center; gap: 8px; height: 44px; margin: 12px 16px; padding: 0 14px; border-radius: 22px; background: var(--surface); color: var(--muted); }
.searchbar:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.searchbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; color: var(--text); font: inherit; font-size: 16px; }
.searchbar input::-webkit-search-cancel-button { appearance: none; }
.trend { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 16px; }
.trend:active { background: var(--surface); }
.trend-rank { width: 20px; flex: none; font-weight: 700; color: var(--muted); }
.trend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trend-tag { font-size: 16px; font-weight: 800; }
.trend-n { font-size: 13px; color: var(--muted); }
.chg { flex: none; font-size: 13px; font-weight: 800; }
.chg.up, .rise-pct.up { color: var(--good); }
.chg.down, .rise-pct.down { color: var(--bad); }
.chg.flat, .rise-pct.new, .rise-pct.flat { color: var(--muted); }
.rise-list { display: grid; gap: 8px; }
.rise { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name amt" "pct spark"; gap: 4px 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-left: 4px solid var(--sc); border-radius: 14px; }
.rise:active { background: var(--surface); }
.rise-name { grid-area: name; font-size: 15px; font-weight: 800; }
.rise-amt { grid-area: amt; justify-self: end; font-size: 17px; font-weight: 800; }
.rise-pct { grid-area: pct; font-size: 13px; font-weight: 800; }
.rise .spark { grid-area: spark; justify-self: end; color: color-mix(in srgb, var(--sc) 55%, var(--text)); }

/* ------------------------------------------------------------ briefs */

.seg { display: flex; gap: 4px; margin: 12px 16px; padding: 4px; border-radius: 12px; background: var(--surface); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 14px; font-weight: 800; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }
.brief-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-bottom: 1px solid var(--border); }
.brief-card:active { background: var(--surface); }
.brief-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.brief-h { font-size: 19px; font-weight: 800; line-height: 1.25; letter-spacing: -0.015em; }
.brief-s { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.45; color: var(--muted); }

.article { padding: 22px 16px 8px; }
.art-eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); }
.art-h { margin: 8px 0 12px; font-size: 31px; font-weight: 900; line-height: 1.1; letter-spacing: -0.035em; text-wrap: balance; }
.art-lede { font-size: 18px; line-height: 1.5; color: var(--text-2); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 22px 0 4px; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--border); }
.stat { margin: 0; padding: 12px 14px; background: var(--bg); }
.stat dt { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-size: 26px; font-weight: 900; letter-spacing: -0.03em; }
.stat-sub { font-size: 12px; color: var(--muted); }
@media (min-width: 520px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.art-sec h2 { margin: 30px 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.bullet { margin-top: 14px; }
.bullet > p { margin-bottom: 10px; font-size: 17px; line-height: 1.55; }
.more-posts { margin-top: 8px; }
.more-posts summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); font-size: 14px; font-weight: 700; cursor: pointer; }
.more-posts[open] summary { margin-bottom: 4px; }
.art-nav { display: flex; justify-content: space-between; margin: 32px 0 8px; }
.art-nav a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--accent); font-weight: 800; }
.art-foot { margin-top: 12px; font-size: 12px; }

/* ------------------------------------------------------------ following */

.fchips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 6px; }
.fchip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 26px; background: var(--bg); }
.fchip-main { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 4px 6px 6px; }
.fchip-name { max-width: 160px; overflow: hidden; font-size: 14px; font-weight: 800; white-space: nowrap; text-overflow: ellipsis; }
.fchip-type { font-size: 12px; color: var(--muted); }
.fchip-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.fchip-x:active { color: var(--bad); }

/* ------------------------------------------------------------ desktop rail */

.rail-card { margin: 12px 0; padding: 12px 0 4px; border-radius: 16px; background: var(--surface); }
.rail-card .block-title { padding: 0 16px; font-size: 18px; }
.rail-more { display: block; padding: 12px 16px; color: var(--accent); font-weight: 700; }
.rail-search { margin: 0 0 12px; }

/* ------------------------------------------------------------ sheet and toast */

.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s; }
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: 88dvh; padding-bottom: var(--sab); border-radius: 22px 22px 0 0; background: var(--bg); color: var(--text); transform: translate3d(0, 100%, 0); transition: transform 0.3s var(--ease); outline: none; }
.sheet.open .sheet-panel { transform: none; }
.sheet-panel.dragging { transition: none; }
.sheet-bar { position: relative; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 14px 8px 0; }
.sheet-grab { position: absolute; top: 0; left: 50%; display: grid; place-items: center; width: 120px; height: 24px; transform: translateX(-50%); touch-action: none; cursor: grab; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--border-strong); }
.sheet-title { grid-column: 2; text-align: center; font-size: 16px; font-weight: 800; }
.sheet-close { grid-column: 3; }
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px 20px; }
@media (min-width: 760px) {
  .sheet-panel { left: 50%; right: auto; bottom: auto; top: 50%; width: 520px; border-radius: 22px; opacity: 0; transform: translate(-50%, -46%) scale(0.97); transition: transform 0.25s var(--ease), opacity 0.2s; }
  .sheet.open .sheet-panel { opacity: 1; transform: translate(-50%, -50%); }
  .sheet-grab { display: none; }
}
.take-text { display: block; width: 100%; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; line-height: 1.45; resize: vertical; }
.take-text:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.take-meta { margin: 8px 2px 14px; font-size: 13px; color: var(--muted); }
.take-meta.over { color: var(--bad); }
.take-meta.over::after { content: " · cut to fit when copied"; }
.take-btns { display: grid; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--sab) + 16px); z-index: 90; max-width: calc(100vw - 32px); padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 700; pointer-events: none; opacity: 0; transform: translate(-50%, 12px); transition: opacity 0.2s, transform 0.25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ------------------------------------------------------------ story viewer */

.sv { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #000; outline: none; overscroll-behavior: none; touch-action: none; }
.sv-card { position: relative; width: 100vw; max-width: 100vw; height: 100dvh; overflow: hidden; background: #000; color: #fff; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.sv.open .sv-card { animation: sv-in 0.26s var(--ease); }
.sv-card.snap { transition: transform 0.22s var(--ease); }
@media (min-width: 700px) {
  .sv-card { height: min(100dvh, 900px); width: calc(min(100dvh, 900px) * 9 / 16); border-radius: 18px; }
}
.sv-bars { position: absolute; z-index: 3; top: calc(var(--sat) + 10px); left: 10px; right: 10px; display: flex; gap: 4px; }
.sv-bar { flex: 1; height: 3px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
.sv-bar b { display: block; width: 100%; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.sv-bar.done b { transform: scaleX(1); }
.sv-bar.run b { animation: sv-fill 6s linear forwards; }
.sv.paused .sv-bar.run b { animation-play-state: paused; }
.sv-head { position: absolute; z-index: 3; top: calc(var(--sat) + 22px); left: 12px; right: 4px; display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); }
.sv-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sv-title { font-size: 15px; font-weight: 800; }
.sv-count { font-size: 12px; font-weight: 600; opacity: 0.85; }
.sv-x { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: #fff; cursor: pointer; }
.sv-slide { position: absolute; inset: 0; background: #000; }
.sv-art { position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(255, 255, 255, 0.22), transparent 50%), linear-gradient(160deg, var(--sc), color-mix(in srgb, var(--sc) 42%, #000)); }
.sv-slide.in .sv-art { animation: sv-slide 0.28s var(--ease); }
.sv-bg { position: absolute; inset: 0; }
.sv-bg img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.sv-bg.plain { display: none; }
.sv-bg.collage { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 2px; }
.sv-bg.collage.c1 { grid-template-columns: 1fr; }
.sv-bg.collage.c3 img:first-child { grid-column: span 2; }
.sv-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.12) 24%, rgba(0, 0, 0, 0.5) 44%, rgba(0, 0, 0, 0.88) 66%, #000 100%); }
.sv-copy { position: absolute; left: 20px; right: 20px; bottom: calc(86px + var(--sab)); display: flex; flex-direction: column; gap: 10px; }
.sv-chip { align-self: flex-start; padding: 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.22); font-size: 13px; font-weight: 800; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sv-big { font-size: clamp(56px, 20vw, 96px); font-weight: 900; letter-spacing: -0.055em; line-height: 0.95; word-break: break-word; }
.sv-big.long { font-size: clamp(36px, 12vw, 60px); line-height: 1; }
.sv-h { font-size: 29px; font-weight: 900; line-height: 1.1; letter-spacing: -0.03em; text-wrap: balance; }
.sv-text { font-size: 18px; line-height: 1.4; font-weight: 500; }
.sv-co { font-size: 14px; font-weight: 700; opacity: 0.9; }
.sv-foot { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px calc(14px + var(--sab)); }
.sv-src { max-width: 50%; overflow: hidden; color: #fff; font-size: 13px; font-weight: 700; text-decoration: underline; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.sv-more { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-left: auto; padding: 0 20px 0 14px; border-radius: 22px; background: #fff; color: #000; font-weight: 800; }
.glyph { font-weight: 900; letter-spacing: -0.03em; }
@keyframes sv-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes sv-slide { from { opacity: 0.4; transform: scale(1.025); } to { opacity: 1; transform: none; } }
@keyframes sv-fill { to { transform: scaleX(1); } }

/* ------------------------------------------------------------ skeleton */

.sk { position: relative; display: block; overflow: hidden; border-radius: 8px; background: var(--surface); }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 8%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-post { display: grid; gap: 0; padding: 14px 16px 18px; border-bottom: 1px solid var(--border); }
.sk-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sk-col { flex: 1; display: grid; gap: 4px; }
.sk-col .sk-line { margin: 2px 0; }
.sk-circle { width: 44px; height: 44px; border-radius: 50%; }
.sk-ring { width: 72px; height: 72px; border-radius: 50%; }
.sk-line { height: 13px; margin: 5px 0; }
.sk-media { aspect-ratio: 16 / 9; margin-top: 12px; border-radius: 16px; }
.w25 { width: 25%; } .w40 { width: 40%; } .w60 { width: 60%; } .w70 { width: 70%; } .w90 { width: 90%; }

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

@media (prefers-reduced-motion: reduce) {
  .chrome, .sheet-panel, .sheet-backdrop, .toast, .act, .ring, .tab-ic, .btn, .ftab::after, .ptab::after, .sv-card.snap, .cluster-btn::after { transition: none; }
  .sv.open .sv-card, .sv-slide.in .sv-art, .sk::after { animation: none; }
  .tab:active .tab-ic, .story:active .ring, .act:active, .btn:active { transform: none; }
}

/* ------------------------------------------------------------ clustered coverage */

.cluster { margin-top: 6px; }
.cluster-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 800; cursor: pointer; }
.cluster-btn::after { content: ""; width: 7px; height: 7px; margin: -2px 0 0 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.2s var(--ease); }
.cluster-btn.open::after { margin-top: 3px; transform: rotate(-135deg); }
.cluster-list { margin: 0 0 4px; padding: 0; list-style: none; border-left: 3px solid var(--border-strong); }
.cluster-row { display: grid; gap: 2px; padding: 8px 0 8px 12px; }
.cluster-row + .cluster-row { border-top: 1px solid var(--border); }
.cluster-title { font-size: 15px; font-weight: 700; line-height: 1.3; }
.cluster-title:hover { text-decoration: underline; }
.cluster-meta { font-size: 13px; color: var(--muted); }
.cluster-meta a { color: var(--accent); font-weight: 700; }
