/* ==========================================================================
   Cửu Lý Đào Hoa — v3: bố cục trang
   - Mỗi section cao bằng khung nhìn (trừ header dính), nội dung căn giữa theo chiều dọc;
     hero cao vừa khít màn hình đầu tiên. page-head (dải tiêu đề trang con) giữ chiều cao gọn.
   - Lăn chuột chuyển theo từng section (page.js) — chỉ chuột trên máy tính; section dài hơn
     màn hình vẫn cuộn bên trong đến hết mới chuyển; điện thoại, bàn phím, trackpad cuộn tự do.
   - Hero Ảnh / Video (html[data-hero]).
   --header-h, --hero-offset do page.js đo.
   ========================================================================== */
:root { --header-h: 76px; --hero-offset: 160px; }

main > section:not(.page-head) {
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
main > section:not(.page-head) > .container { width: 100%; }
main > section.luxury-hero { min-height: calc(100svh - var(--hero-offset)); }

/* ---------- HERO VIDEO ---------- */
.hero-video,
.hero-video__toggle { display: none; }

html[data-hero="video"] .luxury-hero > .luxury-hero-bg-desktop,
html[data-hero="video"] .luxury-hero > .luxury-hero-media-mobile { display: none !important; }

html[data-hero="video"] .hero-video {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.hero-video__el {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Điện thoại: video phủ nền, phần dưới phủ màu nền để chữ đủ tương phản */
html[data-hero="video"] .hero-video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    transparent 0%, transparent 20%,
    color-mix(in srgb, var(--color-bg) 82%, transparent) 44%,
    var(--color-bg) 66%);
}
html[data-hero="video"] .luxury-hero { justify-content: flex-end; }

html[data-hero="video"] .hero-video__toggle {
  display: inline-grid;
  place-items: center;
  position: absolute;
  z-index: 3;
  top: var(--space-4);
  right: var(--space-4);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-strong);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  color: var(--color-primary);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.hero-video__toggle:hover { background: var(--color-surface); }
.hero-video__toggle:focus-visible { outline: 2px solid var(--color-accent-ink); outline-offset: 2px; }
.hero-video__toggle .icon-play { display: none; }
.hero-video__toggle[aria-pressed="true"] .icon-play { display: block; }
.hero-video__toggle[aria-pressed="true"] .icon-pause { display: none; }

/* Máy tính: video chìm vào nền ở nửa phải hero — không khung.
   Mép trái tan dần sang vùng chữ, mép trên tan nhẹ, mép dưới tan hết TRƯỚC vùng mép shape
   của section sau (--flow-h-back) → video và mép núi/sương không chồng lên nhau. */
@media (min-width: 900px) {
  .luxury-hero { --hv-edge: var(--flow-h-back, 96px); --hv-right: max(var(--container-pad-desktop), calc((100vw - var(--container-max)) / 2 + var(--container-pad-desktop))); }
  html[data-hero="video"] .hero-video {
    left: auto;
    width: 58%;
    -webkit-mask-image:
      linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 44%),
      linear-gradient(to bottom, transparent 0%, #000 12%, #000 calc(100% - var(--hv-edge) - 22%), transparent calc(100% - var(--hv-edge)));
    -webkit-mask-composite: source-in;
    mask-image:
      linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 22%, #000 44%),
      linear-gradient(to bottom, transparent 0%, #000 12%, #000 calc(100% - var(--hv-edge) - 22%), transparent calc(100% - var(--hv-edge)));
    mask-composite: intersect;
  }
  .hero-video__el { object-position: center 42%; }
  html[data-hero="video"] .hero-video::after { display: none; }
  html[data-hero="video"] .luxury-hero { justify-content: center; }
  html[data-hero="video"] .hero-video__toggle {
    top: auto;
    bottom: calc(var(--hv-edge) + var(--space-8));
    right: var(--hv-right);
  }
}

/* Tạm ẩn nút tạm dừng video hero (theo yêu cầu). Gỡ dòng này để hiện lại. */
html[data-hero="video"] .hero-video__toggle { display: none !important; }

/* ---------- Khoảng cách nội dung ↔ mép shape (audit 2026-12-01) ----------
   Section nằm ngay trên một mép shape: chừa đủ chỗ cho mép (--flow-h-back) + 40px,
   để nội dung cuối section luôn cách điểm cao nhất của mép (kể cả nút Bát Quái) ≥ 40px. */
main > section.flow-prev:not(.luxury-hero) {
  padding-bottom: calc(var(--flow-h-back) + var(--space-10)) !important;
}
main > section.luxury-hero.flow-prev .luxury-hero-inner {
  padding-bottom: calc(var(--flow-h-back) + var(--space-10));
}

/* ---------- Dải CTA (nền màu chính) cao vừa nội dung, không ép bằng màn hình ---------- */
main > section.section--maroon { min-height: 0; }
