/* Small refinements on the 1.3.1 layout; retain its palette and card hierarchy. */
.page-title > div,
.commerce-current-plan > div,
.commerce-plan-card h2,
.commerce-summary-row > strong {
    min-width: 0;
}
.page-title h1,
.commerce-current-plan strong,
.commerce-plan-card h2,
.commerce-plan-price .amount,
.commerce-period strong {
    overflow-wrap: anywhere;
}
.commerce-plan-price .amount,
.commerce-period strong,
.commerce-summary-row > strong {
    font-variant-numeric: tabular-nums;
}
.commerce-plan-price small {
    display: inline-block;
}
.commerce-current-plan > div {
    max-width: 100%;
}
.commerce-plan-card .commerce-primary-link {
    margin-top: auto;
}

/* Keep the close action reachable when a title or article is long. */
.modal > header,
.modal > footer {
    flex-shrink: 0;
}
.modal > header h2 {
    flex: 1;
    min-width: 0;
    max-height: min(30dvh, 10em);
    overflow-y: auto;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.modal > header > .icon-button {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}
.modal-body {
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

@media (max-width: 640px) {
    .shell main .btn,
    .modal .btn,
    .commerce-primary-link,
    .commerce-plan-categories button,
    .commerce-filter-tabs button {
        min-height: 44px;
    }
    .connect-secondary > .btn {
        font-size: 13px;
    }
    .account-item > .text-link,
    .subscription-card .plan-bottom .text-link,
    .commerce-text-link,
    .modal > footer > .text-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        font-size: 12px;
    }
    .account-item > .text-link {
        flex-shrink: 0;
    }
    .account-item > div > strong {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* A 16px form font prevents automatic zoom when focusing fields on iOS. */
    .shell main input:not([type="checkbox"]):not([type="radio"]),
    .shell main select,
    .shell main .filter-bar > select,
    .shell main textarea,
    .modal input:not([type="checkbox"]):not([type="radio"]),
    .modal select,
    .modal textarea {
        font-size: 16px;
    }
    .modal-backdrop {
        padding: max(13px, env(safe-area-inset-top))
            max(13px, env(safe-area-inset-right))
            max(13px, env(safe-area-inset-bottom))
            max(13px, env(safe-area-inset-left));
    }
    .modal {
        max-height: calc(100dvh - max(13px, env(safe-area-inset-top)) - max(13px, env(safe-area-inset-bottom)));
    }
    .modal > header {
        padding: 11px 15px;
        gap: 10px;
    }
}
