/* =====================================================================
   Font Inter — lưu cùng trang, không tải từ Google.
   Giấy phép: SIL Open Font License 1.1 (theme/fonts/OFL.txt).
   Mỗi kiểu gồm 2 phần (Latin + tiếng Việt); trình duyệt chỉ tải phần cần.
   Một file "variable" chứa mọi độ đậm 300–700.
   ===================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("fonts/inter-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; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("fonts/inter-vietnamese.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; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 300 700; font-display: swap;
  src: url("fonts/inter-italic-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; }
@font-face { font-family: "Inter"; font-style: italic; font-weight: 300 700; font-display: swap;
  src: url("fonts/inter-italic-vietnamese.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; }

/* =====================================================================
   phattran.com — DESIGN TOKENS
   Nguồn duy nhất cho màu, chữ, khoảng cách. Mọi CSS khác chỉ dùng biến ở đây.
   Đổi giá trị ở file này = đổi toàn bộ trang.
   ===================================================================== */
:root {
  /* ---- Màu · sáng ----
     Tương phản so với --bg (chuẩn WCAG AA cho chữ thường: ≥ 4.5:1)        */
  --bg:        #FFFFFF;
  --paper:     #F6F6F6;   /* nền phụ: hover, ô nhập khi cần */
  --ink:       #111111;   /* 18.9:1 — tên, tiêu đề, chữ nhấn */
  --ink-soft:  #3B3B3B;   /* 11.2:1 — nội dung chính */
  --mute:      #5F5F5F;   /*  6.5:1 — chữ phụ, nhãn ô nhập */
  --faint:     #737373;   /*  4.7:1 — ngày tháng, ghi chú nhỏ */
  --deco:      #A3A3A3;   /*  —     — chỉ cho ký hiệu trang trí (gạch đầu dòng), KHÔNG dùng cho chữ */
  --rule:      #E3E3E3;   /* đường kẻ, viền ô nhập */
  --rule-soft: #EFEFEF;   /* đường kẻ giữa các mục trong danh sách */
  --backdrop:  rgba(0, 0, 0, .35);

  /* ---- Chữ ---- */
  --font-sans: "Inter", "Helvetica Neue", Arial,
               "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif; /* nhóm JP: để kaomoji hiển thị đều */

  --font-kao: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif; /* kaomoji */

  --fs-name:     clamp(34px, 6vw, 50px);   /* tên ở đầu trang */
  --fs-greet:    clamp(20px, 3vw, 26px);   /* "Xin chào, mình là" */
  --fs-h2:       28px;                     /* tiêu đề mục */
  --fs-h2-sm:    24px;                     /* tiêu đề mục trên điện thoại */
  --fs-h3:       18px;                     /* tiêu đề hộp thoại */
  --fs-lead:     17px;                     /* đoạn giới thiệu */
  --fs-body:     16px;                     /* nội dung */
  --fs-small:    14px;                     /* nút phụ, ghi chú */
  --fs-meta:     13px;                     /* ngày tháng, nhãn ô nhập */

  --fw-light: 300; --fw-regular: 400; --fw-medium: 500; --fw-semibold: 600; --fw-bold: 700;

  --lh-tight: 1.12;   /* tên, lời chào */
  --lh-body:  1.7;    /* nội dung */

  --ls-display: -0.03em;
  --ls-heading: -0.02em;

  /* ---- Khoảng cách (thang 4px) ---- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 88px; --sp-10: 120px;

  /* ---- Bố cục ---- */
  --page-w:   680px;   /* bề rộng cột nội dung */
  --page-pad: 28px;    /* lề hai bên */

  /* ---- Bo góc ---- */
  --r-sm: 4px;  --r-md: 8px;  --r-lg: 14px;  --r-pill: 999px;

  /* ---- Ảnh đại diện ---- */
  --avatar: 72px;

  /* ---- Chuyển động ---- */
  --t-fast: .2s;  --t-theme: .3s;
}

/* ---- Màu · tối ---- */
:root[data-theme="dark"] {
  --bg:        #0E0E0E;
  --paper:     #181818;
  --ink:       #F2F2F2;   /* 17.2:1 */
  --ink-soft:  #CFCFCF;   /* 12.4:1 */
  --mute:      #A3A3A3;   /*  8.0:1 */
  --faint:     #808080;   /*  4.9:1 */
  --deco:      #5A5A5A;
  --rule:      #2A2A2A;
  --rule-soft: #1D1D1D;
  --backdrop:  rgba(0, 0, 0, .6);
}

/* =====================================================================
   phattran.com — THÀNH PHẦN GIAO DIỆN
   Chỉ dùng biến từ tokens.css. Không mã màu / cỡ chữ cứng trong file này.
   ===================================================================== */

/* ---- Nền tảng ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: var(--fw-regular) var(--fs-body)/var(--lh-body) var(--font-sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t-theme), color var(--t-theme);
}
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul { list-style: none; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }

/* ---- Chữ có định dạng (sinh ra từ trình soạn thảo trong admin) ----
   Chỉ 4 kiểu được phép: đậm, nghiêng, gạch dưới, link.               */
.rt b, .rt strong { font-weight: var(--fw-semibold); color: var(--ink); }
.rt i, .rt em     { font-style: italic; }
.rt u             { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; text-decoration-color: currentColor; }
.rt a, a.link     { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: var(--deco); }
.rt a:hover, a.link:hover { text-decoration-color: var(--ink); }
.kao             { font-family: var(--font-kao); white-space: nowrap; letter-spacing: 0; } /* kaomoji: dùng font Nhật cho cả cụm, không ngắt dòng giữa chừng */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: var(--r-sm); }

/* ---- Khung trang ---- */
.page { max-width: var(--page-w); margin: 0 auto; padding: var(--sp-7) var(--page-pad) var(--sp-10); }
.topbar { display: flex; justify-content: flex-end; }

/* ---- Đầu trang ---- */
.hero { margin-top: 12vh; }
.avatar { width: var(--avatar); height: var(--avatar); border-radius: 50%; object-fit: cover; display: block; margin-bottom: var(--sp-6); background: var(--paper); }
.hello { line-height: var(--lh-tight); letter-spacing: var(--ls-display); }
.hello .greet { display: block; font-size: var(--fs-greet); font-weight: var(--fw-light); color: var(--mute); letter-spacing: -0.01em; margin-bottom: 6px; }
.hello .name  { display: block; font-size: var(--fs-name); font-weight: var(--fw-bold); }
.intro { margin-top: 56px; font-size: var(--fs-lead); color: var(--ink-soft); }

/* ---- Mục ---- */
.sect { margin-top: var(--sp-9); scroll-margin-top: var(--sp-6); }
.sect-title { display: inline-block; font-size: var(--fs-h2); font-weight: var(--fw-semibold); letter-spacing: var(--ls-heading); line-height: 1.3;
  margin: 0 0 22px -4px; padding: 0 4px; border-radius: var(--r-sm); }
.sect:target .sect-title { animation: arrive 1.4s ease; }     /* khi bấm link nhảy tới mục */
@keyframes arrive { 0%, 100% { background: transparent; } 20% { background: var(--rule); } }

/* ---- Danh sách ---- */
.dash li { position: relative; padding-left: 22px; color: var(--ink-soft); }
.dash li + li { margin-top: 6px; }
.dash li::before { content: "–"; position: absolute; left: 0; color: var(--deco); }

.meta { display: block; font-size: var(--fs-meta); color: var(--faint); font-variant-numeric: tabular-nums; }

.updates li { padding: 14px 0; border-top: 1px solid var(--rule-soft); color: var(--ink-soft); }
.updates li:first-child { border-top: 0; padding-top: 0; }

.certs li { padding: var(--sp-2) 0; color: var(--ink-soft); }

/* ---- Nút ---- */
.btn { display: inline-flex; align-items: center; gap: var(--sp-2); height: 42px; padding: 0 18px; border-radius: var(--r-pill);
  font: var(--fw-medium) var(--fs-small)/1 var(--font-sans); text-decoration: none; cursor: pointer;
  border: 1px solid var(--ink); background: none; color: var(--ink); transition: opacity var(--t-fast); }
.btn:hover { opacity: .8; }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.icon-btn { width: 32px; height: 32px; border-radius: var(--r-pill); border: 1px solid var(--rule); background: none; color: var(--mute);
  cursor: pointer; font: 13px var(--font-sans); }
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }

/* ---- Ô nhập ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: var(--fs-meta); font-weight: var(--fw-medium); color: var(--ink); }
.input { width: 100%; font: var(--fs-body)/1.5 var(--font-sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--rule); border-radius: var(--r-md); padding: 10px 12px; transition: border-color var(--t-fast); }
.input:focus { outline: none; border-color: var(--ink); }
textarea.input { min-height: 150px; resize: vertical; }
select.input { appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--mute) 50%), linear-gradient(135deg, var(--mute) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

/* ---- Hộp thoại ---- */
.dialog { border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 0; width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg); color: var(--ink); }
.dialog { overscroll-behavior: contain; }               /* cuộn trong hộp không kéo theo trang */
.dialog::backdrop { background: var(--backdrop); }
html:has(.dialog[open]) { overflow: hidden; }            /* khoá cuộn trang phía sau khi hộp đang mở */
html { scrollbar-gutter: stable; }                       /* tránh trang bị giật ngang khi khoá cuộn */
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: var(--sp-5); margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-head h3 { font-size: var(--fs-h3); font-weight: var(--fw-semibold); }
.dialog-close { background: none; border: 0; font-size: 24px; line-height: 1; color: var(--mute); cursor: pointer; }
.hint { font-size: var(--fs-small); color: var(--mute); }
.note { font-size: var(--fs-small); color: var(--faint); }

/* ---- Tiện ích nhỏ (thay cho style viết thẳng trong HTML, để CSP chặt vẫn chạy) ---- */
.body     { color: var(--ink-soft); }
.stack-sm { margin-top: var(--sp-3); }
.stack-lg { margin-top: 28px; }
.note b   { font-weight: var(--fw-medium); color: var(--ink-soft); }

/* ---- Chân trang ---- */
.footer { margin-top: var(--sp-10); padding-top: var(--sp-5); border-top: 1px solid var(--rule-soft);
  display: flex; justify-content: space-between; gap: var(--sp-4); font-size: var(--fs-small); color: var(--faint); }
.footer nav { display: flex; gap: 18px; }
.footer a { color: inherit; text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ---- Điện thoại ---- */
@media (max-width: 600px) {
  .hero { margin-top: 6vh; }
  .sect-title { font-size: var(--fs-h2-sm); }
}
