/* ============================================================
 * server/lib/article-static.css — single stylesheet pushed to
 * <published_root_folder>/style.css alongside every synced article.
 *
 * Self-contained: final hex values, no var() chain back to the
 * portal's tokens.css / themes.css. Supports light + dark via
 * [data-theme="…"] on <html>, set by the inline theme-before-paint
 * script in each generated page (which honours ?theme= and the
 * postMessage 'set-theme' protocol).
 *
 * Covers: the 6 layout variants (.ae-layout-classic / .ae-layout-split
 * / .ae-layout-hero-overlay / .ae-layout-longform / .ae-layout-photo-
 * essay / .ae-layout-magazine) + master index (.idx-*) + the body
 * typography reused by all six (h1..h3, p, ul/ol, blockquote, pre,
 * img, table, figure).
 *
 * Keep the rule set lean — every byte ships on every static page.
 * ============================================================ */

/* ----- THEME TOKENS — light is the default; dark overrides -----
 * Every var declared here is overrideable at runtime via the
 * postMessage 'set-vars' protocol (see theme-instructions.md). The
 * inline boot script whitelists exactly the names below, so adding
 * a new var here also requires updating ALLOWED_VARS in
 * server/lib/article-static.js. */
:root,
[data-theme="light"] {
  --bg:             #FFFFFF;
  --bg-alt:         #F8FAFC;
  --bg-sunken:      #F1F5F9;
  --text:           #0F172A;
  --text-2:         #475569;
  --text-3:         #64748B;
  --text-4:         #94A3B8;
  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;
  --paper:          #FFFFFF;
  --ink-100:        #F8FAFC;
  --ink-200:        #E2E8F0;
  --accent:         #4B47A8;
  --accent-50:      #4B47A81A;
  --shadow-md:      0 4px 12px rgba(15, 23, 42, 0.06);
  --font-sans:      'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius:         12px;
}
[data-theme="dark"] {
  --bg:             #0B1220;
  --bg-alt:         #111827;
  --bg-sunken:      #0A101C;
  --text:           #F1F5F9;
  --text-2:         #CBD5E1;
  --text-3:         #94A3B8;
  --text-4:         #64748B;
  --border:         #1E293B;
  --border-strong:  #334155;
  --paper:          #0B1220;
  --ink-100:        #111827;
  --ink-200:        #1E293B;
  --accent:         #818CF8;
  --accent-50:      #818CF820;
  --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ----- GLOBAL RESET / BASE -----
 * No background on <html>/<body> — the host site shows through, which
 * matters when these pages are iframed or styled by an outer wrapper.
 * The article card on the article page paints its own --paper surface;
 * the master listing's cards do the same. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; color: var(--text); background: transparent; }
body {
  font: 400 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* ----- STAGE — wraps the article card with breathing room.
 * No background paint: the host site (or the browser default) shows
 * through. The card itself paints --paper for its own surface. */
.ae-preview-stage {
  background: transparent;
  padding: 24px;
  min-height: 100vh;
}
/* Article card — paper surface, rounded corners, drop shadow. Matches
 * the in-portal article-view.html visual treatment so a published
 * page looks identical to its in-editor preview. Page wash is still
 * transparent (body + .ae-preview-stage both); only the card itself
 * paints. overflow:hidden keeps the cover image clipped to the
 * rounded top corners. */
.ae-preview-stage > * {
  max-width: 880px;
  margin: 0 auto;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ----- SHARED BODY TYPOGRAPHY (applied to all 6 layouts) ----- */
[class*="ae-layout-"] .ae-body { font: 400 16px/1.7 inherit; color: var(--text); }
[class*="ae-layout-"] .ae-body p { margin: 0 0 1.1em; }
[class*="ae-layout-"] .ae-body h1 { font: 800 36px/1.15 inherit; letter-spacing: -0.02em; color: var(--text); margin: 14px 0; }
[class*="ae-layout-"] .ae-body h2 { font: 600 24px/1.3  inherit; letter-spacing: -0.015em; color: var(--text); margin: 1.8em 0 0.5em; }
[class*="ae-layout-"] .ae-body h3 { font: 600 18px/1.3  inherit; color: var(--text); margin: 1.5em 0 0.4em; }
[class*="ae-layout-"] .ae-body ul, [class*="ae-layout-"] .ae-body ol { padding-left: 1.4em; margin: 0 0 1.1em; }
[class*="ae-layout-"] .ae-body li { margin: 0.3em 0; }
[class*="ae-layout-"] .ae-body blockquote {
  border-left: 3px solid var(--accent); padding: 6px 14px; color: var(--text-2);
  background: var(--accent-50); margin: 14px 0; border-radius: 4px;
}
[class*="ae-layout-"] .ae-body pre {
  padding: 14px 16px; background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: 8px; overflow-x: auto; margin: 0 0 16px;
  font: 13px/1.5 ui-monospace, 'JetBrains Mono', monospace;
}
[class*="ae-layout-"] .ae-body code:not(pre code) {
  font: 13.5px/1.4 ui-monospace, monospace; padding: 1px 5px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 4px;
}
[class*="ae-layout-"] .ae-body pre code { background: transparent; padding: 0; border: 0; color: inherit; }
[class*="ae-layout-"] .ae-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
[class*="ae-layout-"] .ae-body strong { font-weight: 700; color: var(--text); }
[class*="ae-layout-"] .ae-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 1.2em 0; display: block; }
[class*="ae-layout-"] .ae-body figure { margin: 1.4em 0; }
[class*="ae-layout-"] .ae-body figure img { margin: 0; }
[class*="ae-layout-"] .ae-body figcaption { font: 400 italic 13.5px inherit; color: var(--text-3); margin-top: 6px; text-align: center; }
[class*="ae-layout-"] .ae-body table { border-collapse: collapse; width: 100%; margin: 1.2em 0; font-size: 14px; }
[class*="ae-layout-"] .ae-body th, [class*="ae-layout-"] .ae-body td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
[class*="ae-layout-"] .ae-body th { background: var(--ink-100); font-weight: 600; }

/* ----- SHARED PARTIALS ----- */
[class*="ae-layout-"] .ae-eyebrow {
  display: inline-block; font: 700 11.5px/1 inherit; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 12px;
}
[class*="ae-layout-"] .ae-title { font: 800 38px/1.2 inherit; color: var(--text); margin: 0 0 14px; letter-spacing: -0.02em; }
[class*="ae-layout-"] .ae-excerpt { font: 400 17px/1.55 inherit; color: var(--text-2); margin: 0 0 18px; }
[class*="ae-layout-"] .ae-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; }
[class*="ae-layout-"] .ae-tag-chip {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 4px;
  font: 600 11px/1 inherit; background: var(--bg-alt); color: var(--text-2); border: 1px solid var(--border);
}
[class*="ae-layout-"] .ae-avatar {
  width: 36px; height: 36px; border-radius: 50%; background-size: cover; background-position: center;
  background-color: var(--ink-200); flex-shrink: 0;
}
[class*="ae-layout-"] .ae-byline {
  display: flex; align-items: center; gap: 12px; margin: 14px 0 24px; padding: 12px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
[class*="ae-layout-"] .ae-byline .ae-name { font: 600 14px inherit; color: var(--text); }
/* Author designation (per-article author_tagline column, e.g. "Founder
   & CEO"). Sits between name and meta in the byline + between name
   and bio in the author card. */
[class*="ae-layout-"] .ae-byline .ae-role { font: 500 12.5px/1.35 inherit; color: var(--text-2); margin-top: 1px; }
[class*="ae-layout-"] .ae-byline .ae-meta { font: 400 13px inherit; color: var(--text-3); margin-left: 10px; position: relative; padding-left: 14px; }
[class*="ae-layout-"] .ae-byline .ae-meta::before { content: '·'; position: absolute; left: 0; color: var(--text-4); }
[class*="ae-layout-"] .ae-author-card {
  display: flex; gap: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-alt); margin-top: 32px;
}
[class*="ae-layout-"] .ae-author-card .ae-avatar { width: 56px; height: 56px; align-self: flex-start; }
[class*="ae-layout-"] .ae-author-card .ae-name { font: 700 14px inherit; color: var(--text); }
[class*="ae-layout-"] .ae-author-card .ae-role { font: 500 13px/1.35 inherit; color: var(--text-2); margin-top: 2px; }
[class*="ae-layout-"] .ae-author-card .ae-bio { font: 400 13.5px/1.5 inherit; color: var(--text-2); margin-top: 8px; }

/* ----- LAYOUT 1 — Classic -----
 * Mirrors assets/css/article-edit.css `.ae-layout-classic` rules so the
 * published page matches the in-editor preview. */
.ae-layout-classic .ae-body-wrap { padding: 40px 56px 64px; }
.ae-layout-classic .ae-cover-banner {
  display: block; width: calc(100% + 112px); margin: -40px -56px 28px;
  height: 360px; object-fit: cover; border-radius: 0;
}
.ae-layout-classic .ae-title   { font-size: 36px; line-height: 1.15; margin: 0 0 14px; }
.ae-layout-classic .ae-excerpt { font-size: 19px; margin: 0 0 24px; }

/* ----- LAYOUT 2 — Split -----
 * Mirrors the portal's pages/article-view.html Split rendering: cover is
 * a contained 4:3 box with rounded corners (NOT a full-bleed banner that
 * breaks out of the column). Portal CSS lives in assets/css/article-edit.css
 * — keep these two in lockstep so a published page matches what the
 * operator sees in the editor preview. */
.ae-layout-split { display: grid; grid-template-columns: 1fr; gap: 0; }
.ae-layout-split .ae-left, .ae-layout-split .ae-right { padding: 32px 40px; }
.ae-layout-split .ae-cover-banner {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 10px; margin: 0 0 14px; display: block;
}
.ae-layout-split .ae-cover-placeholder {
  width: 100%; aspect-ratio: 4 / 3; border-radius: 10px;
  background: var(--bg-alt); margin: 0 0 14px;
}
.ae-layout-split .ae-title   { font-size: 30px; }
.ae-layout-split .ae-excerpt { font-size: 16px; }
.ae-layout-split .ae-byline  { margin: 14px 0 0; }
.ae-layout-split .ae-tags    { margin: 14px 0 0; }
@media (min-width: 760px) {
  .ae-layout-split { grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr); }
  .ae-layout-split .ae-left  { background: var(--bg-alt); padding: 56px 44px; border-right: 1px solid var(--border); }
  .ae-layout-split .ae-right { padding: 56px 56px 64px; }
}
@media (max-width: 759px) {
  .ae-layout-split .ae-left  { padding: 22px 18px; border-bottom: 1px solid var(--border); }
  .ae-layout-split .ae-right { padding: 22px 18px; }
}

/* ----- LAYOUT 3 — Hero overlay -----
 * Taller, more dramatic hero per portal spec — 460px min-height, 100px
 * top padding, content anchored to the bottom via flex-direction column
 * + justify-content flex-end. */
.ae-layout-hero-overlay .ae-hero {
  min-height: 460px; padding: 100px 56px 48px;
  color: #FFFFFF;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.ae-layout-hero-overlay .ae-hero-inner { max-width: 720px; }
.ae-layout-hero-overlay .ae-hero .ae-title   { color: #FFFFFF; font-size: 48px; line-height: 1.05; letter-spacing: -0.025em; margin: 14px 0 16px; }
.ae-layout-hero-overlay .ae-hero .ae-excerpt { color: rgba(255,255,255,0.85); font-size: 19px; line-height: 1.5; margin: 0 0 26px; max-width: 600px; }
.ae-layout-hero-overlay .ae-hero .ae-eyebrow { color: rgba(255,255,255,0.85); margin-bottom: 0; }
.ae-layout-hero-overlay .ae-hero .ae-byline  { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.2); padding: 12px 0; margin: 0; }
.ae-layout-hero-overlay .ae-hero .ae-byline .ae-name   { color: #FFFFFF; }
.ae-layout-hero-overlay .ae-hero .ae-byline .ae-meta   { color: rgba(255,255,255,0.7); }
.ae-layout-hero-overlay .ae-hero .ae-byline .ae-avatar { border: 2px solid rgba(255,255,255,0.3); background-color: rgba(255,255,255,0.2); }
.ae-layout-hero-overlay .ae-body-wrap { padding: 44px 56px 64px; max-width: 760px; margin: 0 auto; }

/* ----- LAYOUT 4 — Longform -----
 * Centred narrow serif reading column. Outer wrapper has no horizontal
 * padding — each inner section (head / body / tags / author-card) sets
 * its own max-width + horizontal padding so the centring is consistent
 * regardless of viewport width. */
.ae-layout-longform { padding: 80px 0 64px; font-family: 'Source Serif 4', Georgia, serif; }
.ae-layout-longform .ae-longform-head { max-width: 640px; margin: 0 auto; padding: 0 24px; text-align: center; }
.ae-layout-longform .ae-title { font: 700 44px/1.1 'Source Serif 4', Georgia, serif; letter-spacing: -0.015em; color: var(--text); margin: 12px 0; }
.ae-layout-longform .ae-excerpt { font: italic 400 20px/1.5 'Source Serif 4', Georgia, serif; color: var(--text-2); text-align: center; max-width: 540px; margin: 0 auto 28px; }
.ae-layout-longform .ae-byline { justify-content: center; border-top: 0; border-bottom: 1px solid var(--border); margin: 0 auto; padding: 0 0 16px; width: fit-content; }
.ae-layout-longform .ae-body {
  max-width: 620px; margin: 36px auto 0; padding: 0 24px;
  font: 400 19px/1.75 'Source Serif 4', Georgia, serif; color: var(--text);
}
.ae-layout-longform .ae-body > p:first-of-type::first-letter {
  font-family: 'Source Serif 4', Georgia, serif; float: left;
  font-size: 72px; line-height: 0.85; padding: 8px 10px 0 0;
  font-weight: 700; color: var(--accent);
}
.ae-layout-longform .ae-body h2 { font: 600 26px/1.3 'Source Serif 4', Georgia, serif; text-align: center; margin-top: 1.8em; }
.ae-layout-longform .ae-body h2::before {
  content: '· · ·'; display: block; letter-spacing: 0.5em;
  color: var(--text-4); font: 400 14px var(--font-sans);
  margin: 0.8em 0 0.4em;
}
.ae-layout-longform .ae-body blockquote {
  text-align: center; border-left: 0; padding: 0 24px;
  margin: 1.6em auto; max-width: 520px;
  font-size: 22px; position: relative;
}
.ae-layout-longform .ae-body blockquote::before {
  content: '\201C'; display: block; font: 700 60px/0.5 'Source Serif 4', Georgia, serif;
  margin-bottom: 16px; color: var(--accent);
}
.ae-layout-longform .ae-author-card,
.ae-layout-longform .ae-tags { max-width: 620px; margin: 28px auto 0; padding: 0 24px; }
.ae-layout-longform .ae-tags { justify-content: center; }

/* ----- LAYOUT 5 — Photo essay -----
 * Tall full-bleed cover + max-width-720 centred body. Body images
 * break out of the column padding (margin: 1.6em -32px) for a
 * gallery-like rhythm. */
.ae-layout-photo-essay .ae-cover-tall { display: block; width: 100%; height: 520px; object-fit: cover; margin: 0; }
.ae-layout-photo-essay .ae-photo-head { max-width: 720px; margin: 0 auto; padding: 48px 32px 12px; }
.ae-layout-photo-essay .ae-photo-head .ae-eyebrow { margin: 0 0 14px; }
.ae-layout-photo-essay .ae-photo-head .ae-title   { font-size: 40px; line-height: 1.15; margin: 0 0 14px; }
.ae-layout-photo-essay .ae-photo-head .ae-excerpt { font-size: 19px; margin: 0 0 24px; }
.ae-layout-photo-essay .ae-body { max-width: 720px; margin: 0 auto; padding: 0 32px 64px; }
.ae-layout-photo-essay .ae-body > h2 {
  font: 700 14px var(--font-sans); text-transform: uppercase;
  letter-spacing: 0.16em; color: var(--accent); margin: 2.2em 0 0.4em;
}
.ae-layout-photo-essay .ae-body > figure { margin: 1.6em -32px; }
.ae-layout-photo-essay .ae-body > figure img { border-radius: 0; width: 100%; display: block; }
.ae-layout-photo-essay .ae-body > figure figcaption {
  padding: 8px 32px 0; text-align: left;
  font: italic 400 14px 'Source Serif 4', Georgia, serif;
  color: var(--text-3);
}
.ae-layout-photo-essay .ae-tags        { max-width: 720px; margin: 28px auto 0; padding: 0 32px; }
.ae-layout-photo-essay .ae-author-card { max-width: 720px; margin: 32px auto; }

/* ----- LAYOUT 6 — Magazine -----
 * Display-serif cover-story treatment. Outer wrapper has no horizontal
 * padding so the cover figure can extend to 1040px max-width while the
 * body column stays at 680px — both centred. */
.ae-layout-magazine { padding: 56px 0 64px; font-family: 'Source Serif 4', Georgia, serif; }
.ae-layout-magazine .ae-magazine-head { max-width: 800px; margin: 0 auto; padding: 0 40px; text-align: center; }
.ae-layout-magazine .ae-magazine-meta {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  font: 600 11px var(--font-sans); text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--text-2);
}
.ae-layout-magazine .ae-magazine-meta .ae-eyebrow { color: var(--accent); font-size: 11px; letter-spacing: 0.18em; }
.ae-layout-magazine .ae-magazine-issue { color: var(--text-3); }
.ae-layout-magazine .ae-title   { font: 700 64px/1.02 'Source Serif 4', Georgia, serif; letter-spacing: -0.025em; color: var(--text); text-align: center; margin: 28px 0 24px; }
.ae-layout-magazine .ae-excerpt { font: italic 400 22px/1.45 'Source Serif 4', Georgia, serif; color: var(--text-2); text-align: center; max-width: 580px; margin: 0 auto 32px; }
.ae-layout-magazine .ae-rule    { display: block; width: 60px; height: 2px; background: var(--accent); margin: 0 auto 16px; }
.ae-layout-magazine .ae-byline  { display: flex; justify-content: center; gap: 12px; font: 400 13px var(--font-sans); color: var(--text-2); margin: 0 0 36px; border: 0; padding: 0; }
.ae-layout-magazine .ae-magazine-figure { max-width: 1040px; margin: 0 auto 40px; padding: 0 40px; }
.ae-layout-magazine .ae-magazine-figure img { width: 100%; height: 460px; object-fit: cover; border-radius: 4px; display: block; }
.ae-layout-magazine .ae-body    { max-width: 680px; margin: 0 auto; padding: 0 40px; }
.ae-layout-magazine .ae-body > p:first-of-type::first-letter {
  float: left; font: 700 86px/0.85 'Source Serif 4', Georgia, serif;
  margin: 6px 12px 0 0; color: var(--accent);
}
.ae-layout-magazine .ae-body > blockquote:first-of-type {
  font: italic 600 26px/1.4 'Source Serif 4', Georgia, serif;
  text-align: center; border-left: 0; padding: 16px 0;
  margin: 0 0 28px; color: var(--text);
}
.ae-layout-magazine .ae-author-card,
.ae-layout-magazine .ae-tags { max-width: 680px; margin: 28px auto; padding: 0 40px; }

/* ----- MASTER INDEX ----- */
.idx-wrap { max-width: 1180px; margin: 0 auto; padding: 48px 24px 80px; }

/* Hero — title + tagline + stats stacked at full width. The featured
   card lives below this in its own horizontal strip, NOT to the
   right of the hero (anchoring it to a side-column at 360px wide
   left a giant dead-space rectangle on the left whenever the
   tagline + stats didn't fill the card's height — which is most of
   the time, especially when the Authors stat hides at ≤1). */
.idx-hero {
  margin: 0 0 24px;
}

.idx-title-main {
  font: 800 36px/1.2 inherit; color: var(--text);
  margin: 0 0 8px; letter-spacing: -0.02em;
}
.idx-tagline {
  font: 400 16px/1.5 inherit; color: var(--text-3);
  margin: 0 0 28px; max-width: 52ch;
}

/* Stats row — 3-up grid of icon + number + label blocks. Lightly
   tinted bg gives the contrast the title doesn't compete with. */
.idx-stats {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin: 0;
}
.idx-stats.is-hidden { display: none; }
.idx-stat {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  white-space: nowrap;
}
.idx-stat.is-hidden { display: none; }
.idx-stat-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.idx-stat-num   { font: 700 17px/1 var(--font-sans); color: var(--text); }
.idx-stat-label { font: 500 13px/1 var(--font-sans); color: var(--text-2); }

/* Featured card — full-width horizontal strip sitting between the
   stats row and the search toolbar. Cover image is anchored to the
   left half of the card; title + summary + byline + CTA fill the
   right half. Height is content-driven (no min-height); a bottom-
   anchored CTA absorbs vertical slack via margin-top:auto, so short
   summaries don't leave dead space below the byline. */
.idx-featured-strip { margin: 0 0 32px; }
.idx-featured .idx-featured-card {
  flex-direction: row;            /* override .idx-card column-stack */
  align-items: stretch;
  padding: 0;
}
/* Cover slot — positioned wrapper that owns the 46% flex width and
   stretches vertically to match the text column's content height
   (align-items: stretch on the card). The img inside is absolutely
   positioned to fill the slot so its intrinsic aspect ratio CAN'T
   push the layout — fixes the overlap bug where tall/portrait
   covers grew the card and the byline+CTA collided with the image
   bottom edge. */
.idx-featured .idx-cover-slot {
  flex: 0 0 46%;
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
}
.idx-featured .idx-cover-slot .idx-cover {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.idx-featured .idx-card-body {
  flex: 1 1 auto; min-width: 0;
  padding: 56px 32px 32px;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.idx-featured-title { font: 800 26px/1.25 inherit; letter-spacing: -0.015em; margin: 0 0 10px; }
.idx-featured .idx-summary { font: 400 15px/1.55 inherit; color: var(--text-2); margin: 0 0 14px; max-width: 60ch; }
/* FEATURED badge — chrome at the top-right of the card, sitting
   immediately left of the share button. Tinted-accent pill so it
   reads as a position marker, NOT as another category eyebrow
   (which is what plain accent-uppercase text would suggest). The
   pill shape + position outside the article body's text flow makes
   the semantic distinction unambiguous. */
.idx-featured-badge {
  position: absolute; top: 14px; right: 52px; z-index: 2;
  display: inline-flex; align-items: center;
  height: 28px; padding: 0 12px;
  font: 700 10.5px/1 var(--font-sans);
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-50);
  border-radius: 999px;
  pointer-events: none;
}

/* Featured-card byline — three semantic registers (name → role →
   timestamp). Mono+uppercase tracked-out tail is the editorial
   "data label" convention from News Editorial / Minimalist
   Monochrome typography systems. Each row reads as a different
   KIND of info — fixes the flatness that one-color-step + 1.5px
   size difference couldn't. Segregated from the article body
   above by a hairline border. */
.idx-featured-byline {
  display: flex; align-items: flex-start; gap: 14px;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.idx-byline-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background-color: var(--ink-200);
}
.idx-byline-avatar--initials {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font: 700 13px/1 var(--font-sans); letter-spacing: 0.04em;
}
.idx-byline-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.idx-byline-name { font: 700 15px/1.25 inherit; color: var(--text); }
.idx-byline-role { font: 500 13.5px/1.35 inherit; color: var(--text-2); }
.idx-byline-stamp {
  font: 500 11px/1.2 ui-monospace, 'JetBrains Mono', monospace;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
}

/* CTA — bottom-anchored visual cue inside the card link. Not a
   separate clickable element (the whole card is already wrapped
   in <a>); margin-top:auto pushes it to the bottom of the flex
   column so vertical slack is absorbed here, not left as dead
   space. Underline on parent card hover for affordance. */
.idx-featured-cta {
  margin-top: auto; padding-top: 22px;
  font: 600 13.5px/1 inherit; color: var(--accent);
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
}
.idx-featured-cta span { transition: transform 160ms ease; display: inline-block; }
.idx-featured-card:hover .idx-featured-cta { text-decoration: underline; text-underline-offset: 3px; }
.idx-featured-card:hover .idx-featured-cta span { transform: translateX(2px); }

/* Eyebrow row — wraps the primary tag + NEW chip (or FEATURED + NEW
   on the featured card) so they sit on the same baseline above the
   title. */
.idx-eyebrow-row {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 8px;
}
.idx-eyebrow-row .idx-tag { margin: 0; }

/* NEW chip — filled accent pill. Differentiated from the plain-text
   primary-tag eyebrow + the FEATURED eyebrow by its fill so all three
   can sit on the same row without confusion. */
.idx-new-chip {
  display: inline-flex; align-items: center;
  height: 18px; padding: 0 8px;
  font: 700 9.5px/1 var(--font-sans);
  letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--accent); color: #fff;
  border-radius: 999px;
}

/* Narrow viewport — featured strip stacks to vertical (cover on top,
   content below) so the card stays scannable on phones. */
@media (max-width: 760px) {
  .idx-featured .idx-featured-card {
    flex-direction: column;
    min-height: 0;
  }
  .idx-featured .idx-cover-slot {
    flex: 0 0 auto;
    width: 100%;
    height: 200px;
  }
  .idx-featured .idx-card-body { padding: 20px 22px; }
  .idx-featured-title { font-size: 22px; }
}

/* Toolbar — search input + tag-chip filter on the master listing. */
.idx-toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 0 0 24px; }
.idx-search-wrap {
  position: relative; flex: 1 1 280px; min-width: 240px;
}
.idx-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.idx-search-wrap input {
  width: 100%; padding: 10px 14px 10px 36px;
  font: 400 14px var(--font-sans); color: var(--text);
  background: var(--paper); border: 1px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color 120ms ease, box-shadow 120ms ease;
}
.idx-search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-50);
}

.idx-tag-filter { display: flex; flex-wrap: wrap; gap: 6px; flex: 2 1 auto; }
.idx-tag-chip {
  font: 600 12px/1 var(--font-sans); color: var(--text-2);
  background: transparent; border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.idx-tag-chip:hover { background: var(--bg-alt); color: var(--text); }
.idx-tag-chip.is-active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

.idx-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}

/* Card wrap — positioned-relative parent of the link + the floating
   share button. The button sits on top of the card via absolute
   positioning so the anchor's semantics stay clean. */
.idx-card-wrap { position: relative; }
.idx-card-wrap[hidden] { display: none; }
.idx-card {
  background: var(--paper); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; text-decoration: none; color: var(--text);
  transition: transform 160ms ease, box-shadow 160ms ease;
  display: flex; flex-direction: column;
}
.idx-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.idx-cover { width: 100%; height: 180px; object-fit: cover; display: block; background: var(--bg-alt); }
.idx-cover-placeholder { background: var(--bg-alt); }
.idx-card-body { padding: 16px 18px 18px; }
.idx-tag { display: inline-block; font: 600 10.5px/1 inherit; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
.idx-title { font: 700 18px/1.3 inherit; color: var(--text); margin: 0 0 8px; }
.idx-summary { font: 400 14px/1.5 inherit; color: var(--text-2); margin: 0 0 12px; }
.idx-meta { font: 400 12.5px inherit; color: var(--text-3); }
.idx-empty { color: var(--text-3); padding: 60px 0; text-align: center; grid-column: 1 / -1; }

/* Share button — sits on the card's top-right corner. Default state
   is subdued; brightens on card hover. */
.idx-share-btn {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--border); color: var(--text-2);
  cursor: pointer; opacity: 0.85;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease, transform 120ms ease;
}
.idx-card-wrap:hover .idx-share-btn { opacity: 1; }
.idx-share-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; transform: scale(1.05); }
.idx-share-btn[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Radial share menu — injected into the card-wrap as a sibling of
   the share button when clicked. Each option is positioned absolutely
   via its --dx / --dy custom properties (set inline by JS based on
   the 6-step arc). Opens with a small fan-out animation. */
.idx-share-menu {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 0; height: 0; pointer-events: none;
}
.idx-share-menu.is-open { pointer-events: auto; }
.idx-share-opt {
  position: absolute;
  top: 16px; right: 16px; /* centred on the share button's centre */
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--border); color: var(--accent);
  cursor: pointer; text-decoration: none;
  transform: translate(50%, -50%) scale(0.3);
  opacity: 0;
  transition: transform 220ms cubic-bezier(0.22, 1.32, 0.55, 1.18), opacity 180ms ease, background 120ms ease, color 120ms ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.idx-share-opt > svg { width: 13px; height: 13px; }
.idx-share-menu.is-open .idx-share-opt {
  transform: translate(calc(var(--dx) + 50%), calc(var(--dy) - 50%)) scale(1);
  opacity: 1;
}
.idx-share-opt:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.idx-share-opt.is-copied { background: #10b981; color: #fff; border-color: #10b981; }
@media (prefers-reduced-motion: reduce) {
  .idx-share-opt { transition: opacity 80ms ease; }
}
