/* Cabinhub News — the SERVER-RENDERED subject page (/topics, /topics/<slug>).
   Owner: TOPICS-INT lane.

   Why a second stylesheet instead of reusing frontend/css/topics.css: that file
   styles the client's own hub view (`.cbn-top-*`, rendered by js/topics.js on
   #/topic/<slug>). This one styles the document the API answers at /topics/<slug>
   for a crawler and for a reader who arrives without JavaScript. They are two
   different documents that must look like the same product, so they are two
   files with one rule set each — not one file guessing which document it is in.

   The page is built from the SAME primitives the feed uses (.shell, .card,
   .card--lead, .card--secondary, .card--river, .card__meta, .card__title,
   .card__deck, .thumb, .thumb__img), so a category page is card quality by
   construction rather than by imitation. Everything below only adds the parts a
   document needs: a masthead, a subject head, a chip row, and the pager.

   Design law (TEAM.md §8, Han 2026-11-06): a card is text separated by a
   hairline. No frame, no shadow, no fill on a card, no radius, no pill. */

/* ================================================== document chrome ===== */

/* The masthead row. The server page cannot run app.js (it is a static document
   with no feed to read), so the mark, the section name and the way back are
   plain links here. It sits on the same paper, at the same size, as the client's
   masthead — a reader who lands on /topics from a search result is on the same
   site, not on a second one. */
.tp-masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.tp-masthead__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.85rem var(--pad-r) 0.85rem var(--pad-l);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
}
.tp-masthead__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--fs-mark);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.tp-masthead__link:hover { color: var(--accent); }
.tp-masthead__link img { display: block; width: 22px; height: 30px; }
.tp-masthead__side {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Language and theme are LINKS here, not buttons: this document has no scripts,
   so the only honest control is a URL. `?locale=zh-Hans` is the same parameter
   the client uses, and the theme link sets the stored preference the inline
   bootstrap in the page's own head already reads. */
.tp-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--paper-2);
  border-radius: var(--r-sm);
}
/* The controls on this document take the tap token in LAYOUT (no clipping
   frame above them, so nothing needs absorption): they measured 30-34px on a
   coarse pointer in every combo (n3_server s38b). The token is a square, so a
   short label ("EN") must clear it on both axes. */
.tp-switch__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0 0.5rem;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--ink-faint);
  text-decoration: none;
  border-radius: var(--r-xs);
}
.tp-switch__item[aria-current="page"] {
  background: var(--canvas);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--rule);
}
@media (hover: hover) and (pointer: fine) {
  .tp-switch__item:hover { color: var(--ink); }
}

/* ======================================================= subject head ==== */

.tp-head {
  padding-bottom: clamp(0.9rem, 2vw, 1.4rem);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(1.1rem, 2.4vw, 1.8rem);
}
.tp-kicker {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--accent);
  margin: 0 0 var(--sp-2);
}
/* A separator is TEXT, so it answers to 1.4.3: --rule-strong on --paper
   measures 3.7:1 at 13px and failed on both server documents in both themes
   (n3_server s38, every combo). The quiet ink is the colour a separator takes
   everywhere else in this estate (see chrome.css colophon, topics.css). */
.tp-kicker__sep { color: var(--ink-faint); font-weight: 400; }
.tp-kicker__quiet { color: var(--ink-faint); font-weight: 500; }

/* The subject's name is the page's only H1. --fs-detail is the article's size,
   used here because a subject page is a front door, not a card. */
.tp-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.9rem);
  line-height: 1.06;
  letter-spacing: -0.026em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}
/* The fixed intro: the same sentence the JSON contract carries, so the page and
   the API describe the subject identically. Measure, not full width. */
.tp-intro {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: var(--measure-deck);
  margin: 0 0 var(--sp-3);
}
.tp-facts {
  display: flex;
  align-items: baseline;
  gap: 0.4rem 0.75rem;
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--ink-faint);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tp-facts li { display: flex; align-items: baseline; gap: 0.4rem; }
.tp-facts__n { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* =============================================================== chips ==== */

/* A chip row of real links. `aria-current="page"` marks the filter in force, so
   a screen reader hears the state without a pressed-button metaphor that a
   link cannot honestly carry. */
.tp-chips {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0 0 clamp(1rem, 2.2vw, 1.5rem);
  padding: 0;
  list-style: none;
}
.tp-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--tap);
  /* The token is SQUARE, and this chip is a primary touch control on the subject
     page. Measured on the live pager 2026-11-16 at 390 (coarse pointer): the
     numbered links were 29x44 — "2", "3", "40" are one or two glyphs, so the box
     was under the token's width while its height was over it. a11y.css fixes the
     same defect for .chip and .toolbar__link by adding min-width; the pager's
     own chip class was never in that list. Widening does not move any label
     (justify-content centres it) and the label chips ("Last 30 days 947") are
     already wider than 44, so only the numbers change. */
  min-width: var(--tap);
  padding: 0 0.75rem;
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  color: var(--ink-faint);
  text-decoration: none;
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  background: transparent;
  white-space: nowrap;
}
.tp-chip__n {
  font-size: var(--fs-micro);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.tp-chip[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-color: var(--rule-strong);
  background: var(--paper-2);
}
.tp-chip[aria-current="page"] .tp-chip__n { color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) {
  .tp-chip:hover { color: var(--ink); border-color: var(--rule-strong); }
}

/* ========================================================= the list ==== */

/* The secondary wrapper is a two-column grid from 640px up, and the hairline
   between the two cards is drawn by the SECOND child. A category page often has
   exactly two stories: the lead and one more. That lone card then filled the
   left column of a two-column grid, leaving a full-width hole to its right and
   reading as a layout break rather than a list (measured on tx-nj3 2026-11-10,
   1440px, /topics/technology: one .card--secondary stretched to 1424px of a
   1424px row). The modifier is set by the server, which knows the count, so the
   card never has to infer it from siblings that may not exist.

   The selector is element + class, not a descendant of a wrapper: the document
   body is `<main><div class="shell">` with no `.tp-main` (measured on tx-nj3:
   the first version scoped to `.tp-main`, matched nothing, and the lone card
   still sat at 504px of a 1040px row). One element + one class also outranks
   cards.css's bare `.feed__secondary` inside its 640px media query, so this
   does not depend on which file happens to load last. */
div.feed__secondary--solo {
  grid-template-columns: minmax(0, 1fr);
}
div.feed__secondary--solo > .card--secondary {
  --v-title-measure: 34ch;
  --v-deck-measure: 62ch;
}

/* ============================================================ the rail ==== */

/* Why this story is here: the evidence line. It is a fact about our own data
   ("in Technology", "mentions Federal Reserve"), never a machine string, and it
   sits under the deck at label size so it cannot be mistaken for reporting. */
.card__why {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--ink-faint);
  margin: 0.3rem 0 0;
}

/* The subject rail: other subjects the reader can walk to. Text, one hairline
   above, no boxes. */
.tp-also {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-3);
}
.tp-also__head,
.tp-rule-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.tp-rule-head__label {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-faint);
  margin: 0;
}
.tp-rule-head__rule {
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}
.tp-rule-head__count {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.tp-also__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tp-also__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  /* Both axes: `宏观 7` is 42px wide with min-height alone, and a coarse
     pointer measures the narrow side (recorded sHUB, zh, 390). */
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0.35rem 0;
  font-family: var(--font-ui);
  font-size: var(--fs-meta);
  color: var(--ink);
  text-decoration: none;
}
.tp-also__link:hover { color: var(--accent); }
.tp-also__n {
  font-size: var(--fs-label);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* The directory: one row per subject. A name, its count, and its own fixed
   intro as the deck — the sentence a reader needs to know whether to click. */
.tp-index {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 760px) {
  .tp-index { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(1.2rem, 2.6vw, 2.2rem); }
}
.tp-index__item { border-top: 1px solid var(--rule-soft); }
.tp-index__item:first-child { border-top: 0; }
@media (min-width: 760px) {
  .tp-index__item:first-child,
  .tp-index__item:nth-child(2) { border-top: 0; }
}
.tp-index__link {
  display: block;
  padding: 0.75rem 0 0.85rem;
  text-decoration: none;
  color: var(--ink);
}
.tp-index__link:hover .tp-index__name { color: var(--accent); }
.tp-index__name {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: -0.006em;
  line-height: 1.3;
  margin: 0;
}
.tp-index__n {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 500;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.tp-index__intro {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0.2rem 0 0;
  max-width: 54ch;
}

/* The tail of the page: what the numbers mean, and where the honest limits are.
   A reader who is told nothing about a bounded scan will assume the list is
   complete; this line says what it is. */
.tp-note {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  line-height: 1.55;
  color: var(--ink-faint);
  margin: var(--sp-5) 0 0;
  max-width: var(--measure-deck);
}
/* The masthead kicker ("Subjects / Markets") and the footer links are controls
   a thumb must hit, and they measured 20px tall on both server documents at
   every width (n3_server s38). They take the tap token in LAYOUT — this page
   has no clipping frame above them, so nothing has to absorb an overhang —
   and the row's own rhythm is preserved by centring the text in the box
   rather than pushing the row taller: the masthead line was already 30px of
   mark, and the footer sits below the last hairline where 44px costs a
   reader nothing. */
.tp-kicker a,
.tp-foot a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 0.15rem;
}
/* A bare <a> takes the UA's blue and its underline: measured on the live 404
   and every hub (sHUB2/s404 shots opened) — the kicker's "Subjects" and the
   zh "主题" were BLUE, not this page's accent, because no rule set the colour.
   The kicker sets --accent on the <p>; the anchor must inherit it, and the
   underline belongs to hover only, like every other link on the page. */
.tp-kicker a { color: inherit; text-decoration: none; }
.tp-kicker a:hover { text-decoration: underline; }
.tp-foot {
  margin-top: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--rule);
  padding-top: var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  color: var(--ink-faint);
  display: flex;
  gap: 0.4rem 1.2rem;
  flex-wrap: wrap;
}
.tp-foot a { color: var(--ink-soft); text-decoration: none; }
.tp-foot a:hover { color: var(--accent); }

/* The empty state of a subject with nothing filed: a sentence, not a hole. */
.tp-empty {
  border-top: 1px solid var(--rule);
  padding: var(--sp-5) 0;
  max-width: var(--measure-deck);
}
.tp-empty__title {
  font-family: var(--font-display);
  font-size: var(--fs-sub);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--sp-2);
}
.tp-empty__body {
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
}
.tp-empty__link {
  /* A link a reader must hit to leave a dead end is a control, not a line of
     prose: 15px tall as an inline anchor (recorded sHUB, both locales). */
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--accent);
}

/* ================================================== the lead uses its row ==
   Measured on the live page 2026-11-16 by the lane probe (frontend/e2e/
   craft_bars.mjs, same instrument before and after). At 1440 the lead row is
   1040px wide and the headline is given 400px of it — a 20ch cap set by
   cards.css for the front page, where the lead shares the row with the side
   rail. This feed is single-column (.feed--single, emitted only by
   backend/app/api/site_topics.py): nothing stands beside the lead, so 62% of
   its row was empty and the 40px headline stacked five ragged lines against a
   640px hole, with a full-bleed 16:9 plate beneath. At 768 the same row lost
   38%. The photograph belongs beside the text, not above it.

   This is the house split, not a new pattern: feedback from the front page
   (feed.css, the >=760 .article--lead grid) applied to the one surface that
   never got it. Placement only — the DOM order the server emits is untouched,
   so the reading order and the Tab order are unchanged. */
@media (min-width: 760px) {
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
    column-gap: clamp(1.1rem, 2.6vw, 2.2rem);
    align-items: start;
    /* The column is the measure now: a 20ch cap inside a 515px column would
       put back the hole this rule removes. */
    --v-title-measure: none;
  }
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) > .thumb--card {
    grid-column: 1;
    grid-row: 1 / span 4;
    margin: 0;
  }
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) > .card__meta { grid-column: 2; grid-row: 1; }
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) > .card__title { grid-column: 2; grid-row: 2; }
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) > .card__deck { grid-column: 2; grid-row: 3; }
  .feed--single .feed__lead > .card--lead:has(> .thumb--card .thumb__img) > .card__why { grid-column: 2; grid-row: 4; }
}

/* Below the split the lead is a full-width stack, so the 26ch tablet cap in
   cards.css has no column to protect: at 700px it left a third of the row
   empty under a 16:9 plate. The row is the measure. */
@media (max-width: 759px) {
  .feed--single .feed__lead > .card--lead { --v-title-measure: none; }
}

/* On a phone the subject head carries the whole page, so it gets one more step
   of breathing room than the desktop rule gives it. */
@media (max-width: 559px) {
  .tp-head { padding-bottom: var(--sp-4); margin-bottom: var(--sp-4); }
  /* Four window chips do not need a scroller: wrapping shows every one of them
     without a cut-off label, and a scroller that hides a filter is the defect
     this row exists to avoid. */
  .tp-chips { gap: 0.3rem; }
  .tp-chip { min-height: var(--tap); padding: 0 0.6rem; }

  /* The masthead was 184px on every phone width (measured 2026-11-16 at 360,
     390 and 430: brand row at y=14, four section links at y=66, and the
     language switch alone on a THIRD row at y=122 with the 1px separator
     dangling at the end of row 2, dividing nothing).
     Cause: `.tp-masthead__side` is one flex item, so the whole group — four
     51-77px links plus a separator plus a 94px switch — had to fit in one
     wrap slot; it needs ~422px of the 328-358 available and broke.
     `display: contents` makes the side's children direct flex items of the
     masthead, so the brand and the switch can share row 1 (172 + 94 = 266px,
     fits) and the four links take row 2 (295px, fits). Two rows; measured
     after: 136px at 390, against 184px before, and unchanged at 768/1440
     (76px both).
     The full-width zero-height ::after is the line break: flexbox has no
     wrap primitive, and without it the first link (51px) fits in the 76px
     left on row 1 and the nav starts a row it shares with the brand. */
  .tp-masthead__side { display: contents; }
  .tp-masthead__link { order: 1; }
  .tp-switch { order: 2; margin-left: auto; }
  .tp-masthead__inner::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  .tp-masthead__side > .tp-switch__item { order: 4; }
  /* The separator divides the links from the switch. On phones the switch is
     on the brand row, so it would sit at the start of the link row and read as
     a rule before the first link. */
  .tp-masthead__side > [aria-hidden="true"] { display: none; }
}

/* ================================================ legal documents ====
   /pricing, /terms and /privacy render their prose in .prose, whose type
   rules live in typography.css but whose MEASURE lives in detail.css (the
   article stylesheet, which these pages do not load: 305 lines of story
   furniture for three pages of text). One rule supplies the column these
   pages need, scoped to the sections they build, so an article's .prose
   keeps detail.css's file. The measure token is shared, so a reader moving
   from a story to /terms does not change line length. */
.lg-doc .prose { max-width: var(--measure); }
/* detail.css gives zh articles --font-ui and 1.9 leading; these pages load
   neither that sheet nor its zh override, so the 16px serif display face
   would set Chinese copy at Latin metrics. cjk.css supplies the 1.8 leading
   for `.prose p` already; only the face and the size step are missing here. */
html[lang="zh-Hans"] .lg-doc .prose {
  font-family: var(--font-ui);
  font-size: calc(var(--fs-body) - 1px);
}

/* A document's sections are headings, not the 13px faint micro-label the
   subject page uses to rule off a list: an <h2> smaller than body text is a
   heading a reader cannot see and a level a screen reader announces oddly.
   The measure is the same column as the prose below it. */
.lg-section { margin-top: clamp(1.8rem, 3.4vw, 2.9rem); }
.lg-section:first-of-type { margin-top: clamp(1.4rem, 2.6vw, 2.1rem); }
.lg-h2 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.06rem + 0.6vw, 1.45rem);
  line-height: 1.25;
  letter-spacing: -0.012em;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 var(--sp-2);
  max-width: var(--measure);
  text-wrap: balance;
}

/* The plans are a name-and-allowance pair, so they are a definition list, not
   a ul of sentences: two rows, one per plan, with the number tabular so two
   allowances line up. */
.lg-plans { margin: 0; max-width: var(--measure); }
.lg-plan {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 0.6rem 0;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
}
.lg-plan:first-child { border-top: 0; }
.lg-plan dt { color: var(--ink); font-weight: 600; margin: 0; }
.lg-plan dd {
  margin: 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* The keyless/keys comparison. Three columns of prose would be a table, and a table at
   390px is the horizontal scroll this page must not have, so each capability is one row
   that stacks on a phone: the capability, then the two answers, each under its own label. */
.lg-compare { margin: 0; max-width: var(--measure); }
.lg-compare__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.2rem 1.4rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--font-ui);
  font-size: var(--fs-small);
  line-height: 1.55;
}
.lg-compare__row:first-child { border-top: 0; }
@media (min-width: 760px) {
  .lg-compare__row {
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.05fr) minmax(0, 1.05fr);
    align-items: start;
  }
}
.lg-compare__what { color: var(--ink); font-weight: 600; margin: 0; }
.lg-compare__v { margin: 0; color: var(--ink-soft); }
.lg-compare__k {
  display: block;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}
