/* Self-hosted fonts — Inter (Latin) + IBM Plex Sans Thai (Thai)
   Sourced from Google Fonts on 2026-05-29 (Inter OFL, IBM Plex Sans Thai OFL).
   Production format: woff2, subset for size —
     Inter           -> latin + latin-ext
     IBM Plex Thai   -> thai  + latin
   Weights limited to the design system's 400/500/600/700.
   (800/900 removed: their extreme strokes break Thai tone-marks/loops at low DPI.)
   TrueType source masters live in ../fonts/src/ (build inputs only, NOT served).
   Regenerate the .woff2 with:  python public/assets/fonts/src/build-fonts.py
   (that script documents the subset spec + tabular-nums/--layout-features). */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/inter-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/inter-700.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/plex-thai-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/plex-thai-500.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/plex-thai-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans Thai';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/plex-thai-700.woff2') format('woff2');
}

/* 🆕 [R90 · R-CLS-FONT · 2026-09-06] ฟอนต์สำรอง "จูนความกว้างให้ตรงกับฟอนต์จริง"
   ปัญหา: font-display:swap = วาดด้วยฟอนต์ระบบก่อน แล้วสลับเป็น IBM Plex Sans Thai
   ถ้าความกว้างตัวอักษรสองชุดไม่เท่ากัน ข้อความจะตัดบรรทัดใหม่ = หน้ากระโดด (CLS)
   วิธีแก้มาตรฐาน: ประกาศ @font-face ของ "ฟอนต์ในเครื่อง" แล้วบังคับสัดส่วนด้วย
   size-adjust / ascent-override / descent-override / line-gap-override ให้เท่าฟอนต์จริง
   ตัวเลข size-adjust วัดจริงด้วย canvas measureText (ฟอนต์จริง ÷ Segoe UI, ตัวอย่าง 100px):
     ละติน 400 = 3788.5/3680.5 = 102.9%   ละติน 700 = 3934.7/3929.3 = 100.1%
     ไทย   400 = 3373.2/3384.7 =  99.7%   ไทย   700 = 3474.1/3701.0 =  93.9%
   จึงต้องแยก @font-face ตาม unicode-range (ไทย/ละติน) และตามน้ำหนัก
   ซีริลลิก (รัสเซีย) + จีน ไม่มีในซับเซ็ตของเรา -> ใช้ฟอนต์ระบบทั้งก่อนและหลัง = ไม่มีการสลับ ไม่ต้องจูน
   ascent/descent = ค่าจริงของ IBM Plex Sans Thai (112% / 53%) เพื่อให้กล่องบรรทัดสูงเท่ากันด้วย
   ถ้าเครื่องไหนไม่มีฟอนต์ใน local() เลย @font-face นี้จะไม่ถูกใช้ (ตกไป system-ui ตามเดิม) */
@font-face {
  font-family: 'BD Fallback';
  font-style: normal;
  font-weight: 400;
  src: local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 102.9%;
  ascent-override: 112%;
  descent-override: 53%;
  line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'BD Fallback';
  font-style: normal;
  font-weight: 700;
  src: local('Segoe UI Bold'), local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 100.1%;
  ascent-override: 112%;
  descent-override: 53%;
  line-gap-override: 0%;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: 'BD Fallback';
  font-style: normal;
  font-weight: 400;
  src: local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 99.7%;
  ascent-override: 112%;
  descent-override: 53%;
  line-gap-override: 0%;
  unicode-range: U+0E00-0E7F;
}
@font-face {
  font-family: 'BD Fallback';
  font-style: normal;
  font-weight: 700;
  src: local('Segoe UI Bold'), local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 93.9%;
  ascent-override: 112%;
  descent-override: 53%;
  line-gap-override: 0%;
  unicode-range: U+0E00-0E7F;
}

/* ───────────────────────────────────────────────────────────────────────────
   🆕 [R93 · ชั้น cinematic] ฟอนต์ serif สำหรับ "หัวข้อใหญ่เท่านั้น"
   ที่มา: Google Fonts (OFL ทั้งสองตัว) ดาวน์โหลด woff2 ที่ซับเซ็ตแล้วมาโฮสต์เอง
     BD Serif      = Playfair Display (latin)      · ไฟล์ variable ไฟล์เดียวครอบ 400-700
     BD Serif Thai = Noto Serif Thai (thai)        · ไฟล์ variable ไฟล์เดียวครอบ 400-700
   รวม 69 KB · โหลดแบบ swap จึงไม่บล็อกการแสดงข้อความ

   ⚠️ ทำไมไม่ใช้ build-fonts.py ของโปรเจกต์: สคริปต์นั้นต้องมี fonttools + brotli
      ซึ่งยังไม่ได้ติดตั้งในเครื่องนี้ · ไฟล์ที่ Google เสิร์ฟถูกซับเซ็ตตามสเปคเดียวกันอยู่แล้ว
      (แยกไฟล์ตามช่วงอักขระ) จึงได้ผลเท่ากัน · ถ้าจะทำซ้ำให้ดาวน์โหลดจาก css2 API เหมือนเดิม

   ⛔ ขอบเขตการใช้: หัวข้อใหญ่ (hero H1 · หัวข้อหมวด) เท่านั้น
      ราคา ฟอร์ม ตารางข้อเท็จจริง และตัวเลขทั้งหมด ยังใช้ Inter + IBM Plex Sans Thai เดิม
      เหตุผล: V30 ตั้งใจถอด serif ออกเพื่อให้พื้นผิวที่เกี่ยวกับเงิน "ดูน่าเชื่อถือแบบ Stripe"
      การคืน serif ทั้งระบบจะย้อนการตัดสินใจนั้น จึงคืนเฉพาะชั้นบรรยากาศ
   ─────────────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'BD Serif';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/playfair-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+2070-209F, U+20A0-20BF;
}
@font-face {
  font-family: 'BD Serif Thai';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/serif-thai-var.woff2') format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
