/* Shared storefront safeguards for phone-sized viewports. */
@media (max-width: 1100px) {
    /* The legacy mobile header hid the theme control alongside the desktop account link. */
    .site-header .header-actions .theme-toggle {
        display: grid !important;
        place-items: center;
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        min-width: 40px;
        padding: 0;
        visibility: visible;
        opacity: 1;
    }
}

@media (max-width: 760px) {
    html,
    body {
        max-width: 100%;
        overflow-x: clip;
    }

    body:not(.admin-shell) main,
    body:not(.admin-shell) main > *,
    body:not(.admin-shell) main :where(section, article, aside, div, form, fieldset, nav) {
        min-width: 0;
    }

    body:not(.admin-shell) .section {
        width: min(100% - 28px, 1320px);
        padding-block: 42px;
    }

    body:not(.admin-shell) :where(.page-hero, .hero) {
        min-height: 0;
        padding-top: 34px;
        padding-bottom: 34px;
    }

    body:not(.admin-shell) :where(.page-hero h1, .hero h1, .home-advisor-intro h1) {
        max-width: 100%;
        font-size: 2.85rem;
        line-height: 1.04;
        overflow-wrap: anywhere;
        text-wrap: balance;
    }

    body:not(.admin-shell) :where(.section-heading h2, .home-section-head h2) {
        max-width: 100%;
        font-size: 2.15rem;
        line-height: 1.08;
        overflow-wrap: anywhere;
        text-wrap: balance;
    }

    body:not(.admin-shell) :where(.section-heading, .home-section-head) {
        margin-bottom: 24px;
    }

    body:not(.admin-shell) :where(.section-heading.split, .home-section-head, .catalog-toolbar, .buy-box-heading) {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    body:not(.admin-shell) :where(.catalog, .two-columns, .form-grid, .checkout-layout, .account-layout, .product-detail, .product-story) {
        grid-template-columns: minmax(0, 1fr);
    }

    body:not(.admin-shell) .catalog {
        gap: 28px;
    }

    body:not(.admin-shell) .filters {
        position: static;
    }

    body:not(.admin-shell) :where(.product-grid, .taxonomy-grid, .review-grid, .wishlist-grid, .address-book) {
        grid-template-columns: minmax(0, 1fr);
    }

    body:not(.admin-shell) .product-card-body {
        padding: 18px;
    }

    body:not(.admin-shell) :where(input, select, textarea) {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    body:not(.admin-shell) fieldset {
        width: 100%;
        max-width: 100%;
        min-inline-size: 0;
    }

    body:not(.admin-shell) :where(table, .table-wrap, .admin-table-wrap, .order-table-wrap) {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
    }

    body:not(.admin-shell) table {
        display: block;
        width: 100%;
    }

    body:not(.admin-shell) :where(.pagination, .button-row, .product-section-nav > div) {
        max-width: 100%;
        flex-wrap: wrap;
    }

    body:not(.admin-shell) :where(.rich-content, .product-story-body, .taxonomy-description, .page-content) {
        overflow-wrap: anywhere;
    }

    body:not(.admin-shell) :where(video, iframe) {
        max-width: 100%;
    }

    .site-footer {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
        padding: 40px 18px;
    }

    .site-header {
        gap: 8px;
        padding-inline: 14px;
    }

    .site-header .header-actions {
        min-width: 0;
        gap: 5px;
    }

    .site-header .header-actions .theme-toggle {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
        min-width: 38px;
        border-radius: 9px;
    }

    .site-header .header-actions .theme-toggle::before,
    .site-header .header-actions .theme-toggle::after {
        font-size: 1.2rem;
    }

    .site-footer :where(section, nav, div, p, a) {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .toast {
        right: 14px;
        left: 14px;
        max-width: none;
    }

    .age-card {
        width: 100%;
        max-height: calc(100dvh - 28px);
        padding: 28px 22px;
        overflow-y: auto;
    }

    /* Keep trust information useful, but place it after the landing content. */
    .home-landing {
        display: flex;
        flex-direction: column;
    }

    .home-landing > .home-proof {
        order: 100;
        margin-top: 8px;
    }

    .home-landing > .home-proof .section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: min(100% - 28px, 1320px);
    }
}

@media (max-width: 480px) {
    .site-header {
        padding-inline: 10px;
    }

    .site-header .brand {
        font-size: 1rem;
    }

    .site-header > .menu-toggle {
        width: 38px;
        height: 38px;
    }

    .site-header .currency-switcher select {
        min-width: 3.55rem;
        width: 3.55rem;
        padding-inline: .35rem;
    }

    .site-header .cart-link {
        padding-inline: 8px;
    }

    body:not(.admin-shell) .section {
        width: min(100% - 24px, 1320px);
        padding-block: 34px;
    }

    body:not(.admin-shell) :where(.page-hero h1, .hero h1, .home-advisor-intro h1) {
        font-size: 2.45rem;
    }

    body:not(.admin-shell) :where(.section-heading h2, .home-section-head h2) {
        font-size: 1.9rem;
    }

    body:not(.admin-shell) .button-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    body:not(.admin-shell) .button-row .button {
        width: 100%;
    }

    .home-landing > .home-proof .section {
        grid-template-columns: minmax(0, 1fr);
        width: min(100% - 24px, 1320px);
    }

    .home-landing > .home-proof span,
    .home-landing > .home-proof span:nth-child(2n),
    .home-landing > .home-proof span:nth-last-child(-n + 2) {
        border-right: 0;
        border-bottom: 1px solid var(--home-rule);
    }

    .home-landing > .home-proof span:last-child {
        border-bottom: 0;
    }

    .cookie-notice {
        right: 10px;
        bottom: 10px;
        left: 10px;
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
    }
}
