/* Thanh Long V24 - shared, accessible mobile off-canvas navigation.
   Loaded after homepage/subpage CSS to override the legacy dropdown only on mobile. */
@media (min-width: 993px) {
  #tl-home-shell .tl-mobile-drawer, #tl-home-shell .tl-mobile-drawer-backdrop,
  #tl-v24-header .tl-mobile-drawer, #tl-v24-header .tl-mobile-drawer-backdrop { display: none !important; }
}
@media (max-width: 992px) {
  body.tl-mobile-drawer-open { overflow: hidden !important; }
  /* The category trigger occupies half the available nav row. */
  #tl-home-shell .tl-home-mega,
  #tl-v24-header .tl-home-mega {
    width: 50% !important; flex: 0 0 50% !important;
    max-width: 50% !important; min-width: 0 !important;
    position: relative;
  }
  #tl-home-shell .tl-home-mega .theme-vmm-header,
  #tl-v24-header .tl-home-mega .theme-vmm-header { width: 100%; }
  /* Compact category control on phones/tablets; keep its 50% width. */
  #tl-home-shell #primaryNav,
  #tl-v24-header #primaryNav,
  #tl-home-shell .sticky-header-shell.is-compact #primaryNav,
  #tl-v24-header .sticky-header-shell.is-compact #primaryNav {
    min-height: 38px;
  }
  #tl-home-shell .header__main-menu .theme-vmm-header > .vmm-trigger,
  #tl-v24-header .header__main-menu .theme-vmm-header > .vmm-trigger,
  #tl-home-shell .sticky-header-shell.is-compact .tl-home-mega .theme-vmm-header > .vmm-trigger,
  #tl-v24-header .sticky-header-shell.is-compact .tl-home-mega .theme-vmm-header > .vmm-trigger {
    display: flex !important; width: 100% !important; height: 38px !important;
    min-height: 38px !important; padding: 0 9px !important;
    gap: 6px !important; align-items: center; justify-content: flex-start;
    font-family: inherit; font-size: 12px !important;
    line-height: 1.1; font-weight: 700; letter-spacing: 0;
    white-space: nowrap; border: 0; border-radius: 4px 4px 0 0;
    color: #fff; background: linear-gradient(110deg,#a37d12,#d4a30f);
    box-shadow: none; overflow: hidden;
  }
  #tl-home-shell .tl-home-mega .theme-vmm-header > .vmm-trigger > .fa,
  #tl-v24-header .tl-home-mega .theme-vmm-header > .vmm-trigger > .fa {
    flex: 0 0 auto; width: 16px; margin: 0;
    font-size: 16px !important; line-height: 1; text-align: center;
  }
  #tl-home-shell .sticky-header-shell.is-compact .primary-nav,
  #tl-v24-header .sticky-header-shell.is-compact .primary-nav { min-height: 38px; }
  #tl-home-shell .nav-links, #tl-v24-header .nav-links,
  #tl-home-shell .nav-links.open, #tl-v24-header .nav-links.open { display: none !important; }
  /* No legacy dropdown below the category button: drawer replaces it. */
  #tl-home-shell .tl-home-mega .theme-vmm-header > .vmm-dropdown,
  #tl-v24-header .tl-home-mega .theme-vmm-header > .vmm-dropdown { display: none !important; }
  #tl-home-shell .tl-mobile-drawer-backdrop,
  #tl-v24-header .tl-mobile-drawer-backdrop {
    position: fixed; inset: 0; z-index: 11000; display: block;
    background: rgba(27, 24, 20, .56); opacity: 0; visibility: hidden;
    pointer-events: none; transition: opacity .27s ease, visibility .27s;
  }
  #tl-home-shell .tl-mobile-drawer-backdrop.is-open,
  #tl-v24-header .tl-mobile-drawer-backdrop.is-open {
    opacity: 1; visibility: visible; pointer-events: auto;
  }
  #tl-home-shell .tl-mobile-drawer,
  #tl-v24-header .tl-mobile-drawer {
    position: fixed; top: 0; bottom: 0; right: 0; z-index: 11001;
    display: flex; flex-direction: column; width: min(360px, 88vw); max-width: 100%;
    height: 100dvh; margin: 0; padding: 0;
    background: #fff; box-shadow: -12px 0 40px rgba(35,27,10,.2);
    color: #292017; overflow: hidden;
    transform: translate3d(102%,0,0); visibility: hidden; pointer-events: none;
    transition: transform .29s cubic-bezier(.2,.78,.25,1), visibility .29s;
    font-family: Roboto, Arial, sans-serif;
  }
  #tl-home-shell .tl-mobile-drawer.is-open,
  #tl-v24-header .tl-mobile-drawer.is-open {
    transform: translate3d(0,0,0); visibility: visible; pointer-events: auto;
  }
  #tl-home-shell .tl-mobile-drawer-head,
  #tl-v24-header .tl-mobile-drawer-head {
    position: relative; display: flex; flex-direction: column; gap: 4px;
    flex: 0 0 auto; min-height: 68px; justify-content: center;
    padding: 10px 60px 10px 18px;
    border-bottom: 1px solid #e9dfc9;
    background: linear-gradient(125deg,#fffaf0 0%,#fff 75%);
  }
  #tl-home-shell .tl-mobile-drawer-kicker,
  #tl-v24-header .tl-mobile-drawer-kicker {
    font-size: 12px; font-weight: 700; line-height: 1.4; letter-spacing: 1.5px; color: #ac8008;
  }
  #tl-home-shell .tl-mobile-drawer-head strong,
  #tl-v24-header .tl-mobile-drawer-head strong {
    font-size: 18px; line-height: 1.25; font-weight: 700; color: #292017;
  }
  #tl-home-shell .tl-mobile-drawer-close,
  #tl-v24-header .tl-mobile-drawer-close {
    position: absolute; top: 14px; right: 17px;
    display: grid; place-items: center; width: 40px; height: 40px;
    border: 1px solid #ede4d3; border-radius: 12px;
    background: #fff; color: #55442a; padding: 0;
    font: 400 18px/1 Arial, sans-serif;
  }
  #tl-home-shell .tl-mobile-drawer-close:hover,
  #tl-v24-header .tl-mobile-drawer-close:hover { background: #fbf4e3; color: #9e7100; }
  #tl-home-shell .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-drawer-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 18px 18px max(26px,env(safe-area-inset-bottom));
  }
  #tl-home-shell .tl-mobile-nav-items,
  #tl-v24-header .tl-mobile-nav-items,
  #tl-home-shell .tl-mobile-category-items,
  #tl-v24-header .tl-mobile-category-items {
    display: flex; flex-direction: column; gap: 7px;
  }
  #tl-home-shell .tl-mobile-nav-link,
  #tl-v24-header .tl-mobile-nav-link {
    min-height: 50px; display: flex; align-items: center; justify-content: space-between;
    padding: 12px 15px; border: 1px solid #eee8dc; border-radius: 12px;
    background: #fff; color: #352c1e; font-size: 14px;
    line-height: 1.25; font-weight: 700; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-nav-link.active,
  #tl-v24-header .tl-mobile-nav-link.active {
    border-color: #ebd89c; background: #fff7e2; color: #926909;
  }
  #tl-home-shell .tl-mobile-nav-link:hover,
  #tl-v24-header .tl-mobile-nav-link:hover { background: #fffaf1; color: #926909; text-decoration: none; }
  #tl-home-shell .tl-mobile-row-arrow,
  #tl-v24-header .tl-mobile-row-arrow { font-size: 18px; color: #bda979; font-weight: 400; }
  #tl-home-shell .tl-mobile-drawer-contact,
  #tl-v24-header .tl-mobile-drawer-contact {
    display: flex; flex-direction: column; gap: 8px; margin-top: 22px;
    padding: 16px; background: #fbf7ee; border-radius: 12px;
  }
  #tl-home-shell .tl-mobile-drawer-contact > span,
  #tl-v24-header .tl-mobile-drawer-contact > span { font-size: 12px; color: #7d715e; }
  #tl-home-shell .tl-mobile-drawer-contact a,
  #tl-v24-header .tl-mobile-drawer-contact a {
    display: inline-flex; align-items: center; gap: 9px;
    color: #8b6305; font-weight: 700; font-size: 16px; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-drawer-contact .ic,
  #tl-v24-header .tl-mobile-drawer-contact .ic { width: 17px; height: 17px; }

  /* Drawer điều hướng: logo -> liên kết chữ trơn -> hotline phía dưới.
     Chỉ áp dụng cho nav drawer, giữ nguyên giao diện danh mục sản phẩm. */
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-head,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-head {
    min-height: 68px; padding: 8px 64px 8px 18px;
    border-bottom: 1px solid #e9dfc9; background: #fff;
  }
  #tl-home-shell .tl-mobile-nav-brand,
  #tl-v24-header .tl-mobile-nav-brand {
    display: block; width: 100%; max-width: 214px;
    line-height: 0; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-nav-brand img,
  #tl-v24-header .tl-mobile-nav-brand img {
    display: block; max-width: 100%; width: 100%; height: auto;
    object-fit: contain;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-close,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-close {
    top: 17px; right: 18px; width: 34px; height: 34px;
    border-radius: 8px; font-size: 18px;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-scroll {
    padding: 4px 24px 22px;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-nav-items,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-nav-items {
    gap: 0;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-nav-link,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-nav-link {
    display: block; min-height: 0; margin: 0; padding: 10px 0;
    border: 0; border-radius: 0; box-shadow: none;
    background: transparent; color: #342c22;
    font-size: 14px; font-weight: 600; line-height: 1.3;
    letter-spacing: .08px; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-nav-link.active,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-nav-link.active,
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-nav-link:hover,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-nav-link:hover {
    border: 0; background: transparent; color: #ab800d;
    text-decoration: none;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-row-arrow,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-row-arrow { display: none; }
  /* Contact follows the menu items inside the scroll area, not at the drawer bottom. */
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-contact,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-contact {
    flex: 0 0 auto; margin: 12px 0 0; padding: 15px 0 0;
    gap: 7px; border: 0; border-top: 1px solid #e9dfc9;
    border-radius: 0; background: transparent; box-shadow: none;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-contact > span,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-contact > span {
    font-size: 12px; font-weight: 500; color: #7f735e;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-phones,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-phones {
    display: flex; flex-flow: row nowrap; align-items: center;
    justify-content: flex-start; gap: 6px;
    white-space: nowrap; min-width: 0;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-phones a,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-phones a {
    display: inline-flex; align-items: center; gap: 4px;
    color: #946d0d; font-size: 14px;
    font-weight: 700; line-height: 1.4; white-space: nowrap;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-phones .ic,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-phones .ic {
    width: 14px; height: 14px; flex: 0 0 auto;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-divider,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-divider {
    color: #a88b5d; font-size: 12px; flex: 0 0 auto;
  }
  /* Mobile categories: four first-level cards per row; levels 2-3 open
     only after the complete list of first-level cards. */
  #tl-home-shell .tl-mobile-category-drawer,
  #tl-v24-header .tl-mobile-category-drawer {
    width: min(440px, 96vw);
  }
  #tl-home-shell .tl-mobile-category-drawer .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-category-drawer .tl-mobile-drawer-scroll {
    padding: 12px 14px max(26px, env(safe-area-inset-bottom));
  }
  #tl-home-shell .tl-mobile-category-items,
  #tl-v24-header .tl-mobile-category-items {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px; align-items: stretch;
  }
  #tl-home-shell .tl-mobile-cat-item,
  #tl-v24-header .tl-mobile-cat-item {
    display: flex; min-width: 0; min-height: 54px;
    background: #fff; border: 1px solid #e8decd;
    border-radius: 9px; overflow: hidden;
    transition: border-color .18s ease, background-color .18s ease;
  }
  #tl-home-shell .tl-mobile-cat-item.is-expanded,
  #tl-v24-header .tl-mobile-cat-item.is-expanded {
    background: #fff5db; border-color: #bf931f;
  }
  #tl-home-shell .tl-mobile-cat-row,
  #tl-v24-header .tl-mobile-cat-row {
    display: flex; width: 100%; min-width: 0;
  }
  #tl-home-shell .tl-mobile-cat-main,
  #tl-v24-header .tl-mobile-cat-main {
    display: flex; flex: 1; width: 100%; min-width: 0;
    align-items: center; justify-content: center;
    padding: 4px 2px; border: 0; background: transparent;
    color: #352c20; text-align: center; text-decoration: none;
    cursor: pointer; white-space: normal;
  }
  #tl-home-shell .tl-mobile-cat-main:hover,
  #tl-v24-header .tl-mobile-cat-main:hover {
    color: #a17b0a; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-cat-main:disabled,
  #tl-v24-header .tl-mobile-cat-main:disabled { cursor: default; opacity: .7; }
  #tl-home-shell .tl-mobile-cat-label,
  #tl-v24-header .tl-mobile-cat-label {
    display: block; min-width: 0; width: 100%;
  }
  #tl-home-shell .tl-mobile-cat-label strong,
  #tl-v24-header .tl-mobile-cat-label strong {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4;
    overflow: hidden; overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.28; font-weight: 700;
  }
  #tl-home-shell .tl-mobile-cat-label small,
  #tl-v24-header .tl-mobile-cat-label small { display: none; }
  #tl-home-shell .tl-mobile-cat-details-row,
  #tl-v24-header .tl-mobile-cat-details-row {
    grid-column: 1 / -1; min-width: 0; padding: 12px;
    border: 1px solid #e7d3a1; border-radius: 10px;
    background: #fffbf2;
  }
  #tl-home-shell .tl-mobile-cat-details-row[hidden],
  #tl-v24-header .tl-mobile-cat-details-row[hidden] { display: none !important; }
  #tl-home-shell .tl-mobile-cat-details-header,
  #tl-v24-header .tl-mobile-cat-details-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; min-width: 0; margin-bottom: 8px;
  }
  #tl-home-shell .tl-mobile-cat-details-title,
  #tl-v24-header .tl-mobile-cat-details-title {
    flex: 1 1 auto; min-width: 0; padding: 2px 0;
    font-size: 14px; font-weight: 700;
    line-height: 1.35; color: #86630c;
  }
  #tl-home-shell .tl-mobile-cat-all-link,
  #tl-v24-header .tl-mobile-cat-all-link {
    display: inline-block; flex: 0 0 auto; margin: 0 0 0 auto;
    color: #956c08; font-size: 12px; font-weight: 600;
    line-height: 1.4; white-space: nowrap; text-align: right;
    text-decoration: none;
  }
  #tl-home-shell .tl-mobile-cat-section,
  #tl-v24-header .tl-mobile-cat-section {
    padding: 8px 0 10px; border-top: 1px solid #eee5d1;
  }
  #tl-home-shell .tl-mobile-subheading,
  #tl-v24-header .tl-mobile-subheading {
    display: block; padding: 4px 2px 8px;
    color: #59421c; font-size: 12px; font-weight: 700;
    line-height: 1.4; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-cat-level3,
  #tl-v24-header .tl-mobile-cat-level3 {
    display: grid; grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 2px 8px; list-style: none; margin: 0; padding: 0;
  }
  #tl-home-shell .tl-mobile-cat-level3 li,
  #tl-v24-header .tl-mobile-cat-level3 li { min-width: 0; }
  #tl-home-shell .tl-mobile-sublink,
  #tl-v24-header .tl-mobile-sublink {
    display: block; padding: 7px 5px; border-radius: 5px;
    color: #544b3e; font-size: 12px; line-height: 1.4;
    text-decoration: none; overflow-wrap: anywhere;
  }
  #tl-home-shell .tl-mobile-sublink:hover,
  #tl-v24-header .tl-mobile-sublink:hover,
  #tl-home-shell .tl-mobile-subheading:hover,
  #tl-v24-header .tl-mobile-subheading:hover {
    color: #916500; background: #f9eed0; text-decoration: none;
  }
  #tl-home-shell .tl-mobile-drawer :is(button,a):focus-visible,
  #tl-v24-header .tl-mobile-drawer :is(button,a):focus-visible {
    outline: 2px solid #b28b23 !important; outline-offset: 2px !important;
  }
}
/* Below 420px: use three columns for readable labels.
   From 420px to 992px, use the default four-column grid above. */
@media (max-width: 419px) {
  #tl-home-shell .tl-mobile-category-items,
  #tl-v24-header .tl-mobile-category-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 375px) {
  #tl-home-shell .header__main-menu .theme-vmm-header > .vmm-trigger,
  #tl-v24-header .header__main-menu .theme-vmm-header > .vmm-trigger {
    gap: 5px !important; padding: 0 7px !important; font-size: 12px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  #tl-home-shell .tl-mobile-drawer, #tl-v24-header .tl-mobile-drawer,
  #tl-home-shell .tl-mobile-drawer-backdrop, #tl-v24-header .tl-mobile-drawer-backdrop { transition: none !important; }
}


/* Mobile: /tin-tuc/ & /lien-he/ do not need the old 24px bottom
   padding added by site-pages.css to .header__main-menu. */
@media (max-width: 767px) {
  body.page-template-page-posts-php #tl-v24-header #primaryNav .header__main-menu.tl-home-mega,
  body.page-template-page-contact-php #tl-v24-header #primaryNav .header__main-menu.tl-home-mega {
    padding-bottom: 0px;
  }
}

/* Icon VMM trong danh mục mobile cũng lấy từ cùng attachment ID. */
#tl-home-shell .tl-mobile-cat-label .vmm-category-icon,
#tl-v24-header .tl-mobile-cat-label .vmm-category-icon {
  display:inline-block; width:20px; height:20px; max-width:20px; max-height:20px;
  object-fit:contain; margin:0 auto 3px;
}
