html.ns-source-modal-open {
    overflow: hidden;
}

.ns-source-modal[hidden] {
    display: none !important;
}

.ns-source-modal {
    --ns-source-panel: #121414;
    --ns-source-text: #e8e4da;
    --ns-source-muted: rgb(232 228 218 / 0.62);
    --ns-source-rule: rgb(232 228 218 / 0.18);

    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: clamp(14px, 3vw, 42px);
    color: var(--ns-source-text);
}

.ns-source-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 0.76);
    backdrop-filter: blur(7px);
    opacity: 0;
    transition: opacity 180ms ease;
}

.ns-source-modal__panel {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(920px, 100%);
    max-height: min(88vh, 980px);
    overflow: hidden;
    color: inherit;
    background: var(--ns-source-panel);
    border: 1px solid var(--ns-source-rule);
    border-radius: 2px;
    box-shadow: 0 28px 90px rgb(0 0 0 / 0.38);
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    transition: opacity 180ms ease, transform 180ms ease;
}

.ns-source-modal.is-open .ns-source-modal__backdrop,
.ns-source-modal.is-open .ns-source-modal__panel {
    opacity: 1;
}

.ns-source-modal.is-open .ns-source-modal__panel {
    transform: translateY(0) scale(1);
}

.ns-source-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(22px, 4vw, 42px) clamp(22px, 5vw, 54px) 20px;
    border-bottom: 1px solid var(--ns-source-rule);
}

.ns-source-modal__eyebrow {
    margin: 0 0 8px;
    font: inherit;
    font-size: 0.7em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ns-source-muted);
    opacity: 1;
}

.ns-source-modal__title {
    margin: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    font-size: clamp(1.35em, 3vw, 2em);
    font-weight: 500;
    line-height: 1.12;
}

.ns-source-modal__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: -8px -10px 0 0;
    padding: 0;
    color: inherit;
    background: transparent;
    border: 0;
    border-radius: 50%;
    font: inherit;
    font-size: 30px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    opacity: 0.62;
    transition: opacity 120ms ease, background-color 120ms ease;
}

.ns-source-modal__close:hover,
.ns-source-modal__close:focus-visible {
    opacity: 1;
    background: color-mix(in srgb, currentColor 8%, transparent);
    outline: none;
}

.ns-source-modal__content {
    overflow: auto;
    padding: clamp(24px, 5vw, 54px);
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}


.ns-source-modal__content :where(
    h1, h2, h3, h4, h5, h6,
    p, li, dt, dd, blockquote, cite,
    figcaption, label, strong, em
) {
    color: inherit;
}

.ns-source-modal__content a {
    color: inherit;
}

.ns-source-modal__content hr {
    border-color: var(--ns-source-rule);
}

.ns-source-modal__content pre,
.ns-source-modal__content code {
    color: inherit;
    background: rgb(255 255 255 / 0.055);
}

.ns-source-modal__content > :first-child {
    margin-top: 0;
}

.ns-source-modal__content > :last-child {
    margin-bottom: 0;
}

.ns-source-modal__content img,
.ns-source-modal__content video,
.ns-source-modal__content iframe {
    max-width: 100%;
}

.ns-source-modal__content iframe {
    border: 0;
}

.ns-source-modal__footer {
    display: flex;
    justify-content: flex-end;
    padding: 18px clamp(22px, 5vw, 54px) clamp(22px, 4vw, 36px);
    border-top: 1px solid var(--ns-source-rule);
}

.ns-source-modal__original {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65em;
    min-height: 44px;
    padding: 0.72em 1.05em;
    color: inherit;
    background: transparent;
    border: 1px solid currentColor;
    border-radius: 1px;
    font: inherit;
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
    transition: background-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

.ns-source-modal__original:hover,
.ns-source-modal__original:focus-visible {
    background: color-mix(in srgb, currentColor 8%, transparent);
    outline: none;
}

.ns-source-modal[data-state="loading"] .ns-source-modal__content,
.ns-source-modal[data-state="error"] .ns-source-modal__content {
    min-height: 190px;
    display: grid;
    place-items: center;
    text-align: center;
    opacity: 0.68;
}

@media (max-width: 600px) {
    .ns-source-modal {
        padding: 0;
        place-items: stretch;
    }

    .ns-source-modal__panel {
        width: 100%;
        max-height: 100dvh;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .ns-source-modal__header {
        padding-top: max(22px, env(safe-area-inset-top));
    }

    .ns-source-modal__footer {
        padding-bottom: max(22px, env(safe-area-inset-bottom));
    }

    .ns-source-modal__original {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ns-source-modal__backdrop,
    .ns-source-modal__panel,
    .ns-source-modal__close,
    .ns-source-modal__original {
        transition: none;
    }
}
