/**
 * The in-page CAD dialog for row links and the hero button. Docs' geometry:
 * the frame is 430px high; the card caps at the 1000px embed width. Only
 * shipped on product-taxonomy (group) pages, alongside the JS.
 */

.tp-lightbox[hidden] {
    display: none;
}

.tp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(11 14 16 / 0.66);
}

.tp-lightbox__card {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1000px; /* the docs' embed width */
    max-height: calc(100vh - 2rem);
    overflow: auto;
    background: #fff;
    border-radius: 0.5rem;
}

.tp-lightbox__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgb(11 14 16 / 0.1);
}

.tp-lightbox__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.tp-lightbox__close {
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: rgb(11 14 16 / 0.06);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.tp-lightbox__close:hover,
.tp-lightbox__close:focus-visible {
    background: rgb(11 14 16 / 0.12);
}

.tp-lightbox__close:focus-visible {
    outline: 2px solid var(--theme-secondary-color);
    outline-offset: 2px;
}

.tp-lightbox__frame {
    display: block;
    width: 100%;
    border: 0;
    background: #fff;
}

/* While a dialog is up, the page behind must not scroll. */
body.tp-lightbox-open {
    overflow: hidden;
}

/*
 * Phones: a full-bleed sheet tempted, but a 430px frame at 62vh keeps the
 * widget's own chrome intact and the card scrolls when the viewport is
 * short. The frame height is pinned — height:auto collapses an iframe to
 * its 150px default and "unscrollable" is exactly what that feels like.
 */
@media (max-width: 767.98px) {
    .tp-lightbox {
        padding: 0.75rem;
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
        align-items: center;
    }

    .tp-lightbox__card {
        max-height: 92vh;
        border-radius: 0.75rem;
        overscroll-behavior: contain;
    }

    .tp-lightbox__bar {
        padding: 0.5rem 0.75rem;
    }

    .tp-lightbox__title {
        font-size: 0.875rem;
    }

    .tp-lightbox__frame {
        height: min(62vh, 430px) !important;
    }
}

/*
 * 2026-11-12: the loading veil. TraceParts' viewer takes seconds to arrive; the
 * veil says so — spinner, one quiet line, the frame's own geometry, gone the
 * moment the frame fires load. It only renders while .is-loading rides the body.
 */
.tp-lightbox__body {
    position: relative;
}

.tp-lightbox__loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
}

.tp-lightbox__body.is-loading .tp-lightbox__loading {
    display: flex;
}

.tp-lightbox__spinner {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    border: 3px solid #e5eef4;
    border-top-color: #0e7c6b;
    animation: tp-lightbox-spin 0.8s linear infinite;
}

@keyframes tp-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

.tp-lightbox__loading-text {
    font-size: 0.875rem;
    color: #5d6675;
}

@media (prefers-reduced-motion: reduce) {
    .tp-lightbox__spinner {
        animation-duration: 2.4s;
    }
}

/* The stalled state: the spinner stops, the quiet line says so, and the direct
 * TraceParts URL — the anchor's own href — is one click away in a new tab. */
.tp-lightbox__body.is-stalled .tp-lightbox__loading {
    display: flex;
}

.tp-lightbox__body.is-stalled .tp-lightbox__spinner {
    display: none;
}

.tp-lightbox__body.is-stalled .tp-lightbox__loading-text {
    color: #8a5a00;
}

.tp-lightbox__loading-fallback {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0e7c6b;
    text-decoration: underline;
}

.tp-lightbox__loading-fallback:hover,
.tp-lightbox__loading-fallback:focus-visible {
    color: #0a5f53;
}
