/* ==========================================================================
   RESPONSIVE LAYER (WordPress theme) — html-raw was designed for desktop 1440px only.
   Loaded after every other stylesheet; desktop (≥ 1280px) is left untouched.

   Breakpoints
     ≤ 1279px  small laptop
     ≤ 1100px  tablet landscape — mobile navigation drawer
     ≤  900px  tablet portrait — main grids go single column
     ≤  600px  phone
     ≤  380px  small phone
   ========================================================================== */

.modal-dialog:focus { outline: none; }

/* Carousels: let the browser scroll vertically, JS handles horizontal swipes. */
.services-viewport,
.testimonials-viewport { touch-action: pan-y; }

/* --------------------------------------------------------------------------
   Mobile navigation (hidden on desktop)
   -------------------------------------------------------------------------- */
.mobile-nav-toggle,
.mobile-nav {
  display: none;
}

.mobile-nav-toggle {
  width: 46px;
  height: 46px;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-white);
  cursor: pointer;
}

.mobile-nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-primary-burgundy);
  transition: transform 220ms ease, opacity 220ms ease;
}

.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle-bar:nth-child(2) { opacity: 0; }
.mobile-nav-toggle[aria-expanded="true"] .mobile-nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal, 1000) - 1);
  overflow: hidden; /* keep the off-canvas panel inside the screen (no horizontal scroll on mobile) */
  visibility: hidden;
  pointer-events: none;
}

.mobile-nav.is-open {
  visibility: visible;
  pointer-events: auto;
}

.mobile-nav-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 14, 16, 0.6);
  opacity: 0;
  transition: opacity 260ms ease;
}

.mobile-nav.is-open .mobile-nav-backdrop { opacity: 1; }

.mobile-nav-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-left: 4px solid var(--color-primary-burgundy);
  box-shadow: -18px 0 48px rgba(25, 12, 14, 0.28);
  transform: translateX(100%);
  transition: transform 300ms var(--ease-out-quart, ease);
}

.mobile-nav.is-open .mobile-nav-panel { transform: translateX(0); }

.mobile-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 20px;
  background: var(--color-deep-burgundy);
  color: var(--color-white);
}

.mobile-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-champagne-gold);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.mobile-nav-brand img { width: 34px; height: 40px; object-fit: contain; flex: none; }

.mobile-nav-close {
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(240, 206, 99, 0.45);
  border-radius: 50%;
  background: transparent;
  color: var(--color-champagne-gold);
  cursor: pointer;
}

.mobile-nav-close svg { width: 18px; height: 18px; }

.mobile-nav-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 0;
}

.mobile-nav-list,
.mobile-nav-sub { list-style: none; margin: 0; padding: 0; }

.mobile-nav-item { border-bottom: 1px solid var(--color-border); }

.mobile-nav-row { display: flex; align-items: stretch; }

.mobile-nav-row > a {
  flex: 1;
  padding: 15px 20px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--color-dark-text);
  text-decoration: none;
}

.mobile-nav-item.is-active > .mobile-nav-row > a {
  color: var(--color-primary-burgundy);
  box-shadow: inset 4px 0 0 var(--color-primary-burgundy);
}

.mobile-nav-sub-toggle {
  width: 54px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-primary-burgundy);
  cursor: pointer;
}

.mobile-nav-sub-toggle svg { width: 18px; height: 18px; transition: transform 220ms ease; }
.mobile-nav-item.is-expanded .mobile-nav-sub-toggle svg { transform: rotate(180deg); }

.mobile-nav-sub {
  display: none;
  padding: 4px 0 10px;
  background: var(--color-ivory-bg);
}

.mobile-nav-item.is-expanded .mobile-nav-sub { display: block; }

.mobile-nav-sub a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 24px;
  font-size: 14px;
  color: var(--color-secondary-text);
  text-decoration: none;
}

.mobile-nav-sub a.is-active { color: var(--color-primary-burgundy); font-weight: 600; }

.mobile-nav-sub-icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-burgundy-subtle);
  color: var(--color-primary-burgundy);
}

.mobile-nav-sub-icon .kkt-ico { font-size: 15px; }

.mobile-nav-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-cream-surface);
}

.mobile-nav-foot .btn { width: 100%; }

.mobile-nav-contact {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--color-dark-text);
  text-decoration: none;
  word-break: break-word;
}

.mobile-nav-contact svg { width: 16px; height: 16px; flex: none; color: var(--color-primary-burgundy); }
.mobile-nav-contact strong { color: var(--color-primary-burgundy); }

body.mobile-nav-open { overflow: hidden; }

/* Touch screens: the page itself only pans vertically (and pinch-zooms). Carousels swipe via JS,
   horizontal scrollers (news tabs, about sub-nav) keep their own sideways scrolling. */
@media (max-width: 1279px) and (pointer: coarse) {
  body { touch-action: pan-y pinch-zoom; }
}

/* --------------------------------------------------------------------------
   ≤ 1279px — small laptop
   -------------------------------------------------------------------------- */
@media (max-width: 1279px) {
  body { min-width: 0; }

  /* Safety net: never allow sideways scrolling. "clip" (unlike "hidden") keeps the sticky header working. */
  html,
  body { max-width: 100%; overflow-x: hidden; }
  @supports (overflow-x: clip) {
    html,
    body { overflow-x: clip; }
  }
  html,
  body { overscroll-behavior-x: none; }


  :root { --container-padding: 24px; }

  .nav-link { padding: 10px 11px; }
  .brand-logo-name { font-size: 17px; }
  .header-actions .btn { padding: 12px 18px; }

  .mega-menu-inner { grid-template-columns: 280px 1fr; gap: 36px; }

  .service-card { flex-basis: calc((100% - (24px * 2)) / 3); }
  .services-viewport.is-grid-mode .services-track { grid-template-columns: repeat(3, 1fr); }

  .about-grid { gap: 44px; }
  .cta-consultation-grid { gap: 40px; }
  .service-layout,
  .article-layout { gap: 32px; }
}

/* --------------------------------------------------------------------------
   ≤ 1100px — tablet landscape: navigation drawer
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .primary-nav,
  .header-actions { display: none; }

  .mobile-nav-toggle { display: inline-flex; }
  .mobile-nav { display: block; }

  .header-topbar-inner .topbar-item:first-child,
  .header-topbar-inner .topbar-item:first-child + .topbar-divider { display: none; }
  .topbar-contacts { justify-content: center; gap: 24px; }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 40px 32px; }

  .articles-journal-grid { grid-template-columns: 1fr; }

  .testimonial-card { flex-basis: calc((100% - var(--grid-gap)) / 2); }

  .core-values-editorial { grid-template-columns: repeat(2, 1fr); }
  .core-values-editorial .core-value-pillar { grid-column: auto; }
  .core-values-editorial .core-value-pillar:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .news-cards-grid { grid-template-columns: repeat(2, 1fr); }

  .burgundy-cta-inner { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   ≤ 900px — tablet portrait: single-column layouts
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  :root {
    --text-display: 2.5rem;
    --text-h1: 2.125rem;
    --text-h2: 1.875rem;
    --text-h3: 1.3125rem;
    --section-py-lg: 72px;
    --section-py-md: 60px;
    --section-py-sm: 48px;
  }

  /* Hero */
  .hero-section { height: auto; min-height: 600px; }
  .hero-title { font-size: 2.5rem; }

  /* Home — about */
  .about-grid { grid-template-columns: 1fr; gap: 56px; }
  .about-visual { max-width: 620px; width: 100%; margin: 0 auto; }

  /* Home — mid banner */
  .mid-banner-section { height: auto; padding: 56px 0; }
  .mid-banner-inner { flex-direction: column; align-items: flex-start; }

  /* Home — services & testimonials carousels */
  .service-card { flex-basis: calc((100% - 24px) / 2); }
  .services-viewport.is-grid-mode .services-track { grid-template-columns: repeat(2, 1fr); }

  /* Home — CTA + form */
  .cta-consultation-grid { grid-template-columns: 1fr; }

  /* Sections with hard-coded padding */
  .clients-section { padding: 64px 0; }
  .testimonials-section { padding: 64px 0; }
  .burgundy-cta-banner { padding: 56px 0; }
  .related-articles-section,
  .contact-main-section { padding: 56px 0; }
  .contact-map-section { padding: 48px 0 64px; }
  .service-detail-section,
  .news-page-section { padding-top: 48px; }
  .footer-top { padding: 56px 0 44px; }

  /* Page hero */
  .page-hero { min-height: 0; padding: 56px 0 52px; }

  /* Giới thiệu */
  .about-story-grid { grid-template-columns: 1fr; }
  .mission-grid { grid-template-columns: 1fr; }
  .leadership-card { grid-template-columns: 1fr; }
  .leadership-media { min-height: 380px; }
  .leadership-body { padding: 36px 32px; }
  .profile-showcase { grid-template-columns: 1fr; }
  .profile-mockup-wrap { display: flex; justify-content: center; }
  .legal-cards-grid { grid-template-columns: 1fr; }
  .about-subnav-list { overflow-x: auto; scrollbar-width: none; }
  .about-subnav-list::-webkit-scrollbar { display: none; }
  .about-subnav-link { white-space: nowrap; padding: 0 16px; }

  /* Dịch vụ */
  .service-layout { grid-template-columns: 1fr; }
  .service-sidebar { position: static; }
  .service-overview-media img { height: 300px; }

  /* Tin tức & bài viết */
  .featured-news-card { grid-template-columns: 1fr; }
  .featured-news-media { min-height: 280px; }
  .news-filter-bar { flex-direction: column; align-items: stretch; }
  .article-layout { grid-template-columns: 1fr; }
  .article-toc-sidebar { position: static; }
  .article-featured-figure img { height: 320px; }

  /* Card / box paddings */
  .service-overview-box,
  .service-editorial,
  .service-reasons-box,
  .service-inline-form-card,
  .contact-form-card,
  .office-info-card,
  .article-main-col { padding: 32px 30px; }
  .profile-showcase { padding: 36px 32px; }
  .featured-news-body { padding: 28px 28px 30px; }

  /* Liên hệ */
  .contact-grid { grid-template-columns: 1fr; }
  .contact-map-header { flex-direction: column; align-items: flex-start; }
}

/* --------------------------------------------------------------------------
   ≤ 600px — phone
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --container-padding: 16px;
    --text-display: 2rem;
    --text-h1: 1.75rem;
    --text-h2: 1.5625rem;
    --text-h3: 1.1875rem;
    --text-lead: 1.0625rem;
    --section-py-lg: 56px;
    --section-py-md: 48px;
    --section-py-sm: 40px;
  }

  /* Header */
  .header-topbar { display: none; }
  .header-main { height: 68px; }
  .brand-logo { gap: 10px; min-width: 0; }
  .brand-logo-emblem { width: 40px; height: 46px; }
  .brand-logo-sub { font-size: 8.5px; letter-spacing: 0.08em; }
  .brand-logo-prefix { font-size: 9.5px; }
  .brand-logo-name { font-size: 14.5px; }
  .mobile-nav-toggle { width: 42px; height: 42px; }

  /* Buttons */
  .btn { white-space: normal; text-align: center; }

  /* Hero */
  .hero-section { min-height: 560px; }
  .hero-title { font-size: 2rem; }
  .hero-slides-text { min-height: 210px; }
  .hero-inner { padding-bottom: 96px; }
  .hero-cta-group { flex-wrap: wrap; }
  .hero-cta-group .btn { flex: 1 1 100%; }

  /* Home — about */
  .about-visual { padding-right: 16px; padding-bottom: 36px; }
  .about-img-primary { height: 300px; }
  .about-crest-badge { top: 16px; right: 0; max-width: calc(100% - 24px); padding: 10px 12px; }
  .about-crest-badge-text strong,
  .about-crest-badge-text span { white-space: normal; }
  .about-img-secondary-wrap { width: 160px; }
  .about-img-secondary { height: 112px; }
  .about-highlights { grid-template-columns: 1fr; }
  .about-actions { flex-wrap: wrap; }
  .about-actions .btn { flex: 1 1 100%; }

  /* Home — mid banner */
  .mid-banner-watermark { width: 140px; height: 160px; }

  /* Home — carousels */
  .service-card { flex-basis: 100%; }
  .services-viewport.is-grid-mode .services-track { grid-template-columns: 1fr; }
  .services-footer-bar { flex-direction: column; gap: 18px; }
  .services-dots { flex-wrap: wrap; justify-content: center; }
  .testimonial-card { flex-basis: 100%; padding: 24px 20px 20px; }

  /* Home — clients */
  .partner-logo-card { height: 84px; }
  .partner-logo-card img { max-width: 130px; }
  .clients-trust-divider { display: none; }

  /* Home — articles */
  .article-lead-media { height: 220px; }
  .article-row-card { grid-template-columns: 110px 1fr; gap: 14px; }
  .article-row-thumb { height: 96px; }

  /* Home — CTA */
  .cta-reasons-list { grid-template-columns: 1fr; }
  .cta-action-buttons { flex-wrap: wrap; }
  .cta-action-buttons .btn { flex: 1 1 100%; }
  .cta-form-panel { padding: 26px 18px 22px; }

  /* Forms & modal */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .modal-backdrop {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
    align-items: center;
  }
  .modal-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .modal-header { padding-top: 18px; padding-bottom: 16px; }
  .modal-title { font-size: 1.375rem; }
  .modal-subtitle { font-size: 13.5px; }
  .modal-body .btn-secondary { white-space: nowrap; flex: none; }
  .modal-header,
  .modal-body { padding-left: 18px; padding-right: 18px; }

  /* Floating buttons & toast */
  .floating-utilities { right: 12px; bottom: 16px; gap: 8px; }
  .floating-btn { width: 44px; height: 44px; }
  .floating-btn .kkt-ico { font-size: 18px; }
  .floating-tooltip { display: none; }
  .status-toast { left: 12px; right: 12px; max-width: none; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }

  /* Burgundy CTA */
  .burgundy-cta-actions { width: 100%; flex-direction: column; align-items: stretch; }
  .burgundy-cta-actions .btn { width: 100%; }

  /* Page hero */
  .page-hero { padding: 44px 0 40px; }
  .breadcrumb { flex-wrap: wrap; }

  /* Giới thiệu */
  .about-principles-strip { grid-template-columns: 1fr; }
  .about-story-frame img { height: 260px; }
  .core-values-editorial { grid-template-columns: 1fr; }
  .core-values-editorial .core-value-pillar:last-child:nth-child(odd) { grid-column: auto; }
  .leadership-media { min-height: 320px; }
  .leadership-body { padding: 28px 20px; }
  .leadership-signoff { flex-direction: column; align-items: flex-start; gap: 16px; }
  .profile-highlights { grid-template-columns: 1fr; }
  .profile-actions { flex-wrap: wrap; }
  .profile-actions .btn { flex: 1 1 100%; }
  .legal-info-row { grid-template-columns: 1fr; gap: 4px; }
  .legal-card-footer { flex-wrap: wrap; }
  .legal-card-footer .btn { flex: 1 1 100%; }

  /* Dịch vụ */
  .service-overview-media img { height: 220px; }
  .service-process-steps,
  .service-reasons-grid { grid-template-columns: 1fr; }

  /* Tin tức & bài viết */
  .news-cards-grid { grid-template-columns: 1fr; }
  .news-category-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .news-category-tabs::-webkit-scrollbar { display: none; }
  .news-cat-btn { white-space: nowrap; flex: none; }
  .featured-news-media { min-height: 220px; }
  .featured-news-footer { flex-wrap: wrap; gap: 12px; }
  .pagination-wrap { flex-wrap: wrap; justify-content: center; }
  .page-btn--nav span { display: none; }
  .article-featured-figure img { height: 220px; }
  .article-inline-figure img { height: 200px; }
  .article-meta-bar { flex-wrap: wrap; row-gap: 8px; }

  /* Card / box paddings */
  .service-overview-box,
  .service-editorial,
  .service-reasons-box,
  .service-inline-form-card,
  .contact-form-card,
  .office-info-card,
  .article-main-col,
  .profile-showcase { padding: 24px 18px; }
  .mission-card,
  .legal-card { padding: 24px 18px; }
  .core-value-pillar { padding: 24px 20px; }
  .article-lead-body,
  .featured-news-body { padding: 22px 18px 24px; }

  /* Liên hệ */
  .contact-map-frame iframe { height: 320px; }
  .map-overlay-card { position: static; max-width: none; margin-top: 0; }
}

/* --------------------------------------------------------------------------
   ≤ 380px — small phone
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .brand-logo-sub { display: none; }
  .brand-logo-name { font-size: 13px; }
  .hero-title { font-size: 1.75rem; }
}
