/* Layout móvel da Chiptec */
@media screen and (max-width: 991px) {
    #html-body {
        --chiptec-mobile-ink: #173544;
        --chiptec-mobile-blue: #0a5376;
        --chiptec-mobile-border: #e1e8ed;
        --chiptec-mobile-surface: #f3f6f8;
        --chiptec-mobile-gap: 12px;
    }

    #html-body .header-middle .logo {
        max-width: min(64vw, 320px);
    }

    #html-body .header-middle .logo img {
        height: auto;
        max-width: 100%;
    }

    #html-body .header-middle .nav-toggle,
    #html-body .header-middle .minicart-wrapper .showcart {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    #html-body .header-middle .block-search input[type="text"] {
        min-height: 44px;
        font-size: 16px;
    }

    #html-body .header-middle .showcart .counter.qty {
        top: 2px;
    }

    #html-body .breadcrumbs .items {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* A navegação fica em frente à pesquisa e aos controlos dos banners. */
    .nav-open #html-body .page-header {
        position: relative;
        z-index: 11000;
    }

    .nav-open #html-body .header-container .block-search {
        visibility: hidden;
    }

    .nav-open #html-body .navigation.mobile-style.nav-sections {
        z-index: 11001;
        position: fixed;
        inset: 0 auto 0 0;
        width: min(100%, 420px);
        height: 100vh;
        height: 100dvh;
        transform: none;
        transition: none;
        overflow: auto;
        overscroll-behavior: contain;
        background: #fff;
    }

    #html-body .navigation.mobile-style .menu-mobile-title {
        position: sticky;
        inset-block-start: 0;
        z-index: 4;
        min-height: 56px;
        padding: 16px 64px 16px 20px;
    }

    .nav-open #html-body .navigation.mobile-style #close-menu {
        z-index: 5;
        position: fixed;
        inset: 6px auto auto min(calc(100% - 52px), 368px);
        width: 44px;
        height: 44px;
        top: 6px;
        right: auto;
    }

    #html-body .navigation.mobile-style .custommenu-list {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    #html-body .navigation.mobile-style li.ui-menu-item > a {
        display: block;
        min-height: 44px;
        padding: 12px 52px 12px 20px;
        font-size: 15px;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #html-body .navigation.mobile-style li.level1 > a {
        padding-inline-start: 34px;
    }

    #html-body .navigation.mobile-style li.level2 > a {
        padding-inline-start: 48px;
    }

    #html-body .navigation.mobile-style li.level3 > a {
        padding-inline-start: 60px;
    }

    #html-body .navigation.mobile-style li.ui-menu-item > .open-children-toggle {
        width: 50px;
        height: 44px;
        touch-action: manipulation;
    }

    #html-body .navigation.mobile-style .submenu {
        border-inline-start: 2px solid var(--chiptec-mobile-border);
        margin-inline-start: 10px;
    }

    /* Banners com a proporção dos ficheiros originais. */
    #html-body .wrap-slider-banner > .pagebuilder-column-group {
        display: grid !important;
        grid-template-columns: minmax(0, 2.08fr) minmax(0, 1fr);
        align-items: start;
        gap: var(--chiptec-mobile-gap);
        width: 100%;
        margin-inline: 0;
    }

    #html-body .wrap-slider-banner > .pagebuilder-column-group > .wrap-slider-revo {
        grid-column: 1 / -1;
        width: 100% !important;
        min-width: 0;
        margin: 0;
        padding: 0;
    }

    #html-body .wrap-slider-banner .wrap-slider-revo .swiper {
        position: relative;
        border-radius: 8px;
        overflow: hidden;
    }

    #html-body .wrap-slider-banner .swiper-slide img {
        display: block;
        width: 100%;
        height: auto;
    }

    #html-body .wrap-slider-banner .swiper:not(.swiper-initialized) .swiper-wrapper {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
    }

    #html-body .wrap-slider-banner .swiper:not(.swiper-initialized) .swiper-slide {
        width: 100%;
        flex: 0 0 100%;
        scroll-snap-align: start;
    }

    #html-body .wrap-slider-banner .swiper:not(.swiper-initialized) :is(.swiper-button-prev, .swiper-button-next) {
        display: none;
    }

    #html-body.cms-index-index .wrap-slider-banner .pagebuilder-column.chiptec-offy-flexi-column {
        display: contents;
    }

    #html-body.cms-index-index .wrap-slider-banner .chiptec-offy-flexi-column > .banner-column-item:not(.chiptec-offy-flexi-banner) {
        display: block;
        grid-column: 1;
        grid-row: 3;
    }

    #html-body.cms-index-index .wrap-slider-banner .chiptec-offy-flexi-column > .chiptec-offy-flexi-banner {
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: min(100%, 420px);
        margin: 0 auto;
    }

    #html-body .wrap-slider-banner > .pagebuilder-column-group > .col-banner.banner-column {
        display: block;
        grid-column: 2;
        grid-row: 3;
        width: 100% !important;
        margin: 0;
        padding: 0;
    }

    #html-body .wrap-slider-banner .banner-column-item,
    #html-body .wrap-banner-middle .banner-middle-content,
    #html-body .wrap-list-product .banner-column-item {
        position: relative;
        aspect-ratio: 337 / 240;
        width: 100%;
        margin: 0;
    }

    #html-body .wrap-slider-banner .col-banner .banner-column-item {
        aspect-ratio: 337 / 500;
    }

    #html-body .wrap-slider-banner .banner-column-item > a,
    #html-body .wrap-banner-middle .banner-middle-content > a,
    #html-body .wrap-list-product .banner-column-item > a {
        display: block;
        position: absolute;
        inset: 0;
    }

    #html-body.cms-index-index .wrap-slider-banner .banner-column-item .pagebuilder-banner-wrapper,
    #html-body .wrap-banner-middle .banner-middle-content .pagebuilder-banner-wrapper,
    #html-body .wrap-list-product .banner-column-item .pagebuilder-banner-wrapper {
        height: 100%;
        min-height: 0;
        border-radius: 8px;
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
    }

    #html-body.cms-index-index .wrap-slider-banner .banner-column-item .pagebuilder-overlay,
    #html-body .wrap-banner-middle .banner-middle-content .pagebuilder-overlay,
    #html-body .wrap-list-product .banner-column-item .pagebuilder-overlay {
        height: 100%;
        min-height: 0;
        padding: 0;
    }

    #html-body .wrap-list-product .banner-column-item {
        aspect-ratio: 420 / 550;
    }

    #html-body .wrap-banner-middle .pagebuilder-column-group:has(.banner-middle-item) {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
        gap: var(--chiptec-mobile-gap);
        padding: 0 15px;
        overflow: visible;
    }

    #html-body .wrap-banner-middle .banner-middle-item {
        width: 100% !important;
        min-width: 0;
        padding: 0;
        margin: 0;
    }

    #html-body .wrap-banner-middle .banner-middle-content {
        aspect-ratio: 560 / 195;
    }

    #html-body .wrap-banner-middle .pagebuilder-column-group:has(> .banner-middle-item:nth-child(2):last-child) .banner-middle-content {
        aspect-ratio: 768 / 160;
    }

    #html-body .wrap-banner-middle .banner-middle-content img {
        max-width: 100%;
        height: auto;
    }

    #html-body .shipping-support {
        margin: 16px 0;
        background: #fff;
        border: 1px solid var(--chiptec-mobile-border);
        border-radius: 10px;
    }

    #html-body .shipping-support > .row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin: 0;
    }

    #html-body .shipping-support > .row > div {
        width: auto;
        max-width: none;
        padding: 11px;
    }

    #html-body .shipping-support > .row > div:nth-child(odd) {
        border-inline-end: 1px solid var(--chiptec-mobile-border);
    }

    #html-body .shipping-support > .row > div:nth-child(-n + 2) {
        border-bottom: 1px solid var(--chiptec-mobile-border);
    }

    #html-body .shipping-support .col-content {
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        align-items: center;
        gap: 8px;
        min-height: 45px;
        margin: 0;
        padding: 0;
        border: 0;
    }

    #html-body .shipping-support :is(.content, p, h6, a) {
        color: var(--chiptec-mobile-ink);
        overflow-wrap: anywhere;
    }

    #html-body .shipping-support p {
        line-height: 1.35;
        margin: 3px 0 0;
    }

    #html-body .shipping-support .icon {
        flex: 0 0 24px;
        color: var(--chiptec-mobile-blue);
        font-size: 24px;
        margin: 0;
    }

    /* Uma grelha utilizável enquanto o carrossel está a carregar. */
    #html-body .block-highlight .owl-carousel:not(.owl-loaded) {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: calc((100% - var(--chiptec-mobile-gap)) / 2);
        gap: var(--chiptec-mobile-gap);
        overflow-x: auto;
        scroll-snap-type: x proximity;
        margin: 0;
        padding: 0 0 6px;
    }

    #html-body .block-highlight .owl-carousel:not(.owl-loaded) > .product-item {
        min-width: 0;
        width: auto;
        margin: 0;
        scroll-snap-align: start;
    }

    #html-body .products-grid .product-item .product-item-info {
        border: 1px solid var(--chiptec-mobile-border);
        border-radius: 8px;
        background: #fff;
    }

    #html-body .products-grid .product-item-link {
        -webkit-line-clamp: 3;
        max-height: 4.05em;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    #html-body .products-grid .product-image-photo,
    #html-body .cart.table-wrapper .product-image-photo {
        object-fit: contain;
    }

    #html-body .products-grid .product-item-photo :is(.image_hover, .chiptec-hover-image) {
        display: none;
    }

    #html-body .rokan-title.has-see-all .module-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 44px;
        line-height: 1.25;
    }

    #html-body .rokan-title .see-all {
        float: none;
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        color: var(--chiptec-mobile-blue);
    }

    #html-body :is(.cart-empty, .chiptec-promotions-empty) {
        background: #fff;
        border: 1px solid var(--chiptec-mobile-border);
        border-radius: 10px;
        padding: 20px;
    }

    #html-body .cart-empty a,
    #html-body .chiptec-promotions-empty a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        text-decoration: underline;
        text-underline-offset: .18em;
    }

    #html-body .header-middle .minicart-wrapper .block-minicart {
        width: min(360px, calc(100vw - 24px));
        max-height: 75vh;
        max-height: 75dvh;
        overflow: auto;
        overscroll-behavior: contain;
        border-radius: 10px;
    }

    #html-body.checkout-cart-index .cart-container :is(.form-cart, .cart-summary) {
        min-width: 0;
        width: 100%;
    }

    #html-body.checkout-cart-index .cart-summary {
        background: var(--chiptec-mobile-surface);
        border: 1px solid var(--chiptec-mobile-border);
        border-radius: 10px;
        padding: 16px;
    }

    #html-body.checkout-cart-index .cart-summary .actions-toolbar .primary,
    #html-body.checkout-cart-index .cart-summary .action.checkout,
    #html-body.checkout-cart-index .cart-summary #chiptec-print-proposal {
        min-height: 44px;
    }

    #html-body.checkout-cart-index .cart-container .cart.actions {
        gap: 8px;
    }

    #html-body.checkout-cart-index .cart-container .cart.actions .action {
        min-height: 44px;
    }

    #html-body.catalog-product-view .gallery-placeholder,
    #html-body.catalog-product-view .gallery-placeholder__image {
        max-width: 100%;
    }

    #html-body.catalog-product-view .gallery-placeholder__image {
        height: auto;
        object-fit: contain;
    }

    #html-body.catalog-product-view .product-info-main .box-tocart .fieldset {
        flex-wrap: wrap;
        gap: 8px;
    }

    #html-body.catalog-product-view .product-info-main .box-tocart .action.tocart {
        min-height: 44px;
        white-space: normal;
    }

    #html-body.catalog-product-view .product.info.detailed .table-wrapper {
        max-width: 100%;
        overflow-x: auto;
    }

    #html-body.catalog-product-view .product.info.detailed td {
        overflow-wrap: anywhere;
    }
}

@media (hover: none), (pointer: coarse) {
    #html-body .product-item-photo .chiptec-hover-image {
        display: none;
    }
}

@media screen and (min-width: 600px) and (max-width: 991px) {
    #html-body .wrap-slider-banner > .pagebuilder-column-group {
        grid-template-columns: minmax(0, 2.08fr) minmax(0, 2.08fr) minmax(0, 1fr);
    }

    #html-body.cms-index-index .wrap-slider-banner .chiptec-offy-flexi-column > .chiptec-offy-flexi-banner {
        grid-column: 1;
        grid-row: 2;
    }

    #html-body.cms-index-index .wrap-slider-banner .chiptec-offy-flexi-column > .banner-column-item:not(.chiptec-offy-flexi-banner) {
        grid-column: 2;
        grid-row: 2;
    }

    #html-body .wrap-slider-banner > .pagebuilder-column-group > .col-banner.banner-column {
        grid-column: 3;
        grid-row: 2;
    }

    #html-body .block-highlight .owl-carousel:not(.owl-loaded) {
        grid-auto-columns: calc((100% - 2 * var(--chiptec-mobile-gap)) / 3);
    }
}

@media screen and (max-width: 767px) {
    #html-body.checkout-cart-index .cart.table-wrapper .cart.item {
        display: block;
        border: 1px solid var(--chiptec-mobile-border);
        border-radius: 10px;
        margin-block: 0 12px;
        padding: 12px;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-info {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        align-items: start;
        gap: 10px;
        padding: 0;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-info > .col {
        display: block;
        width: auto;
        min-width: 0;
        border: 0;
        padding: 0;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-info > .col.item {
        grid-column: 1 / -1;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding-block-end: 10px;
        border-bottom: 1px solid var(--chiptec-mobile-border);
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-info > .col.item::before {
        display: none;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .product-item-photo {
        position: static;
        flex: 0 0 72px;
        max-width: 72px;
        margin: 0;
        padding: 0;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .product-item-details {
        min-width: 0;
        padding: 0;
        overflow-wrap: anywhere;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-info > .col:not(.item)::before {
        display: block;
        width: auto;
        margin: 0 0 5px;
        font-size: 12px;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .cart.item .input-text.qty {
        min-height: 44px;
        max-width: 100%;
        font-size: 16px;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .cart.item .item-actions {
        position: static;
        transform: none;
        display: block;
        width: 100%;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-actions > td {
        display: block;
        width: 100%;
        padding: 6px 0 0;
    }

    #html-body.checkout-cart-index .cart.table-wrapper .item-actions .actions-toolbar {
        display: flex;
        justify-content: flex-end;
    }
}
