/* Final responsive layer for the public redesign, including server-rendered
   mobile variants. Keep wide content scrollable locally instead of clipping it. */
@media screen and (max-width:1023px) {
    html {scroll-padding-top:120px;}
    body {padding-bottom:calc(var(--mobile-toolbar-height, 72px) + 12px);}
    body:has(.pd-mobile-purchase) {padding-bottom:calc(var(--mobile-toolbar-height, 72px) + var(--mobile-purchase-height, 72px) + 12px);}
    body:has(.cart-mobile-checkout) {padding-bottom:calc(var(--mobile-toolbar-height, 72px) + var(--mobile-checkout-height, 80px) + 12px);}
    main[id],main[id] > .container,main[id] form,main[id] fieldset {min-width:0;}
    main[id] :is(h1,h2,h3) {overflow-wrap:anywhere;}
    main[id] :is(input:not([type=hidden]):not([type=checkbox]):not([type=radio]),select,textarea),
    .modal-global :is(input:not([type=hidden]),select,textarea),
    .component-modal-variation-content :is(input,select) {min-width:0;max-width:100%;font-size:16px;}
    main[id] .breadcrumb {display:flex;flex-wrap:wrap;gap:4px 6px;line-height:1.6;}
    main[id] .breadcrumb li {min-width:0;overflow-wrap:anywhere;}
    main[id] .pagination {display:flex;flex-wrap:wrap;justify-content:center;}

    /* An authenticated account is an anchor; legacy header styles target it
       more strongly than the guest button. Hide both at the same hook. */
    .dtl-site-header .header-top .dtl-header-main > .dtl-header-account {display:none;}
    .dtl-site-header .dtl-header-discovery .header-search-field {height:52px;}
    .dtl-site-header .dtl-header-discovery .header-search-input,
    .dtl-site-header .dtl-header-discovery .header-search-button {height:44px;}
    .dtl-site-header .dtl-header-discovery-inner {min-height:62px;}
    #toolbar-menu-mobile.toolbar-menu-mobile {padding-bottom:env(safe-area-inset-bottom, 0px);}
    #toolbar-menu-mobile.toolbar-menu-mobile ul {width:100%;margin:0;}
    #toolbar-menu-mobile.toolbar-menu-mobile :is(a,button) {min-height:64px;}
    .dtl-site-footer {padding-bottom:24px;}
    .dtl-site-footer .dtl-footer-call {min-height:44px;}
    .dtl-site-footer .dtl-footer-social a {width:44px;height:44px;}
    .dtl-site-footer .dtl-footer-legal {gap:16px;}
    .dtl-site-footer .dtl-footer-legal p {font-size:12px;}

    /* Modals fit short screens as well as portrait phones; content scrolls
       inside the dialog while its close button remains reachable. */
    body .modal-global-container {box-sizing:border-box;width:calc(100% - 24px);max-width:480px;max-height:calc(100dvh - 24px);padding:48px 20px 20px;}
    body .modal-global-data {max-height:calc(100dvh - 94px);padding-right:0;overflow:auto;overscroll-behavior:contain;}
    body .modal-global-close {top:4px;right:4px;width:44px;height:44px;display:grid;place-items:center;}
    body .form-login-register {min-width:0;max-width:100%;}
    body .modal-global .form-control {min-height:48px;}
    body .form-login-register .btn {min-height:48px;white-space:normal;}
    body .form-login-register-taikhoan {display:flex;flex-wrap:wrap;justify-content:center;gap:8px;line-height:1.6;}
    body .component-modal-variation-content {box-sizing:border-box;width:calc(100% - 24px);max-height:calc(100dvh - 24px);overflow-y:auto;overscroll-behavior:contain;}
    body .component-modal-variation-content-close {width:44px;height:44px;}

    #page-home .home-section-heading {flex-wrap:wrap;}
    #page-home .home-section-heading > a,
    #page-home .home-category-tabs button {min-height:44px;}
    #page-home .home-flash {padding:20px 16px;}
    #page-home .home-discovery,#page-home .home-product-section,
    #page-home .home-editorial,#page-home .dtl-banner-categories,
    #page-home .section-banner-center {margin-bottom:48px;}

    /* Product images lead on touch screens. Keep text and actions compact;
       no flexible spacer is allowed to stretch the price area. */
    :is(#page-home,main[id]) .p-item.home-product-card {border-color:#e3e9e5;border-radius:14px;box-shadow:none;}
    :is(#page-home,main[id]) .p-item.home-product-card > .p-img {order:0;aspect-ratio:1.15;padding:14px;border:0;border-bottom:1px solid #edf1ee;background:#f5f8f6;}
    :is(#page-home,main[id]) .p-item.home-product-card > .p-img img {mix-blend-mode:multiply;}
    :is(#page-home,main[id]) .p-item.home-product-card > .home-product-summary {order:1;flex:none;padding:12px 12px 8px;}
    :is(#page-home,main[id]) .p-item.home-product-card .home-product-category {margin:0 0 6px;color:#778078;font-size:11px;line-height:1.5;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-name h3 {height:63px;min-height:63px;font-size:15px!important;line-height:21px!important;font-weight:600;letter-spacing:-.02em;-webkit-line-clamp:3;}
    :is(#page-home,main[id]) .p-item.home-product-card > .p-text {order:2;display:grid;grid-template-columns:minmax(0,1fr);align-items:start;align-content:start;flex:none;gap:8px;margin:0;padding:0 12px 12px;background:#fff;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-text .p-price-group {grid-column:1/-1;min-height:42px;height:auto;margin:0;gap:0;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-text .p-price {max-width:100%;font-size:19px;line-height:1.35;letter-spacing:-.035em;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-price-meta {min-height:0;line-height:18px;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-text .p-old-price {font-size:11px;line-height:18px;}
    :is(#page-home,main[id]) .p-item.home-product-card .home-product-discount {top:10px;left:10px;right:auto;padding:4px 7px;border-radius:6px;font-size:11px;}
    :is(#page-home,main[id]) .p-item.home-product-card :is(.home-add-cart,.home-inquiry) {display:flex;align-items:center;justify-content:center;gap:6px;justify-self:stretch;width:100%;height:auto;min-height:44px;min-width:0;margin:0;padding:8px;border:1px solid #d8e7dc!important;border-radius:8px;background:#eef5f0;color:var(--dtl-green-dark);font-size:12px;font-weight:600;line-height:1.4;}
    :is(#page-home,main[id]) .p-item.home-product-card :is(.home-add-cart,.home-inquiry) svg {display:block;width:17px;height:17px;flex:0 0 17px;}
    :is(#page-home,main[id]) .p-item.home-product-card :is(.home-add-cart,.home-inquiry) .dtl-visually-hidden {position:static!important;width:auto!important;height:auto!important;margin:0!important;overflow:visible!important;clip:auto!important;clip-path:none!important;white-space:normal!important;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-btn-group {margin:0;border-top:1px solid #eef1ee;}
    :is(#page-home,main[id]) .p-item.home-product-card .p-btn-compare {font-size:12px;}
    #page-home .home-product-grid,#page-home .home-continue .home-product-grid {display:grid;grid-template-columns:none;grid-template-rows:auto;grid-auto-flow:column;grid-auto-columns:minmax(164px,calc((100% - 24px)/3));gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;padding:0!important;}
    #page-home .home-product-grid .home-product-card:nth-child(n) {display:flex;scroll-snap-align:start;}
    #page-home .home-continue-remove {top:8px;right:8px;width:36px;height:36px;box-shadow:0 2px 6px #193d2710;}
    #page-home .banner-center-track {display:grid;grid-template-columns:none;grid-template-rows:auto;grid-auto-flow:column;grid-auto-columns:calc((100% - 16px)/2);gap:16px;margin:0;padding:0;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:none;}
    #page-home .banner-center-track::-webkit-scrollbar {display:none;}
    #page-home .section-banner-center .container .banner-center-card {width:100%;max-width:100%;border:1px solid #e3e9e5;border-radius:14px;background:#f5f8f6;box-shadow:none;}
    #page-home .section-banner-center .banner-center-card .banner-center-art {width:100%;}
    #page-home .section-banner-center .banner-center-card .banner-center-art > img {width:100%;height:auto;max-width:100%;}
    #page-home .section-banner-center .banner-center-card img {width:auto;height:auto;object-fit:cover;border-radius:0;}
    #page-home .banner-center-art {display:block;position:relative;aspect-ratio:auto;background:#edf4ef;}
    #page-home .banner-center-card:nth-child(3n+2) .banner-center-art {background:#edf2f8;}
    #page-home .banner-center-card:nth-child(3n) .banner-center-art {background:#f6f1e9;}
    #page-home .banner-center-art:has(.dtl-image-fallback) img {visibility:hidden;}
    #page-home .banner-center-art:has(.dtl-image-fallback) .banner-center-fallback {position:absolute;inset:0;display:grid;place-items:center;}
    #page-home .banner-center-fallback .category-menu-icon {display:grid;place-items:center;width:88px;height:88px;border:1px solid #ffffffb3;border-radius:24px;background:#ffffffa8;color:var(--dtl-green);box-shadow:0 8px 24px #2a724a08;}
    #page-home .banner-center-fallback svg {width:48px;height:48px;}
    #page-home .section-banner-center .banner-center-caption {display:flex;contain:inline-size;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;background:#fff;color:var(--dtl-ink);font-size:14px;font-weight:500;line-height:1.5;}
    #page-home .banner-center-caption > span {flex:1;min-width:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;}
    #page-home .banner-center-caption svg {flex:none;color:var(--dtl-green);}

    :is(#page-category,#page-search,#page-manufacturer) .page-heading {text-align:left;}
    :is(#page-category,#page-search,#page-manufacturer) .page-heading h1 {margin:20px 0 24px;font-size:32px;font-weight:400;line-height:1.2;text-align:left;}
    :is(#page-category,#page-search,#page-manufacturer) .page-heading p {font-size:15px;line-height:1.6;}
    #page-category .product-filter .op a {display:flex;align-items:center;min-height:44px;}
    #page-category .featured-products-heading {flex-wrap:wrap;gap:8px;}
    #page-category .product-sort button {min-height:44px;}

    #page-product .product-buy-area h1.product-name {font-size:26px;}
    #page-product .product-buy-area .pd-info {flex-wrap:wrap;}
    #page-product .product-buy-area .product-buy-area-price {padding:20px 16px;}
    #page-product .product-buy-area .product-warranty {flex-wrap:wrap;}
    #page-product .product-highlight > .static-text {align-items:flex-start;padding:16px;line-height:1.6;}
    #page-product .product-highlight > .static-text svg {margin-top:3px;}
    #page-product .c-desription .product-description-h {font-size:22px;line-height:1.4;}

    #page-cart .cart-page {padding-top:20px;padding-bottom:24px;}
    #page-cart .cart-intro {flex-wrap:wrap;}
    #page-cart .cart-back {min-height:44px;}
    #page-cart .cart-intro p {font-size:14px;}
    #page-cart .cart-count {margin-top:0;}
    #page-cart .cart-page :is(.cot-1,.cot-2,.cot-3) > p {font-size:22px;}
    #page-cart .cart-page .voucher-c-input {font-size:16px;}
    #page-cart .cart-page :is(.quantity-change,.quantity-buy) {width:44px;height:44px;line-height:44px;}
    #page-cart .cart-page .cart-item-body .cart-col-3 {flex-basis:134px;width:134px;}
    #page-cart .cart-page .js-delete-item {min-width:44px;min-height:44px;}
    #page-cart .cart-invoice summary {min-height:48px;font-size:20px;}
    #page-cart .cart-mobile-checkout {bottom:var(--mobile-toolbar-height, calc(64px + env(safe-area-inset-bottom, 0px)));padding:10px 16px;}
    body:has(.cart-mobile-checkout) .widget-social {bottom:calc(var(--mobile-toolbar-height, 72px) + var(--mobile-checkout-height, 80px) + 12px);}

    #page-taikhoan:has(.account-profile) {background:#fff;}
    #page-taikhoan .account-profile {grid-template-columns:minmax(0,1fr);gap:24px;}
    #page-taikhoan .account-heading h1 {font-size:30px;line-height:1.3;}
    #page-taikhoan .taikhoan-col-left {padding:16px;}
    #page-taikhoan .taikhoan-col-left ul li a {min-height:48px;}
    #page-taikhoan .account-profile .account-fields {grid-template-columns:repeat(2,minmax(0,1fr));}
    #page-taikhoan .account-orders .orders-search input {font-size:16px;}
    #page-taikhoan .account-orders .quan-ly-don-hang-tab {flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;}
    #page-taikhoan .account-orders .quan-ly-don-hang-tab li {flex-shrink:0;}
    #page-taikhoan .account-orders .quan-ly-don-hang-tab button {min-height:44px;white-space:nowrap;}

    :is(#page-article,#page-page) .articleDetail {font-size:16px;line-height:1.8;overflow-wrap:anywhere;}
    :is(#page-article,#page-page) .articleDetail h1 {margin-block:24px 28px;font-size:32px;}
    main[id] :is(.articleDetail,.SContent,.product-description) table {display:block;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;table-layout:auto;}
    main[id] :is(.articleDetail,.SContent,.product-description) :is(td,th) {min-width:100px;}
    main[id] :is(.articleDetail,.SContent,.product-description) :is(img,video,iframe),
    #page-page > .container :is(img,video,iframe) {max-width:100%!important;}
    #page-page > .container img {height:auto;}
    #page-contact .contact-wrapper {display:grid;grid-template-columns:minmax(0,1fr);gap:24px;}
    #page-contact .contact-wrapper :is(.contact-left,.contact-right) {width:100%;min-width:0;}
    #page-contact .contact-wrapper iframe {width:100%;max-width:100%;}
    #page-contact .message-form :is(input,textarea,button) {box-sizing:border-box;width:100%;min-height:48px;}
    #page-baoloi .gone-search input {font-size:16px;}
}
@media screen and (max-width:639px) {
    #page-home .dtl-slider-stage {height:410px;min-height:0;}
    #page-home .dtl-slider-stage--cover {height:auto;}
    #page-home .dtl-campaign:not(.dtl-banner-cover) {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);align-items:start;gap:12px;padding:20px 24px;}
    #page-home .dtl-campaign-copy {align-self:start;width:100%;max-width:none;}
    #page-home .dtl-campaign-copy .dtl-hero-brand {min-height:0;margin:0 0 10px;padding:0;border:0;border-radius:0;background:none;font-size:11px;color:#65746a;}
    #page-home .dtl-campaign-copy h2 {font-size:clamp(27px,7.2vw,32px);line-height:1.12;letter-spacing:-.04em;}
    #page-home .dtl-campaign-copy > p:not(.dtl-hero-brand) {margin:10px 0 14px;font-size:14px;line-height:1.5;}
    #page-home .dtl-campaign-cta {min-height:44px;max-width:none;padding:10px 14px;font-size:12px;}
    #page-home .dtl-campaign-art {position:static;align-self:center;justify-self:center;width:100%;height:100%;min-height:0;max-height:180px;max-width:320px;filter:drop-shadow(0 10px 12px #18352212);}
    #page-home .home-product-grid,#page-home .home-continue .home-product-grid {grid-auto-columns:minmax(164px,calc((100% - 12px)/2));}
    #page-home .banner-center-track {grid-auto-columns:82%;gap:12px;}
    #page-home .section-banner-center.banner-center--single .banner-center-track {grid-auto-flow:row;grid-template-columns:minmax(0,1fr);}
    #page-home .home-section-heading h2 {font-size:25px;}
    #page-home .home-section-heading > a {font-size:12px;}
    #page-home .home-flash {padding:20px 12px;}
    #page-taikhoan .account-heading h1 {font-size:26px;}
    #page-taikhoan .account-profile .account-fields {grid-template-columns:minmax(0,1fr);}
    #page-taikhoan .account-profile .account-actions {align-items:stretch;flex-direction:column;}
    #page-taikhoan .account-profile .account-save {width:100%;}
    :is(#page-category,#page-search,#page-manufacturer) .page-heading h1,
    :is(#page-article,#page-page) .articleDetail h1 {font-size:28px;}
    #page-tlkhuyenmai .promo-categories {flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:12px;margin-bottom:8px;}
    #page-tlkhuyenmai .promo-categories a {flex:none;min-height:44px;}
    #page-contact .form-row-haft {display:grid;grid-template-columns:minmax(0,1fr);gap:12px;}
}
@media screen and (max-width:1023px) and (max-height:500px) and (orientation:landscape) {
    #page-home .dtl-slider-stage {height:380px;min-height:380px;}
    #page-home .dtl-campaign {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;padding:24px;}
    #page-home .dtl-campaign-copy h2 {font-size:32px;}
    #page-home .dtl-campaign-art {position:static;width:100%;height:240px;align-self:center;}
}
