/* Phần dùng chung cho cả 3 hướng. Mỗi hướng đặt các biến --bg, --fg, --muted, --line, --surface,
   --cta-bg, --cta-fg trong file riêng; màu gốc nằm ở tokens.css (sinh từ brandkit/tokens.py). */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url("fonts/BeVietnamPro-Regular.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url("fonts/BeVietnamPro-Medium.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url("fonts/BeVietnamPro-SemiBold.woff2") format("woff2"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 800; font-display: swap; src: url("fonts/BeVietnamPro-ExtraBold.woff2") format("woff2"); }

:root {
  --bg: #fff; --fg: var(--ink); --muted: #4F5D6B; --line: #D9DEE4; --surface: #fff;
  --cta-bg: var(--blue); --cta-fg: #fff;
  --wrap: 1200px; --gutter: clamp(16px, 4vw, 40px);
  --step--1: .875rem; --step-0: 1rem; --step-1: 1.25rem; --step-2: 1.5625rem; --step-3: 1.953rem;
  --step-4: 2.441rem; --step-5: 3.052rem; --step-6: 3.815rem;
  --ease: cubic-bezier(.2, .7, .2, 1); --ease-io: cubic-bezier(.7, 0, .2, 1);
}

/* Song ngữ: chỉ hiện ngôn ngữ đang chọn. */
html[data-lang="vi"] [lang="en"]:not(html), html[data-lang="en"] [lang="vi"]:not(html) { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--step-0)/1.6 "Be Vietnam Pro", system-ui, sans-serif; }
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.plain { list-style: none; margin: 0; padding: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.visually-quiet { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 48px;
  padding: .75em 1.4em; border-radius: 999px; font-weight: 600; text-decoration: none; white-space: nowrap;
  border: 1.5px solid transparent; transition: transform .25s var(--ease), box-shadow .25s var(--ease),
  background-color .25s, filter .25s; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: none; }
.btn-zalo { background: var(--cta-bg); color: var(--cta-fg); }
.btn-zalo:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--cta-bg) 70%, transparent); }
.btn-ghost { border-color: currentColor; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--navy); }
.btn-ghost:hover { background: color-mix(in srgb, currentColor 10%, transparent); }

.icon { display: block; width: 32px; height: 32px; }

/* Dải demo */
.demo-ribbon { background: var(--ink); color: #fff; font-size: var(--step--1); text-align: center; padding: 6px 16px; }

/* Thanh trên */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--header-bg, var(--bg));
  border-bottom: 1px solid var(--header-line, var(--line)); transition: box-shadow .3s, background-color .3s; }
.scrolled .site-header { box-shadow: 0 10px 30px -12px rgba(16, 36, 55, .28); }
.bar { transition: min-height .3s var(--ease); }
.scrolled .bar { min-height: 60px; }
.site-header.theme-dark { color: #fff; }
.bar { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.brand img { height: 52px; width: auto; transition: height .3s var(--ease); }
.scrolled .brand img { height: 44px; }
.nav-desktop { display: flex; gap: 28px; margin-left: auto; font-weight: 500; }
.nav-desktop a, .nav-mobile a { text-decoration: none; }
.nav-desktop a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat;
  padding-bottom: 4px; transition: background-size .35s var(--ease); }
.nav-desktop a:hover { background-size: 100% 1.5px; }
.bar-actions { display: flex; align-items: center; gap: 12px; }
.bar-zalo { min-height: 42px; padding: .5em 1.1em; }
.lang-toggle { font: 600 var(--step--1) / 1 inherit; font-family: inherit; color: inherit; background: none;
  border: 1.5px solid currentColor; border-radius: 999px; width: 44px; height: 42px; cursor: pointer; opacity: .85; }
.lang-toggle:hover { opacity: 1; }
details.nav { display: none; position: relative; }
details.nav summary { list-style: none; cursor: pointer; width: 44px; height: 42px; display: grid; place-items: center; }
details.nav summary::-webkit-details-marker { display: none; }
.burger, .burger::before, .burger::after { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -7px; } .burger::after { top: 7px; }
details.nav[open] .burger { background: transparent; }
details.nav[open] .burger::before { top: 0; transform: rotate(45deg); }
details.nav[open] .burger::after { top: 0; transform: rotate(-45deg); }
.nav-mobile { position: absolute; right: 0; top: calc(100% + 14px); min-width: 230px; display: grid;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 16px;
  padding: 8px; box-shadow: 0 18px 40px rgba(16, 36, 55, .18); }
.nav-mobile a { padding: 12px 14px; border-radius: 10px; font-weight: 500; }
.nav-mobile a:hover { background: color-mix(in srgb, var(--fg) 6%, transparent); }

@media (max-width: 960px) {
  .nav-desktop { display: none; }
  .bar-actions { margin-left: auto; }
  details.nav { display: block; }
}
@media (max-width: 560px) {
  .bar, .scrolled .bar { gap: 12px; min-height: 64px; }
  .brand img, .scrolled .brand img { height: 36px; }
  .bar-zalo { display: none; }  /* trên điện thoại đã có thanh Gọi/Zalo cuối màn hình */
}

/* Ảnh minh hoạ: nhãn nhỏ góc ảnh */
.ph { position: relative; overflow: hidden; margin: 0; }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
html[data-lang="vi"] .ph::after { content: attr(data-note-vi); }
html[data-lang="en"] .ph::after { content: attr(data-note-en); }
.ph::after { position: absolute; right: 8px; bottom: 8px; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; background: rgba(16, 36, 55, .55); color: #fff; }

/* Chân trang */
.site-footer { padding: 64px 0 24px; background: var(--footer-bg, var(--ink)); color: var(--footer-fg, #fff); }
.footer-grid { display: grid; grid-template-columns: 1.3fr 1.4fr 1.2fr auto; gap: 40px; align-items: start; }
.footer-brand img { height: 52px; width: auto; }
.legal { margin-top: 16px; font-size: var(--step--1); opacity: .75; letter-spacing: .02em; }
.footer-h { font-size: var(--step-0); font-weight: 600; margin-bottom: 12px; opacity: .7; }
.site-footer li { margin-bottom: 8px; }
.site-footer a { text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.footer-qr { display: grid; justify-items: center; gap: 8px; text-decoration: none; font-size: var(--step--1); }
.footer-qr img { background: #fff; padding: 6px; border-radius: 10px; }
.footer-note { margin-top: 48px; padding-top: 20px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  font-size: var(--step--1); opacity: .7; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } .footer-qr { justify-items: start; } }

/* Thanh Gọi/Zalo dính cuối màn hình (điện thoại) */
.mobile-bar { display: none; }
@media (max-width: 760px) {
  .mobile-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: fixed; z-index: 30;
    left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-top: 1px solid #D9DEE4; }
  .mobile-bar a { display: grid; place-items: center; min-height: 48px; border-radius: 999px; font-weight: 600; text-decoration: none; }
  .mb-call { border: 1.5px solid var(--ink); color: var(--ink); }
  .mb-zalo { background: var(--cta-bg); color: var(--cta-fg); }
  body { padding-bottom: 76px; }
}

/* ---- Chuyển động. Chỉ chạy khi html.motion (bật trong <head> lúc người xem không chọn giảm chuyển động);
   không có thì mọi thứ hiện sẵn ở trạng thái cuối. ---- */

/* Hiện dần khi cuộn tới: mặc định trồi lên; "wipe" mở như màn kéo từ dưới; "wipe-x" kéo ngang; "fade" chỉ mờ. */
.motion [data-reveal] { opacity: 0; transform: translateY(32px);
  transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.motion [data-reveal].in { opacity: 1; transform: none; }
.motion [data-reveal="fade"] { transform: none; }
/* Màn kéo cắt ảnh bên trong, không cắt khung: khung bị cắt hết thì IntersectionObserver coi như không thấy. */
.motion :is([data-reveal="wipe"], [data-reveal="wipe-x"]) { opacity: 1; transform: none; }
.motion :is([data-reveal="wipe"], [data-reveal="wipe-x"]) img { clip-path: inset(100% 0 0 0); scale: 1.18;
  transition: clip-path 1.25s var(--ease-io), scale 1.8s var(--ease), transform 1.2s var(--ease);
  transition-delay: calc(var(--i, 0) * 110ms), calc(var(--i, 0) * 110ms), 0s; }
.motion [data-reveal="wipe-x"] img { clip-path: inset(0 100% 0 0); }
.motion :is([data-reveal="wipe"], [data-reveal="wipe-x"]).in img { clip-path: inset(0); scale: 1; }
.motion .ph::after { transition: opacity .4s 1s; }
.motion [data-reveal]:not(.in) .ph::after, .motion [data-reveal]:not(.in).ph::after { opacity: 0; }

/* Tiêu đề hero: từng chữ trồi lên trong khung che riêng (chừa chỗ cho dấu tiếng Việt). */
.w { display: inline-block; overflow: hidden; vertical-align: top; padding: .2em .04em .12em; margin: -.2em -.04em -.12em; }
.w > span { display: inline-block; }
.motion .w > span { transform: translateY(135%); animation: word-up 1s var(--ease) forwards;
  animation-delay: calc(150ms + var(--i) * 75ms); }
@keyframes word-up { to { transform: none; } }

/* Icon nét tự vẽ khi khối chứa nó hiện ra. */
.motion [data-reveal] .icon path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.motion [data-reveal].in .icon path { animation: draw-line 1.4s calc(var(--i, 0) * 90ms + .3s) var(--ease) forwards; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }

/* Parallax: phần tử dịch theo biến --py (site.js), dùng thuộc tính translate để không đè transform. */
[data-parallax] { translate: 0 var(--py, 0px); }
