/* Site-wide mobile refinements. Loaded after each page's stylesheet. */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  #root {
    box-sizing: border-box;
    width: 100vw;
    min-width: 0;
    max-width: 100vw;
    overflow-x: clip;
  }

  #root .ref-container,
  #root .site-container,
  #root .shell,
  #root .shop-container,
  #root .cd-container,
  #root .cd2-wrap,
  #root .pa-container,
  #root .v3-container,
  #root .news-main,
  #root .contact-page-inner,
  #root .ar-about-wrap,
  #root .alaska-catalog-layout,
  #root .cart-flow-page > .cart-flow-container,
  #root .shop-cart-page > .shop-container {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-right: auto;
    margin-left: auto;
  }

  #root .ref-main,
  #root main,
  #root .ref-container,
  #root .site-container,
  #root .cd2,
  #root .cd2-wrap,
  #root .cd2-hero,
  #root .cd2-gallery,
  #root .cd2-hero-info,
  #root .alaska-catalog-layout,
  #root .alaska-catalog-results,
  #root .cart-flow-page,
  #root .cart-flow-container,
  #root .site-footer-grid {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  #root .ref-main,
  #root main {
    width: 100vw !important;
  }

  #root img,
  #root video,
  #root iframe,
  #root svg {
    max-width: 100%;
  }

  #root :where(h1, h2, h3, h4, p, li, label, th, td) {
    overflow-wrap: anywhere;
  }

  #root :where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  #root :where(button, input[type="button"], input[type="submit"], .button, .btn, [role="button"]) {
    touch-action: manipulation;
  }

  /* Keep the header compact and preserve the menu and cart controls. */
  #root .ref-header {
    width: 100%;
    height: auto;
    max-width: 100%;
  }

  #root .ref-announcement {
    min-height: 32px;
    overflow: hidden;
  }

  #root .ref-announcement-inner {
    box-sizing: border-box;
    width: 100%;
    min-height: 32px;
    padding-inline: 10px;
    overflow: hidden;
  }

  #root .ref-announcement-inner > .ref-announcement-items {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    overscroll-behavior-inline: contain;
  }

  #root .ref-announcement-inner > .ref-announcement-items::-webkit-scrollbar {
    display: none;
  }

  #root .ref-announcement-item {
    flex: 0 0 auto;
    gap: 5px;
    padding-inline: 5px;
    white-space: nowrap;
    font-size: 10px;
  }

  #root .ref-announcement-item svg {
    flex: none;
    width: 16px;
    height: 16px;
  }

  #root .ref-main-bar {
    position: relative;
  }

  #root .ref-header .ref-main-inner {
    position: relative;
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 64px;
    padding: 7px 12px;
  }

  #root .ref-logo {
    position: absolute;
    top: 50%;
    left: 12px;
    justify-self: start;
    width: max-content;
    max-width: 100%;
    height: 46px;
    padding-inline: 8px;
    transform: translateY(-50%);
  }

  #root .ref-logo-mark {
    flex: none;
    width: 29px;
    height: 33px;
  }

  #root .ref-logo-word b {
    font-size: 14px;
  }

  #root .ref-header .ref-header-actions {
    position: absolute;
    top: 50%;
    right: 58px;
    display: flex;
    justify-self: end;
    gap: 8px;
    transform: translateY(-50%);
  }

  #root .ref-header-actions .ref-hotline,
  #root .ref-header-actions .ref-account {
    display: none;
  }

  #root .ref-header .ref-header-actions .ref-cart-link {
    display: grid;
    width: 38px;
    height: 42px;
    place-items: center;
  }

  #root .ref-header-actions .ref-cart-link > span:last-child {
    display: none;
  }

  #root .ref-cart-icon,
  #root .ref-cart-icon svg {
    width: 25px;
    height: 25px;
  }

  #root .ref-header .ref-mobile-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid !important;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 1px solid #ffffff80;
    border-radius: 4px;
    background: transparent;
    color: #fff;
    transform: translateY(-50%);
    visibility: visible;
    opacity: 1;
    z-index: 5;
  }

  #root .ref-mobile-toggle svg {
    width: 22px;
    height: 22px;
  }

  #root .ref-main-inner > .ref-search {
    position: absolute;
    top: 100%;
    right: 12px;
    left: 12px;
    z-index: 4;
    display: grid;
    grid-template-columns: minmax(76px, 94px) minmax(0, 1fr) 38px;
    width: auto;
    height: 42px;
    overflow: hidden;
    border: 1px solid #cbd8e4;
    border-radius: 0 0 5px 5px;
  }

  #root .ref-search select,
  #root .ref-search input {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding-inline: 7px;
    font-size: 12px;
  }

  #root .ref-search select {
    text-overflow: ellipsis;
  }

  #root .ref-search button {
    display: grid;
    width: 38px;
    min-width: 38px;
    place-items: center;
  }

  #root .ref-nav-bar {
    height: 42px;
    border: 0;
  }

  #root .ref-nav-inner {
    width: 100%;
    height: 42px;
  }

  #root .ref-nav-inner nav {
    top: 138px;
    right: 0;
    left: auto;
    width: min(340px, 88vw);
    max-height: calc(100dvh - 110px);
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    overflow-y: auto;
    border-radius: 0 0 0 10px;
  }

  #root .ref-nav-bar.is-open::after {
    inset: 138px 0 0;
  }

  #root .ref-category-control {
    top: 0;
    right: 0;
    left: 0;
    height: 0;
  }

  #root .ref-category-control > button {
    display: none;
  }

  #root .ref-nav-bar.is-open .ref-category-control > button {
    position: fixed;
    top: 138px;
    right: min(340px, 88vw);
    left: 0;
    z-index: 3;
    display: flex;
    width: auto;
    min-height: 48px;
    justify-content: flex-start;
    padding-inline: 14px;
  }

  /* Product archive filters become compact horizontal category chips. */
  #root .alaska-catalog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 16px auto 38px;
  }

  #root .alaska-catalog-sidebar {
    position: static;
    min-width: 0;
    padding: 12px;
    overflow: hidden;
  }

  #root .alaska-catalog-sidebar h2 {
    margin-bottom: 9px;
    padding-bottom: 8px;
    font-size: 15px;
  }

  #root .alaska-catalog-sidebar > nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    margin-inline: -2px;
    padding: 0 2px 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
  }

  #root .alaska-catalog-sidebar > nav a {
    display: inline-flex;
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    justify-content: center;
    gap: 7px;
    padding: 7px 11px;
    border: 1px solid #dce5ec;
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
  }

  #root .alaska-catalog-sidebar > nav a.is-current {
    border-color: #064d91;
  }

  #root .alaska-asado-category-tree {
    margin-top: 8px;
  }

  #root .alaska-asado-category-tree > summary {
    min-height: 40px;
    padding: 10px;
    font-size: 12px;
  }

  #root .alaska-woocommerce-catalog {
    width: 100%;
    min-width: 0;
  }

  #root .alaska-woocommerce-catalog .ref-catalog-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  #root .alaska-woocommerce-catalog .ref-catalog-toolbar h2 {
    font-size: 22px;
    line-height: 1.3;
  }

  #root .alaska-woocommerce-catalog .ref-catalog-search {
    width: 100%;
    min-width: 0;
  }

  #root .alaska-woocommerce-catalog ul.products,
  #root .alaska-woocommerce-catalog .ref-product-grid,
  #root .catalog-redesign .product-grid,
  #root .shop-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    width: calc(100vw - 24px) !important;
    min-width: 0;
    max-width: 100%;
  }

  #root .alaska-woocommerce-catalog ul.products > *,
  #root .alaska-woocommerce-catalog .ref-product-grid > *,
  #root .catalog-redesign .product-grid > *,
  #root .shop-product-grid > *,
  #root .ref-home-intro-grid > *,
  #root .ref-product-grid > *,
  #root .ref-project-grid > *,
  #root .ref-news-grid > *,
  #root .cart-flow-checkout-grid > *,
  #root .site-footer-grid > * {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  #root .alaska-woocommerce-catalog li.product,
  #root .shop-product-card,
  #root .product-card {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    width: 100% !important;
  }

  #root .alaska-woocommerce-catalog li.product img,
  #root .shop-product-card-image img,
  #root .product-card-image img {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: cover;
  }

  #root .shop-product-card h3,
  #root .alaska-woocommerce-catalog li.product .woocommerce-loop-product__title,
  #root .product-card h3 {
    font-size: clamp(13px, 3.7vw, 15px);
    line-height: 1.4;
    overflow-wrap: anywhere;
  }

  #root .shop-product-price,
  #root .shop-product-price > span,
  #root .shop-product-price del,
  #root .shop-product-price ins,
  #root .shop-product-price .shop-product-discount {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  /* Keep the product hero, information table, and purchase actions inside the viewport. */
  #root .cd2-purchase-template .cd2-wrap {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin-right: auto;
    margin-left: auto;
  }

  #root .cd2-purchase-template {
    width: 100vw;
    min-width: 0;
    max-width: 100%;
  }

  #root .cd2-purchase-template .cd2-breadcrumb {
    width: 100vw;
    max-width: 100vw;
    padding-inline: 12px;
    margin-bottom: 16px;
    overflow-x: auto;
    white-space: nowrap;
  }

  #root .cd2-purchase-template .cd2-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 100%;
  }

  #root .cd2-purchase-template .cd2-hero > *,
  #root .cd2-purchase-template .cd2-product-summary {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }

  #root .cd2-purchase-template .cd2-gallery,
  #root .cd2-purchase-template .cd2-main-photo,
  #root .cd2-purchase-template .cd2-hero-info {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #root .cd2-purchase-template .cd2-main-photo {
    aspect-ratio: 4 / 3;
  }

  #root .cd2-purchase-template .cd2-thumbs {
    justify-content: flex-start;
    gap: 7px;
    padding-top: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  #root .cd2-purchase-template .cd2-thumbs button {
    flex: 0 0 calc((100% - 21px) / 4);
    width: calc((100% - 21px) / 4);
    min-width: 0;
    height: auto;
    aspect-ratio: 4 / 3;
  }

  #root .cd2-purchase-template .cd2-product-summary {
    min-width: 0;
    padding: 16px 13px 12px;
  }

  #root .cd2-purchase-template .cd2-product-summary h1 {
    font-size: clamp(20px, 5.5vw, 24px);
    line-height: 1.32;
  }

  #root .cd2-purchase-template .cd2-product-summary .cd2-hero-highlights {
    width: 100%;
    max-width: 100%;
  }

  #root .cd2-purchase-template .cd2-product-summary .cd2-hero-highlights > div {
    grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
    gap: 8px;
  }

  #root .cd2-purchase-template .cd2-store-buy,
  #root .cd2-purchase-template .cd2-contact-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #root .cd2-purchase-template .cd2-store-buy button,
  #root .cd2-purchase-template .cd2-contact-actions a {
    min-width: 0;
    min-height: 46px;
    padding-inline: 7px;
    font-size: 12px;
  }

  #root .cd2-purchase-template .cd2-assurance.cd2-reference-assurance {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
    font-size: 11px;
    line-height: 1.4;
  }

  #root .cd2-purchase-template .cd2-assurance.cd2-reference-assurance > * {
    min-width: 0;
  }

  #root .cd2-product-description,
  #root .cd2-body,
  #root .cd2-overview,
  #root .cd2-spec-layout,
  #root .cd2-comparison-faq,
  #root .cd2-related {
    min-width: 0;
    max-width: 100%;
  }

  #root .cd2-table-scroll,
  #root .cd2-product-description .table-wrap,
  #root .woocommerce table.shop_table_responsive {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  /* Stack cart and checkout columns; let wide order tables scroll within their card. */
  #root .cart-flow-page > .cart-flow-container,
  #root .shop-cart-page > .shop-container,
  #root .cart-flow-container {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    padding-inline: 0;
  }

  #root .cart-flow-checkout-grid,
  #root .cart-flow-cart-layout,
  #root .cart-flow-two-column,
  #root .woocommerce-checkout .col2-set {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  #root .cart-flow-order-summary,
  #root .cart-flow-payment-summary,
  #root .cart-flow-customer-form,
  #root .cart-flow-cart-panel {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding-inline: 14px;
  }

  #root .cart-flow-table-wrap,
  #root .woocommerce table.shop_table,
  #root .woocommerce-checkout-review-order-table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  #root .cart-flow-page :where(input, select, textarea),
  #root .woocommerce-checkout :where(input, select, textarea) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  /* Long form and editorial content should wrap instead of widening the page. */
  #root .contact-page-inner,
  #root .contact-page-layout,
  #root .contact-page-form,
  #root .account-auth-card,
  #root .account-profile,
  #root .account-requests,
  #root .ad-layout,
  #root .pa-detail,
  #root .pa-article-intro,
  #root .ar-about-wrap,
  #root .company-location-card {
    min-width: 0;
    max-width: 100%;
  }

  #root .ad-table-scroll,
  #root .pa-article-table-wrap,
  #root .wp-block-table {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  #root .ad-table-scroll table,
  #root .pa-article-table-wrap table,
  #root .wp-block-table table {
    max-width: none;
  }

  #root .ref-footer,
  #root .site-footer,
  #root .site-footer-grid {
    width: 100%;
    min-width: 0;
  }

  #root .floating.has-zalo,
  #root .floating.has-zalo > a {
    max-width: calc(100vw - 16px);
  }
}

/* Keep the mobile navigation usable: the category control belongs inside the full-width drawer. */
@media (max-width: 760px) {
  #root .ref-header .ref-nav-bar.is-open::after {
    inset: var(--ref-mobile-menu-top, calc(138px + var(--wp-admin--admin-bar--height, 0px))) 0 0;
  }

  #root .ref-nav-bar.is-open .ref-nav-inner {
    position: fixed;
    top: var(--ref-mobile-menu-top, calc(138px + var(--wp-admin--admin-bar--height, 0px)));
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    width: 100vw;
    max-width: 100vw;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    box-shadow: 0 8px 18px #0002;
  }

  #root .ref-nav-bar.is-open .ref-category-control {
    position: relative;
    inset: auto;
    z-index: 3;
    flex: 0 0 auto;
    height: auto;
  }

  #root .ref-nav-bar.is-open .ref-category-control > button {
    position: relative;
    inset: auto;
    z-index: auto;
    display: flex;
    width: 100%;
    height: 48px;
    min-height: 48px;
    justify-content: flex-start;
    padding-inline: 14px;
  }

  #root .ref-category-menu {
    position: static;
    top: auto;
    right: auto;
    left: auto;
    width: auto;
    max-height: 55vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: none;
  }

  #root .ref-category-menu-category > .ref-category-submenu {
    display: none;
  }

  #root .ref-category-menu-category.is-submenu-open > .ref-category-submenu {
    display: block;
  }

  #root .ref-nav-bar.is-open .ref-nav-inner nav {
    position: static;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    z-index: auto;
    display: flex;
    width: auto;
    height: auto;
    max-height: none;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    transform: none;
    visibility: visible;
    transition: none;
  }
}

@media (max-width: 420px) {
  #root .ref-announcement-inner > .ref-announcement-items {
    gap: 3px;
  }

  #root .ref-announcement-item {
    padding-inline: 3px;
    font-size: 9px;
  }

  #root .ref-main-inner {
    gap: 6px;
    padding-inline: 9px;
  }

  #root .ref-logo {
    height: 42px;
    padding-inline: 6px;
  }

  #root .ref-header-actions .ref-cart-link {
    width: 34px;
  }

  #root .ref-mobile-toggle {
    width: 38px;
    height: 38px;
  }

  #root .ref-main-inner > .ref-search {
    right: 9px;
    left: 9px;
    grid-template-columns: 82px minmax(0, 1fr) 36px;
  }

  #root .ref-search button {
    width: 36px;
    min-width: 36px;
  }

  #root .alaska-catalog-layout {
    width: calc(100% - 20px);
  }

  #root .alaska-woocommerce-catalog ul.products,
  #root .alaska-woocommerce-catalog .ref-product-grid,
  #root .catalog-redesign .product-grid,
  #root .shop-product-grid {
    gap: 9px !important;
  }

  #root .cd2-purchase-template .cd2-product-summary .cd2-hero-highlights > div {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 7px;
  }

  #root .cd2-purchase-template .cd2-store-buy button,
  #root .cd2-purchase-template .cd2-contact-actions a {
    font-size: 11px;
  }

  #root .cd2-purchase-template .cd2-assurance.cd2-reference-assurance {
    grid-template-columns: minmax(0, 1fr);
  }
}
