/* 印地文(hi)、日文(ja)、烏爾都文(ur)專用字型與排版(紀錄 0178–0180)。
   只在這三種語言的頁面載入(src/layouts/Layout.astro),英文與其他語言的頁面不載入、不下載任何字型。
   字型自行託管(同源,符合 CSP 的 font-src 'self'),SIL Open Font License 1.1,已子集化,來源與重建方式見 docs/字型說明.md。
   font-display: swap:字型下載前先用系統字型顯示文字,不會空白等待。
   unicode-range:只有頁面真的用到該文字區塊的字元時,瀏覽器才會下載對應字型檔。 */
@font-face {
  font-family: "Noto Sans Devanagari SG";
  src: url("/assets/fonts/noto-sans-devanagari-sg.woff2?v=3f7a7574") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0900-097F, U+A8E0-A8FF, U+200C-200D, U+25CC, U+20B9;
}
@font-face {
  font-family: "Noto Naskh Arabic SG";
  src: url("/assets/fonts/noto-naskh-arabic-sg.woff2?v=5cf1e8d3") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: "Noto Sans JP SG";
  src: url("/assets/fonts/noto-sans-jp-sg.woff2?v=b9e39311") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+3000-30FF, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF, U+2010-2027, U+00B7;
}

/* 字型順序:該文字的網頁字型 → 站內原本的字型組合(Latin 與數字仍用原字型)→ 各平台系統字型 */
html[lang="hi"] body { font-family: "Noto Sans Devanagari SG", var(--font), "Nirmala UI", "Kohinoor Devanagari", "Devanagari Sangam MN", "Noto Sans Devanagari", sans-serif; line-height: 1.8; }
html[lang="ja"] body { font-family: "Noto Sans JP SG", var(--font), "Yu Gothic UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, "Noto Sans CJK JP", sans-serif; line-height: 1.85; }
html[lang="ur"] body { font-family: "Noto Naskh Arabic SG", var(--font), "Segoe UI", Tahoma, "Geeza Pro", "Noto Naskh Arabic", sans-serif; line-height: 1.95; }

/* 標題行高:天城文上下符號、阿拉伯文字上下點與日文都需要比拉丁字更高的行高,1.1 會被切到 */
html[lang="hi"] :is(h1, h2, h3, h4, .h1, .h2, .h3) { line-height: 1.4; }
html[lang="ja"] :is(h1, h2, h3, h4, .h1, .h2, .h3) { line-height: 1.35; }
html[lang="ur"] :is(h1, h2, h3, h4, .h1, .h2, .h3) { line-height: 1.65; }

/* 字距:這三種文字不加字距(烏爾都文是連筆字,字距會把字母拆開;天城文與日文加字距也不自然) */
html:is([lang="hi"], [lang="ja"], [lang="ur"]) *,
html:is([lang="hi"], [lang="ja"], [lang="ur"]) *::before,
html:is([lang="hi"], [lang="ja"], [lang="ur"]) *::after { letter-spacing: normal; }

/* 長字、長按鈕不撐出畫面(同 de、pl、fr、vi 的處理) */
html:is([lang="hi"], [lang="ja"], [lang="ur"]) .page-hero--media > * { min-width: 0; }
html:is([lang="hi"], [lang="ja"], [lang="ur"]) :is(h1, h2, h3, .h1, .h2, .h3, dt) { overflow-wrap: break-word; }
@media (max-width: 47.99rem) {
  html:is([lang="hi"], [lang="ja"], [lang="ur"]) .btn { white-space: normal; text-align: center; }
}

/* 日文斷行:禁則處理(標點不放行首、「」不放行尾)、標題依詞組斷行(支援的瀏覽器),其餘瀏覽器退回一般斷行 */
html[lang="ja"] body { line-break: strict; overflow-wrap: break-word; }
html[lang="ja"] :is(h1, h2, h3, .h1, .h2, .h3) { word-break: auto-phrase; overflow-wrap: anywhere; text-wrap: balance; }
/* auto-phrase 會把很長的片假名複合詞(コンピュータ手術ナビゲーションシステム)當成一個詞組;overflow-wrap: anywhere 讓它在窄螢幕仍可斷開,不撐出畫面 */

/* 烏爾都文(右到左):夾在文字中的英文產品名稱、數字、網址、電話、Email 依本身方向顯示(<bdi> 與 dir="ltr" 元素由頁面標記,
   這裡讓 Email、電話連結在右到左段落裡維持由左到右的顯示,不會被反轉) */
html[lang="ur"] :is(a[href^="mailto:"], a[href^="tel:"], .ltr, bdi, code) { unicode-bidi: isolate; direction: ltr; }
html[lang="ur"] input[type="email"], html[lang="ur"] input[type="tel"], html[lang="ur"] input[type="url"] { direction: ltr; text-align: right; }

/* 規格表:這三種文字沒有空白可以斷行(日文)或字較寬,欄寬下限放寬到 12rem,手機上才不會被擠成很窄的一長串 */
html:is([lang="hi"], [lang="ja"], [lang="ur"]) .spec-table td { min-width: 12rem; }
