/*
 * Phone / tablet storefront — same actions as desktop, without shrinking
 * tap targets or hiding catalog links. Desktop layout stays unchanged.
 */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html.is-catalog-filters-open {
    overflow: hidden;
}

a,
button,
input,
select,
textarea,
summary,
label {
    -webkit-tap-highlight-color: rgba(66, 116, 108, 0.18);
}

button,
a,
input,
select,
textarea {
    touch-action: manipulation;
}

.catalog-filters-toggle {
    display: none;
}

#auth-modal .auth-modal__sheet {
    max-height: min(92dvh, 44rem);
    overflow-y: auto;
}

.cookie-banner {
    padding-bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 1023px) {
    .site-chrome--header {
        padding-top: env(safe-area-inset-top, 0px);
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]),
    select,
    textarea {
        font-size: 16px;
    }

    .catalog-layout {
        display: flex;
        flex-direction: column;
    }

    .catalog-main {
        order: 1;
        width: 100%;
    }

    /*
     * Filters as an overlay under the toolbar — not buried after the product
     * grid, and not pushing the Φίλτρα button off-screen.
     */
    .catalog-filters {
        display: none;
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: max(5.25rem, calc(env(safe-area-inset-top, 0px) + 4.25rem));
        z-index: 45;
        max-height: min(72vh, 34rem);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 1rem 0.85rem;
        border: 1px solid #e2e8f0;
        border-radius: 0.9rem;
        background: #fff;
        box-shadow: 0 12px 40px rgb(15 23 42 / 0.18);
    }

    .catalog-filters .sticky {
        position: static;
    }

    .catalog-layout.is-filters-open .catalog-filters {
        display: block;
    }

    .catalog-layout.is-filters-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 40;
        background: rgb(15 23 42 / 0.35);
    }

    .catalog-toolbar {
        position: sticky;
        top: 0;
        z-index: 30;
        margin-left: -0.25rem;
        margin-right: -0.25rem;
        padding: 0.55rem 0.25rem 0.65rem;
        background: rgb(255 255 255 / 0.96);
        backdrop-filter: blur(8px);
    }

    .catalog-filters-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        min-height: 2.75rem;
        padding: 0.45rem 1rem;
        border: 1px solid #42746c;
        border-radius: 999px;
        background: #fff;
        color: #42746c;
        font-family: Inter, sans-serif;
        font-size: 0.875rem;
        font-weight: 600;
        flex-shrink: 0;
    }

    .catalog-filters-toggle[aria-expanded="true"] {
        background: #42746c;
        color: #fff;
    }

    .catalog-filters-toggle__dot {
        width: 0.45rem;
        height: 0.45rem;
        border-radius: 999px;
        background: #ed7c59;
    }

    .catalog-filters-toggle[aria-expanded="true"] .catalog-filters-toggle__dot {
        background: #fff;
    }

    .catalog-pagination__row {
        gap: 0.65rem;
    }

    .catalog-pagination__pages {
        width: 100%;
        justify-content: center;
        gap: 0.25rem;
    }

    .catalog-pagination__btn {
        width: 2rem !important;
        min-width: 2rem !important;
        height: 2rem !important;
        padding-inline: 0.2rem !important;
        border-radius: 0.45rem !important;
        font-size: 0.75rem !important;
    }

    .catalog-pagination__size {
        min-width: 2rem !important;
        padding: 0.3rem 0.55rem !important;
        font-size: 0.75rem !important;
        border-radius: 0.4rem !important;
    }

    .catalog-pagination__ellipsis {
        min-width: 1.1rem !important;
        height: 2rem !important;
    }

    #catalog-page .cart-stepper .qty-minus,
    #catalog-page .cart-stepper .qty-plus,
    .product-card-footer .qty-minus,
    .product-card-footer .qty-plus,
    #cart-page .cart-stepper .qty-minus,
    #cart-page .cart-stepper .qty-plus {
        width: 2.5rem;
        height: 2.5rem;
    }

    .product-card-footer .cart-add {
        min-height: 2.75rem;
    }

    .brand-products--panel .brand-products__row {
        width: 100%;
    }

    .brand-products--panel .product-card-footer {
        width: calc(100% - 0.75rem);
    }

    .brand-products--panel .product-card-footer .cart-add {
        font-size: 0.85rem;
        padding-block: 0.55rem;
    }

    .brand-products__track {
        -webkit-overflow-scrolling: touch;
    }

    .checkout-step-panel,
    .checkout-boxnow-panel {
        margin-left: 0;
    }

    .account-details-actions {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    .cookie-banner .cookie-banner__actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .cookie-banner .cookie-banner__actions button {
        min-height: 2.75rem;
        width: 100%;
    }

    html.has-cookie-banner .kokkoris-notice-host {
        bottom: calc(11.5rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 639px) {
    #cart-page .cart-line-row:not(.cart-line-row--compact) {
        display: grid;
        grid-template-columns: 4rem minmax(0, 1fr);
        grid-template-areas:
            "image info"
            "image meta";
        align-items: center;
        column-gap: 0.75rem;
        row-gap: 0.55rem;
    }

    #cart-page .cart-line-row__image {
        grid-area: image;
        align-self: start;
    }

    #cart-page .cart-line-row__info {
        grid-area: info;
    }

    #cart-page .cart-line-row__stepper {
        grid-area: meta;
        justify-self: start;
    }

    #cart-page .cart-line-row__subtotal {
        grid-area: meta;
        justify-self: end;
        width: auto;
    }

    #auth-modal {
        align-items: flex-end;
        padding: 0;
    }

    #auth-modal .auth-modal__sheet {
        max-width: 100%;
        max-height: min(92dvh, 44rem);
        border-radius: 1.25rem 1.25rem 0 0;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    }

    .checkout-delivery-option__card {
        flex-direction: column;
        align-items: stretch;
    }

    .checkout-delivery-option__fee {
        white-space: normal;
    }

    .home-hero-welcome {
        overflow-wrap: anywhere;
    }

    /* 3-up product cards: drop SKU + €/unit, tighten spacing. */
    #catalog-grid,
    #wishlist-grid,
    .wishlist-grid {
        gap: 0.4rem;
    }

    .product-card {
        border-radius: 0.55rem;
    }

    .product-card-sku,
    .product-card-unit,
    .product-card-availability {
        display: none !important;
    }

    .product-card-info {
        min-height: 0;
        padding: 0.35rem 0.35rem 0.4rem !important;
        text-align: center !important;
    }

    .product-card-info--browse {
        min-height: 0;
    }

    .product-card-title {
        -webkit-line-clamp: 2;
        min-height: calc(1.2em * 2);
        font-size: 0.65rem !important;
        line-height: 1.2 !important;
        margin-top: 0 !important;
    }

    .product-card-meta {
        min-height: 0;
        margin-top: 0.2rem !important;
        justify-content: center;
    }

    .product-card-meta > span {
        font-size: 0.55rem !important;
    }

    .product-card-price {
        min-height: 0;
        margin-top: 0.25rem !important;
        text-align: center !important;
    }

    .product-card-price > p:first-child {
        font-size: 0.8rem !important;
    }

    .product-image-slot {
        padding: 0.25rem !important;
    }

    /* Sachet “zoom” is calibrated for ~120px slots — dampen on tiny cards. */
    .product-image-slot img {
        transform: scale(
            clamp(
                0.92,
                calc(0.72 + 0.28 * var(--img-display-scale, 1)),
                1.18
            )
        ) !important;
    }

    .product-image-slot .wishlist-toggle {
        top: 0.2rem;
        right: 0.2rem;
        width: 1.45rem;
        height: 1.45rem;
    }

    .product-image-slot .wishlist-toggle svg {
        width: 0.7rem;
        height: 0.7rem;
    }

    .product-card-footer .cart-add {
        min-height: 2rem;
        padding-block: 0.35rem !important;
        font-size: 0.65rem !important;
        letter-spacing: 0.04em;
    }

    .product-card-footer .cart-stepper {
        padding: 0.25rem 0.35rem !important;
    }

    .product-card-footer .qty-minus,
    .product-card-footer .qty-plus {
        width: 1.65rem !important;
        height: 1.65rem !important;
    }

    /* Company browse rows: compact logos + exact 3-across strips. */
    .browse-company-section {
        margin-bottom: 1.75rem !important;
    }

    .browse-company-header {
        height: 4.25rem !important;
        margin-bottom: 0.65rem !important;
    }

    .browse-company-header__logo {
        height: calc(var(--browse-logo-height, 7.5rem) * 0.42) !important;
        max-width: min(11rem, 72vw) !important;
    }

    .browse-company-header__title {
        font-size: 1rem !important;
    }

    .brand-products--panel {
        padding-top: 0.35rem !important;
        padding-bottom: 0.85rem !important;
    }

    .brand-products--panel .brand-products__row {
        width: 100%;
        padding-inline: 0;
    }

    .brand-products__track,
    .browse-products-track {
        display: flex;
        gap: 0.35rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .product-browse-cell,
    .brand-products--panel .brand-products__track > .product-browse-cell {
        flex: 0 0 calc((100% - 0.7rem) / 3);
        width: calc((100% - 0.7rem) / 3) !important;
        max-width: none;
        margin-right: 0 !important;
        scroll-snap-align: start;
    }

    .brand-products--panel .brand-products__track > .product-browse-cell::after {
        display: none;
    }

    .product-browse-cell .product-image-slot {
        max-height: 7.25rem;
        padding: 0.15rem !important;
    }

    .brand-products--panel .product-card-footer {
        width: calc(100% - 0.4rem);
        margin-left: 0.2rem;
        margin-right: 0.2rem;
        margin-bottom: 0.35rem;
    }

    .brand-products--panel .product-card-footer .cart-add {
        font-size: 0.6rem;
        padding-block: 0.35rem;
    }
}
