/**
 * The ticket details modal on tablets and phones.
 *
 * Mobile uses the same framing as the site's other sheets (flight details, prebook
 * profile): the overlay is the dynamic viewport, the dialog fills it, and the head
 * pads itself below the device safe area. Large `vh` is never used for height —
 * on iOS Safari it is taller than the visible screen, which is what buried the
 * close control and the top of the map under the browser chrome.
 */

@media (max-width: 900px) {
    .tbo-modal {
        padding: 20px 14px;
    }

    .tbo-modal__map {
        height: 220px;
    }
}

@media (max-width: 720px) {
    .tbo-modal {
        align-items: stretch;
        justify-content: stretch;
        padding: 0;
    }

    .tbo-modal__dialog {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        border: none;
    }

    /*
     * Head clears the notch / status bar / Safari top chrome. Safe-area alone is
     * the inset Apple documents for this; the extra 12px is the same breathing
     * room the flight-details and prebook sheets use above their title.
     */
    .tbo-modal__head {
        gap: 10px;
        padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
    }

    /*
     * Same 44px circle the rest of the site's mobile close controls use. The
     * global tap-target rule was stretching a 36px-wide button to 44px tall;
     * locking every axis here keeps the control round after that exclusion.
     */
    .tbo-modal__close {
        width: 44px;
        height: 44px;
        min-width: 44px;
        max-width: 44px;
        min-height: 44px;
        max-height: 44px;
        aspect-ratio: 1;
        border-radius: 50%;
    }

    .tbo-modal__title {
        font-size: 18px;
    }

    .tbo-modal__kind {
        display: none;
    }

    .tbo-modal__scroll {
        gap: 18px;
        padding: 16px 16px 20px;
    }

    /* Fixed px height — same as flight details — so the map never inherits a
       collapsing Safari vh and draws as a half-empty frame. */
    .tbo-modal__map {
        height: 200px;
        border-radius: 14px;
    }

    /* Phone: price on the left, buy control tucked into the right corner. */
    .tbo-modal__foot {
        flex-direction: row;
        gap: 12px;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .tbo-modal__price {
        flex: 1 1 auto;
        gap: 1px;
        min-width: 0;
    }

    .tbo-modal__amount {
        font-size: 20px;
    }

    .tbo-modal__price-note {
        font-size: 11.5px;
    }

    .tbo-modal__seats {
        font-size: 11px;
    }

    .tbo-modal__purchase {
        flex: 0 0 auto;
        max-width: 58%;
    }

    .tbo-modal__buy {
        width: auto;
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
    }

    .tbo-modal__purchase-error {
        max-width: 11rem;
        font-size: 11px;
        text-align: right;
    }

    .tbo-details {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .tbo-leg__row {
        grid-template-columns: 46px 14px minmax(0, 1fr);
        gap: 11px;
    }

    .tbo-wait {
        padding-left: 60px;
    }
}

@media (max-width: 430px) {
    .tbo-modal__identity {
        gap: 10px;
    }

    .tbo-modal__title {
        font-size: 17px;
    }

    .tbo-leg__row {
        grid-template-columns: 42px 14px minmax(0, 1fr);
        gap: 10px;
    }

    .tbo-leg__time,
    .tbo-leg__city {
        font-size: 13px;
    }

    .tbo-wait {
        padding-left: 0;
    }

    .tbo-modal__amount {
        font-size: 19px;
    }
}
