/* Website V2 — editorial pages: feed index + immersive reader. Prefixes: .w2fd-, .w2rd- */

/* ================================ Feed ================================ */
.w2fd-head { position: relative; max-width: var(--container-wide); margin: 0 auto; padding: 150px clamp(20px, 4vw, 48px) 28px; }
.w2fd-head__h1 { font-family: var(--font-display); font-size: clamp(3rem, 1.6rem + 6vw, 6.6rem); line-height: .98;
  letter-spacing: -0.024em; color: var(--text); margin: 18px 0 0; }
.w2fd-head__h1 em { font-style: italic; color: var(--accent-text); }
.w2fd-head__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-top: 26px; }
.w2fd-count { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.w2fd-count b { color: var(--accent-text); font-weight: 600; }

/* domain wash that follows hovered row */
.w2fd-wash { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0; transition: opacity .6s var(--ease-out);
  background: radial-gradient(60% 50% at 70% 40%, color-mix(in oklab, var(--dc, transparent) 9%, transparent), transparent 70%); }
.w2fd-wash--on { opacity: 1; }

/* filter bar */
.w2fd-bar { position: relative; z-index: 2; max-width: var(--container-wide); margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px) 8px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--border-subtle); }
.w2fd-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.w2fd-tab { position: relative; padding: 14px 14px; font-family: var(--font-sans); font-size: 13.5px; color: var(--text-muted);
  background: none; border: none; cursor: pointer; transition: var(--transition-colors); }
.w2fd-tab::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: 0 50%; transition: transform .35s var(--ease-out); }
.w2fd-tab:hover { color: var(--text-secondary); }
.w2fd-tab--on { color: var(--text); }
.w2fd-tab--on::after { transform: scaleX(1); }
.w2fd-sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.w2fd-sort button { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--text-muted); background: none;
  border: none; cursor: pointer; padding: 6px 4px; transition: var(--transition-colors); text-transform: uppercase; }
.w2fd-sort button:hover { color: var(--text-secondary); }
.w2fd-sort button.on { color: var(--accent-text); }

/* index rows */
.w2fd-list { position: relative; z-index: 1; max-width: var(--container-wide); margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px) 110px; }
.w2fd-row { display: grid; grid-template-columns: 64px 1fr 112px auto; align-items: center; gap: clamp(14px, 3vw, 36px);
  padding: clamp(22px, 3.4vh, 36px) 6px; border-bottom: 1px solid var(--border-subtle); text-decoration: none; cursor: pointer;
  transition: background .35s var(--ease-out), padding .35s var(--ease-out); position: relative; }
.w2fd-row__main { align-self: center; }
/* Explicit cells: the thumbnail sits 3rd visually on desktop (title · thumb ·
   score) but is 2nd in the DOM (before .main) so the mobile float can wrap the
   text. Pin BOTH column and row — the out-of-source-order columns make grid's
   sparse auto-placement wrap .main to a phantom row 2 (thumb floats top-right,
   content drops below) unless every cell is fixed to row 1. */
.w2fd-row__n { grid-column: 1; grid-row: 1; }
.w2fd-row__main { grid-column: 2; grid-row: 1; }
.w2fd-row__thumb { grid-column: 3; grid-row: 1; }
.w2fd-row__side { grid-column: 4; grid-row: 1; }
.w2fd-row:hover { background: color-mix(in oklab, var(--surface) 55%, transparent); padding-left: 18px; padding-right: 18px; }
.w2fd-row__n { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); letter-spacing: .08em; transition: color .3s; }
.w2fd-row:hover .w2fd-row__n { color: var(--accent-text); }
.w2fd-row__main { min-width: 0; }
.w2fd-row__meta { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.w2fd-row__dom { display: inline-flex; align-items: center; gap: 6px; letter-spacing: .1em; text-transform: uppercase; }
.w2fd-row__dom i { width: 7px; height: 7px; border-radius: 50%; background: var(--dc); }
.w2fd-row__t { font-family: var(--font-display); font-size: clamp(1.5rem, 1rem + 2.4vw, 2.7rem); line-height: 1.05; letter-spacing: -0.016em;
  color: var(--text); margin: 0; transition: color .3s; text-wrap: balance; }
.w2fd-row:hover .w2fd-row__t { color: var(--accent-text); }
.w2fd-row__lede { margin: 10px 0 0; font-size: var(--text-sm); line-height: 1.6; color: var(--text-secondary); max-width: 46rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.w2fd-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.w2fd-row__score { font-family: var(--font-mono); font-size: clamp(18px, 2vw, 24px); font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
.w2fd-row__score small { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.w2fd-row__go { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-faint); opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .3s var(--ease-out), color .3s; }
.w2fd-row:hover .w2fd-row__go { opacity: 1; transform: none; color: var(--accent-text); }
.w2fd-empty { text-align: center; padding: 90px 0; color: var(--text-muted); font-size: 14px; }

/* lead-figure thumbnail (desktop only). Scientific figures are mostly white —
   frame them as little paper clippings: rounded, bordered, slightly recessed
   and dimmed at rest, lifting to full on row hover. */
.w2fd-row__thumb { width: 112px; height: 74px; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--border-subtle); background: var(--surface-2); position: relative; flex: none; }
.w2fd-row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; filter: saturate(.9) brightness(.94); transition: opacity .5s var(--ease-out), filter .35s var(--ease-out), transform .45s var(--ease-out); }
.w2fd-row__thumb.is-loaded img { opacity: .82; }
.w2fd-row:hover .w2fd-row__thumb img { opacity: 1; filter: none; transform: scale(1.05); }
/* figure-less rows keep the grid aligned with a quiet domain-tinted placeholder */
.w2fd-row__thumb.is-empty { background:
  linear-gradient(135deg, color-mix(in oklab, var(--dc, var(--border)) 22%, var(--surface)), var(--surface-2)); }

@media (max-width: 720px) {
  /* one card — the figure floats and the snippet text wraps around it */
  .w2fd-row { display: flow-root; }
  .w2fd-row__n, .w2fd-row__side { display: none; }
  .w2fd-row__thumb { float: left; width: 92px; height: 92px; margin: 3px 16px 6px 0; }
  .w2fd-row__thumb.is-loaded img { opacity: 1; filter: none; }
  .w2fd-row__meta { flex-wrap: wrap; }
}

/* =============================== Reader =============================== */
.w2rd-hero { position: relative; min-height: 78vh; display: flex; align-items: flex-end; overflow: clip;
  padding: 150px clamp(20px, 4vw, 48px) clamp(40px, 7vh, 72px); }
.w2rd-hero__wash { position: absolute; inset: 0; pointer-events: none; opacity: .2; will-change: transform;
  background: radial-gradient(70% 90% at 30% 0%, var(--dc), transparent 62%); }
.w2rd-hero__fade { position: absolute; inset: auto 0 0; height: 30vh; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg)); }
.w2rd-hero__in { position: relative; max-width: var(--container-wide); margin: 0 auto; width: 100%; }
.w2rd-hero__meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.w2rd-ai { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent-text); background: var(--accent-bg); border: 1px solid var(--border-signal);
  padding: 5px 11px; border-radius: var(--radius-full); }
.w2rd-hero__t { font-family: var(--font-display); font-size: clamp(2.4rem, 1.2rem + 4.8vw, 5.4rem); line-height: 1.02;
  letter-spacing: -0.022em; color: var(--text); margin: 22px 0 0; max-width: 22ch; text-wrap: balance; }
.w2rd-hero__byline { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 26px;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.w2rd-hero__byline b { color: var(--text-secondary); font-weight: 500; }
.w2rd-hero__byline .sep { color: var(--text-faint); }

/* floating glass toolbar */
.w2rd-bar { position: fixed; top: 76px; left: 50%; transform: translate(-50%, -16px); z-index: 50; display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-full); box-shadow: 0 16px 48px -20px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; transition: opacity .4s var(--ease-out), transform .4s var(--ease-out); }
.w2rd-bar--in { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.w2rd-bar__btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; font-family: var(--font-sans); font-size: 12.5px;
  color: var(--text-secondary); background: none; border: none; border-radius: var(--radius-full); cursor: pointer; text-decoration: none;
  transition: var(--transition-colors); white-space: nowrap; }
.w2rd-bar__btn:hover { color: var(--text); background: var(--surface-2); }
.w2rd-bar__btn--on { color: var(--accent-text); }
.w2rd-bar__sep { width: 1px; height: 18px; background: var(--border-subtle); margin: 0 2px; }
.w2rd-bar__pct { font-family: var(--font-mono); font-size: 11px; color: var(--accent-text); min-width: 40px; text-align: center; }

/* prose */
.w2rd-body { position: relative; max-width: var(--container-prose); margin: 0 auto; padding: 10px clamp(20px, 4vw, 48px) 60px; }
.w2rd-notice { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; margin: 0 0 36px; background: var(--accent-bg);
  border: 1px solid var(--border-signal); border-radius: var(--radius-lg); font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }
.w2rd-notice svg { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
/* Source attribution (CC: title · author · licence) under the article body. */
.w2rd-attrib { margin: 36px 0 0; padding: 15px 18px; background: var(--surface);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.w2rd-attrib__lbl { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-faint); margin-bottom: 7px; }
.w2rd-attrib__body { margin: 0; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.w2rd-attrib__body cite { font-style: italic; color: var(--text-secondary); }
.w2rd-attrib__body a { color: var(--accent-text); text-decoration: none; }
.w2rd-attrib__body a:hover { text-decoration: underline; }
.w2rd-prose { font-family: var(--font-sans); font-size: var(--text-lg); line-height: var(--leading-prose); color: var(--text-secondary); overflow-wrap: break-word; }
.w2rd-prose > p:first-of-type { font-size: 1.18em; color: var(--text); }
.w2rd-prose > p:first-of-type::first-letter { font-family: var(--font-display); font-size: 3.4em; float: left; line-height: .82;
  padding: 6px 10px 0 0; color: var(--accent-text); }
.w2rd-prose p { margin: 0 0 1.35em; }
/* Block (not flex) so headings that mix text + KaTeX math wrap instead of
   running off-screen; anywhere-break + bounded math keep long notation-heavy
   headings inside the column. */
.w2rd-prose h2 { display: block; font-family: var(--font-display); font-size: var(--text-3xl);
  letter-spacing: -0.015em; color: var(--text); margin: 1.8em 0 .7em; font-weight: 400; overflow-wrap: anywhere; }
.w2rd-prose h2 .idx { font-family: var(--font-mono); font-size: 12px; color: var(--accent-text); letter-spacing: .1em; margin-right: 12px; }
/* KaTeX inside prose: shrink in headings, let display math scroll not overflow. */
.w2rd-prose h2 .katex, .w2rd-prose h3 .katex { font-size: .9em; }
.w2rd-prose .katex-display { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.w2rd-prose code { font-family: var(--font-mono); font-size: .85em; background: var(--surface-2); border: 1px solid var(--border-subtle);
  padding: 2px 6px; border-radius: var(--radius-sm); color: var(--text); }
.w2rd-prose ul, .w2rd-prose ol { margin: 0 0 1.35em; padding-left: 1.4em; }
.w2rd-prose li { margin-bottom: .5em; }
.w2rd-prose li::marker { color: var(--accent); }
/* Figures rendered from markdown ({{FIGURE:N}} + end gallery). The caption
   must read as a caption, not as body prose — smaller, mono, muted, framed. */
.w2rd-prose figure { margin: 32px 0; }
/* width:100% fills the column for the common (wide) figure; max-height caps the
   occasional tall micrograph so it can't swallow the whole screen — object-fit
   keeps aspect (a tall image centres within the capped box instead of stretching). */
.w2rd-prose figure img { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain;
  border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--surface); }
/* Captions read as machine annotations. Long ones (paper figure legends often
   run a full paragraph) were a centered mono wall that was hard to scan —
   left-align, drop the size, add a signal rule, cap the measure so they read
   as a sidebar caption rather than body prose. Short ones still look clean. */
.w2rd-prose figcaption { margin: 12px auto 0; max-width: 62ch; padding-left: 13px;
  border-left: 2px solid var(--border-signal); font-family: var(--font-mono);
  font-size: 11.5px; line-height: 1.6; letter-spacing: .005em; color: var(--text-muted); text-align: left; }
/* The end-of-article "Figures from the paper" gallery heading. */
.w2rd-prose h2 + figure { margin-top: 16px; }

/* parallax figure */
.w2rd-fig { margin: 40px 0; border-radius: var(--radius-xl); overflow: hidden; border: 1px solid var(--border-subtle); background: var(--surface); }
.w2rd-fig__frame { height: 280px; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.w2rd-fig__layer { position: absolute; inset: -16% 0; will-change: transform; }
.w2rd-fig__lbl { position: relative; font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.w2rd-fig__cap { padding: 13px 16px; font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border-subtle); }

/* score meters */
.w2rd-scores { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 44px 0 8px; padding: 24px;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-xl); }
@media (max-width: 640px) { .w2rd-scores { grid-template-columns: repeat(2, 1fr); } }
.w2rd-score__lbl { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.w2rd-score__n { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; margin-bottom: 8px; }
.w2rd-score__n small { font-size: 12px; color: var(--text-faint); font-weight: 400; }
.w2rd-score__bar { height: 3px; background: var(--surface-inset); border-radius: var(--radius-full); overflow: hidden; }
.w2rd-score__bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit;
  transform: scaleX(var(--p, 0)); transform-origin: 0 50%; transition: transform 1.1s var(--ease-out); }
.w2rd-score--hero .w2rd-score__bar i { background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 55%, white)); }
/* Tone by score (placed AFTER the hero rule so it wins on equal specificity):
   strong work reads green, weak reads amber — gold stays the neutral middle. */
.w2rd-score--good .w2rd-score__bar i { background: var(--success); }
.w2rd-score--weak .w2rd-score__bar i { background: var(--warning); }
.w2rd-score--hero.w2rd-score--good .w2rd-score__bar i { background: linear-gradient(90deg, var(--success), color-mix(in oklab, var(--success) 55%, white)); }
.w2rd-score--hero.w2rd-score--weak .w2rd-score__bar i { background: linear-gradient(90deg, var(--warning), color-mix(in oklab, var(--warning) 55%, white)); }
.w2rd-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 22px; }
.w2rd-tag { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); background: var(--surface-2);
  border: 1px solid var(--border-subtle); padding: 5px 11px; border-radius: var(--radius-full); }

/* next-article band */
.w2rd-next { display: block; margin-top: clamp(70px, 10vh, 110px); border-top: 1px solid var(--border-subtle); text-decoration: none;
  position: relative; overflow: clip; }
.w2rd-next__in { max-width: var(--container-wide); margin: 0 auto; padding: clamp(50px, 9vh, 90px) clamp(20px, 4vw, 48px); }
.w2rd-next__lbl { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint); }
.w2rd-next__t { font-family: var(--font-display); font-size: clamp(2rem, 1.2rem + 3.4vw, 4rem); line-height: 1.04; letter-spacing: -0.02em;
  color: var(--text); margin: 16px 0 0; max-width: 24ch; transition: color .35s; text-wrap: balance; }
.w2rd-next:hover .w2rd-next__t { color: var(--accent-text); font-style: italic; }
.w2rd-next__meta { display: flex; align-items: center; gap: 14px; margin-top: 16px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.w2rd-next__wash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(50% 80% at 50% 100%, color-mix(in oklab, var(--dc, transparent) 10%, transparent), transparent 70%); }
.w2rd-next:hover .w2rd-next__wash { opacity: 1; }

/* "How this was made" — open-provenance disclosure */
.w2rd-recipe { margin-top: 30px; border: 1px solid var(--border-subtle); border-radius: var(--radius-xl);
  background: var(--surface); overflow: hidden; }
.w2rd-recipe > summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; cursor: pointer;
  font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--text); list-style: none;
  transition: var(--transition-colors); }
.w2rd-recipe > summary::-webkit-details-marker { display: none; }
.w2rd-recipe > summary:hover { color: var(--accent-text); }
.w2rd-recipe > summary svg:first-of-type { color: var(--accent); flex: none; }
.w2rd-recipe > summary span { flex: 1; }
.w2rd-recipe > summary svg:last-of-type { color: var(--text-faint); transition: transform .3s var(--ease-out); }
.w2rd-recipe[open] > summary svg:last-of-type { transform: rotate(180deg); }
.w2rd-recipe__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px 28px;
  padding: 4px 20px 22px; border-top: 1px solid var(--border-subtle); }
@media (max-width: 560px) { .w2rd-recipe__grid { grid-template-columns: 1fr; } }
.w2rd-recipe__k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin: 14px 0 8px; }
.w2rd-recipe__v { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--text-muted); }
.w2rd-recipe__v span { font-family: var(--font-mono); font-size: .92em; color: var(--text-secondary); }
.w2rd-recipe__more { display: inline-flex; align-items: center; gap: 7px; margin-top: 16px; font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .04em; color: var(--accent-text); text-decoration: none; }
.w2rd-recipe__more:hover { gap: 11px; }

/* Related — KG-shared article cards */
.w2rd-rel { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border-subtle); }
.w2rd-rel__eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 18px; }
.w2rd-rel__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) { .w2rd-rel__grid { grid-template-columns: 1fr; } }
.w2rd-rel__card { display: flex; flex-direction: column; gap: 12px; padding: 18px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  transition: border-color .3s, background .3s, transform .3s var(--ease-out); }
.w2rd-rel__card:hover { border-color: color-mix(in oklab, var(--dc, var(--accent)) 45%, var(--border-subtle));
  background: var(--surface-2); transform: translateY(-2px); }
.w2rd-rel__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.w2rd-rel__dom { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.w2rd-rel__dom i { width: 7px; height: 7px; border-radius: 50%; background: var(--dc, var(--accent)); flex: none; }
.w2rd-rel__score { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--text); }
.w2rd-rel__score small { font-size: 9px; color: var(--text-faint); font-weight: 400; }
.w2rd-rel__score.is-good { color: var(--success-text); }
.w2rd-rel__score.is-weak { color: var(--warning); }
.w2rd-rel__t { margin: 0; font-family: var(--font-sans); font-size: 14.5px; font-weight: 500; line-height: 1.4;
  color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.w2rd-rel__card:hover .w2rd-rel__t { color: var(--text); }
