/*
 * Non-index typography adapter, based on the approved /blog/ index.
 *
 * Load fonts.css first and this adapter AFTER every legacy page stylesheet.
 * Add hf-unified to the five existing bodies; retain site-narrow.
 * The current /blog/ body has no site-narrow class and is intentionally excluded.
 *
 * Only typography changes: sizes, line heights, spacing, grids and breakpoints
 * remain owned by the existing page styles. The explicit family declarations
 * override site-shell.css's final broad sans-serif reset and font shorthands.
 */

body.hf-unified.site-narrow {
  --f-display: "Newsreader", "Songti SC", "Noto Serif SC", Georgia, serif;
  --f-body: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Bridge the names used by home, careers, journal and the old shared shell. */
  --site-font: var(--f-body);
  --font-ui: var(--f-body);
  --sans: var(--f-body);
  --reading: var(--f-body);
  --display: var(--f-display);
  --mono: var(--f-mono);

  font-family: var(--f-body) !important;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

/* Reading text, navigation, controls, captions and dense data stay sans-serif. */
body.hf-unified.site-narrow :where(
  article, p, li, dt, dd, th, td, caption, figcaption,
  a, button, input, textarea, select, summary, blockquote,
  .intro-copy, .masthead-byline, .paper-keywords,
  .caption-title, .caption-index, .reference-entry,
  .benchmark-scope, .benchmark-comparison, .benchmark-source,
  .benchmark-gain, .reading-note, .table-note
) {
  font-family: var(--f-body) !important;
}

/* Use the available 600 face for prose emphasis rather than synthesized 700. */
body.hf-unified.site-narrow :where(strong, b) {
  font-weight: 600;
}
body.hf-unified.research-page #article strong,
body.hf-unified.research-page .benchmark-gain strong {
  font-weight: 600;
}

/* Main display hierarchy, with existing sizes and line-height preserved. */
body.hf-unified.site-narrow :where(
  h1, h2, .copy-lead, .masthead-subtitle, .section-heading
) {
  font-family: var(--f-display) !important;
  font-weight: 400 !important;
}

body.hf-unified.site-narrow :where(h3) {
  font-family: var(--f-display) !important;
  font-weight: 500 !important;
}

body.hf-unified.site-narrow :where(h4, h5, h6) {
  font-family: var(--f-body) !important;
  font-weight: 600 !important;
}

/* A headline link or emphasized word keeps the enclosing display typeface. */
body.hf-unified.site-narrow :where(h1, h2, h3) :where(a, strong, b, em) {
  font-family: inherit !important;
  font-weight: inherit;
}

body.hf-unified.research-page :where(
  .editorial-insight p,
  .editorial-definitions strong:first-child
) {
  font-family: var(--f-display) !important;
  font-weight: 400 !important;
}

/* Category labels correspond to the index's .mono, .chip and .meta time. */
body.hf-unified.site-narrow :where(
  .mono, .hf-mono,
  .masthead-category, .masthead-category a, .masthead-category time,
  .masthead-byline > span, .masthead-byline time,
  .toc-label, .toc-number, .reference-number
),
body.hf-unified.careers-page .role-group h3 {
  font-family: var(--f-mono) !important;
  font-weight: 400 !important;
}

body.hf-unified.research-page .finding-list p::before {
  font-family: var(--f-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Job titles are interactive content, while the group names are labels. */
body.hf-unified.careers-page .role-link {
  font-family: var(--f-body) !important;
  font-weight: 400;
}

/* Download and disclosure controls must not inherit the old --display face. */
body.hf-unified.research-page :where(
  .paper-download, .research-details > summary,
  .mobile-contents > summary, .viewer-toolbar, .viewer-toolbar button,
  .result-comparison-heading, .comparison-panel h4
) {
  font-family: var(--f-body) !important;
}

/* Headline metrics follow the index's Newsreader 500 .results b treatment. */
body.hf-unified.research-page :where(
  .benchmark-scores dd,
  .editorial-results strong:first-child
),
body.hf-unified.research-page #article .result-pair strong {
  font-family: var(--f-display) !important;
  font-weight: 500 !important;
  font-variant-numeric: lining-nums tabular-nums;
}

/* Metric annotations remain reading text, including dd.benchmark-gain. */
body.hf-unified.research-page .benchmark-scores .benchmark-gain {
  font-family: var(--f-body) !important;
  font-weight: 400 !important;
}
body.hf-unified.research-page .benchmark-scores .benchmark-gain strong {
  font-family: var(--f-body) !important;
  font-weight: 600 !important;
}

/* Tables and chart labels retain compact sans text with aligned numerals. */
body.hf-unified.research-page :where(
  table, th, td, .comparison-row dt, .comparison-row dd,
  .comparison-row strong, .chart-scale
) {
  font-family: var(--f-body) !important;
  font-variant-numeric: lining-nums tabular-nums;
}

/* Code is mono; equation pre blocks are prose mathematics, not source code. */
body.hf-unified.site-narrow :where(code, kbd, samp, pre) {
  font-family: var(--f-mono) !important;
}
body.hf-unified.site-narrow pre.equation {
  font-family: var(--f-display) !important;
  font-weight: 400;
}
body.hf-unified.site-narrow :where(pre, code, kbd, samp) :where(a, span, strong, b) {
  font-family: inherit !important;
}

/*
 * No SVG font override is needed. The audited live inline SVGs have no <text>;
 * chart SVG glyphs are paths, and original paper images retain their type.
 */
