/**
 * QBA Typography System
 *
 * Three faces, three jobs:
 *   IBM Plex Serif — headings only (academic display)
 *   Inter (theme-bundled) — body text and UI, tuned for on-screen reading
 *   IBM Plex Mono  — dates, labels, metadata
 *
 * All files self-hosted (works behind the GFW), latin subset;
 * Chinese text falls through to the system CJK stack.
 */

@font-face {
	font-family: 'IBM Plex Serif';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('fonts/ibm-plex-serif-latin-500-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Serif';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('fonts/ibm-plex-serif-latin-600-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Serif';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('fonts/ibm-plex-serif-latin-700-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

:root {
	--qba-font-heading: 'IBM Plex Serif', 'Songti SC', 'STSong', 'SimSun', Georgia, serif;
	--qba-font-body: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', -apple-system, 'Helvetica Neue', Arial, sans-serif;
	--qba-font-mono: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;

	/* Type scale — fluid between phone and desktop. */
	--qba-size-display: clamp(2rem, 1.55rem + 1.9vw, 2.7rem);   /* h1, page titles */
	--qba-size-h2: clamp(1.5rem, 1.3rem + 0.8vw, 1.75rem);
	--qba-size-h3: clamp(1.22rem, 1.12rem + 0.4vw, 1.35rem);
	--qba-size-body: 1rem;
	--qba-size-lead: 1.15rem;
	--qba-size-small: 0.875rem;
	--qba-size-label: 0.8rem;

	/* Retune the WP presets the theme's blocks already reference. */
	--wp--preset--font-family--heading: var(--qba-font-heading);
	--wp--preset--font-family--body: var(--qba-font-body);
	--wp--preset--font-size--small: var(--qba-size-small);
	--wp--preset--font-size--medium: var(--qba-size-body);
	--wp--preset--font-size--large: var(--qba-size-h2);
	--wp--preset--font-size--x-large: var(--qba-size-h2);
	--wp--preset--font-size--xx-large: var(--qba-size-display);
}

/* --- Body ----------------------------------------------------------------- */
body {
	font-family: var(--qba-font-body);
	font-size: var(--qba-size-body);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* --- Headings: one face, clear steps, tighter leading ---------------------- */
h1, h2, h3, h4, h5, h6,
.wp-block-heading {
	font-family: var(--qba-font-heading);
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: -0.005em;
	text-wrap: balance;
}

h1, .wp-block-heading:where(h1) {
	font-size: var(--qba-size-display);
	font-weight: 600;
	line-height: 1.15;
}

h2 { font-size: var(--qba-size-h2); }
h3 { font-size: var(--qba-size-h3); }

h4, h5, h6 {
	font-family: var(--qba-font-body);
	font-size: var(--qba-size-body);
	font-weight: 600;
	letter-spacing: 0;
}

/* Site title is UI, not a document heading — keep it in Sans. */
.wp-block-site-title,
.wp-block-site-title a {
	font-family: var(--qba-font-body);
	font-weight: 600;
	letter-spacing: 0;
}

/* --- Lists & links ---------------------------------------------------------- */
ul, ol {
	line-height: 1.65;
}

a {
	text-underline-offset: 0.15em;
}

/* --- Small print ------------------------------------------------------------ */
figcaption,
.wp-block-image figcaption,
.wp-element-caption {
	font-family: var(--qba-font-body);
	font-size: var(--qba-size-small);
	line-height: 1.5;
}

/* --- Utility classes for content editors --------------------------------------
   qba-date   — news dates and timestamps
   qba-label  — small uppercase section labels                              */
.qba-date {
	font-family: var(--qba-font-mono);
	font-size: var(--qba-size-label);
	font-weight: 500;
	letter-spacing: 0.04em;
}

.qba-label {
	font-family: var(--qba-font-mono);
	font-size: var(--qba-size-label);
	font-weight: 500;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
