/* Takes nothing from site.css, so the window looks the same in both site themes. */

.term-overlay {
    --term-font: "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
    --term-bg: #0B1119;
    --term-bar: #111A25;
    --term-border: #1F2B39;
    --term-text: #D6DEE8;
    --term-muted: #8E9BAB;
    --term-prompt: #D9B96C;
    --term-accent: #7CC4F2;
    --term-ok: #7DD4A0;
    --term-warn: #F0B45E;
    --term-match: rgba(217, 185, 108, 0.32);
    --term-thumb: #2A3849;
    --term-hover: rgba(255, 255, 255, 0.06);

    position: fixed;
    left: 0;
    right: 0;
    top: var(--term-viewport-top, 0);
    height: var(--term-viewport-height, 100%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 16px;
    background: rgba(3, 8, 15, 0.62);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.term-overlay[hidden] {
    display: none;
}

.term-overlay *,
.term-overlay *::before,
.term-overlay *::after {
    box-sizing: border-box;
}

.term-window {
    display: flex;
    flex-direction: column;
    width: min(840px, 100%);
    height: min(560px, 100%);
    overflow: hidden;
    background: var(--term-bg);
    color: var(--term-text);
    border: 1px solid var(--term-border);
    border-radius: 12px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.02);
    font-family: var(--term-font);
    font-size: 13.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    animation: term-open 180ms ease-out;
}

@keyframes term-open {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.term-window ::selection {
    background: var(--term-prompt);
    color: var(--term-bg);
}

.term-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    flex: 0 0 auto;
    height: 40px;
    padding: 0 8px 0 14px;
    background: var(--term-bar);
    border-bottom: 1px solid var(--term-border);
    user-select: none;
}

.term-lights {
    display: flex;
    gap: 8px;
}

.term-light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #FF5F57;
}

.term-light:nth-child(2) {
    background: #FEBC2E;
}

.term-light:nth-child(3) {
    background: #28C840;
}

.term-title {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    color: var(--term-muted);
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.term-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--term-muted);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.term-close:hover {
    background: var(--term-hover);
    color: var(--term-text);
}

.term-close:focus-visible {
    outline: 2px solid var(--term-prompt);
    outline-offset: 1px;
}

.term-output {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 6px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--term-thumb) transparent;
}

.term-output::-webkit-scrollbar {
    width: 8px;
}

.term-output::-webkit-scrollbar-thumb {
    background: var(--term-thumb);
    border-radius: 8px;
}

.term-line {
    min-height: 1.6em;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.term-line a {
    color: var(--term-accent);
    text-decoration: underline;
    text-decoration-color: rgba(124, 196, 242, 0.45);
    text-underline-offset: 2px;
    border-radius: 2px;
}

.term-line a:hover {
    text-decoration-color: currentColor;
}

.term-line a:focus-visible {
    outline: 2px solid var(--term-prompt);
    outline-offset: 1px;
}

.term-prompt {
    color: var(--term-prompt);
}

.term-muted {
    color: var(--term-muted);
}

.term-accent {
    color: var(--term-accent);
}

.term-ok {
    color: var(--term-ok);
}

.term-warn {
    color: var(--term-warn);
}

.term-match {
    background: var(--term-match);
    color: inherit;
    border-radius: 2px;
}

.term-input-row {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    padding: 4px 16px 14px;
}

.term-input-row .term-prompt {
    white-space: nowrap;
}

.term-input {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--term-text);
    caret-color: var(--term-text);
    font: inherit;
}

body.term-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .term-overlay {
        align-items: stretch;
        padding: 8px;
    }

    .term-window {
        width: 100%;
        height: 100%;
        border-radius: 10px;
        font-size: 13px;
    }

    .term-input-row {
        flex-wrap: wrap;
        row-gap: 2px;
        padding-bottom: 12px;
    }

    .term-input {
        flex-basis: 100%;
        /* 16px stops iOS from zooming the page when the input gets focus. */
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .term-window {
        animation: none;
    }
}

@media print {
    .term-overlay {
        display: none;
    }
}
