/* Informational pages, customer accounts, affiliate portal and checkout.
   These rules keep content in the layout; only data tables scroll sideways. */
html :where(.aw-content-page, .aw-account-page, .aw-checkout-modal) :is(.grid > *, .flex-1, fieldset, .aw-field) {
    min-width: 0;
}

html :where(.aw-content-page, .aw-account-page, .aw-checkout-modal) fieldset {
    min-inline-size: 0;
}

html :where(.aw-content-page, .aw-account-page, .aw-checkout-modal) :is(input, select, textarea) {
    min-width: 0;
    max-width: 100%;
}

html :where(.aw-content-page, .aw-account-page) :is(p, address, .aw-label, .aw-rule-list, .aw-notice) {
    overflow-wrap: anywhere;
}

html .aw-account-heading > .min-w-0 {
    overflow-wrap: anywhere;
}

html .aw-order-number,
html .aw-order-reward-card,
html .aw-order-reward-code {
    min-width: 0;
    overflow-wrap: anywhere;
}

html .aw-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

html .aw-table-scroll:focus-visible {
    outline: 2px solid var(--aw-leaf, #1f6d1a);
    outline-offset: 3px;
}

/* A checkout is a document page, so the keyboard and browser own its scrolling.
   A second 88vh scrollport used to hide the address/payment controls on phones. */
html #checkout-sheet-scroll {
    max-height: none;
    overflow: visible;
}

html .aw-checkout-modal :is(#order-summary-toggle, #email-otp-box > .flex, .aw-payment-option-title) {
    gap: 0.5rem;
    flex-wrap: wrap;
}

html .aw-checkout-modal #order-summary-toggle > .flex {
    min-width: 0;
    flex-wrap: wrap;
}

html .aw-checkout-modal :is(#summary-total-head, #summary-mrp) {
    overflow-wrap: anywhere;
}

html .aw-checkout-modal :is(#coupon-input-group, #referral-input-group) > .flex-1 {
    min-width: 0;
}

html .aw-checkout-modal :is(#coupon-applied-chip, #referral-applied-chip) {
    gap: 0.5rem;
    flex-wrap: wrap;
    overflow-wrap: anywhere;
}

html .aw-payment-option-title > span:last-child {
    max-width: 100%;
}

html .aw-checkout-modal #recs-track {
    max-width: 100%;
    overscroll-behavior-inline: contain;
}

html .aw-affiliate-dashboard .aw-hero-code-text,
html .aw-account-page .aw-voucher-code {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

html .aw-affiliate-stat-grid .truncate,
html .aw-account-stat-grid .truncate,
html .aw-affiliate-balances .truncate {
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (min-width: 640px) and (max-width: 1023px) {
    /* Keep the identity readable next to its avatar; put shopping below. */
    html .aw-account-heading {
        flex-wrap: wrap;
    }

    html .aw-account-heading > .aw-magnetic {
        flex-basis: 100%;
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    html .aw-affiliate-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    html .aw-account-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    html :where(.aw-content-page, .aw-account-page, .aw-checkout-modal) :is(
        input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea
    ) {
        font-size: 16px;
        min-height: 44px;
    }

    html .aw-checkout-modal #fast_otp_code {
        font-size: 1.25rem;
    }

    html .aw-checkout-modal #checkout-sheet-scroll button {
        min-height: 44px;
    }

    html .aw-affiliate-balances {
        grid-template-columns: minmax(0, 1fr);
    }

    html .aw-affiliate-stat-grid > *,
    html .aw-account-stat-grid > * {
        padding: 1rem;
    }

    html :is(.aw-affiliate-stat-grid, .aw-account-stat-grid) .text-headline-lg {
        font-size: clamp(1.35rem, 5vw, 2rem);
        line-height: 1.2;
    }
}

@media (max-width: 639px) {
    /* The address card no longer covers the entire map at phone widths. */
    html .aw-contact-map {
        aspect-ratio: auto;
        max-height: none;
        overflow: visible;
    }

    html .aw-contact-map > iframe {
        display: block;
        height: 18rem;
    }

    html .aw-contact-map-card {
        position: static;
        width: 100%;
        max-width: none;
        border-radius: 0;
        box-shadow: none;
        padding: 1rem;
    }

    html .aw-distributor-submit {
        max-width: 100%;
        padding-inline: 1rem;
    }

    html .aw-checkout-brandbar {
        gap: 0.5rem;
        padding-inline: 0.75rem;
    }

    html .aw-checkout-brandbar > .flex {
        min-width: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    html .aw-checkout-brandbar > :first-child,
    html .aw-checkout-brandbar > :last-child {
        flex-shrink: 0;
    }

    html .aw-order-item {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        column-gap: 0.75rem;
        row-gap: 0.4rem;
    }

    html .aw-order-item > :last-child {
        grid-column: 2;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 359px) {
    html .aw-affiliate-stat-grid,
    html .aw-account-stat-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    html .aw-account-page .aw-voucher {
        grid-template-columns: minmax(0, 1fr);
    }

    html .aw-account-page .aw-voucher-value {
        align-items: flex-start;
        padding: 0 0 0.75rem;
        border-right: 0;
        border-bottom: 2px dashed var(--aw-line-strong);
    }
}
