/* ==========================================================================
   ภาษาไทย — Thai typography layer
   只在泰文頁載入（inc/typography.php cardo_lang_assets()；<html lang="th">），排在 theme.css、
   pages-extra.css 之後。字型檔由同一支以 Google Fonts 載入（IBM Plex Sans Thai＋Noto Sans Thai）。

   泰文的四件事：
   1. 字型：拉丁字母仍用 IBM Plex Sans（品牌字），泰文字落到 IBM Plex Sans Thai（同一家族的泰文版），
      再退 Noto Sans Thai 與系統泰文字型。等寬字（HUD 小字）也要有泰文字型，否則退成系統字。
   2. 行高：泰文有上方的母音、聲調符號與下方母音，疊起來比拉丁字高。內文 1.75–1.8，標題至少 1.4，
      否則上一行的下母音會碰到下一行的聲調、background-clip:text 的標題會把符號切掉。
   3. 斷行：泰文詞與詞之間沒有空白，靠瀏覽器的字典斷詞（要 lang="th"）。中文用的 keep-all 對泰文
      沒有意義、在部分瀏覽器會擋住斷詞，一律改回 normal；line-break: strict 不讓符號落在行首。
   4. 字距：任何 letter-spacing 都會把泰文的組合符號（上下母音、聲調）跟主字拆開，全部歸零。
   ========================================================================== */

:lang(th) {
	--t-font-default:   "IBM Plex Sans", "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", "Thonburi", Tahoma, ui-sans-serif, system-ui, sans-serif;
	--t-font-heading:   "IBM Plex Sans", "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", "Thonburi", Tahoma, ui-sans-serif, system-ui, sans-serif;
	--t-font-monospace: "IBM Plex Mono", "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", ui-monospace, SFMono-Regular, Menlo, monospace;

	/* 行高（tokens.css §10 的桌機值也一起蓋掉：本檔排在後面、選擇器同權重）。 */
	--t-line-height-display:    1.4;
	--t-line-height-h1:         1.4;
	--t-line-height-h2:         1.4;
	--t-line-height-h3:         1.45;
	--t-line-height-h4:         1.45;
	--t-line-height-h5:         1.5;
	--t-line-height-h6:         1.5;
	--t-line-height-body-large: 1.75;
	--t-line-height-body-default: 1.8;
	--t-line-height-body-small: 1.75;
	--t-line-height-p:          1.8;
	--t-line-height-p-small:    1.75;
	--t-line-height-caption:    1.65;
	--t-line-height-label:      1.5;
	--t-line-height-mono:       1.7;
	--t-line-height-mono-small: 1.5;

	/* 內文略放大：泰文字身（x-height）比同字級的拉丁字小。標題不放大 —— 泰文標題本來就比中文長。 */
	--t-font-size-body-default: 1.0625rem;
	--t-font-size-body-small:   1.0625rem;
	--t-font-size-p:            1.1875rem;
	--t-font-size-p-small:      1.0625rem;
	--t-font-size-caption:      1.0625rem;
}
@media (min-width: 1024px) {
	:lang(th) {
		--t-font-size-body-large: 1.3125rem;
		--t-font-size-body-small: 1rem;
	}
}

/* ── 斷行 ── */
:lang(th) body {
	line-height: var(--t-line-height-body-default);
	word-break: normal;
	line-break: strict;
	overflow-wrap: break-word;
}
/* theme.css 裡給中文的 keep-all（標題、導言、公告列、FAQ…）在泰文頁一律還原，交給字典斷詞。
   試過標題用 keep-all（只在空白處換行）：Chrome 對泰文確實照做，但沒有空白的長片語
   （「เริ่มจากเรื่องที่ปวดหัวที่สุดของคุณ」）就只能靠 overflow-wrap 在任意字母間硬切，比字典斷詞更糟。
   字典斷詞偶爾會把複合詞（ปวด｜หัว）拆在兩行 —— 個別標題請校稿時用片語間的空白調整。 */
:lang(th) body * {
	word-break: normal !important;
}

/* ── 字距：全部歸零（組合符號不能被拆開）。 ── */
:lang(th) body *:not(svg):not(svg *) {
	letter-spacing: normal !important;
}

/* ── 標題：行高至少 1.4，漸層字（background-clip:text）上下多留空間，聲調與下母音不被切掉。 ── */
:lang(th) :is(h1, h2, h3, h4, h5, h6, .cd-display, .cd-h1, .cd-h2, .cd-h3, .cd-h4, .cd-h5, .cd-h6) {
	line-height: max(1.4, var(--t-line-height-h2));
}
:lang(th) :is(.cd-hero__title, .cd-hero__accent, .cd-dhero__title, .cd-cta__title, .cd-page-hero .cd-h1) {
	line-height: 1.45;
	padding-block: .06em;
}
:lang(th) :is(.cd-hero__sub, .cd-dhero__tagline, .cd-page-hero__lede, .cd-body-lg, .cd-section-head .cd-body-lg) {
	line-height: 1.75;
}
/* 中文為了不斷在「工｜廠」把標題寬度放到 31ch；泰文字比較長，交給斷詞，不必再限寬到一行。 */
:lang(th) .cd-cta__title { max-width: 36ch; }

/* ── 小字（眉標、膠囊、HUD 標籤）：泰文在 12–13px 很難讀，下限 13px，行高放寬。 ── */
:lang(th) :is(.cd-eyebrow, .cd-pill, .cd-soon, .cd-later, .cd-live, .cd-badge, .cd-tag, .cd-mono) {
	line-height: 1.5;
}
