/* Thanh Long | Typography + mobile tuning
   Font scale: 12/14/16/18px; weight: 400/500/600/700.
   Keep Font Awesome / SVG controls and intentional line-height:0 unaffected.
   Unitless line-height tracks the 4 font sizes without shrinking text.
*/
:root {
  --tt-leading-body: 1.5;
  --tt-leading-heading: 1.4;
  --tt-leading-control: 1.4;
}

/* Content paragraphs, long product names, descriptions and breadcrumbs. */
body:not(.wp-admin) { line-height: var(--tt-leading-body); }
.site-page :is(p,li,dd,blockquote,.page-lead,.post-excerpt,.product-description,.product-name,.contact-item),
#product-category :is(.caption p,.caption h4,.product-brand-heading,.product-thumb .description),
#product-product :is(.product-info,.product-description,.tab-content p),
#tl-home-shell :is(.footer-about > p,.footer-column p,.footer-column > a,.product-name,.product-title,.news-content p,.news-content h3),
#tl-v24-header :is(.tl-mobile-nav-link,.tl-mobile-sublink) {
  line-height: var(--tt-leading-body);
  overflow-wrap: break-word;
}

/* Headings use a slightly tighter rhythm than body text. */
.site-page :is(.page-title,.site-section-title,h1,h2,h3,h4),
#product-category :is(.product-brand-heading strong,.related-brands__header h3),
#tl-home-shell :is(.footer-column h3,.product-bottom strong),
#tl-home-shell :is(h1,h2,h3),
#tl-v24-header :is(h1,h2,h3),
#tl-home-shell :is(.tl-mobile-drawer-title,.tl-mobile-cat-details-title),
#tl-v24-header :is(.tl-mobile-drawer-title,.tl-mobile-cat-details-title) {
  line-height: var(--tt-leading-heading);
  overflow-wrap: break-word;
}

/* Prevent labels from colliding in flexible cards. No forced ellipsis of prices. */
.site-page :is(.site-card,.contact-item,.post-card,.cart-summary,.checkout-layout),
#tl-home-shell :is(.product-card,.product-info,.news-card,.footer-column),
#tl-v24-header :is(.tl-mobile-cat-label,.tl-mobile-cat-details-row) { min-width: 0; }

@media (max-width: 992px) {
  /* Nav drawer text: readable rows and touch-friendly target size. */
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-nav-link,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-nav-link {
    display: flex; align-items: center;
    min-height: 44px;
    line-height: 1.5;
    padding-block: 10px;
    white-space: normal;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-phones,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-phones {
    flex-wrap: wrap;
    white-space: normal;
    row-gap: 6px;
  }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-contact-phones a,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-contact-phones a {
    white-space: normal;
    line-height: 1.4;
  }
}

@media (max-width: 767px) {
  /* Cards/forms keep their own widths, rather than overflowing small screens. */
  .site-page :is(.site-card,.contact-grid,.post-grid,.cart-layout,.cart-summary),
  #product-category :is(.product-grid,.product-thumb,.product-brand-heading),
  #product-product :is(.product-gallery,.product-image,.product-info) {
    min-width: 0;
    max-width: 100%;
  }
  .site-page :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea),
  #product-product :is(input,select,textarea) {
    max-width: 100%;
    box-sizing: border-box;
  }
  .site-page :is(.btn,.btn-brand,.btn-outline-brand,.cart-btn,.post-category),
  #product-product :is(.tt-btn,.single_add_to_cart_button) {
    min-height: 44px;
    line-height: var(--tt-leading-control);
  }
  .site-page :is(.page-title,.page-lead,.site-section-title),
  #product-category :is(.product-brand-heading,.related-brands__header),
  #product-product :is(.product-info,.product-title) {
    overflow-wrap: anywhere;
  }
  #tl-home-shell .footer-column h3 { white-space: normal; }
  #tl-home-shell .footer-column > a { line-height: 1.5; }
}

@media (max-width: 620px) {
  #tl-home-shell .footer-grid { gap: 16px; }
  #tl-home-shell .footer-column h3 { margin-bottom: 10px; }
  #tl-home-shell .footer-newsletter form { height: 44px; }
  #tl-home-shell .footer-newsletter button { width: 44px; }
  #tl-home-shell .footer-bottom-inner { gap: 8px; }
}

@media (max-width: 380px) {
  #tl-home-shell .footer-grid { column-gap: 12px; row-gap: 16px; }
  #tl-home-shell .footer-column h3 { overflow-wrap: anywhere; }
  #tl-home-shell .tl-mobile-nav-drawer .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-nav-drawer .tl-mobile-drawer-scroll { padding-inline: 16px; }
  #tl-home-shell .tl-mobile-category-drawer .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-category-drawer .tl-mobile-drawer-scroll { padding-inline: 10px; }
}

/* V24 | 320–430px: give the category trigger enough room for its full label.
   The drawer stylesheet enforces nowrap + a 38px fixed height + overflow:hidden,
   which cuts off “Danh mục sản phẩm” inside the 50%-width nav item.
   Override both normal and compact headers on Home and inner pages. */
@media (max-width: 430px) {
  #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 {
    height: auto !important;
    min-height: 48px !important;
  }

  #tl-home-shell #primaryNav .nav-inner,
  #tl-v24-header #primaryNav .nav-inner {
    min-height: 48px;
    height: auto;
  }

  #tl-home-shell #primaryNav .tl-home-mega,
  #tl-v24-header #primaryNav .tl-home-mega {
    min-width: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
  }

  #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 {
    box-sizing: border-box;
    width: 100% !important;
    height: auto !important;
    min-height: 40px !important;
    min-width: 0;
    padding: 2px 8px !important;
    gap: 6px !important;
    align-items: center;
    justify-content: flex-start;
    font-size: 12px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    text-wrap: balance;
    overflow-wrap: anywhere;
    word-break: normal;
    text-align: left;
  }

  #tl-home-shell .tl-home-mega .theme-vmm-header > .vmm-trigger > :is(.fa, .vmm-trigger-icon),
  #tl-v24-header .tl-home-mega .theme-vmm-header > .vmm-trigger > :is(.fa, .vmm-trigger-icon) {
    flex: 0 0 16px;
    width: 16px;
    align-self: center;
  }

  /* Header search and actions must share the remaining width, not force
     horizontal scrolling on 320px screens. */
  #tl-home-shell .header-inner,
  #tl-v24-header .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 6px;
  }
  #tl-home-shell .header-inner .brand,
  #tl-v24-header .header-inner .brand,
  #tl-home-shell .header-inner .search-form,
  #tl-v24-header .header-inner .search-form { min-width: 0; max-width: 100%; }
  #tl-home-shell .header-inner .brand img,
  #tl-v24-header .header-inner .brand img { max-width: 100%; height: auto; }
  #tl-home-shell .header-actions,
  #tl-v24-header .header-actions { gap: 5px; }

  #tl-home-shell .tl-mobile-drawer,
  #tl-v24-header .tl-mobile-drawer { max-width: 100vw; }
  #tl-home-shell .tl-mobile-nav-link,
  #tl-v24-header .tl-mobile-nav-link { min-width: 0; overflow-wrap: anywhere; }
}

@media (max-width: 360px) {
  #tl-home-shell .header-inner .brand img,
  #tl-v24-header .header-inner .brand img { width: min(145px, 100%); }
  #tl-home-shell .tl-mobile-drawer-scroll,
  #tl-v24-header .tl-mobile-drawer-scroll { padding-left: 12px; padding-right: 12px; }
  #tl-home-shell .cart-item-values { grid-template-columns: 88px minmax(0, 1fr) minmax(0, 1fr); }
}

/* V24 | Compact navigation row on phones/tablets.
   The legacy .header__main-menu can carry padding-bottom:24px on inner pages,
   while nav-inner's desktop height:100% and a 48px mobile min-height leave
   a white strip between the category button and the banner/content. */
@media (max-width: 992px) {
  #tl-home-shell #primaryNav,
  #tl-v24-header #primaryNav {
    height: auto !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  #tl-home-shell #primaryNav > .container.nav-inner,
  #tl-v24-header #primaryNav > .container.nav-inner {
    display: block;
    position: relative;
    height: auto !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  #tl-home-shell #primaryNav .header__main-menu.tl-home-mega,
  #tl-v24-header #primaryNav .header__main-menu.tl-home-mega {
    float: none !important;
  }

  #tl-home-shell #primaryNav .header__main-menu.tl-home-mega,
  #tl-v24-header #primaryNav .header__main-menu.tl-home-mega,
  #tl-home-shell #primaryNav .tl-home-mega > .theme-vmm-header,
  #tl-v24-header #primaryNav .tl-home-mega > .theme-vmm-header {
    height: auto !important;
    min-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
}

@media (max-width: 767px) {
  /* Same compact 12px control at 320–767px, including sticky header. */
  #tl-home-shell #primaryNav .tl-home-mega .theme-vmm-header > .vmm-trigger,
  #tl-v24-header #primaryNav .tl-home-mega .theme-vmm-header > .vmm-trigger {
    box-sizing: border-box;
    height: auto !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 2px 8px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-align: left;
  }
}
