/* NuGet package viewer --------------------------------------------------- */
.nuget-modal {
    z-index: 9700;
}

.nuget-modal__backdrop {
    background: rgba(3, 8, 18, 0.78);
    backdrop-filter: blur(10px);
}

.nuget-modal__panel {
    --nuget-pad: clamp(1rem, 2.4vw, 1.45rem);
    position: relative;
    width: min(760px, 100%);
    max-height: min(88vh, 780px);
    padding: 0;
    gap: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 24%, var(--theme-border));
    border-radius: 18px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--theme-accent) 5%, transparent), transparent 34%),
        var(--theme-surface);
    color: var(--theme-text);
    box-shadow: 0 28px 90px rgba(2, 7, 18, 0.48);
    animation: nuget-modal-enter 180ms ease-out both;
}

.nuget-modal__header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    padding: var(--nuget-pad) calc(var(--nuget-pad) + 3rem) var(--nuget-pad) var(--nuget-pad);
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
    background: color-mix(in srgb, var(--theme-surface-soft) 54%, transparent);
}

.nuget-modal__mark {
    display: inline-grid;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 42%, var(--theme-border));
    border-radius: 12px;
    background: color-mix(in srgb, var(--theme-accent) 10%, var(--theme-surface-soft));
    color: var(--theme-accent);
}

.nuget-modal__mark svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.nuget-modal__heading {
    display: grid;
    min-width: 0;
    gap: 0.16rem;
}

.nuget-modal__eyebrow {
    color: var(--theme-accent);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    line-height: 1.2;
    text-transform: uppercase;
}

.nuget-modal__header h2 {
    margin: 0;
    overflow: hidden;
    color: var(--theme-text);
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 3vw, 1.55rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nuget-modal__header p {
    margin: 0;
    overflow: hidden;
    color: var(--theme-muted);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nuget-modal__close {
    top: var(--nuget-pad);
    right: var(--nuget-pad);
    width: 36px;
    height: 36px;
    border: 1px solid color-mix(in srgb, var(--theme-border) 88%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--theme-surface-soft) 86%, transparent);
    color: var(--theme-muted);
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.nuget-modal__close::before {
    display: block;
    font-size: 0.9rem;
    line-height: 1;
}

.nuget-modal__close:hover {
    border-color: color-mix(in srgb, var(--theme-accent) 44%, var(--theme-border));
    background: color-mix(in srgb, var(--theme-accent) 9%, var(--theme-surface-soft));
    color: var(--theme-text);
    transform: translateY(-1px);
}

.nuget-modal__close:focus-visible,
.nuget-modal__tab-button:focus-visible,
.nuget-modal__copy:focus-visible,
.nuget-modal__external:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--theme-accent) 72%, transparent);
    outline-offset: 2px;
}

.nuget-modal__tabs {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    gap: 0;
}

.nuget-modal__tab-buttons {
    display: flex;
    gap: 1.2rem;
    padding: 0 var(--nuget-pad);
    overflow-x: auto;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
    background: var(--theme-surface);
    /* The strip still scrolls on narrow screens, without a native scrollbar
       cutting through the modal chrome. */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nuget-modal__tab-buttons::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.nuget-modal__tab-button {
    position: relative;
    min-height: 48px;
    padding: 0 0.12rem;
    border: 0;
    background: transparent;
    color: var(--theme-muted);
    font-family: var(--font-ui, var(--font-body));
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.02em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 150ms ease;
}

.nuget-modal__tab-button::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: transparent;
    transform: scaleX(0.45);
    transition: background-color 150ms ease, transform 180ms ease;
}

.nuget-modal__tab-button:hover {
    background: transparent;
    color: var(--theme-text);
}

.nuget-modal__tab-button.is-active {
    border: 0;
    color: var(--theme-accent);
}

.nuget-modal__tab-button.is-active::after {
    background: var(--theme-accent);
    transform: scaleX(1);
}

.nuget-modal__tab-content {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--theme-accent) 38%, var(--theme-border)) transparent;
}

.nuget-modal__tab-content::-webkit-scrollbar {
    width: 8px;
}

.nuget-modal__tab-content::-webkit-scrollbar-track {
    background: transparent;
}

.nuget-modal__tab-content::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-accent) 38%, var(--theme-border));
    background-clip: padding-box;
}

.nuget-modal__tab-pane {
    display: none;
    min-height: 100%;
    padding: var(--nuget-pad);
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.nuget-modal__tab-pane.is-active {
    display: block;
    animation: nuget-tab-enter 160ms ease-out both;
}

.nuget-modal__tab-pane[hidden] {
    display: none;
}

.nuget-modal__loading {
    display: grid;
    min-height: 240px;
    place-items: center;
    align-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--theme-muted);
    font-size: 0.78rem;
    font-weight: 650;
}

.nuget-modal__loading .site-spinner {
    width: 28px;
    height: 28px;
    border-color: color-mix(in srgb, var(--theme-accent) 22%, transparent);
    border-top-color: var(--theme-accent);
}

.nuget-modal__info-content,
.nuget-modal__package-summary {
    display: grid;
    gap: 1rem;
}

.nuget-modal__package-intro {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nuget-modal__package-intro h3,
.nuget-modal__section-heading h3 {
    margin: 0;
    color: var(--theme-text);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.nuget-modal__package-intro > div:first-child {
    display: grid;
    min-width: 0;
    gap: 0.25rem;
}

.nuget-modal__status-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
}

.nuget-modal__status {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    padding: 0.32rem 0.55rem;
    border: 1px solid color-mix(in srgb, #37d39a 35%, var(--theme-border));
    border-radius: 999px;
    background: color-mix(in srgb, #37d39a 8%, transparent);
    color: #71e6bc;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 750;
    text-transform: uppercase;
}

.nuget-modal__status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent);
}

.nuget-modal__status--neutral {
    border-color: color-mix(in srgb, var(--theme-accent) 32%, var(--theme-border));
    background: color-mix(in srgb, var(--theme-accent) 7%, transparent);
    color: var(--theme-accent);
}

.nuget-modal__status--warning {
    border-color: color-mix(in srgb, #f3a35c 42%, var(--theme-border));
    background: color-mix(in srgb, #f3a35c 9%, transparent);
    color: #f3b273;
}

.nuget-modal__description {
    margin: 0;
    max-width: 68ch;
    color: var(--theme-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.nuget-modal__stat-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}

.nuget-modal__stat {
    display: grid;
    align-content: center;
    min-height: 88px;
    gap: 0.34rem;
    margin: 0;
    padding: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--theme-border) 84%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--theme-surface-soft) 72%, transparent);
}

.nuget-modal__stat-label {
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nuget-modal__stat-value {
    overflow: hidden;
    color: var(--theme-text);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nuget-modal__recent-versions {
    display: grid;
    gap: 0.65rem;
    padding-top: 0.15rem;
}

.nuget-modal__metadata {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--theme-border) 82%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--theme-surface-soft) 46%, transparent);
}

.nuget-modal__metadata > div {
    display: grid;
    min-width: 0;
    gap: 0.28rem;
    padding: 0.78rem 0.85rem;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 68%, transparent);
}

.nuget-modal__metadata > div:nth-child(odd) {
    border-right: 1px solid color-mix(in srgb, var(--theme-border) 68%, transparent);
}

.nuget-modal__metadata > div:nth-last-child(-n + 2) {
    border-bottom: 0;
}

.nuget-modal__metadata dt {
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.59rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nuget-modal__metadata dd {
    margin: 0;
    overflow: hidden;
    color: var(--theme-text);
    font-size: 0.75rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nuget-modal__resource-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nuget-modal__resource-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 34px;
    padding: 0.35rem 0.65rem;
    border: 1px solid color-mix(in srgb, var(--theme-border) 88%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--theme-surface-soft) 66%, transparent);
    color: var(--theme-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.nuget-modal__resource-links a:hover,
.nuget-modal__resource-links a:focus-visible {
    border-color: color-mix(in srgb, var(--theme-accent) 44%, var(--theme-border));
    background: color-mix(in srgb, var(--theme-accent) 8%, transparent);
    color: var(--theme-accent);
    outline: 0;
}

.nuget-modal__deprecation {
    display: grid;
    gap: 0.25rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid color-mix(in srgb, #f3a35c 36%, var(--theme-border));
    border-radius: 10px;
    background: color-mix(in srgb, #f3a35c 7%, transparent);
    color: var(--theme-muted);
    font-size: 0.74rem;
    line-height: 1.5;
}

.nuget-modal__deprecation strong {
    color: #f3b273;
}

.nuget-modal__recent-label {
    margin: 0;
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nuget-modal__release-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nuget-modal__release-heading > span {
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
}

.nuget-modal__version-list {
    display: grid;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--theme-border) 76%, transparent);
    border-radius: 10px;
    list-style: none;
}

.nuget-modal__version-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 40px;
    padding: 0.55rem 0.72rem;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 66%, transparent);
    background: color-mix(in srgb, var(--theme-surface-soft) 48%, transparent);
}

.nuget-modal__version-list li:last-child {
    border-bottom: 0;
}

.nuget-modal__version-list li > span {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.nuget-modal__version-list code {
    color: var(--theme-text);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
}

.nuget-modal__version-list em {
    padding: 0.15rem 0.38rem;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 34%, var(--theme-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--theme-accent) 9%, transparent);
    color: var(--theme-accent);
    font-size: 0.57rem;
    font-style: normal;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nuget-modal__version-list small {
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.62rem;
}

.nuget-modal__recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.nuget-modal__info-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.25rem 0.58rem;
    border: 1px solid color-mix(in srgb, var(--theme-accent) 22%, var(--theme-border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--theme-accent) 6%, var(--theme-surface-soft));
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.nuget-modal__install-content {
    display: grid;
    gap: 0.75rem;
}

.nuget-modal__dependencies-content {
    display: grid;
    gap: 1rem;
}

.nuget-modal__dependency-groups {
    display: grid;
    gap: 0.7rem;
}

.nuget-modal__dependency-group {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--theme-border) 84%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--theme-surface-soft) 58%, transparent);
}

.nuget-modal__dependency-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 70%, transparent);
}

.nuget-modal__dependency-head h4 {
    margin: 0;
    color: var(--theme-text);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.nuget-modal__dependency-head span {
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.61rem;
}

.nuget-modal__dependency-list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nuget-modal__dependency-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.68rem 0.85rem;
    border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 60%, transparent);
}

.nuget-modal__dependency-list li:last-child {
    border-bottom: 0;
}

.nuget-modal__dependency-list a {
    overflow: hidden;
    color: var(--theme-accent);
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nuget-modal__dependency-list code {
    flex: 0 0 auto;
    color: var(--theme-muted);
    font-family: var(--font-mono);
    font-size: 0.65rem;
}

.nuget-modal__dependency-none {
    margin: 0;
    padding: 0.7rem 0.85rem;
    color: var(--theme-muted);
    font-size: 0.72rem;
}

.nuget-modal__empty {
    display: grid;
    min-height: 190px;
    place-content: center;
    gap: 0.35rem;
    padding: 2rem;
    border: 1px dashed color-mix(in srgb, var(--theme-border) 86%, transparent);
    border-radius: 12px;
    color: var(--theme-muted);
    text-align: center;
}

.nuget-modal__empty strong {
    color: var(--theme-text);
    font-family: var(--font-heading);
}

.nuget-modal__empty span {
    max-width: 52ch;
    font-size: 0.74rem;
    line-height: 1.55;
}

.nuget-modal__section-heading {
    display: grid;
    gap: 0.28rem;
    margin-bottom: 0.25rem;
}

.nuget-modal__section-heading p {
    margin: 0;
    color: var(--theme-muted);
    font-size: 0.78rem;
}

.nuget-modal__install-method {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--theme-border) 84%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--theme-surface-soft) 62%, transparent);
}

.nuget-modal__method-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nuget-modal__install-content h4 {
    margin: 0;
    color: var(--theme-text);
    font-size: 0.76rem;
    font-weight: 750;
}

.nuget-modal__copy {
    padding: 0.28rem 0.52rem;
    border: 1px solid color-mix(in srgb, var(--theme-border) 88%, transparent);
    border-radius: 7px;
    background: transparent;
    color: var(--theme-muted);
    font-family: var(--font-ui, var(--font-body));
    font-size: 0.66rem;
    font-weight: 750;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.nuget-modal__copy:hover,
.nuget-modal__copy.is-copied {
    border-color: color-mix(in srgb, var(--theme-accent) 40%, var(--theme-border));
    background: color-mix(in srgb, var(--theme-accent) 8%, transparent);
    color: var(--theme-accent);
}

.nuget-modal__code-block {
    margin: 0;
    padding: 0.75rem 0.85rem;
    overflow-x: auto;
    border: 1px solid color-mix(in srgb, var(--theme-code-border) 90%, transparent);
    border-radius: 9px;
    background: var(--theme-code-surface);
    color: var(--theme-code-text);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    line-height: 1.55;
    white-space: pre;
    word-break: normal;
}

.nuget-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.15rem;
    padding-top: 0.9rem;
    border-top: 1px solid color-mix(in srgb, var(--theme-border) 76%, transparent);
    color: var(--theme-muted);
    font-size: 0.7rem;
}

.nuget-modal__external {
    flex: 0 0 auto;
    border-color: color-mix(in srgb, var(--theme-accent) 42%, var(--theme-border));
    background: var(--theme-accent);
    color: var(--theme-accent-contrast, #07101f);
}

.nuget-modal__info-content > .status-error {
    margin: 0;
}

@keyframes nuget-modal-enter {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes nuget-tab-enter {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 680px) {
    .nuget-modal {
        align-items: flex-end;
        padding: 0.55rem;
    }

    .nuget-modal__panel {
        width: 100%;
        max-height: calc(100dvh - 1.1rem);
        border-radius: 16px;
    }

    .nuget-modal__header {
        align-items: flex-start;
    }

    .nuget-modal__mark {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .nuget-modal__stat-list {
        grid-template-columns: 1fr;
    }

    .nuget-modal__metadata {
        grid-template-columns: 1fr;
    }

    .nuget-modal__metadata > div,
    .nuget-modal__metadata > div:nth-child(odd),
    .nuget-modal__metadata > div:nth-last-child(-n + 2) {
        border-right: 0;
        border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 68%, transparent);
    }

    .nuget-modal__metadata > div:last-child {
        border-bottom: 0;
    }

    .nuget-modal__stat {
        min-height: 70px;
    }

    .nuget-modal__version-list small {
        font-size: 0.58rem;
    }

    .nuget-modal__footer {
        align-items: stretch;
        flex-direction: column;
    }

    .nuget-modal__external {
        justify-content: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nuget-modal__panel,
    .nuget-modal__tab-pane.is-active {
        animation: none;
    }

    .nuget-modal__close,
    .nuget-modal__tab-button::after,
    .nuget-modal__copy {
        transition: none;
    }
}
