/* Mobile RWD refinements */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

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

.catalog-filter-panel {
    display: contents;
}

.cart-undo-notification {
    position: fixed;
    left: 50%;
    bottom: max(1rem, env(safe-area-inset-bottom));
    z-index: 2600;
    display: flex;
    width: min(420px, calc(100% - 2rem));
    min-height: 56px;
    padding: 0.55rem 0.65rem 0.55rem 1rem;
    border-radius: 999px;
    background: var(--gallery-ink);
    color: var(--gallery-paper);
    box-shadow: 0 18px 50px rgba(33, 29, 27, 0.28);
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    transform: translateX(-50%);
}

.cart-undo-notification[hidden] {
    display: none;
}

.cart-undo-notification button {
    min-width: 64px;
    min-height: 44px;
    padding-inline: 0.8rem;
    border: 0;
    border-radius: 999px;
    background: var(--gallery-paper);
    color: var(--gallery-ink);
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 900px) {
    .site-header__inner {
        gap: 0.55rem;
    }

    .primary-nav a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .announcement-bar p {
        overflow: hidden;
        font-size: 0.58rem;
        letter-spacing: 0.025em;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .editorial-hero__copy {
        padding: 3.4rem 1.25rem 2.65rem;
    }

    .editorial-hero h1 {
        max-width: none;
        font-size: clamp(2.35rem, 10.6vw, 3.2rem);
        letter-spacing: -0.045em;
        line-height: 1.08;
        text-wrap: balance;
    }

    .editorial-hero h1 > span[aria-hidden="true"] {
        display: inline;
    }

    .editorial-hero__lead {
        margin-top: 1.35rem;
        font-size: 0.92rem;
        line-height: 1.75;
    }

    .editorial-hero__actions {
        margin-top: 1.65rem;
    }

    .editorial-hero__actions .button {
        min-height: 50px;
    }

    .editorial-hero__assurances {
        gap: 0.5rem 0.9rem;
        margin-top: 1.6rem;
        padding-top: 1rem;
    }

    .editorial-hero__media {
        min-height: min(88vw, 480px);
    }

    .occasion-section,
    .monthly-edit,
    .collection-section,
    .service-section,
    .concierge-section,
    .catalog-section {
        padding-block: 4.25rem;
    }

    .section-heading {
        margin-bottom: 2.2rem;
    }

    .monthly-edit {
        width: auto;
        margin-inline: -20px;
        padding-inline: 20px;
    }

    .featured-products-grid {
        width: 100%;
        margin-inline: 0;
        padding-inline: 0;
        scroll-padding-inline: 0;
    }

    .service-grid {
        width: auto;
        margin-inline: -20px;
    }

    .catalog-section .controls {
        position: static;
        top: auto;
        width: auto;
        margin-inline: 0;
        padding: 0.9rem;
    }

    .catalog-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .catalog-filter-toggle {
        position: relative;
        display: flex;
        width: 100%;
        min-height: 50px;
        padding: 0.7rem 2.5rem 0.7rem 0.9rem;
        border: 1px solid var(--gallery-line);
        border-radius: var(--gallery-radius-sm);
        background: var(--gallery-paper);
        color: var(--gallery-ink);
        cursor: pointer;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        text-align: left;
    }

    .catalog-filter-toggle::after {
        content: "+";
        position: absolute;
        top: 50%;
        right: 1rem;
        font-size: 1.25rem;
        line-height: 1;
        transform: translateY(-50%);
    }

    .catalog-filter-toggle[aria-expanded="true"]::after {
        content: "−";
    }

    .catalog-filter-toggle > span {
        font-size: 0.78rem;
        font-weight: 700;
    }

    .catalog-filter-toggle small {
        display: block;
        max-width: 100%;
        margin-top: 0.05rem;
        overflow: hidden;
        color: var(--gallery-muted);
        font-size: 0.66rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .catalog-filter-toggle.has-active-filter {
        border-color: rgba(113, 50, 71, 0.45);
        background: rgba(236, 218, 221, 0.5);
    }

    .catalog-filter-panel {
        display: none;
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding-top: 0.15rem;
    }

    .catalog-filter-panel.is-open {
        display: grid;
    }

    .results-toolbar {
        margin-top: 0.85rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--gallery-line);
    }

    .results-summary {
        font-size: 0.74rem;
    }

    .clear-filters-btn {
        min-height: 44px;
        padding-inline: 0.9rem;
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2.25rem 0.75rem;
    }

    .product-card,
    .product-content,
    .product-name,
    .product-category {
        min-width: 0;
    }

    .floating-cart-button {
        display: none;
    }

    .modal-close,
    .gallery-nav,
    .cart-close-btn {
        width: 48px;
        min-width: 48px;
        height: 48px;
        min-height: 48px;
    }

    .cart-sidebar {
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
    }

    .modal-content {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
    }

    .quantity-btn,
    .cart-item-remove {
        min-width: 44px;
        min-height: 44px;
    }

    .checkout-page .checkout-section,
    .policy-page .policy-section {
        padding: 1.35rem;
    }

    .checkout-page .checkout-item-controls {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 0.35rem;
        justify-content: space-between;
    }

    .checkout-page .checkout-item-price {
        grid-column: 1 / -1;
        padding-top: 0.2rem;
    }

    .checkout-quantity-control {
        grid-template-columns: 42px 44px 42px;
        height: 44px;
        border-radius: 10px;
    }

    .checkout-quantity-btn,
    .checkout-quantity-input {
        min-height: 44px;
    }

    .checkout-remove-btn {
        min-width: 48px;
        min-height: 44px;
        padding: 0.55rem 0.65rem;
    }

    .form-input,
    .form-textarea,
    .payment-option,
    .privacy-consent,
    .submit-order-btn,
    .cancel-btn {
        min-height: 48px;
    }

    .form-input,
    .form-textarea,
    .catalog-select,
    .search-input {
        font-size: 16px;
    }

    .gift-needs-fieldset {
        padding: 1rem;
    }

    .form-actions,
    .order-fallback__actions {
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .monthly-edit {
        margin-inline: -14px;
        padding-inline: 14px;
    }

    .featured-products-grid .featured-product-card {
        min-width: min(76vw, 280px);
    }

    .service-grid {
        margin-inline: -14px;
        padding-inline: 14px;
    }

    .occasion-card,
    .collection-card {
        min-height: 185px;
    }

    .catalog-section .controls {
        border-radius: 18px;
    }

    .product-image-wrapper {
        margin-bottom: 0.7rem;
    }

    .product-name__primary {
        font-size: 0.86rem;
        -webkit-line-clamp: 2;
    }

    .product-name__original {
        display: none;
    }

    .product-card-footer {
        margin-top: 0.55rem;
    }

    .modal-info {
        padding: 1.4rem 1.25rem 2rem;
    }

    .cart-sidebar-header,
    .cart-footer {
        padding-inline: 1rem;
    }

    .cart-items {
        padding-inline: 1rem;
    }

    .cart-item {
        display: grid;
        grid-template-columns: 64px minmax(0, 1fr);
        align-items: start;
        gap: 0.65rem 0.8rem;
    }

    .cart-item-image {
        grid-column: 1;
        grid-row: 1;
        width: 64px;
        height: 64px;
    }

    .cart-item-info {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .cart-item-quantity,
    .cart-item-controls {
        grid-column: 2;
    }

    .cart-item-controls {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .checkout-page .checkout-header,
    .policy-page .policy-header {
        padding: 1.8rem 1.25rem;
    }

    .checkout-page .checkout-title,
    .policy-page .policy-title {
        font-size: clamp(2.6rem, 15vw, 3.4rem);
    }
}

@media (max-width: 360px) {
    .brand__name {
        font-size: 1.02rem;
    }

    .gift-bag-button {
        padding-inline: 0.62rem;
        font-size: 0.68rem;
    }

    .editorial-hero__copy {
        padding: 2.8rem 1rem 2.3rem;
    }

    .editorial-hero h1 {
        font-size: 2.25rem;
    }

    .editorial-hero__caption {
        display: none;
    }

    .editorial-hero__media {
        min-height: 275px;
    }

    .section-heading h2,
    .concierge-section h2,
    .featured-title {
        font-size: 2.15rem;
    }

    .occasion-card,
    .collection-card {
        min-height: 175px;
        padding: 1rem;
    }

    .products-grid {
        gap-inline: 0.6rem;
    }

    .product-category {
        font-size: 0.55rem;
    }

    .product-name__primary {
        font-size: 0.82rem;
    }

    .product-price {
        font-size: 0.78rem;
    }

    .checkout-page .checkout-section,
    .policy-page .policy-section {
        padding: 1.1rem;
    }
}

@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .cart-sidebar-header {
            padding-top: max(1rem, env(safe-area-inset-top));
        }

        .cart-footer,
        .modal-info {
            padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
        }
    }
}
