/* =============================================================================
   phong.css — phông chữ Be Vietnam Pro TỰ LƯU TRỮ trong dự án
   =============================================================================
   Nguồn      : Google Fonts (bản v12) —
                https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap
                Tệp woff2 tải nguyên vẹn từ fonts.gstatic.com, không sửa đổi, chỉ đổi tên
                thành be-vietnam-pro-<subset>-<độ đậm>.woff2.
   Ngày tải   : 12/11/2026
   Giấy phép  : SIL Open Font License 1.1 — toàn văn ở
                ui/fonts/be-vietnam-pro/OFL.txt (phải giữ kèm tệp phông khi phân phối).
                Copyright 2021 The Be Vietnam Pro Project Authors.

   Vì sao tự lưu trữ:
     - Không phụ thuộc máy chủ ngoài (fonts.googleapis.com / fonts.gstatic.com):
       mạng trường chậm hoặc chặn ra ngoài thì trang vẫn đủ phông, không phải chờ
       tra tên miền + bắt tay TLS tới hai máy chủ khác.
     - Phông đi cùng tên miền của hệ thống nên dùng chung kết nối đang mở và được
       nginx cho lưu đệm dài hạn như mọi tệp /static/.
     - Không gửi địa chỉ IP của người dùng cho bên thứ ba.

   Cách trình duyệt tải:
     Mỗi độ đậm chia 3 subset (vietnamese, latin-ext, latin) theo unicode-range
     — CHÉP NGUYÊN từ CSS của Google. Trình duyệt CHỈ tải subset nào có ký tự
     thật sự xuất hiện trên trang với đúng độ đậm đó; khai báo đủ 15 khối không
     có nghĩa là tải 15 tệp. Trang tiếng Việt thông thường tải "latin" +
     "vietnamese" của các độ đậm đang dùng; "latin-ext" hầu như không bị tải.

   Đường dẫn:
     Tệp này ở   /static/css/phong.css
     Phông ở     /static/ui/fonts/be-vietnam-pro/…
     nên đường dẫn tương đối ../ui/fonts/be-vietnam-pro/… trong src là đúng.
     Dự án không dùng ManifestStaticFilesStorage nên tên tệp giữ nguyên sau
     collectstatic. (Cố ý không viết mẫu u-r-l(...) trong chú thích: nếu sau này
     bật ManifestStaticFilesStorage, nó dò cả đường dẫn nằm trong chú thích.)

   Khi cập nhật phông:
     nginx phục vụ /static/ với lưu đệm 1 năm (immutable) và đường dẫn phông trong
     CSS không có ?v= như {% static_v %}. Thay tệp phông bằng bản mới thì PHẢI đổi tên tệp
     hoặc tên thư mục (vd be-vietnam-pro-v13/), nếu không trình duyệt giữ bản cũ.

   Thứ tự trong mỗi độ đậm: vietnamese, latin-ext, latin (giống Google).
   ============================================================================= */

/* vietnamese · 400 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-400.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext · 400 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-400.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;
}
/* latin · 400 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-400.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;
}
/* vietnamese · 500 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-500.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext · 500 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-500.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;
}
/* latin · 500 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-500.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;
}
/* vietnamese · 600 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-600.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext · 600 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-600.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;
}
/* latin · 600 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-600.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;
}
/* vietnamese · 700 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-700.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext · 700 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-700.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;
}
/* latin · 700 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-700.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;
}
/* vietnamese · 800 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-vietnamese-800.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext · 800 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-ext-800.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;
}
/* latin · 800 */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../ui/fonts/be-vietnam-pro/be-vietnam-pro-latin-800.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;
}


/* =============================================================================
   Phông dự phòng đã chỉnh kích thước — giảm xô lệch bố cục trong lúc
   Be Vietnam Pro chưa tải xong (font-display: swap hiện phông máy trước).

   Cách dùng: đặt NGAY SAU 'Be Vietnam Pro' trong font-family, vd
     font-family: 'Be Vietnam Pro', 'Be Vietnam Pro Fallback', system-ui, sans-serif;
   Khối này không tải gì từ mạng (chỉ local()).

   Căn cứ số liệu (đo ngày 12/11/2026 từ bảng head / hhea / OS/2 / hmtx / cmap
   của chính tệp phông, độ đậm Regular 400):
     Be Vietnam Pro Regular (kho google/fonts): unitsPerEm 1000;
       hhea = typo: ascender 1000, descender -265, lineGap 0 (USE_TYPO_METRICS bật).
     Độ rộng trung bình mỗi ký tự trên một đoạn mẫu giao diện tiếng Việt
     (642 ký tự: chữ thường, chữ hoa, số, dấu câu, khoảng trắng), tính theo em:
       Be Vietnam Pro 0,4932 | Segoe UI 0,4528 | Roboto 0,4506 | Arial 0,4563
     Tỉ lệ Be Vietnam Pro / phông máy:
       Segoe UI 108,9 % | Roboto 109,4 % | Arial 108,1 %
     Ba phông máy chỉ lệch nhau khoảng 1,3 % nên dùng chung MỘT size-adjust,
     lấy theo Segoe UI (Windows — đa số máy của trường): 108,9 %.

     ascent-override  = 1000 / (1000 × 1,089) = 91,83 %
     descent-override =  265 / (1000 × 1,089) = 24,33 %
     line-gap-override = 0 / … = 0 %
     (công thức quen dùng: chia số đo của phông web cho unitsPerEm × size-adjust;
      ba giá trị override thay hẳn số đo của phông máy nên giống nhau cho cả ba.)

   Giới hạn: số đo lấy ở độ đậm 400, chưa tính kerning; chữ đậm (600–800) của
   Be Vietnam Pro rộng hơn nên tiêu đề vẫn có thể xê dịch nhẹ. Trình duyệt
   không hiểu size-adjust / *-override (bản cũ) sẽ bỏ qua các dòng đó, vô hại.
   ============================================================================= */
@font-face {
  font-family: 'Be Vietnam Pro Fallback';
  src: local('Segoe UI'), local('Roboto'), local('Arial');
  size-adjust: 108.9%;
  ascent-override: 91.83%;
  descent-override: 24.33%;
  line-gap-override: 0%;
}
