/* ==========================================================================
   AU VIET RACK — COMPONENT STYLESHEET
   Trang: Chi tiết dự án (Project Detail)
   Quy ước đặt tên: BEM rút gọn  .block  .block__element  .block--modifier
   Mọi giá trị lấy từ tokens.css — không hard-code.
   ========================================================================== */

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }


svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
img { height: auto; }
h1, h2, h3, h4, p, ul, dl, dt, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* Font tiêu đề riêng biệt với văn bản — áp cho mọi thẻ heading + wordmark logo */
h1, h2, h3, h4, .logo__text {
  font-family: var(--font-heading);
  font-weight: var(--fw-bold);
}

/* Focus ring dùng chung — bắt buộc giữ, phục vụ điều hướng bàn phím */
:where(a, button, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
}

/* ---------- LAYOUT PRIMITIVES ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { margin-block: var(--section-gap); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

 
@media (max-width: 767px) { 

 
 }

/* ==========================================================================
   2. HEADER  —  sticky, nền trắng, h 84px (68px khi cuộn)
   ========================================================================== */
.header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--h-header);
  background: var(--c-surface);
  transition: height var(--dur-base) var(--ease-standard),
              box-shadow var(--dur-base) var(--ease-standard);
}
.header.is-scrolled { height: var(--h-header-scrolled); box-shadow: var(--sh-header); }
.header__inner { display: flex; align-items: center; justify-content: space-between; height: 100%; gap: var(--sp-8); }

.logo__mark { width: 42px; height: 42px; flex: none; }
.logo__text { font-weight: var(--fw-extrabold); font-size: 22px; letter-spacing: -.02em; line-height: 1.1; }
.logo__text i { font-style: normal; color: var(--c-orange-500); }        /* AUVIET */
.logo__text b { font-weight: var(--fw-extrabold); color: var(--c-blue-700); } /* RACK */
.logo__tagline {
  display: block; font-size: 11px; font-weight: var(--fw-medium);
  color: var(--c-blue-600); letter-spacing: .01em; margin-top: 2px;
}
 
.header__actions { display: flex; align-items: center; gap: var(--sp-4); flex: none; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-pill); background: var(--c-orange-500); color: #fff;
  transition: background var(--dur-fast) var(--ease-standard), transform var(--dur-fast);
}
.icon-btn:hover { background: var(--c-orange-600); }
.icon-btn:active { transform: scale(.94); }

.burger { display: none; width: 40px; height: 40px; place-items: center; color: var(--c-blue-700); }
@media (max-width: 1023px) {
  .burger { display: grid; }
  .logo__tagline { display: none; }
}

/* ==========================================================================
   3. BREADCRUMB  —  h 52px
   ========================================================================== */
.breadcrumb { height: var(--h-breadcrumb); display: flex; align-items: center; font-size: var(--fs-caption); }
.breadcrumb ol { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-ink-400); }
.breadcrumb a { color: var(--c-ink-500); transition: color var(--dur-fast); }
.breadcrumb a:hover { color: var(--c-orange-500); }
.breadcrumb [aria-current="page"] {
  color: var(--c-ink-900); font-weight: var(--fw-semibold);
  max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.breadcrumb .sep { color: var(--c-ink-400); }

/* ==========================================================================
   4. HERO  —  ảnh nền + overlay gradient trái→phải
   ========================================================================== */
.hero { position: relative; min-height: var(--h-hero); display: flex; align-items: center; isolation: isolate; }
/* Specificity cao hơn .ph (placeholder demo) để không bị ghi đè position */
.hero .hero__media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero__overlay { position: absolute; inset: 0; z-index: -1; background: var(--g-hero-overlay); }
.hero__content { max-width: 620px; padding-block: var(--sp-11); color: var(--c-on-dark); }

.badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 32px; padding-inline: var(--sp-4);
  background: var(--c-orange-500); color: #fff;
  border-radius: var(--r-pill);
  font-size: var(--fs-caption); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
}
.hero__title {
  margin-top: var(--sp-5);
  font-size: var(--fs-display); line-height: var(--lh-display);
  font-weight: var(--fw-bold); letter-spacing: var(--ls-tight); color: #fff;
  text-wrap: balance;
}
.hero__lede {
  margin-top: var(--sp-5); max-width: 46ch;
  font-size: var(--fs-body-lg); line-height: var(--lh-body-lg);
  color: var(--c-on-dark-muted);
}
.hero__cta { margin-top: var(--sp-7); }

/* ==========================================================================
   5. BUTTON
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 52px; padding-inline: var(--sp-6);
  border-radius: var(--r-sm);
  font-size: var(--fs-label); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  transition: background var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
}
/* Nền orange-700 (không phải orange-500) — chữ trắng cần đạt AA 4.5:1, xem HANDOFF-SPEC §11 */
.btn--primary { background: var(--c-orange-700); color: #fff; box-shadow: var(--sh-btn); }
.btn--primary:hover { background: var(--c-orange-800); box-shadow: var(--sh-btn-hover); transform: translateY(-2px); }
.btn--primary:active { background: var(--c-orange-900); transform: translateY(0); box-shadow: var(--sh-btn); }
.btn--ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px var(--c-on-dark-line); }
.btn--ghost:hover { background: rgba(255,255,255,.10); box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.btn--lg { height: 56px; padding-inline: var(--sp-7); }
.btn[disabled], .btn[aria-disabled="true"] {
  background: var(--c-line); color: var(--c-ink-400);
  box-shadow: none; pointer-events: none;
}
.btn.is-loading { pointer-events: none; position: relative; color: transparent; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   6. SPEC CARD  —  card trắng đè lên hero (margin-top âm)
   ========================================================================== */
.spec-card {
  position: relative; z-index: var(--z-raised);
  margin-top: -56px;                     /* mức đè lên hero — giảm từ -96 vì sát nút CTA (còn 8px), nay chừa ~48px */
  padding: var(--sp-8);
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-float);
}
.spec-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  row-gap: var(--sp-8); column-gap: 0;
}
.spec-item {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding-inline: var(--sp-6);
  border-left: 1px solid var(--c-line);
}
/* Bỏ divider ở ô đầu mỗi hàng */
.spec-item:nth-child(4n + 1) { border-left: 0; padding-left: 0; }
.spec-item__icon {
  display: grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: var(--r-pill);
  background: var(--c-blue-100); color: var(--c-blue-600);
}
.spec-item__label {
  font-size: var(--fs-h4); line-height: var(--lh-h4);
  font-weight: var(--fw-bold); color: var(--c-ink-900);
}
.spec-item__value {
  margin-top: 2px; font-size: var(--fs-body-sm); line-height: var(--lh-body-sm);
  color: var(--c-ink-500);
}

@media (max-width: 1023px) {
  .spec-card { margin-top: -64px; padding: var(--sp-6); }
  .spec-grid { grid-template-columns: repeat(2, 1fr); row-gap: var(--sp-6); }
  .spec-item { border-left: 0; padding-inline: 0; }
}
@media (max-width: 479px) {
  .spec-card { margin-top: -40px; border-radius: var(--r-lg); }
  .spec-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   7. GALLERY  —  bento 3 cột x 2 hàng, ô đầu span 2 hàng
   ========================================================================== */
.gallery {
  display: grid;
  grid-template-columns: 1.38fr 1fr 1fr;
  grid-template-rows: repeat(2, 1fr);
  gap: var(--grid-gap);
  aspect-ratio: 1200 / 380;
}
.gallery__item:first-child { grid-row: span 2; }
.gallery__item {
  position: relative; overflow: hidden;
  border-radius: var(--r-md); background: var(--c-line-soft);
  cursor: zoom-in;
}
.gallery__item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-emphasis);
}
.gallery__item::after {                     /* lớp phủ khi hover */
  content: ""; position: absolute; inset: 0;
  background: rgba(1, 30, 77, .28); opacity: 0;
  transition: opacity var(--dur-base) var(--ease-standard);
}
.gallery__item:hover img { transform: scale(1.06); }
.gallery__item:hover::after { opacity: 1; }
.gallery__more {                            /* badge "+N ảnh" trên ô cuối */
  position: absolute; inset: 0; z-index: 1;
  display: grid; place-items: center;
  background: rgba(1, 30, 77, .58); color: #fff;
  font-size: var(--fs-h3); font-weight: var(--fw-bold);
}
@media (max-width: 1023px) {
  .gallery { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(3, 1fr); aspect-ratio: 1 / 1; }
  .gallery__item:first-child { grid-row: span 1; grid-column: span 2; }
}
@media (max-width: 767px) {
  /* Mobile: carousel trượt ngang, snap từng ảnh */
  .gallery {
    display: flex; aspect-ratio: auto;
    overflow-x: auto; scroll-snap-type: x mandatory;
    gap: var(--sp-3); padding-bottom: var(--sp-2);
    scrollbar-width: none;
  }
  .gallery::-webkit-scrollbar { display: none; }
  .gallery__item { flex: 0 0 82%; aspect-ratio: 4 / 3; scroll-snap-align: center; }
}

/* ==========================================================================
   8. PROBLEM / SOLUTION  —  2 cột đối xứng
   ========================================================================== */
.ps-grid { display: grid; grid-template-columns: 1fr 1.28fr; gap: var(--grid-gap); align-items: stretch; }
.ps-card {
  position: relative; overflow: hidden;
  padding: var(--sp-8); border-radius: var(--r-lg);
}
.ps-card--problem  { background: var(--c-orange-050); }
.ps-card--solution { background: var(--c-blue-050); }
.ps-card__head { display: flex; align-items: center; gap: var(--sp-3); }
.ps-card__title { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); }
.ps-card--problem  .ps-card__title { color: var(--c-orange-500); }
.ps-card--solution .ps-card__title { color: var(--c-blue-700); }
.ps-card__head svg { flex: none; }
.ps-card--problem  .ps-card__head svg { color: var(--c-orange-500); }
.ps-card--solution .ps-card__head svg { color: var(--c-blue-600); }

.ps-list { margin-top: var(--sp-7); display: grid; gap: var(--sp-5); position: relative; z-index: 1; }
.ps-list li { display: flex; align-items: flex-start; gap: var(--sp-3); font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-ink-700); }
.ps-list svg { flex: none; margin-top: 1px; }
.ps-card--problem  .ps-list svg { color: var(--c-orange-500); }
.ps-card--solution .ps-list svg { color: var(--c-blue-600); }

/* Hoạ tiết chìm góc phải (?) và (mảnh ghép) */
.ps-card__watermark {
  position: absolute; right: -8px; bottom: -12px; z-index: 0;
  width: 168px; opacity: .10; pointer-events: none;
}
.ps-card--problem  .ps-card__watermark { color: var(--c-orange-500); }
.ps-card--solution .ps-card__watermark { color: var(--c-blue-600); }

@media (max-width: 767px) {
  .ps-grid { grid-template-columns: 1fr; }
  .ps-card { padding: var(--sp-6); }
}

/* ==========================================================================
   9. CTA BAND
   ========================================================================== */
.cta-band {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; gap: var(--sp-7);
  padding: var(--sp-7) var(--sp-8);
  border-radius: var(--r-lg);
  background: var(--g-cta-band); color: #fff;
}
.cta-band .cta-band__bg {             /* ảnh kho mờ phía sau, chỉ trang trí */
  position: absolute; inset: 0; z-index: -1;
  opacity: .16; overflow: hidden;
}
.cta-band__bg img { width: 100%; height: 100%; object-fit: cover; }
.cta-band__icon {
  display: grid; place-items: center; flex: none;
  width: 64px; height: 64px; border-radius: var(--r-pill);
  background: var(--c-blue-600); color: #fff;
}
.cta-band__body { flex: 1 1 auto; min-width: 0; }
.cta-band__title { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-bold); text-wrap: balance; }
.cta-band__sub { margin-top: var(--sp-2); font-size: var(--fs-body-sm); color: var(--c-on-dark-muted); }
.cta-band .btn { flex: none; }

@media (max-width: 767px) {
  .cta-band { flex-direction: column; align-items: flex-start; text-align: left; padding: var(--sp-6); gap: var(--sp-5); }
  .cta-band .btn { width: 100%; }
}

/* ==========================================================================
   10. PLACEHOLDER ẢNH  (chỉ dùng trong bản demo — xoá khi có asset thật)
   ========================================================================== */
.ph { position: relative; background: linear-gradient(135deg, #0B3A80, #08224F 60%, #123C8F); }
.ph::before {
  content: ""; position: absolute; inset: 0; opacity: .30;
  background-image:
    repeating-linear-gradient(90deg, rgba(242,107,26,.55) 0 3px, transparent 3px 78px),
    repeating-linear-gradient(0deg,  rgba(255,255,255,.30) 0 2px, transparent 2px 54px);
}
.ph::after {
  content: attr(data-spec);
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 6px 12px; border-radius: var(--r-pill);
  background: rgba(1, 30, 77, .72); color: #fff;
  font-size: 11px; font-weight: var(--fw-semibold); letter-spacing: .02em;
  white-space: nowrap; pointer-events: none;
}
.ph > img { position: relative; z-index: 1; }

/* ==========================================================================
   11. LIGHTBOX (gallery)
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: none; place-items: center; padding: var(--sp-8);
  background: rgba(1, 30, 77, .92);
}
.lightbox[open], .lightbox.is-open { display: grid; }
.lightbox__img { max-width: min(1100px, 92vw); max-height: 86vh; border-radius: var(--r-md); }
.lightbox__close {
  position: absolute; top: var(--sp-6); right: var(--sp-6);
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: var(--r-pill); background: rgba(255,255,255,.12); color: #fff;
}
.lightbox__close:hover { background: rgba(255,255,255,.24); }
.lightbox__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: var(--r-pill); background: rgba(255,255,255,.12); color: #fff;
}
.lightbox__nav--prev { left: var(--sp-6); }
.lightbox__nav--next { right: var(--sp-6); }
.lightbox__counter { position: absolute; bottom: var(--sp-7); left: 50%; transform: translateX(-50%); color: var(--c-on-dark-muted); font-size: var(--fs-body-sm); }

/* ==========================================================================
   12. REVEAL ON SCROLL (tuỳ chọn)
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(24px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-emphasis);
}

/* ==========================================================================
   13. SPEC OVERLAY — bật/tắt bằng nút "Xem lưới & số đo" (chỉ bản demo)
   ========================================================================== */
.specmode-toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: var(--z-toast);
  height: 44px; padding-inline: 18px; border-radius: var(--r-pill);
  background: var(--c-ink-900); color: #fff;
  font-size: var(--fs-caption); font-weight: var(--fw-semibold);
  box-shadow: var(--sh-card);
  display: inline-flex; align-items: center; gap: 8px;
}
body.specmode [data-anno] { position: relative; outline: 1px dashed rgba(242,107,26,.7); outline-offset: 2px; }
body.specmode [data-anno]::before {
  content: attr(data-anno);
  position: absolute; top: 0; left: 0; z-index: var(--z-dropdown);
  transform: translateY(-100%);
  padding: 2px 8px; border-radius: var(--r-xs) var(--r-xs) 0 0;
  background: var(--c-orange-500); color: #fff;
  font: var(--fw-semibold) 11px/1.6 var(--font-sans); white-space: nowrap;
}
.grid-overlay { display: none; }
body.specmode .grid-overlay {
  display: block; position: fixed; inset: 0; z-index: var(--z-overlay); pointer-events: none;
}
body.specmode .grid-overlay .container { height: 100%; }
body.specmode .grid-overlay__cols {
  height: 100%; display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--grid-gap);
}
body.specmode .grid-overlay__cols span { background: rgba(242, 107, 26, .07); border-inline: 1px solid rgba(242,107,26,.16); }

/* ==========================================================================
   14. DỰ ÁN LIÊN QUAN  —  3 cột, cùng cấu trúc "Bài viết liên quan" của
   auvietrack.com (ảnh · meta · tiêu đề · mô tả ngắn), đặt dưới CTA band.
   ========================================================================== */
.related__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); }
.related__title { font-size: var(--fs-h2); line-height: var(--lh-h2); color: var(--c-ink-900); }
.related__link {
  flex: none; display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-label); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-caps); text-transform: uppercase;
  color: var(--c-orange-700);
  transition: gap var(--dur-fast) var(--ease-standard), color var(--dur-fast);
}
.related__link svg { transition: transform var(--dur-fast) var(--ease-standard); 
height:20px;
}
.related__link:hover { color: var(--c-orange-800); }
.related__link:hover svg { transform: translateX(3px); }

.related-grid {
  margin-top: var(--sp-8);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--grid-gap);
}
.related-card {
  display: block; background: var(--c-surface);
  border: 1px solid var(--c-line); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--sh-sm);
  transition: box-shadow var(--dur-base) var(--ease-standard), transform var(--dur-base) var(--ease-standard);
}
.related-card:hover { box-shadow: var(--sh-card); transform: translateY(-4px); }
.related-card__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--c-line-soft); }
.related-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-emphasis); }
.related-card:hover .related-card__media img { transform: scale(1.05); }
.related-card__body { padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.related-card__meta {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-caption); color: var(--c-ink-500);
}
.related-card__meta svg { flex: none; color: var(--c-blue-600); }
.related-card__meta .dot { color: var(--c-ink-400); }
.related-card__title {
  margin-top: var(--sp-3); font-size: var(--fs-h4); line-height: var(--lh-h4);
  color: var(--c-ink-900);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-card:hover .related-card__title { color: var(--c-blue-700); }
.related-card__excerpt {
  margin-top: var(--sp-2); font-size: var(--fs-body-sm); line-height: var(--lh-body-sm); color: var(--c-ink-500);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

@media (max-width: 1023px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .related-card:nth-child(3) { display: none; }   /* 2 cột: ưu tiên 2 dự án mới nhất */
}
@media (max-width: 767px) {
  .related__head { align-items: center; }
  .related__title { font-size: var(--fs-h3); }
  .related-grid {
    display: flex; grid-template-columns: unset;
    overflow-x: auto; scroll-snap-type: x mandatory; gap: var(--sp-4); padding-bottom: var(--sp-2);
    scrollbar-width: none;
  }
  .related-grid::-webkit-scrollbar { display: none; }
  .related-card { flex: 0 0 82%; scroll-snap-align: center; }
  .related-card:nth-child(3) { display: block; }  /* mobile: khôi phục đủ 3, carousel trượt ngang */
}
