/**
 * JavocSoft Portfolio - Terminal
 * A drop-down console, dark in both themes.
 */

.term {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 950;
    height: min(62vh, 560px);
    display: flex;
    flex-direction: column;
    background: rgba(2, 6, 23, 0.97);
    color: #d1fae5;
    border-bottom: 2px solid #22c55e;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    font-family: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.55;
    animation: term-drop 0.22s ease-out;
}

.term[hidden] {
    display: none;
}

@keyframes term-drop {
    from { transform: translateY(-100%); }
    to { transform: none; }
}

.term-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.45rem 0.9rem;
    background: #0b1220;
    border-bottom: 1px solid #1e293b;
    color: #94a3b8;
    font-size: 0.78rem;
}

.term-dots {
    display: flex;
    gap: 6px;
}

.term-dots i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #ef4444;
}

.term-dots i:nth-child(2) { background: #f59e0b; }
.term-dots i:nth-child(3) { background: #22c55e; }

.term-title {
    flex: 1;
    text-align: center;
}

.term-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #94a3b8;
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
}

.term-close:hover {
    color: #ffffff;
    border-color: #22c55e;
}

.term-out {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 1rem 0.4rem;
    overflow-wrap: anywhere;
}

.term-line {
    min-height: 1.55em;
    white-space: pre-wrap;
}

.term-pre {
    white-space: pre-wrap;
}

.term-prompt {
    color: #4ade80;
    font-weight: 600;
    white-space: nowrap;
}

.term-accent {
    color: #fde047;
    font-weight: 700;
}

.term-key {
    color: #67e8f9;
}

.term-dim {
    color: #94a3b8;
}

.term-error {
    color: #fca5a5;
}

.term-line a {
    color: #93c5fd;
    text-decoration: underline;
}

.term-link {
    padding: 0;
    background: none;
    border: 0;
    color: #67e8f9;
    font: inherit;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
}

.term-link:hover,
.term-link:focus-visible {
    color: #fde047;
    outline: none;
}

.term-ai {
    padding: 0.3rem 0 0.3rem 0.8rem;
    border-left: 2px solid #a78bfa;
    color: #e2e8f0;
}

.term-ai p + p,
.term-ai p + ul,
.term-ai ul + p {
    margin-top: 0.35rem;
}

.term-ai ul {
    padding-left: 1.2rem;
}

.term-ai strong {
    color: #fde047;
}

.term-thinking::after {
    content: '...';
    display: inline-block;
    width: 3ch;
    overflow: hidden;
    white-space: nowrap;        /* the output allows breaking anywhere: keep the dots on one line */
    overflow-wrap: normal;
    vertical-align: bottom;
    animation: term-dots 1.2s steps(4) infinite;
}

@keyframes term-dots {
    from { width: 0; }
    to { width: 4ch; }
}

.term-form {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1rem 0.8rem;
    border-top: 1px solid #1e293b;
}

.term-form input {
    flex: 1;
    min-width: 0;
    padding: 0.2rem 0;
    background: transparent;
    border: 0;
    outline: none;
    color: #ffffff;
    font: inherit;
    caret-color: #4ade80;
}

@media (max-width: 640px) {
    .term {
        height: 70vh;
        font-size: 0.8rem;
    }

    .term-out {
        padding: 0.7rem 0.75rem 0.4rem;
    }

    .term-form {
        padding: 0.5rem 0.75rem 0.7rem;
    }

    .term-prompt {
        font-size: 0.72rem;
    }

    /* Listings: the description on its own line, under the name */
    .term-gap {
        display: none;
    }

    .term-desc {
        display: block;
        padding-left: 2ch;
        margin-bottom: 0.25rem;
    }
}

/* Short screens (phones in landscape): nearly the whole height */
@media (max-height: 500px) {
    .term {
        height: 88vh;
    }

    .term-bar {
        padding: 0.25rem 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .term,
    .term-thinking::after {
        animation: none;
    }
}
