/* Chinese Learning Hub — theme styles.
   Duplicates the plugin's design tokens (plugin/clh/assets/css/base.css) so
   theme pages and plugin pages read as one product. */

/* Onest (SIL Open Font License, see assets/fonts/OFL.txt): self-hosted, one
   variable file per subset. It covers every pinyin tone mark, so pinyin
   never falls back to a second typeface mid-word. */
@font-face {
	font-family: 'Onest';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url(../fonts/onest-latin-ext.woff2) format('woff2');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: 'Onest';
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url(../fonts/onest-latin.woff2) format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	color-scheme: light;
	/* Surfaces, lightest on top: bg < card < raised. Sunken is for wells
	   (progress tracks, quiet chips). */
	--clh-bg: #faf6f0;
	--clh-card-bg: #ffffff;
	--clh-raised: #ffffff;
	--clh-sunken: #f1ebe3;
	--clh-card-shadow: 0 1px 2px rgba(44, 30, 18, 0.05), 0 8px 24px rgba(44, 30, 18, 0.07);
	--clh-radius: 16px;
	--clh-radius-sm: 12px;
	--clh-text: #1f1a17;
	--clh-text-muted: #675e57;
	--clh-border: #ebe4da;
	--clh-control-border: #d3c9be;
	/* Brand red: --clh-accent fills primary buttons (white text on it),
	   --clh-accent-strong is their bottom edge, --clh-accent-text is
	   accent-coloured text on page / card surfaces. */
	--clh-accent: #c8102e;
	--clh-accent-strong: #9c0c24;
	--clh-accent-text: #c8102e;
	--clh-accent-soft: rgba(200, 16, 46, 0.08);
	/* Answer states. Selection is blue so red only ever means "wrong". */
	--clh-select: #1f6fe0;
	--clh-select-soft: rgba(31, 111, 224, 0.1);
	/* Jade: progress and success. --clh-green is text / borders,
	   --clh-green-fill a button fill (white text), --clh-progress a bar fill. */
	--clh-green: #0e7a52;
	--clh-green-soft: rgba(14, 122, 82, 0.1);
	--clh-green-fill: #0e7a52;
	--clh-green-fill-strong: #0a5a3c;
	--clh-progress: #17a673;
	--clh-wrong: #c8102e;
	--clh-wrong-soft: rgba(200, 16, 46, 0.08);
	--clh-disabled-bg: #ebe5dd;
	--clh-disabled-text: #7d746d;
	--clh-focus: #1f6fe0;
	/* Gold: rewards (XP, streak, goals). --clh-warm is gold as text. */
	--clh-gold: #f2a51d;
	--clh-gold-soft: #fff3d6;
	--clh-warm: #b25f00;
	--clh-culture-bg: #fff8e6;
	--clh-culture-border: #f0e3c0;

	--clh-tone-1: #e30000;
	--clh-tone-2: #d97a00;
	--clh-tone-3: #2a9d2a;
	--clh-tone-4: #1f6fe0;
	--clh-tone-5: #888;

	--clh-font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--clh-font-cn: 'Noto Sans TC', 'Noto Sans SC', 'PingFang TC', 'PingFang SC', 'Microsoft JhengHei', 'Microsoft YaHei', sans-serif;

	--clh-header-h: 64px;
	--clh-wrap: 1080px;
	--clh-content: 720px;
	/* Where sticky bars sit: below the WP admin bar (logged in) and site header. */
	--clh-sticky-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--clh-header-h));
}

/* Dark palette: follows the system unless the learner picked a theme
   (html[data-theme], set by the header switch and an inline head script). */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--clh-bg: #181513;
		--clh-card-bg: #24201d;
		--clh-raised: #2e2925;
		--clh-sunken: #3a342f;
		--clh-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
		--clh-text: #f4efea;
		--clh-text-muted: #c2b8af;
		--clh-border: #3b3530;
		--clh-control-border: #7a7066;
		--clh-accent: #d42a45;
		--clh-accent-strong: #a31c33;
		--clh-accent-text: #ff7385;
		--clh-accent-soft: rgba(255, 90, 110, 0.16);
		--clh-select: #6fa8ff;
		--clh-select-soft: rgba(111, 168, 255, 0.16);
		--clh-green: #4fd69c;
		--clh-green-soft: rgba(79, 214, 156, 0.14);
		--clh-green-fill: #1a8259;
		--clh-green-fill-strong: #125e40;
		--clh-progress: #34c08a;
		--clh-wrong: #ff7385;
		--clh-wrong-soft: rgba(255, 90, 110, 0.14);
		--clh-disabled-bg: #3a3430;
		--clh-disabled-text: #a99e95;
		--clh-focus: #6fa8ff;
		--clh-gold: #f5b942;
		--clh-gold-soft: rgba(245, 185, 66, 0.14);
		--clh-warm: #ffb35c;
		--clh-culture-bg: #332a17;
		--clh-culture-border: #5a4b26;

		--clh-tone-1: #ff6b6b;
		--clh-tone-2: #ffb25e;
		--clh-tone-3: #5edb74;
		--clh-tone-4: #6fb6ff;
		--clh-tone-5: #b0a89f;
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--clh-bg: #181513;
	--clh-card-bg: #24201d;
	--clh-raised: #2e2925;
	--clh-sunken: #3a342f;
	--clh-card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
	--clh-text: #f4efea;
	--clh-text-muted: #c2b8af;
	--clh-border: #3b3530;
	--clh-control-border: #7a7066;
	--clh-accent: #d42a45;
	--clh-accent-strong: #a31c33;
	--clh-accent-text: #ff7385;
	--clh-accent-soft: rgba(255, 90, 110, 0.16);
	--clh-select: #6fa8ff;
	--clh-select-soft: rgba(111, 168, 255, 0.16);
	--clh-green: #4fd69c;
	--clh-green-soft: rgba(79, 214, 156, 0.14);
	--clh-green-fill: #1a8259;
	--clh-green-fill-strong: #125e40;
	--clh-progress: #34c08a;
	--clh-wrong: #ff7385;
	--clh-wrong-soft: rgba(255, 90, 110, 0.14);
	--clh-disabled-bg: #3a3430;
	--clh-disabled-text: #a99e95;
	--clh-focus: #6fa8ff;
	--clh-gold: #f5b942;
	--clh-gold-soft: rgba(245, 185, 66, 0.14);
	--clh-warm: #ffb35c;
	--clh-culture-bg: #332a17;
	--clh-culture-border: #5a4b26;

	--clh-tone-1: #ff6b6b;
	--clh-tone-2: #ffb25e;
	--clh-tone-3: #5edb74;
	--clh-tone-4: #6fb6ff;
	--clh-tone-5: #b0a89f;
}

/* ---- Base / reset ---- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background: var(--clh-bg);
	color: var(--clh-text);
	font-family: var(--clh-font);
	font-size: 17px;
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	margin: 0 0 0.6em;
}

h3,
h4 {
	font-weight: 700;
	letter-spacing: -0.01em;
}

p {
	margin: 0 0 1em;
}

img {
	max-width: 100%;
	height: auto;
}

a {
	color: var(--clh-accent-text);
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

a:hover {
	color: var(--clh-accent-text);
}

.zh {
	font-family: var(--clh-font-cn);
}

/* ---- Accessibility ---- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: 16px;
	top: 12px;
	z-index: 1000;
	background: var(--clh-accent);
	color: #fff;
	padding: 10px 16px;
	border-radius: 8px;
	font-weight: 700;
	text-decoration: none;
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: translateY(0);
	color: #fff;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--clh-focus);
	outline-offset: 2px;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
	outline: none;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* ---- Layout ---- */

.container {
	width: 100%;
	max-width: var(--clh-wrap);
	margin: 0 auto;
	padding-left: 20px;
	padding-right: 20px;
}

.page-wrap {
	width: 100%;
	max-width: var(--clh-content);
	margin: 0 auto;
	padding: 32px 16px 72px;
}

/* The dashboard uses a wider, two-column page on desktop. */
.page-wrap:has(#clh-dashboard),
.page-wrap:has(#clh-stats),
.page-wrap:has(#clh-certificate) {
	max-width: var(--clh-wrap);
}

.site-main {
	display: block;
	min-height: 60vh;
}

/* ---- Buttons ----
   Tactile: a solid bottom edge (box-shadow, so pressing never shifts the
   layout) that the button sinks into on :active. */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 10px 22px;
	border-radius: 14px;
	font-family: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
	border: 2px solid var(--clh-control-border);
	box-shadow: 0 3px 0 var(--clh-control-border);
	background: var(--clh-raised);
	color: var(--clh-text);
	text-decoration: none;
	transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.15s ease;
}

.btn:hover {
	filter: brightness(0.98);
	color: var(--clh-text);
}

.btn:active {
	transform: translateY(3px);
	box-shadow: none;
}

.btn--primary {
	background: var(--clh-accent);
	border-color: var(--clh-accent);
	box-shadow: 0 4px 0 var(--clh-accent-strong);
	color: #fff;
}

.btn--primary:hover {
	color: #fff;
	filter: brightness(1.06);
}

.btn--primary:active {
	transform: translateY(4px);
}

.btn--ghost {
	background: transparent;
}

.btn--lg {
	min-height: 56px;
	padding: 14px 30px;
	font-size: 1.08rem;
	border-radius: 16px;
}

.btn--sm {
	min-height: 40px;
	padding: 6px 16px;
	font-size: 0.92rem;
	border-radius: 12px;
	box-shadow: 0 2px 0 var(--clh-control-border);
}

.btn--sm.btn--primary {
	box-shadow: 0 3px 0 var(--clh-accent-strong);
}

/* ---- Header ---- */

.site-header {
	position: sticky;
	/* Below the WP admin bar when logged in (WP sets this variable). */
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	border-bottom: 1px solid var(--clh-border);
}

/* The frosted backdrop sits on a layer of its own: a backdrop-filter on the header
   itself would stop the mobile menu panel inside it from blurring the page. */
.site-header::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: color-mix(in srgb, var(--clh-card-bg) 92%, transparent);
	-webkit-backdrop-filter: saturate(1.4) blur(10px);
	backdrop-filter: saturate(1.4) blur(10px);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: 12px;
	min-height: var(--clh-header-h);
}

.site-brand {
	flex: 1 1 auto;
	min-width: 0;
}

.site-brand__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	color: var(--clh-text);
}

.site-brand__link:hover {
	color: var(--clh-text);
}

/* Logo: the owner's name seal, 孫子杰, pressed slightly askew like a real stamp. */
.site-brand__seal {
	display: block;
	width: 40px;
	height: 40px;
	flex: none;
	color: var(--clh-accent);
	transform: rotate(-3deg);
}

.site-brand__seal svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.site-brand__name {
	font-size: 1.12rem;
	font-weight: 800;
	letter-spacing: -0.02em;
	white-space: nowrap;
}

.custom-logo {
	max-height: 44px;
	width: auto;
}

/* Nav */

.site-nav {
	display: none;
}

.site-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.site-nav__link {
	display: block;
	padding: 10px 14px;
	white-space: nowrap;
	color: var(--clh-text-muted);
	text-decoration: none;
	font-weight: 700;
	font-size: 0.97rem;
	border-radius: 999px;
	transition: background 0.15s ease, color 0.15s ease;
}

.site-nav__link:hover {
	color: var(--clh-text);
	background: var(--clh-sunken);
}

.site-nav__link[aria-current="page"] {
	color: var(--clh-accent-text);
	background: var(--clh-accent-soft);
}

/* Hamburger */

.site-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex: none;
	border: 2px solid var(--clh-border);
	border-radius: 12px;
	background: var(--clh-card-bg);
	color: var(--clh-text);
	cursor: pointer;
}

.site-nav-toggle__bars {
	display: flex;
	flex-direction: column;
	gap: 5px;
	width: 20px;
}

.site-nav-toggle__bar {
	display: block;
	height: 2px;
	width: 20px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.18s ease, opacity 0.18s ease;
}

.site-nav-toggle.is-open .site-nav-toggle__bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.site-nav-toggle.is-open .site-nav-toggle__bar:nth-child(2) {
	opacity: 0;
}

.site-nav-toggle.is-open .site-nav-toggle__bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Header actions (auth / pill) */

.site-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: none;
}

/* Colour theme switch: one icon per mode (auto / light / dark). */
.site-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 2px solid var(--clh-border);
	border-radius: 999px;
	background: transparent;
	color: var(--clh-text-muted);
	cursor: pointer;
	flex: none;
}

.site-theme-toggle:hover {
	border-color: var(--clh-control-border);
	color: var(--clh-text);
}

.site-theme-toggle__icon {
	display: none;
}

.site-theme-toggle:not([data-mode]) .site-theme-toggle__icon--auto,
.site-theme-toggle[data-mode="auto"] .site-theme-toggle__icon--auto,
.site-theme-toggle[data-mode="light"] .site-theme-toggle__icon--light,
.site-theme-toggle[data-mode="dark"] .site-theme-toggle__icon--dark {
	display: block;
}

.lang-offer {
	background: var(--clh-card-bg);
	border-bottom: 1px solid var(--clh-border);
}

.lang-offer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 16px;
	padding-top: 7px;
	padding-bottom: 7px;
}

.lang-offer__text {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
}

.lang-offer__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: center;
}

.lang-offer__yes,
.lang-offer__no {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 6px 14px;
	border-radius: 999px;
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
}

.lang-offer__yes {
	background: var(--clh-accent);
	border: 2px solid var(--clh-accent);
	color: #fff;
	text-decoration: none;
}

.lang-offer__yes:hover {
	color: #fff;
	filter: brightness(1.06);
}

.lang-offer__no {
	background: transparent;
	border: 2px solid var(--clh-border);
	color: var(--clh-text-muted);
}

.lang-offer__no:hover {
	border-color: var(--clh-control-border);
	color: var(--clh-text);
}

/* Streak + XP: the learner's two daily numbers, always in view. */
.site-pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px;
	border: 2px solid var(--clh-border);
	border-radius: 999px;
	color: var(--clh-text);
	text-decoration: none;
	font-weight: 800;
	font-size: 0.92rem;
}

.site-pill:hover {
	color: var(--clh-text);
	border-color: var(--clh-control-border);
}

.site-pill__stat {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 9px;
	border-radius: 999px;
}

.site-pill__stat svg {
	color: var(--clh-text-muted);
	font-size: 1.05em;
}

/* XP is gold; the flame lights up once there is a streak. */
.site-pill__stat + .site-pill__stat {
	background: var(--clh-gold-soft);
}

.site-pill__stat + .site-pill__stat svg {
	color: var(--clh-gold);
}

.site-pill.is-lit .site-pill__stat:first-child svg {
	color: var(--clh-gold);
}

.site-pill__value {
	font-variant-numeric: tabular-nums;
}

.site-pill__unit {
	color: var(--clh-warm);
	font-size: 0.78em;
	font-weight: 800;
}

/* ---- Lesson focus mode ----
   Inside a lesson nothing competes with the exercise: no site navigation,
   no footer, and the header scrolls away so only the lesson's own progress
   row stays on screen. */

.single-clh_lesson .site-header,
.clh-focus .site-header {
	position: static;
	background: transparent;
	border-bottom-color: transparent;
}

.single-clh_lesson .site-header::before,
.clh-focus .site-header::before {
	content: none;
}

.single-clh_lesson .site-nav,
.single-clh_lesson .site-nav-toggle,
.single-clh_lesson .site-footer,
.clh-focus .site-nav,
.clh-focus .site-nav-toggle,
.clh-focus .site-footer,
.clh-focus .page-header {
	display: none;
}

body.single-clh_lesson,
body.clh-focus {
	--clh-sticky-top: var(--wp-admin--admin-bar--height, 0px);
}

/* ---- Entry / page content ---- */

.page-header {
	margin-bottom: 24px;
}

.page-title {
	font-size: 2.1rem;
	margin: 0;
}

.page-header__desc {
	color: var(--clh-text-muted);
}

.entry-content {
	font-size: 1.05rem;
}

.entry-content > :first-child {
	margin-top: 0;
}

.page-links {
	margin-top: 24px;
}

/* Lesson single: no chrome, the plugin owns the layout. */
.lesson-page {
	width: 100%;
}

/* ---- Blog / archive listing ---- */

.post-list {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.post-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	background: var(--clh-card-bg);
	border-radius: var(--clh-radius);
	box-shadow: var(--clh-card-shadow);
	padding: 16px;
}

.post-card__thumb {
	display: block;
	border-radius: var(--clh-radius-sm);
	overflow: hidden;
	background: var(--clh-sunken);
}

.post-card__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.post-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.post-card__title {
	font-size: 1.25rem;
	margin: 0;
}

.post-card__title a {
	color: var(--clh-text);
	text-decoration: none;
}

.post-card__title a:hover {
	color: var(--clh-accent-text);
}

.post-card__meta {
	font-size: 0.85rem;
	color: var(--clh-text-muted);
}

.post-card__excerpt {
	color: var(--clh-text-muted);
}

.post-card__excerpt p {
	margin: 0;
}

.pagination .nav-links {
	display: flex;
	gap: 8px;
	justify-content: center;
	margin-top: 32px;
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 6px 12px;
	border: 2px solid var(--clh-border);
	border-radius: 12px;
	color: var(--clh-text);
	text-decoration: none;
	font-weight: 700;
}

.pagination .page-numbers.current {
	background: var(--clh-accent);
	border-color: var(--clh-accent);
	color: #fff;
}

/* ---- Front page ----
   A serif headline beside the 你好 quiz card, then the first story, an HSK exam question, the
   tones and the A1-C2 path. Headings and big characters use 'CLH Serif', a subset of Noto Serif
   CJK TC Black holding only this page's characters (dev/home-font.py). */

@font-face {
	font-family: 'CLH Serif';
	src: url('../fonts/serif-home.woff2') format('woff2');
	font-weight: 900;
	font-display: swap;
}

.home {
	--home-serif: 'CLH Serif', 'Noto Serif TC', 'Songti TC', 'STSong', Georgia, serif;
}

.home-band {
	padding: 88px 0;
}

.home-band + .home-band {
	border-top: 1px solid var(--clh-border);
}

.home-hero__title,
.home-title {
	margin: 0;
	font-family: var(--home-serif);
	font-weight: 900;
	letter-spacing: -0.01em;
	color: var(--clh-text);
}

.home-hero__title {
	font-size: clamp(2.5rem, 6vw, 4.25rem);
	line-height: 1.08;
}

.home-hero__title em {
	font-style: normal;
	color: var(--clh-accent-text);
}

.home-title {
	font-size: clamp(1.9rem, 4vw, 2.6rem);
	line-height: 1.15;
}

.home-lede {
	max-width: 34em;
	margin: 20px 0 0;
	font-size: 1.19rem;
	line-height: 1.6;
	color: var(--clh-text-muted);
}

.home-kicker {
	margin: 0 0 18px;
	font-size: 0.95rem;
	color: var(--clh-text-muted);
}

.home-kicker b {
	color: var(--clh-text);
}

.home-split {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 64px;
	align-items: center;
}

.home-split--wide {
	grid-template-columns: 5fr 6fr;
}

.home-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 32px;
}

.home-more {
	display: inline-block;
	margin-top: 22px;
	font-weight: 600;
	color: var(--clh-accent-text);
	text-decoration: none;
}

.home-more:hover {
	text-decoration: underline;
}

.home-facts {
	display: grid;
	gap: 12px;
	margin: 28px 0 0;
	padding: 0;
	list-style: none;
}

.home-facts li {
	position: relative;
	padding-left: 22px;
	line-height: 1.5;
	color: var(--clh-text);
}

.home-facts li::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0.6em;
	width: 8px;
	height: 8px;
	border-radius: 2px;
	background: var(--clh-accent);
}

/* Hero */
.home-hero {
	position: relative;
	overflow: hidden;
	padding: 72px 0 88px;
}

.home-hero__seal {
	position: absolute;
	right: -40px;
	bottom: -80px;
	font-family: var(--home-serif);
	font-weight: 900;
	font-size: 420px;
	line-height: 1;
	color: var(--clh-accent);
	opacity: 0.045;
	pointer-events: none;
	user-select: none;
}

.home-hero .home-demo {
	position: relative;
}

/* Hero demo: a real question the visitor can answer before signing up. */

.home-demo {
	justify-self: center;
	width: 100%;
	max-width: 400px;
	background: var(--clh-card-bg);
	border-radius: 24px;
	box-shadow: 0 2px 4px rgba(44, 30, 18, 0.06), 0 24px 48px rgba(44, 30, 18, 0.14);
	padding: 18px 22px 22px;
	text-align: center;
}

.home-demo__bar {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 14px;
}

.home-demo__track {
	flex: 1;
	height: 12px;
	border-radius: 999px;
	background: var(--clh-sunken);
	overflow: hidden;
}

.home-demo__fill {
	display: block;
	height: 100%;
	width: 8%;
	border-radius: 999px;
	background: var(--clh-progress);
	transition: width 0.35s ease;
}

.home-demo__xp {
	font-size: 0.85rem;
	font-weight: 800;
	color: var(--clh-warm);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.home-demo__label {
	font-size: 0.78rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--clh-text-muted);
	margin: 0 0 6px;
}

.home-demo__zh {
	font-family: var(--clh-font-cn);
	font-size: 3.6rem;
	font-weight: 500;
	line-height: 1.15;
}

.home-demo__py {
	display: flex;
	gap: 10px;
	justify-content: center;
	font-size: 1.3rem;
	font-weight: 600;
	margin-bottom: 14px;
}

.home-demo__q {
	font-weight: 700;
	margin: 0 0 12px;
}

.home-demo__options {
	display: grid;
	gap: 10px;
}

.home-demo__opt {
	min-height: 52px;
	padding: 10px 16px;
	border: 2px solid var(--clh-control-border);
	box-shadow: 0 3px 0 var(--clh-control-border);
	border-radius: 14px;
	background: var(--clh-raised);
	color: var(--clh-text);
	font-family: inherit;
	font-size: 1.02rem;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.06s ease, box-shadow 0.06s ease, border-color 0.15s ease;
}

.home-demo__opt:hover:not(:disabled) {
	border-color: var(--clh-select);
	box-shadow: 0 3px 0 var(--clh-select);
}

.home-demo__opt:active:not(:disabled) {
	transform: translateY(3px);
	box-shadow: none;
}

.home-demo__opt.is-correct {
	border-color: var(--clh-green);
	box-shadow: 0 3px 0 var(--clh-green);
	background: var(--clh-green-soft);
	color: var(--clh-green);
}

.home-demo__opt.is-wrong {
	border-color: var(--clh-wrong);
	box-shadow: none;
	background: var(--clh-wrong-soft);
	text-decoration: line-through;
	opacity: 0.8;
	cursor: not-allowed;
}

.home-demo__opt:disabled:not(.is-correct):not(.is-wrong) {
	opacity: 0.55;
	cursor: default;
}

.home-demo__fb {
	margin: 14px 0 0;
	padding: 10px 14px;
	border-radius: 12px;
	font-weight: 600;
	text-align: left;
}

.home-demo__fb.is-correct {
	background: var(--clh-green-soft);
	color: var(--clh-green);
}

.home-demo__fb.is-wrong {
	background: var(--clh-wrong-soft);
	color: var(--clh-wrong);
}

.home-demo__next {
	width: 100%;
	margin-top: 12px;
}

.home-demo__next.btn--primary {
	background: var(--clh-green-fill);
	border-color: var(--clh-green-fill);
	box-shadow: 0 4px 0 var(--clh-green-fill-strong);
}

.home-demo__done-title {
	font-size: 1.5rem;
	margin: 10px 0 6px;
}

.home-demo__done-text {
	color: var(--clh-text-muted);
	margin: 0 0 4px;
}

.home-demo__star {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	margin-top: 6px;
	border-radius: 50%;
	background: var(--clh-gold-soft);
	color: var(--clh-gold);
	font-size: 2.4rem;
	animation: home-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes home-pop {
	from {
		transform: scale(0.4);
		opacity: 0;
	}
	to {
		transform: scale(1);
		opacity: 1;
	}
}

.tone-1 { color: var(--clh-tone-1); }
.tone-2 { color: var(--clh-tone-2); }
.tone-3 { color: var(--clh-tone-3); }
.tone-4 { color: var(--clh-tone-4); }
.tone-5 { color: var(--clh-tone-5); }


/* Story reader */
.home-reader {
	padding: 28px 28px 20px;
	border: 1px solid var(--clh-border);
	border-radius: var(--clh-radius);
	background: var(--clh-card-bg);
	box-shadow: var(--clh-card-shadow);
}

.home-reader__head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	margin-bottom: 8px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--clh-border);
}

.home-reader__title {
	font-family: var(--home-serif);
	font-weight: 900;
	font-size: 1.9rem;
}

.home-reader__title small {
	display: block;
	margin-top: 2px;
	font-family: var(--clh-font);
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--clh-text-muted);
}

.home-reader__tools {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 6px;
}

.home-chip {
	min-height: 32px;
	padding: 6px 12px;
	border: 1px solid var(--clh-control-border);
	border-radius: 999px;
	background: transparent;
	color: var(--clh-text);
	font: 600 0.8rem/1 var(--clh-font);
	cursor: pointer;
}

.home-chip[lang^="zh"] {
	font-family: var(--clh-font-cn);
}

.home-chip[aria-pressed="true"] {
	border-color: var(--clh-text);
	background: var(--clh-text);
	color: var(--clh-bg);
}

.home-line {
	display: grid;
	grid-template-columns: 36px 1fr;
	align-items: start;
	gap: 10px;
	padding: 12px 6px;
	border-radius: 10px;
	cursor: pointer;
}

.home-line:hover,
.home-line.is-playing {
	background: var(--clh-sunken);
}

.home-line__play {
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin-top: 4px;
	border: 0;
	border-radius: 50%;
	background: var(--clh-select-soft);
	color: var(--clh-select);
	cursor: pointer;
}

.home-line__zh {
	font-family: var(--clh-font-cn);
	font-size: 1.5rem;
	line-height: 1.4;
}

.home-line__py {
	margin-top: 2px;
	font-size: 0.95rem;
}

.home-line__en {
	margin-top: 2px;
	font-size: 0.875rem;
	color: var(--clh-text-muted);
}

.home-reader.no-py .home-line__py,
.home-reader.no-en .home-line__en {
	display: none;
}

.home-reader__foot {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--clh-border);
	font-size: 0.8rem;
	color: var(--clh-text-muted);
}

/* Exam question */
.home-exam {
	padding: 28px;
	border: 1px solid var(--clh-border);
	border-radius: var(--clh-radius);
	background: var(--clh-card-bg);
	box-shadow: var(--clh-card-shadow);
}

.home-exam__meta {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--clh-text-muted);
}

.home-exam__listen {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 22px 0;
}

.home-exam__listen button {
	display: grid;
	place-items: center;
	flex: none;
	width: 56px;
	height: 56px;
	border: 0;
	border-radius: 50%;
	background: var(--clh-accent);
	color: #fff;
	box-shadow: 0 3px 0 var(--clh-accent-strong);
	cursor: pointer;
}

.home-exam__note {
	font-size: 0.875rem;
	color: var(--clh-text-muted);
}

.home-exam__pics {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
}

.home-exam__pic {
	position: relative;
	padding: 8px;
	border: 2px solid var(--clh-border);
	border-radius: 14px;
	background: var(--clh-raised);
	cursor: pointer;
}

.home-exam__pic img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.home-exam__pic span {
	position: absolute;
	top: 8px;
	left: 10px;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.home-exam__pic.is-right {
	border-color: var(--clh-green);
	background: var(--clh-green-soft);
}

.home-exam__pic.is-wrong {
	border-color: var(--clh-wrong);
	background: var(--clh-wrong-soft);
}

.home-exam__explain {
	min-height: 3em;
	margin: 16px 0 0;
	font-size: 0.95rem;
	line-height: 1.5;
	color: var(--clh-text-muted);
}

/* Tones */
.home-tones {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 8px;
	margin-top: 40px;
}

.home-tone {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 18px 4px 14px;
	border: 1px solid var(--clh-border);
	border-radius: 14px;
	background: var(--clh-card-bg);
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.home-tone:hover {
	background: var(--clh-sunken);
}

.home-tone__zh {
	font-family: var(--home-serif);
	font-weight: 900;
	font-size: 3.25rem;
	line-height: 1.1;
}

.home-tone__py {
	margin-top: 4px;
	font-size: 1.25rem;
	font-weight: 700;
}

.home-tone__en {
	margin-top: 2px;
	font-size: 0.8rem;
	color: var(--clh-text-muted);
	text-align: center;
}

/* The path */
.home-path {
	position: relative;
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	margin: 48px 0 0;
	padding: 0;
	list-style: none;
}

.home-path::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 27px;
	height: 2px;
	background: var(--clh-border);
}

.home-path li {
	position: relative;
	padding-right: 16px;
}

.home-path li > span {
	display: block;
}

.home-path .home-path__dot {
	position: relative;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	border-radius: 16px;
	background: var(--clh-accent);
	color: #fff;
	font-size: 1.1rem;
	font-weight: 800;
	box-shadow: 0 3px 0 var(--clh-accent-strong);
}

.home-path li.is-soon .home-path__dot {
	background: var(--clh-sunken);
	color: var(--clh-text-muted);
	box-shadow: none;
}

.home-path__hsk {
	margin-top: 14px;
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--clh-text-muted);
}

.home-path__desc {
	margin-top: 4px;
	font-size: 0.95rem;
	line-height: 1.45;
}

.home-path__n {
	margin-top: 6px;
	font-size: 0.8rem;
	color: var(--clh-text-muted);
}

.home-parts {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 28px;
	margin: 56px 0 0;
	font-size: 0.95rem;
	color: var(--clh-text-muted);
}

.home-parts b {
	color: var(--clh-text);
}

/* Videos */
.home-videos {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	margin-top: 32px;
}

.home-video {
	margin: 0;
}

.home-video__thumb {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: var(--clh-radius);
	background: var(--clh-sunken);
	box-shadow: var(--clh-card-shadow);
}

.home-video__thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.home-video__play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.18);
	color: #fff;
	font-size: 2.6rem;
}

.home-video__thumb:hover .home-video__play {
	background: rgba(0, 0, 0, 0.3);
}

.home-video__title {
	margin: 12px 0 0;
	font-size: 1.1rem;
}

.home-video__title a {
	color: var(--clh-text);
	text-decoration: none;
}

.home-video__title a:hover {
	color: var(--clh-accent-text);
}

/* The end */
.home-end {
	text-align: center;
}

.home-end .home-end__sub {
	display: block;
	margin-top: 10px;
	font-family: var(--clh-font);
	font-size: 0.6em;
	font-weight: 600;
	color: var(--clh-text-muted);
}

.home-end .home-actions {
	justify-content: center;
}

@media (max-width: 820px) {
	.home-band {
		padding: 56px 0;
	}

	.home-hero {
		padding: 40px 0 56px;
	}

	.home-split,
	.home-split--wide {
		grid-template-columns: 1fr;
		gap: 36px;
	}

	.home-hero__seal {
		top: 0;
		right: -60px;
		bottom: auto;
		font-size: 260px;
	}

	.home-first-sm {
		order: -1;
	}

	.home-reader,
	.home-exam {
		padding: 20px 16px 16px;
	}

	.home-reader__head {
		flex-direction: column;
		align-items: flex-start;
	}

	.home-line__zh {
		font-size: 1.3rem;
	}

	.home-tones {
		gap: 6px;
	}

	.home-tone__zh {
		font-size: 2.25rem;
	}

	.home-tone__py {
		font-size: 1rem;
	}

	.home-path {
		grid-template-columns: 1fr;
		gap: 22px;
	}

	.home-path::before {
		left: 27px;
		right: auto;
		top: 0;
		bottom: 0;
		width: 2px;
		height: auto;
	}

	.home-path li {
		display: grid;
		grid-template-columns: 56px 1fr;
		column-gap: 16px;
		padding: 0;
	}

	.home-path .home-path__dot {
		grid-row: span 3;
	}

	.home-path__hsk {
		margin-top: 0;
	}

	.home-videos {
		grid-template-columns: 1fr;
	}
}

/* ---- Footer ---- */

.site-footer {
	background: var(--clh-card-bg);
	border-top: 1px solid var(--clh-border);
	padding: 40px 0 32px;
}

.site-footer__inner {
	text-align: center;
}

.site-footer__list {
	list-style: none;
	margin: 0 0 20px;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px 22px;
	justify-content: center;
}

.site-footer__list a {
	color: var(--clh-text);
	text-decoration: none;
	font-weight: 700;
}

.site-footer__list a:hover {
	color: var(--clh-accent-text);
}

.site-footer__copyright {
	color: var(--clh-text-muted);
	margin: 0 0 8px;
	font-size: 0.9rem;
}

.site-footer__credit {
	color: var(--clh-text-muted);
	margin: 0;
	font-size: 0.85rem;
}

.site-footer__credit a {
	color: var(--clh-text-muted);
}

.site-footer__privacy {
	margin: 0;
	font-size: 0.85rem;
}

.site-footer__privacy a {
	color: var(--clh-text-muted);
}

/* The name seal under the credit: pressed into the page, a little askew. */
.site-footer__seal {
	display: block;
	width: 60px;
	height: 60px;
	margin: 18px auto 0;
	transform: rotate(-4deg);
	mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .site-footer__seal {
		mix-blend-mode: normal;
	}
}

:root[data-theme="dark"] .site-footer__seal {
	mix-blend-mode: normal;
}

/* Language picker (footer and login page) */
.site-lang {
	margin: 0 0 20px;
}

.site-lang__label {
	display: block;
	color: var(--clh-text-muted);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin-bottom: 6px;
}

.site-lang__list {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	justify-content: center;
	margin: 0;
	padding: 0;
}

.site-lang__link {
	color: var(--clh-text);
	font-weight: 700;
	text-decoration: none;
}

.site-lang__link:hover,
.site-lang__link:focus-visible {
	color: var(--clh-accent-text);
	text-decoration: underline;
}

.site-lang__current {
	color: var(--clh-text-muted);
	font-weight: 700;
}

/* ---- Comments ---- */

.comments__title {
	font-size: 1.3rem;
}

.comments__list {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
}

.comments__list .comment-body {
	border: 1px solid var(--clh-border);
	border-radius: var(--clh-radius);
	padding: 16px;
	margin-bottom: 14px;
}

.comments__closed {
	color: var(--clh-text-muted);
}

/* ---- 404 ---- */

.not-found__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 14px;
	margin-top: 24px;
}

/* ---- Responsive ---- */

@media (max-width: 520px) {
	.site-brand__name {
		display: none;
	}
}

/* The logo never shrinks under the buttons beside it. */
.site-brand {
	min-width: 38px;
}

/* Narrow phones: a guest's "Log in" moves from the header into the menu. */
.site-nav__item--login {
	display: none;
}

@media (max-width: 419px) {
	.site-auth__login {
		display: none;
	}

	.site-nav__item--login {
		display: block;
	}
}

/* Mobile nav panel (slide-down) */
@media (max-width: 860px) {
	.site-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		z-index: 50;
		/* Frosted glass: the page shows through, blurred. */
		background: color-mix(in srgb, var(--clh-card-bg) 74%, transparent);
		-webkit-backdrop-filter: saturate(1.6) blur(18px);
		backdrop-filter: saturate(1.6) blur(18px);
		border-bottom: 1px solid color-mix(in srgb, var(--clh-border) 70%, transparent);
		border-radius: 0 0 22px 22px;
		box-shadow: 0 18px 40px -12px rgb(0 0 0 / 0.35);
		padding: 8px 12px 14px;
	}

	.site-nav.is-open {
		display: block;
		animation: site-nav-slide 0.2s ease;
	}

	.site-nav__link {
		padding: 13px 16px;
		border-radius: var(--clh-radius-sm);
		color: var(--clh-text);
	}

	.site-nav__item + .site-nav__item {
		border-top: 1px solid color-mix(in srgb, var(--clh-border) 45%, transparent);
	}

	.site-nav.is-open .site-nav__item {
		animation: site-nav-item 0.22s ease both;
	}

	.site-nav.is-open .site-nav__item:nth-child(2) { animation-delay: 0.02s; }
	.site-nav.is-open .site-nav__item:nth-child(3) { animation-delay: 0.04s; }
	.site-nav.is-open .site-nav__item:nth-child(4) { animation-delay: 0.06s; }
	.site-nav.is-open .site-nav__item:nth-child(5) { animation-delay: 0.08s; }
	.site-nav.is-open .site-nav__item:nth-child(n+6) { animation-delay: 0.1s; }
}

/* Without backdrop blur the panel stays solid, so text never sits on a busy page. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.site-nav {
		background: var(--clh-card-bg);
	}
}

@keyframes site-nav-item {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.site-nav.is-open,
	.site-nav.is-open .site-nav__item {
		animation: none;
	}
}

@keyframes site-nav-slide {
	from {
		opacity: 0;
		transform: translateY(-8px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (min-width: 861px) {
	.site-nav-toggle {
		display: none;
	}

	.site-nav {
		display: flex;
		align-items: center;
		gap: 8px;
		margin-right: 8px;
	}

	.site-nav__list {
		display: flex;
		gap: 2px;
	}
}

@media (min-width: 640px) {
	.not-found__actions {
		flex-direction: row;
		align-items: center;
	}

	.post-card {
		flex-direction: row;
		align-items: center;
	}

	.post-card__thumb {
		flex: 0 0 200px;
	}
}

/* Under 600px the WP admin bar scrolls away with the page (position:
   absolute), so sticky bars sit directly under the site header. */
@media (max-width: 600px) {
	.site-header {
		top: 0;
	}
	:root {
		--clh-sticky-top: var(--clh-header-h);
	}
	body.single-clh_lesson,
	body.clh-focus {
		--clh-sticky-top: 0px;
	}
}

/* CookieYes consent banner and preferences: rounded to match the site's cards and buttons. */
.cky-consent-container,
.cky-consent-container .cky-consent-bar,
.cky-modal.cky-modal-open,
.cky-modal .cky-preference-center {
	border-radius: var(--clh-radius) !important;
	overflow: hidden;
}

.cky-consent-container .cky-consent-bar {
	border-color: var(--clh-border) !important;
	box-shadow: 0 12px 40px rgba(31, 26, 23, 0.18);
}

.cky-consent-container .cky-btn,
.cky-modal .cky-btn {
	border-radius: 999px;
	font-weight: 600;
	padding: 12px 20px;
}

.cky-modal .cky-switch input[type="checkbox"] {
	border-radius: 999px;
}

/* On a phone the banner floats above the bottom edge, so its rounded corners show. */
@media (max-width: 576px) {
	.cky-consent-container.cky-box-bottom-left {
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
	}

	.cky-modal.cky-modal-open {
		width: calc(100% - 24px);
		max-width: calc(100% - 24px);
		max-height: calc(100dvh - 24px);
		border-radius: var(--clh-radius);
		overflow: hidden;
	}

	.cky-modal .cky-preference-center {
		max-height: calc(100dvh - 24px) !important;
	}
}
