/* ===== FONTS ===== */
/* The real Be Vietnam Pro faces are in assets/css/fonts.css, loaded off
   the critical path. What has to be here -- i.e. in the critical CSS that
   scripts/inline_critical_css.py inlines into every page -- is the
   metric-matched fallback, because it only prevents the font-swap reflow
   if it is already in effect at first paint.
   Same avg advance width and same ascent/descent as Be Vietnam Pro, so
   pre-swap text occupies exactly the same box (no reflow => no CLS).
   Values derived in scripts/selfhost_be_vietnam_pro.py (--metrics
   recomputes them). Generated -- do not hand-edit. */
@font-face{font-family:'BVP Fallback';src:local('Arial'),local('Liberation Sans'),local('Arimo'),local('Helvetica Neue'),local('Helvetica'),local('Roboto');size-adjust:107.44%;ascent-override:93.07%;descent-override:24.66%;line-gap-override:0%}

/* ===== TOKENS ===== */
:root {
  --ground: #F5FAFB;
  --surface: #EBF5F7;
  --surface-2: #DAEEf1;
  --text: #111111;
  --text-muted: #4A6A6F;      /* >=4.5:1 tren ground/surface/white (WCAG AA) */
  --espresso: #026162;
  --espresso-light: #037E7F;
  --amber: #15ACBA;
  --amber-light: #1BBDCC;
  --amber-deep: #0E7A85;      /* amber toi hon: dat 4.5:1 voi chu trang / lam chu tren nen sang */
  --amber-deep-hover: #0C6B75;
  --orange: #EA8025;
  --orange-deep: #AE5507;     /* orange toi hon cho chu/icon can 4.5:1 */
  --border: #B8D8D9;
  --border-input: #7FA6A9;    /* vien control >=3:1 (WCAG 1.4.11) */
  --white: #FFFFFF;
  --error: #c0392b;
  --radius: 4px;
  --radius-lg: 8px;
  --radius-md: 12px;
  --radius-xl: 16px;
  --radius-pill: 999px;
  --max-w: 1200px;
  /* 'BVP Fallback' = metric-matched local system font (see FONTS section) --
     keeps pre-swap text the same size as Be Vietnam Pro so nothing reflows. */
  --font-display: 'Be Vietnam Pro', 'BVP Fallback', system-ui, -apple-system, sans-serif;
  --font-body: 'Be Vietnam Pro', 'BVP Fallback', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(10,92,101,0.08);
  --shadow-md: 0 4px 16px rgba(10,92,101,0.12);
  --shadow-lg: 0 8px 32px rgba(10,92,101,0.16);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; background: var(--espresso); overflow-x: clip; }
body { background: var(--ground); color: var(--text); font-family: var(--font-body); line-height: 1.65; min-height: 100vh; display: flex; flex-direction: column; }
.page-content-wrap { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5 { font-family: var(--font-display); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 700; }
h3 { font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 600; }
h4 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--amber-deep); }
.page-hero .eyebrow, .hero .eyebrow { color: var(--amber-light); } /* tren nen toi giu amber sang */

/* ===== LAYOUT ===== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--sm { padding: 40px 0; }
.section--alt { background: var(--surface); }
.section-header { text-align: center; margin-bottom: 48px; }
.section-header h2 { color: var(--espresso); margin-bottom: 12px; }
.section-header p { color: var(--text-muted); max-width: 500px; margin: 0 auto; font-size: 1.05rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
/* Product detail page: image stacked on top of info at every screen size
   (not just mobile) -- prevents the image column from dominating on wide
   monitors and squeezing the description/specs into a narrow strip. */
/* Product detail page: image + key info (name/price/short desc/buy buttons)
   side-by-side, image column capped so it doesn't dominate on wide monitors.
   Specs table/brand story moved to a separate full-width section below
   (see .pd-detail-section) instead of overloading this narrow info column. */
.grid-2.pd-layout { grid-template-columns: minmax(0, 480px) 1fr; max-width: 1100px; margin: 0 auto; gap: 48px; min-width: 0; }
.pd-layout > div { min-width: 0; }
@media(max-width: 768px) { .grid-2.pd-layout { grid-template-columns: 1fr; gap: 24px; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-2 > *, .grid-3 > *, .grid-4 > * { min-width: 0; } /* chan anh/chu dai lam tran track */

@media(max-width: 1024px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media(max-width: 768px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media(max-width: 480px) { .grid-4 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr; } }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-pill); font-size: 0.875rem;
  font-weight: 600; letter-spacing: 0.01em; transition: background-color 0.22s ease, border-color 0.22s ease, color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease; cursor: pointer;
  white-space: nowrap; border: 2px solid transparent;
  /* So loi dong 13: nut mua hang thieu 2-12px so voi 44px cua WCAG 2.5.8. Do duoc:
     "Them vao gio hang" 203x42 tren 21/21 trang chi tiet SP, "Them vao gio" trong the
     SP 130x36, "Mua ngay" 130x36, "Dang nhap"/"Dang ky" 151x41 (tat ca deu dung class .btn,
     ket hop voi .btn-sm/.btn-primary/... khong doi height). Dung min-height chu khong
     phai height: nut co chu xuong 2 dong van phai cao them duoc. */
  min-height: 44px;
}
.btn-primary { background: var(--espresso); color: var(--white); border-color: var(--espresso); }
.btn-primary:hover { background: var(--espresso-light); border-color: var(--espresso-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(2,97,98,0.25); }
.btn-amber { background: var(--amber-deep); color: var(--white); border-color: var(--amber-deep); }
.btn-amber:hover { background: var(--amber-deep-hover); border-color: var(--amber-deep-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(14,122,133,0.3); }
.btn-outline { background: transparent; color: var(--espresso); border-color: var(--espresso); }
.btn-outline:hover { background: var(--espresso); color: var(--white); transform: translateY(-1px); }
.btn-outline-light { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.7); }
.btn-outline-light:hover { background: rgba(255,255,255,0.15); border-color: white; transform: translateY(-1px); }
.btn-sm { padding: 8px 20px; font-size: 0.8rem; }
.btn-lg { padding: 15px 40px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ===== PROMO BANNER ===== */
.promo-banner {
  display: none; align-items: center; justify-content: center; gap: 12px;
  background: var(--espresso); color: #fff; font-size: 0.85rem; font-weight: 500;
  text-align: center; padding: 10px 44px 10px 16px;
  position: sticky; top: 0; z-index: 250;
}
.promo-banner__close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #fff; font-size: 1.3rem; line-height: 1;
  cursor: pointer; opacity: 0.8;
}
.promo-banner__close:hover { opacity: 1; }
@media (max-width: 600px) { .promo-banner { font-size: 0.78rem; padding: 8px 36px 8px 12px; } }

/* CLS: the banner's content only exists once /api/campaigns resolves, so the
   slot itself ships in the static HTML (scripts/fix_cls_shifts.py) and reserves
   its own height from first paint -- otherwise the banner appearing after paint
   shoves the entire page down (measured 0.19 CLS on mobile).
   `is-reserved` is transparent, so no empty coloured bar flashes; layout.js
   fills it, measures the tallest campaign slide, pins min-height to that (so
   rotating through campaigns of different title length never shifts either) and
   remembers the value in localStorage. The inline reserve script in each page
   replays that value into --promo-slot-h before paint, so returning visitors
   reserve the exact height and visitors who saw NO banner last time reserve
   nothing at all (no permanent empty gap).
   The defaults below are the measured tallest slide of the live campaign
   set (6 running campaigns, 375px / 1440px). */
.promo-banner.is-reserved { display: flex; background: transparent; min-height: var(--promo-slot-h, 101px); }
@media (min-width: 601px) { .promo-banner.is-reserved { min-height: var(--promo-slot-h, 40px); } }

/* ===== HEADER ===== */
.site-header {
  position: sticky; top: var(--promo-banner-height, 0px); z-index: 200;
  background: rgba(250,248,244,0.96); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s;
}
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; }

.site-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.site-logo img { height: 64px; width: auto; object-fit: contain; }
.site-logo__text { font-family: var(--font-display); font-size: 1.4rem; font-weight: 900; color: var(--espresso); letter-spacing: -0.01em; }

.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav__link {
  padding: 8px 14px; font-size: 0.85rem; font-weight: 500;
  color: var(--text); border-radius: var(--radius); transition: color 0.2s, background-color 0.2s;
  position: relative;
}
.site-nav__link::after {
  content: ''; position: absolute; bottom: 4px; left: 14px; right: 14px;
  height: 2px; background: var(--amber); border-radius: 1px;
  transform: scaleX(0); transition: transform 0.2s;
}
.site-nav__link:hover { color: var(--espresso); }
.site-nav__link:hover::after, .site-nav__link.active::after { transform: scaleX(1); }
.site-nav__link.active { color: var(--espresso); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.loyalty-greeting { font-size: 0.78rem; color: var(--text-muted); padding: 4px 10px; background: var(--surface); border-radius: var(--radius-pill); white-space: nowrap; }

.cart-btn {
  position: relative; padding: 8px 10px; border-radius: var(--radius);
  color: var(--espresso); transition: background 0.2s; display: flex; align-items: center;
}
.cart-btn:hover { background: var(--surface); }
.cart-count {
  position: absolute; top: 2px; right: 2px;
  background: var(--amber); color: white; border-radius: 50%;
  width: 18px; height: 18px; font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.cart-count[data-count="0"] { display: none; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; cursor: pointer; }
.nav-toggle span { width: 22px; height: 2px; background: var(--espresso); border-radius: 1px; transition: all 0.3s; display: block; }

@media(max-width: 900px) {
  /* Drop backdrop-filter on mobile: it establishes a containing block that
     traps the fixed dropdown menu to the header box (menu opened at the
     document-top instead of under the sticky header). Header bg is 98% opaque
     so the frosted blur isn't needed here. */
  .site-header { background: rgba(250,248,244,0.98); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .site-nav {
    display: none; position: fixed; top: var(--nav-top, calc(var(--promo-banner-height, 0px) + 80px)); left: 0; right: 0;
    flex-direction: column; background: var(--ground); padding: 16px 24px 24px; gap: 0;
    max-height: calc(100dvh - var(--nav-top, calc(var(--promo-banner-height, 0px) + 80px)));
    overflow-y: auto; align-items: flex-start; border-top: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); z-index: 199;
  }
  .site-nav.open { display: flex; }
  .site-nav__link { display: block; font-size: 1.1rem; padding: 14px 16px; width: 100%; border-bottom: 1px solid var(--border); }
  .site-nav__link::after { display: none; }
  .nav-toggle { display: flex; }
  .loyalty-greeting { display: none !important; }
}

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 88vh;
  display: flex; align-items: center;
  background: #111; overflow: hidden;
}
.hero__bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: 40% center;
  opacity: 1; transition: opacity 0.5s;
}
.hero__overlay { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to right, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.55) 45%, rgba(0,0,0,0.2) 100%); }
.hero__content { position: relative; z-index: 1; max-width: 640px; padding: 48px 0; }
.hero__eyebrow { margin-bottom: 16px; }
.hero__title { color: var(--white); margin-bottom: 20px; line-height: 1.1; }
.hero__desc { color: rgba(255,255,255,0.78); font-size: 1.1rem; margin-bottom: 36px; max-width: 500px; line-height: 1.7; }
.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; }
@media(max-width: 600px) {
  .hero { min-height: 75vh; }
  .hero__title { font-size: 2.2rem; }
  .hero__bg { background-position: 60% center; }
  .hero__overlay { background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.5) 60%, rgba(0,0,0,0.4) 100%); }
}

/* ===== TRUST BADGES ===== */
.trust-badges { display: flex; gap: 16px; justify-content: center; flex-wrap: nowrap; }
.trust-badge {
  display: flex; align-items: center; gap: 12px; flex: 1;
  padding: 14px 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.trust-badge__icon { font-size: 1.4rem; flex-shrink: 0; }
.trust-badge__icon-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.trust-badge__text { font-size: 0.78rem; font-weight: 600; color: var(--espresso); line-height: 1.35; }
@media(max-width: 700px) {
  .trust-badges { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .trust-badge { flex-direction: column; align-items: center; text-align: center; padding: 16px 10px; gap: 10px; justify-content: flex-start; }
  .trust-badge__icon-img { width: 40px; height: 40px; }
  .trust-badge__text { font-size: 0.8rem; }
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow 0.25s, transform 0.25s;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card__img { aspect-ratio: 1/1; overflow: hidden; background: var(--surface); flex-shrink: 0; }
.product-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.product-card:hover .product-card__img img { transform: scale(1.06); }
.product-card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card__cat { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-weight: 600; }
.product-card__name { font-family: var(--font-display); font-size: 0.95rem; font-weight: 700; color: var(--espresso); line-height: 1.3; }
/* [Task 2] The product NAME is a real link to the product page (the image already
   was one). Two separate <a>s inside the card -- deliberately NOT one giant anchor
   wrapping the whole card, which would nest the "Thêm vào giỏ" button and the
   image link inside another anchor (invalid HTML, and it swallows the button's
   click). Hover treatment: COLOUR ONLY. An earlier pass also wiped an underline in
   from the left (animated via `background-size` so it caused no reflow) -- the owner
   found that effect ugly and asked for just the colour change, so the whole
   background-gradient underline is gone rather than merely switched off. The
   card-level hover tints the name too, so hovering the image and hovering the name
   feel like the same object. The global REDUCED MOTION block clamps the transition
   to 0.01ms, which leaves the colour as an instant state change rather than removing
   the affordance. Keyboard users keep a non-colour cue from the :focus-visible
   OUTLINE below -- colour alone would fail WCAG 1.4.1 (use of colour). */
.product-card__name-link {
  color: inherit; text-decoration: none;
  transition: color 0.2s ease;
}
.product-card:hover .product-card__name-link { color: var(--amber-deep); }
.product-card__name-link:hover { color: var(--amber-deep); }
.product-card__name-link:focus-visible {
  outline: 2px solid var(--amber-deep); outline-offset: 3px;
  border-radius: 2px; color: var(--amber-deep);
}
.product-card__price { font-size: 1.05rem; font-weight: 700; color: var(--amber-deep); }
/* [Task 3] Shared price markup emitted by window.priceHtml() in products.js --
   ONE renderer for the homepage featured block, the /san-pham/ grid, the product
   detail page, related products and the cart, so the effective price, the struck
   through original and the discount reason can never drift between them again. */
.price-block { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.price-now { font-weight: 700; color: inherit; }
.price-was { font-size: 0.8em; font-weight: 500; color: var(--text-muted); text-decoration: line-through; }
.price-off {
  /* [PATCHED-BADGE-VCENTER] font tu host "Be Vietnam Pro"/"BVP Fallback" co
     ascent-override:93.07%/descent-override:24.66% (xem @font-face trong main.css) --
     chu khong co net xuong (HOT, Flash Sale, %, so) nam sat tren trong khung dong, phan
     descent danh rieng phia duoi gan nhu bo trong. line-height cao (1.5 cu) chi khuech
     dai khoang trong do. Giam line-height ve gan 1 + bu them padding-top > padding-bottom
     theo dung ty le font de chu nhin CAN GIUA THAT trong pill, khong chi can giua theo
     toan bo khung dong (se van lech vi khung dong ban than da lech). */
  font-size: 0.68rem; font-weight: 800; line-height: 1; letter-spacing: 0.02em;
  color: var(--white); background: var(--orange-deep);
  border-radius: var(--radius-pill); padding: 3px 8px 1px; white-space: nowrap;
}
/* [2026-08-04, giamgia.jpg] flash+standing-sale stack renders as 3 separate pill
   chips instead of one long concatenated string -- same .price-off pill look,
   just side by side with a small gap; Σ (total) chip gets a slightly darker/
   outlined look so it visually reads as "the sum of the two before it". */
.price-off-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.price-off--total { background: var(--espresso); }
.price-contact { font-weight: 700; color: var(--espresso); }
/* Product-detail sidebar column can be as narrow as ~480px minus padding; at the 2rem
   #pd-price font-size a long "was" price + a percent-off badge crammed inline with
   .price-now can overflow past the column and run into the gallery. Force .price-now
   onto its own full-width row (flex-basis:100%) so .price-was + .price-off wrap
   together onto the line below it -- markup order is unchanged (products.js emits
   now/was/off as flat siblings), this is a pure CSS reflow local to this variant only. */
.price-block--detail { align-items: flex-start; }
.price-block--detail .price-now { flex-basis: 100%; }
.price-block--detail .price-was { font-size: 0.55em; }
.price-block--detail .price-off { font-size: 0.8rem; }
/* Used by the cart's "Thành tiền" cell and the gift rows: that column must stay on
   ONE line, so the struck original sits beside the effective total, never under it. */
.price-block--nowrap { flex-wrap: nowrap; }
.price-block--inline { gap: 2px 6px; }
/* [2026-08-05] On wide screens (cart's Đơn giá column at desktop widths, ~166px)
   .price-now + .price-was fit on ONE line (79px + 65px < 166px), so flex-wrap
   never triggers -- the struck "was" price stayed glued next to the sale price
   instead of dropping to its own line. Force it, same fix as --detail above. */
.price-block--inline .price-now { flex-basis: 100%; }
.price-block--inline .price-was { font-size: 0.85em; }
.price-block--inline .price-off { font-size: 0.6rem; padding: 2px 6px 0; }  /* [PATCHED-BADGE-VCENTER] */
/* [2026-08-03 fix, Nhóm B final review Finding 1] .price-off's own `white-space: nowrap`
   above ([PATCHED-BADGE-VCENTER]) is intentional -- it keeps that rule's vertical-centering
   padding math from being confused by a wrapped second line, and must stay untouched. But
   Task 3's reason string can now be a long combined label ("Flash Sale −25% + Giảm giá
   thường −12% · tổng −34%") which that nowrap rule was never tuned for: forced onto one
   line it overflows the mobile viewport (measured LIVE on san-pham/premium-filter-500g.html,
   a real product with a flash+standing-sale stack, +25px document.scrollWidth at both
   375px and 390px -- the "trang không được cuộn ngang" rule). Only the 3 variants that can
   actually receive this long reason (detail sidebar column, cart's inline pill, and the
   plain card variant used on the homepage/related-products, which has no ribbon-badge
   guard the /san-pham/ listing has) get the wrap back; the shared base rule is untouched. */
.price-block--detail .price-off,
.price-block--inline .price-off,
.price-block--card .price-off {
  white-space: normal;
}
/* [2026-08-04, giamgia.jpg] the 3-chip group case doesn't need the mid-text wrap
   above -- each chip's own text is now short ("Flash Sale −25%", "−16%", "Σ −34%")
   and never long enough to overflow on its own; overflow is instead handled by
   .price-off-group's flex-wrap (chips drop to their own line as a whole, not
   mid-word). Must come AFTER the rule above to win the same-specificity tie. */
.price-off-group .price-off { white-space: nowrap; }
.product-card__desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* [2026-08-07] `margin-top:auto` (thay vì 12px cố định) để khối nút LUÔN dính đáy thẻ.
   Trước đây việc canh đáy phụ thuộc HOÀN TOÀN vào `.product-card__desc{flex:1}` hút hết
   chỗ trống -- mà thẻ ở khối "Sản phẩm liên quan" (products.js `_pdRenderRelated`) KHÔNG
   render phần mô tả, nên không có gì hút chỗ trống: thẻ nào có chip giảm giá (Flash Sale
   -- thêm một dòng vào khối giá) là nút bị đẩy tụt xuống so với thẻ không giảm giá. Đo
   trên /san-pham/premium-espresso-500g: lệch 19px ở 1440px và 45px ở 390px, trong khi
   lưới chính ở /san-pham/ và trang chủ không lệch (vì có mô tả).
   `margin-top:auto` không phụ thuộc thẻ có mô tả hay không -- các thẻ vốn đã cao bằng
   nhau do CSS grid kéo giãn, nên nút tự thẳng hàng. `padding-top:6px` + `gap:6px` của
   .product-card__body giữ nguyên khoảng cách 12px như cũ khi thẻ đã kín nội dung
   (margin auto co về 0 lúc không còn chỗ trống). */
.product-card__actions { margin-top: auto; padding-top: 6px; }
.product-card__actions--row { display: flex; gap: 8px; flex-wrap: wrap; }
.product-card__actions--row .btn { flex: 1 1 auto; min-width: fit-content; border-radius: var(--radius-lg); padding: 8px 16px; }

/* First-paint skeletons for #products-grid (/san-pham/). products.js renders the
   cards from /api/products after paint; without a reservation the grid grows from
   0 to full height and everything below it (footer) jumps -- 0.055 CLS.
   Deliberately built out of the REAL .product-card classes rather than fixed
   pixel heights, so the reserved height tracks the card's own typography,
   padding and breakpoints (incl. after the webfont swaps in). The first
   renderProducts() replaces grid.innerHTML wholesale, which releases the
   reservation -- so a filtered/searched result set of 3 cards leaves no dead
   space. Only bars are visible; the &nbsp; text is what gives each line its
   height. */
.sp-skel { pointer-events: none; }
.sp-skel .product-card__img { background: var(--surface); }
.sp-skel .product-card__body > *:not(.product-card__actions) { color: transparent; background: var(--surface); border-radius: 4px; }
.sp-skel .btn { background: var(--surface); border-color: var(--surface); color: transparent; }

/* ===== CATEGORY CARDS ===== */
.cat-card-link { text-decoration: none; display: block; }
.cat-card {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  aspect-ratio: 3/4; cursor: pointer; box-shadow: var(--shadow-md);
  transition: transform 0.3s, box-shadow 0.3s;
}
.cat-card-link:hover .cat-card { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.cat-card__img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.5s;
}
.cat-card-link:hover .cat-card__img { transform: scale(1.06); }
.cat-card__overlay {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(2,97,98,0.88) 0%, rgba(2,97,98,0.4) 50%, rgba(2,97,98,0.1) 100%);
  transition: background 0.3s;
}
.cat-card-link:hover .cat-card__overlay {
  background: linear-gradient(to top, rgba(2,97,98,0.92) 0%, rgba(2,97,98,0.5) 50%, rgba(2,97,98,0.15) 100%);
}
.cat-card__body {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 28px 24px;
}
.cat-card__name {
  color: white; font-family: var(--font-display); font-size: 1.5rem;
  font-weight: 700; margin-bottom: 6px; line-height: 1.2;
}
.cat-card__desc {
  color: rgba(255,255,255,0.82); font-size: 0.85rem; line-height: 1.55;
  margin-bottom: 14px;
}
.cat-card__cta {
  color: var(--amber-light); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 0.03em; transition: color 0.2s;
}
.cat-card-link:hover .cat-card__cta { color: var(--white); }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 32px; }
.filter-btn {
  padding: 8px 18px; border: 2px solid var(--border); border-radius: var(--radius-pill);
  font-size: 0.82rem; font-weight: 500; background: none; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s; color: var(--text-muted);
}
.filter-btn:hover { border-color: var(--espresso); color: var(--espresso); }
.filter-btn.active { border-color: var(--espresso); background: var(--espresso); color: white; }
.sort-select {
  margin-left: auto; padding: 9px 14px; border: 2px solid var(--border);
  border-radius: var(--radius); font-family: inherit; font-size: 0.82rem;
  background: var(--white); color: var(--text); cursor: pointer;
  transition: border-color 0.2s;
}
.sort-select:focus { outline: none; border-color: var(--espresso); }

/* ===== CART TABLE ===== */
.cart-table-wrap { overflow-x: auto; }
.cart-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.cart-table th { text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--border); font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.cart-table td { padding: 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-item-img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); background: var(--surface); }
.cart-item-name { font-weight: 600; color: var(--espresso); font-size: 0.9rem; }

.qty-stepper { display: inline-flex; align-items: center; border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.qty-stepper__btn { width: 34px; height: 34px; font-size: 1.1rem; background: var(--surface); color: var(--text); transition: background 0.15s; flex-shrink: 0; }
.qty-stepper__btn:hover { background: var(--border); }
.qty-stepper__input { width: 42px; height: 34px; text-align: center; border: none; border-left: 2px solid var(--border); border-right: 2px solid var(--border); font-size: 0.9rem; background: white; -moz-appearance: textfield; padding: 0; }
.qty-stepper__input:focus { outline: 2px solid var(--espresso); outline-offset: -2px; }
.qty-stepper__input::-webkit-outer-spin-button, .qty-stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.remove-btn { color: var(--text-muted); font-size: 1rem; transition: color 0.2s; padding: 4px 8px; border-radius: var(--radius); }
.remove-btn:hover { color: var(--error); background: rgba(192,57,43,0.08); }

/* ===== ORDER SUMMARY ===== */
.order-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.order-summary h3 { color: var(--espresso); margin-bottom: 20px; font-size: 1.1rem; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.summary-row:last-child { border: none; font-weight: 700; font-size: 1rem; color: var(--espresso); padding-top: 14px; }
.summary-row--discount { color: var(--amber-deep); }
.summary-row span:last-child, .cart-table td:nth-child(n+3) { font-variant-numeric: tabular-nums; }

/* ===== FORMS ===== */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.form-input {
  padding: 12px 14px; border: 2px solid var(--border-input); border-radius: var(--radius);
  font-family: inherit; font-size: 0.9rem; background: var(--white);
  transition: border-color 0.2s; width: 100%; color: var(--text);
}
.form-input:focus { outline: none; border-color: var(--espresso); }
.form-input::placeholder { color: var(--text-muted); opacity: 1; }
textarea.form-input { resize: vertical; min-height: 88px; }
.address-combobox { position: relative; }
.address-combobox__list {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  background: var(--white); border: 2px solid var(--border); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 240px; overflow-y: auto;
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}
.address-combobox__item { padding: 10px 14px; font-size: 0.9rem; cursor: pointer; }
.address-combobox__item:hover, .address-combobox__item.is-active { background: var(--ground); }
.address-combobox__empty { padding: 10px 14px; font-size: 0.85rem; color: var(--text-muted); }

/* ===== LOYALTY ===== */
.loyalty-card { background: linear-gradient(135deg, var(--espresso) 0%, #5a2d0e 100%); color: white; border-radius: var(--radius-lg); padding: 20px 24px; }
.loyalty-card h4 { font-size: 0.82rem; opacity: 0.8; margin-bottom: 6px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.loyalty-points { font-size: 2rem; font-weight: 700; color: var(--amber-deep); line-height: 1; }
.loyalty-sub { font-size: 0.78rem; opacity: 0.7; margin-top: 4px; }
.loyalty-redeem { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.15); }

/* ===== FOOTER ===== */
.site-footer { background: var(--espresso); color: rgba(255,255,255,0.82); }
.footer-main { padding: 64px 0 40px; }
.footer-brand { margin-bottom: 16px; }
.footer-brand img { height: 40px; filter: brightness(10); opacity: 0.9; margin-bottom: 12px; }
.footer-brand__name { font-family: var(--font-display); color: white; font-size: 1.2rem; margin-bottom: 10px; }
.footer-brand p { font-size: 0.82rem; line-height: 1.6; opacity: 0.7; max-width: 220px; }

.footer-col h4 { color: white; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 16px; font-weight: 600; }
.footer-col ul { display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: 0.85rem; opacity: 0.88; transition: opacity 0.2s; }
.footer-col a:hover { opacity: 1; color: var(--amber); }

.social-links { display: flex; gap: 10px; margin-top: 12px; }
.social-link {
  width: 36px; height: 36px; border: 1px solid rgba(255,255,255,0.25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 700; transition: background-color 0.2s, border-color 0.2s, color 0.2s; color: rgba(255,255,255,0.8);
}
.social-link:hover { background: var(--amber); border-color: var(--amber); color: white; }

.footer-bottom { border-top: 1px solid rgba(255,255,255,0.12); padding: 20px 0; }
.footer-bottom p { font-size: 0.78rem; opacity: 0.68; text-align: center; }

/* ===== BREADCRUMB ===== */
.breadcrumb { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 28px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.breadcrumb a { color: var(--text-muted); transition: color 0.2s; }
.breadcrumb a:hover { color: var(--espresso); }
.breadcrumb span { opacity: 0.5; }

/* ===== ARTICLE BODY (kien-thuc) =====
   Heading bài viết teal cho ĐỒNG BỘ. Trước đây rule này chỉ nằm trong <style> riêng
   của từng trang, mà 21/59 bài (batch cũ hơn) KHÔNG có <style> riêng nào -> heading
   của chúng rơi về mặc định var(--text) #111 = ĐEN, còn 38 bài kia teal. Chủ shop
   báo đúng chỗ này. Đặt ở main.css để mọi bài dùng chung một nguồn, kể cả bài tạo
   sau này. 38 bài vẫn còn bản sao rule trong <style> của trang với CÙNG giá trị nên
   vô hại (không xoá để khỏi sửa 38 file cho một thay đổi không có tác dụng gì). */
.article-body h2, .article-body h3, .article-body h4 { color: var(--espresso); margin: 32px 0 12px; }
/* [PATCHED-ARTICLE-LINK-STYLE] link san pham/noi bo chen trong bai viet truoc gio ke
   thua a{color:inherit;text-decoration:none} toan site -- dong mau voi van ban, khach
   khong nhan ra la link bam duoc. :not(.btn) tru nut CTA "Xem san pham" da tu co style
   rieng. */
.article-body a:not(.btn) { color: var(--amber-deep); font-weight: 600; text-decoration: underline; text-decoration-color: var(--amber); text-underline-offset: 2px; }
.article-body a:not(.btn):hover { color: var(--espresso); text-decoration-color: var(--espresso); }

/* ===== PAGE HERO (inner pages) ===== */
.page-hero {
  background: var(--espresso); padding: 72px 0; text-align: center; color: white;
  position: relative; overflow: hidden; background-size: cover; background-position: center;
}
.page-hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.45) 100%);
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero .eyebrow { margin-bottom: 12px; }
.page-hero h1 { color: white; margin: 0 auto 12px; }
/* [PATCHED-HERO-H1-MINHEIGHT] chong CLS font-swap: khi font Be Vietnam Pro thuc thay
   'BVP Fallback', hai font da metric-matched TONG THE (ascent/descent) nhung KHONG dam
   bao cung diem ngat dong cho MOT chuoi ky tu cu the -- do bang h1 co the doi so dong
   (vd 3 dong fallback -> 2 dong font thuc), lam .page-hero co lai va ca <main> phia duoi
   dich chuyen (do duoc CLS 0.19 tren 1 bai kien-thuc). --hero-h1-m/--hero-h1-d duoc BAKE
   theo TUNG TRANG (script scripts/bake_page_hero_minheight.py, do that chieu cao h1 o CA
   HAI font tai 375px/1440px roi lay max) -- KHONG dung mot so px cung cho moi trang, vi
   the se de khoang trang xau tren trang tieu de ngan (ly do da tu choi huong "3 dong cho
   tat ca" luc thiet ke). Thieu bien (trang chua bake) -> 0px, hanh vi CU nguyen. */
.page-hero h1 { min-height: var(--hero-h1-m, 0px); }
@media (min-width: 769px) {
  .page-hero h1 { min-height: var(--hero-h1-d, var(--hero-h1-m, 0px)); }
}
.page-hero p { color: rgba(255,255,255,0.82); max-width: 480px; margin: 0 auto; font-size: 1.05rem; }

/* ===== TOAST ===== */
.toast {
  position: fixed; top: 24px; left: 50%;
  background: var(--espresso); color: white;
  padding: 12px 20px; border-radius: var(--radius-lg);
  font-size: 0.88rem; z-index: 9999;
  transform: translateX(-50%) translateY(-80px); opacity: 0; transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none; max-width: 320px; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-state__icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 24px; }

/* ===== SCROLL TO TOP =====
   [Task 4] Sized and positioned to match the .floating-contact stack it sits above
   (both live in the bottom-right corner). Measured off .floating-contact__btn
   further down this file, not guessed:
     desktop  52x52, right: 20px   (was 44x44, right: 20px  -> 8px too small)
     <=600px  46x46, right: 14px   (was 44x44, right: 20px  -> 6px off-axis, so the
                                    circles' centres did not line up vertically)
   Colour: var(--amber), the SAME token .floating-contact__btn uses -- measured on
   live, the Zalo and Messenger buttons both render rgb(21,172,186) = #15ACBA, NOT
   Zalo brand blue. An earlier pass set this to #0068FF "to match Zalo's identity";
   that made the arrow the odd one out in a stack of teal buttons, which is exactly
   what the owner then reported. Hover uses --amber-deep-hover so the darkening
   stays on the same hue. White glyph on #15ACBA is ~3.1:1, over the 3:1 WCAG
   minimum for non-text graphics. The bottom offsets stay where they were -- see the
   stacking note further down, recomputed for the 52/46px height. */
.back-to-top {
  position: fixed; bottom: 28px; right: 20px; width: 52px; height: 52px;
  background: var(--amber); color: white; border: none; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25); opacity: 0; transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s, background 0.15s; z-index: 200; pointer-events: none;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { background: var(--amber-deep-hover); }
.back-to-top:focus-visible { outline: 2px solid var(--white); outline-offset: -6px; }
@media (max-width: 600px) {
  .back-to-top { width: 46px; height: 46px; right: 14px; }
}

/* ===== STICKY BUY BAR (mobile product pages) ===== */
.sticky-buy-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; border-top: 1px solid var(--border);
  padding: 10px 16px; display: flex; align-items: center; gap: 12px;
  z-index: 300; box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
  transform: translateY(100%); transition: transform 0.3s;
}
.sticky-buy-bar.visible { transform: translateY(0); }
@media(min-width: 701px) { .sticky-buy-bar { display: none !important; } }

/* ===== RELATED POSTS (kien-thuc articles) ===== */
.wp_rp_wrap { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.related_post_title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 20px; }
ul.related_post { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
ul.related_post li { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow 0.2s, border-color 0.2s; }
ul.related_post li:hover { border-color: var(--amber); box-shadow: var(--shadow-md); }
ul.related_post .wp_rp_thumbnail { display: block; aspect-ratio: 16/9; overflow: hidden; }
ul.related_post .wp_rp_thumbnail img { width: 100%; height: 100%; object-fit: cover; margin: 0 !important; border-radius: 0 !important; display: block; }
ul.related_post .wp_rp_title { display: block; padding: 12px 14px; font-size: 0.8rem; font-weight: 600; color: var(--espresso); line-height: 1.45; text-decoration: none; flex: 1; }
ul.related_post .wp_rp_title:hover { color: var(--amber-deep); }
@media(max-width: 700px) { ul.related_post { grid-template-columns: repeat(2, 1fr); gap: 12px; } }

/* ===== REDUCED MOTION ===== */
@media(prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* Company VAT invoice box on checkout */
.invoice-box {
  border: 1.5px solid var(--amber);
  background: linear-gradient(135deg, rgba(21,172,186,0.06), rgba(234,128,37,0.06));
  border-radius: var(--radius);
  padding: 14px 16px;
}
.invoice-box__head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--espresso);
}
.invoice-box__head input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--amber); cursor: pointer; }
.invoice-box__title { font-size: 0.95rem; }
.invoice-box__hint { font-size: 0.78rem; color: var(--text-muted); margin: 6px 0 0 28px; }
.invoice-box__fields { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

/* Floating contact widget (Zalo + Call) -- bottom offset lifted to clear the
   AI chat toggle now stacked below it on the same corner (56px icon + 12px
   gap desktop, 56px + 10px gap mobile -- ai-chat-toggle has no mobile-specific
   size override, stays 56px at every width). */
.floating-contact {
  position: fixed; right: 20px; bottom: 88px; z-index: 400;
  display: flex; flex-direction: column; gap: 12px;
}
.floating-contact__btn {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber); color: var(--white);
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
}
.floating-contact__btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 8px 26px rgba(0,0,0,0.3); }
.floating-contact__btn--call { background: var(--orange-deep); } /* 3:1 non-text contrast cho icon trang */
/* [FIX-FAB-STACK] Nút gom: chỉ tồn tại ở mobile. Desktop `display:none` nên cột 3 nút
   giữ nguyên hành vi cũ hoàn toàn. */
.floating-contact__fab { display: none; }
@media (max-width: 600px) {
  .floating-contact { right: 14px; bottom: 80px; gap: 10px; }
  .floating-contact__btn { width: 46px; height: 46px; }
  /* Mặc định: chỉ nút gom. Ba nút liên hệ thu về sau nó (scale 0) chứ không
     `display:none` — giữ chúng trong luồng để bung ra có chuyển động, và để trình
     đọc màn hình vẫn thấy chúng khi cụm mở. */
  .floating-contact__fab {
    display: flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--amber); color: var(--white);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    order: 99;   /* nút gom nằm DƯỚI CÙNG, ngay chỗ trước đây là nút gọi */
  }
  .floating-contact .fc-ico-close { display: none; }
  .floating-contact.is-open .fc-ico-open { display: none; }
  .floating-contact.is-open .fc-ico-close { display: block; }
  .floating-contact__btn {
    transform: scale(0); opacity: 0; height: 0; margin: 0;
    pointer-events: none; visibility: hidden;
    transition: transform .16s ease, opacity .16s ease;
  }
  .floating-contact.is-open .floating-contact__btn {
    transform: scale(1); opacity: 1; height: 46px; visibility: visible; pointer-events: auto;
  }
  /* Cụm thu lại chỉ còn 1 nút -> nút lên-đầu-trang tụt xuống sát nó.
     46 (nút gom) + 10 (gap) = 56 trên đáy cụm. */
  .back-to-top { bottom: 146px; }
  body:has(.sticky-buy-bar.visible) .back-to-top { bottom: 214px; }
  .floating-contact.is-open ~ .back-to-top { bottom: 248px; }
  body:has(.sticky-buy-bar.visible) .floating-contact.is-open ~ .back-to-top { bottom: 316px; }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  .floating-contact__btn { transition: none; }
}
/* Keep back-to-top clear above the floating-contact stack (both bottom-right).
   Stack holds 3 icons (Zalo, Messenger, Call) -- offsets recomputed for that height,
   plus the +68/+66 lift above for the ai-chat-toggle now below the stack.
   [Task 4] Re-verified after back-to-top grew from 44px to the stack's own 52/46px:
     desktop  stack top = 88 + (3x52 + 2x12) = 88 + 180 = 268px  -> 280px leaves a 12px gap
     <=600px  stack top = 80 + (3x46 + 2x10) = 80 + 158 = 238px  -> 248px leaves a 10px gap
   ...and in the sticky-buy-bar state (product pages, mobile bar showing):
     desktop  stack top = 156 + 180 = 336px -> 348px leaves 12px
     <=600px  stack top = 148 + 158 = 306px -> 316px leaves 10px
   The gaps match the stack's own inter-button gap, so back-to-top reads as the
   4th item of one evenly spaced column. Do not shrink these without redoing the sum. */
.back-to-top { bottom: 280px; }
@media (max-width: 600px) { .back-to-top { bottom: 248px; } }
/* Lift floating-contact clear of the mobile sticky-buy-bar when it's showing (product pages) --
   same +68 lift the sticky-buy-bar has always added, applied on top of the new base position. */
body:has(.sticky-buy-bar.visible) .floating-contact { bottom: 156px; }
@media (max-width: 600px) { body:has(.sticky-buy-bar.visible) .floating-contact { bottom: 148px; } }
/* ...and lift back-to-top to match, so it still clears the stack in that state */
body:has(.sticky-buy-bar.visible) .back-to-top { bottom: 348px; }
@media (max-width: 600px) { body:has(.sticky-buy-bar.visible) .back-to-top { bottom: 316px; } }

/* AI chat widget -- right side, stacked directly below the floating-contact
   icons (Zalo/Messenger/Call), which are lifted out of the way above it. */
#ai-chat-widget { position: fixed; right: 20px; bottom: 20px; z-index: 401; }
#ai-chat-toggle { width: 56px; height: 56px; border-radius: 50%; background: var(--white); color: var(--espresso); border: 2px solid var(--amber); box-shadow: 0 6px 20px rgba(0,0,0,0.28); cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 4px; }
#ai-chat-toggle img { width: 100%; height: 100%; object-fit: contain; }
#ai-chat-panel { position: fixed; right: 20px; bottom: 88px; width: 340px; max-width: calc(100vw - 40px); height: 460px; max-height: 70vh; background: var(--white); border-radius: var(--radius-md); box-shadow: 0 10px 40px rgba(0,0,0,0.25); display: flex; flex-direction: column; overflow: hidden; }
#ai-chat-header { background: var(--amber); color: var(--white); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
#ai-chat-header-title { display: flex; align-items: center; gap: 8px; }
#ai-chat-header-title img { width: 34px; height: 34px; object-fit: contain; }
#ai-chat-header button { background: none; border: none; color: var(--white); cursor: pointer; font-size: 16px; }
#ai-chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-chat-msg { max-width: 80%; padding: 8px 12px; border-radius: var(--radius-md); font-size: 0.85rem; line-height: 1.5; white-space: pre-wrap; }
.ai-chat-msg--user { align-self: flex-end; background: var(--amber); color: var(--white); }
.ai-chat-msg--assistant { align-self: flex-start; background: var(--ground); color: var(--text); }
.ai-chat-msg--thinking { display: flex; align-items: center; gap: 4px; padding: 10px 12px; }
.ai-chat-msg--thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); opacity: 0.4; animation: aiThinkingDot 1.1s infinite ease-in-out; }
.ai-chat-msg--thinking span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-msg--thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiThinkingDot { 0%, 60%, 100% { opacity: 0.4; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .ai-chat-msg--thinking span { animation: none; opacity: 0.7; } }
#ai-chat-inputrow { display: flex; border-top: 1px solid var(--border); padding: 8px; gap: 8px; }
#ai-chat-inputrow input { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px 10px; font-size: 0.85rem; }
#ai-chat-inputrow button { background: var(--amber); color: var(--white); border: none; border-radius: var(--radius-lg); width: 40px; cursor: pointer; }
.ai-chat-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: stretch; }
.ai-chat-chip { border: 1px solid var(--amber); color: var(--espresso); background: var(--white); border-radius: var(--radius-pill); padding: 6px 12px; font-size: 0.78rem; cursor: pointer; }
.ai-chat-chip:hover { background: var(--ground); }
.ai-chat-zalo-cta { display: inline-block; margin-top: 6px; color: var(--espresso); font-weight: 600; text-decoration: underline; font-size: 0.85rem; }

/* AI chat in-widget order form */
.ai-order-form { align-self: stretch; background: var(--ground); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; font-size: 0.85rem; }
.ai-order-products { max-height: 170px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px 8px; margin-bottom: 6px; background: var(--white); }
.ai-order-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 0; }
.ai-order-row + .ai-order-row { border-top: 1px solid var(--ground); }
.ai-order-row-name { font-size: 0.8rem; flex: 1; }
.ai-order-row-name em { display: block; font-style: normal; color: var(--text-muted); font-size: 0.75rem; }
.ai-order-stepper { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ai-order-stepper button { width: 22px; height: 22px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--white); cursor: pointer; font-size: 0.8rem; line-height: 1; }
.ai-order-qty-val { min-width: 16px; text-align: center; font-size: 0.8rem; }
.ai-order-row-remove { border: none; background: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; flex-shrink: 0; }
.ai-order-add-row { display: flex; gap: 6px; margin-bottom: 8px; }
.ai-order-add-select { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-lg); font-size: 0.78rem; }
.ai-order-add-btn { flex-shrink: 0; padding: 6px 10px; border: 1px solid var(--espresso); color: var(--espresso); background: var(--white); border-radius: var(--radius-lg); cursor: pointer; font-size: 0.78rem; }
.ai-order-add-btn:disabled { opacity: 0.5; cursor: default; }
.ai-order-field { margin-bottom: 8px; }
.ai-order-field label { display: block; font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.ai-order-field .form-input { font-size: 0.8rem; padding: 7px 9px; }
.ai-order-note { font-size: 0.75rem; color: var(--text-muted); margin: 0 0 8px; }
.ai-order-invoice-toggle { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; margin-bottom: 8px; cursor: pointer; }
.ai-order-invoice-fields { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 8px; margin-bottom: 8px; background: var(--white); }
.ai-order-submit { width: 100%; padding: 9px; background: var(--espresso); color: var(--white); border: none; border-radius: var(--radius-lg); cursor: pointer; font-size: 0.85rem; font-weight: 600; }
.ai-order-submit:disabled { opacity: 0.6; cursor: default; }
.ai-order-error { color: #c0392b; font-size: 0.75rem; margin-top: 6px; }
@media (max-width: 600px) {
  #ai-chat-widget { right: 14px; bottom: 14px; }
  /* Same side as floating-contact now (both right-anchored), so the panel just needs
     to clear the viewport's left edge -- no longer needs the opposite-side clearance
     hack the old left-anchored version needed against the right-side icon stack. */
  #ai-chat-panel { right: 14px; bottom: 78px; max-width: calc(100vw - 28px); }
}
/* Lift the AI chat widget/panel clear of the mobile sticky-buy-bar when it's showing
   (product pages) -- same pattern already used for .floating-contact/.back-to-top above,
   since #ai-chat-widget shares the same fixed-bottom stacking-context problem on those pages. */
body:has(.sticky-buy-bar.visible) #ai-chat-widget { bottom: 88px; }
body:has(.sticky-buy-bar.visible) #ai-chat-panel { bottom: 156px; }
@media (max-width: 600px) {
  body:has(.sticky-buy-bar.visible) #ai-chat-widget { bottom: 82px; }
  body:has(.sticky-buy-bar.visible) #ai-chat-panel { bottom: 146px; }
}

/* [FLOATING-COLLISION-GUARD] .fc-collision-* classes are toggled by layout.js's
   initFloatingCollisionGuard() whenever, at the CURRENT scroll position, ONE
   SPECIFIC cluster (Zalo/Messenger/Call stack, the AI-chat toggle, or
   back-to-top) sits on top of an input, button or heading -- measured live
   covering the last order-code box on /tra-cuu-don/ and a heading on
   /nhuong-quyen/ at 375px. Each cluster is evaluated INDEPENDENTLY (2026-08-08
   fix): a collision caused by the contact stack must not also hide the AI-chat
   toggle, which used to happen when all three shared one flag (measured 31% of
   scroll stops on the homepage @375px hiding the toggle for no reason of its
   own). Fixed elements don't participate in layout, so fading any of them out
   here cannot shift anything else on the page (no CLS). #ai-chat-panel is
   intentionally excluded: the guard already skips the AI-toggle check while the
   panel is open (see isChatPanelOpen()), so a customer mid-conversation never
   loses it. .back-to-top only appears after scrolling past the very top of the
   page. */
body.fc-collision-contact #floating-contact,
body.fc-collision-ai #ai-chat-widget,
body.fc-collision-btt .back-to-top {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* Product detail extras: gallery, variant picker, growing region */
.pd-gallery { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pd-gallery::-webkit-scrollbar { display: none; }
.pd-gallery__thumb { width: 64px; height: 64px; border-radius: var(--radius); overflow: hidden; border: 2px solid transparent; padding: 0; cursor: pointer; flex-shrink: 0; }
.pd-gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-gallery__thumb.active { border-color: var(--amber); }
.pd-gallery-arrow{position:absolute;top:50%;transform:translateY(-50%);width:36px;height:36px;border-radius:50%;background:rgba(0,0,0,0.45);color:#fff;border:none;display:none;align-items:center;justify-content:center;cursor:pointer;z-index:2}
.pd-gallery-arrow:hover{background:rgba(0,0,0,0.65)}
.pd-gallery-arrow--prev{left:12px}
.pd-gallery-arrow--next{right:12px}
.pd-fallback-icon{font-size:5rem}
.about-fallback-icon{display:flex;align-items:center;justify-content:center;height:100%;font-size:4rem}
.pd-detail-section{max-width:900px;margin:56px auto 0;padding-top:40px;border-top:1px solid var(--border)}
.pd-detail-heading{color:var(--espresso);font-size:1.3rem;margin-bottom:20px}
.pd-specs-table{display:none;width:100%;border-collapse:collapse;margin-bottom:24px}
.pd-specs-table th,.pd-specs-table td{padding:8px 10px;border-bottom:1px solid var(--border);text-align:left;font-size:0.875rem}
.pd-specs-table th{color:var(--text-muted);font-weight:600;width:35%}
.pd-brand-story{display:none;color:var(--text-muted);line-height:1.7;margin-bottom:12px}
.pd-brand-story ul,.pd-brand-story ol{list-style:none;padding-left:0;margin:0}
.pd-brand-story li{margin-bottom:14px}
.pd-brand-story li:last-child{margin-bottom:0}
.pd-brand-story strong{color:var(--espresso);font-weight:700}
.pd-brand-story em{font-style:normal;font-weight:400;color:inherit}
.pd-signature{font-style:italic;font-size:0.8rem;color:var(--text-muted);margin-bottom:24px}
/* Content chi tiết SP (brand_story rich): tiêu đề/đoạn/ảnh/link — styling qua CLASS
   (không inline style) để sanitize_html + bake giữ được thẻ thuần h3/a/img. Cùng giá
   trị với bản mẫu premium-pha-phin-500g. */
.pd-brand-story h3{color:var(--espresso);font-size:1.15rem;font-weight:700;margin:28px 0 10px;letter-spacing:-0.01em}
.pd-brand-story h3:first-child{margin-top:0}
.pd-brand-story h4{color:var(--espresso);font-size:1rem;font-weight:700;margin:20px 0 8px}
.pd-brand-story p{margin-bottom:14px;color:var(--text)}
.pd-brand-story img{width:100%;max-width:600px;height:auto;border-radius:12px;margin:18px auto;display:block;box-shadow:0 4px 16px rgba(2,97,98,.12)}
.pd-brand-story a{color:var(--amber-deep);font-weight:600;text-decoration:underline;text-decoration-color:var(--amber);text-underline-offset:2px}
.pd-brand-story a:hover{color:var(--espresso);text-decoration-color:var(--espresso)}
.pd-variant { padding: 8px 16px; border-radius: var(--radius-pill); border: 1.5px solid var(--border); background: var(--white); font-size: 0.85rem; font-weight: 600; color: var(--espresso); cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.pd-variant.active, .pd-variant:hover { border-color: var(--amber); background: rgba(21,172,186,0.08); }

/* ===== A11Y BASELINE (audit 2026-07) ===== */
/* Focus ro rang cho ban phim tren moi element tuong tac — khong animate ring */
:focus-visible { outline: 2px solid var(--espresso); outline-offset: 2px; }
.site-footer :focus-visible, .page-hero :focus-visible, .hero :focus-visible { outline-color: var(--amber-light); }

/* Skip link: an cho mouse, hien khi Tab (layout.js chen vao dau body) */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--espresso); color: #fff; padding: 10px 18px;
  border-radius: 0 0 var(--radius-lg) 0; font-size: 0.85rem; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* Touch target >=44px tren man hinh cam ung HOẶC màn hẹp (<=768) — không phụ thuộc pointer type */
@media (pointer: coarse), (max-width: 768px) {
  .qty-stepper__btn { width: 44px; height: 44px; }
  .qty-stepper__input { height: 44px; }
  .remove-btn { padding: 10px 12px; min-width: 40px; min-height: 40px; }
  .promo-banner__close { padding: 10px; right: 6px; }
  .btn-sm { padding: 11px 20px; }
  .cart-btn { padding: 12px; min-width: 44px; min-height: 44px; justify-content: center; }
  .nav-toggle { padding: 12px 10px; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .social-link { width: 44px; height: 44px; min-width: 44px; min-height: 44px; flex-shrink: 0; }
  #pd-arrow-prev, #pd-arrow-next, .pd-gallery-arrow, .pd-gallery__arrow { width: 44px; height: 44px; }
  /* chừa chỗ cho cụm nút liên hệ nổi góc phải-dưới, tránh đè cuối form giỏ hàng */
  #cart-content, .cart-checkout, .order-summary { padding-bottom: 8px; }
  body[data-page-key="cart"] .page-content-wrap { padding-bottom: 72px; }
}
/* Mo rong vung cham cho icon nho ma khong doi kich thuoc nhin thay */
.social-link, .nav-toggle, .cart-btn { position: relative; }
.social-link::after { content: ''; position: absolute; inset: -5px; border-radius: 50%; }

/* 320px: header + footer khong tran ngang */
@media (max-width: 380px) {
  .container { padding: 0 14px; }
  .site-logo img { height: 48px; }
  .site-logo__text { font-size: 1.05rem; }
  .header-actions { gap: 2px; }
  .cart-btn { padding: 8px 6px; }
  .footer-main .grid-4 { grid-template-columns: 1fr; }
  .footer-col a { overflow-wrap: anywhere; }
}

/* Ton trong nguoi dung tat animation */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
