/* ============================================================
   Terminal overlay — the original retro terminal, alive and well,
   now summoned as an easter egg on top of the modern site.
   All rules scoped to #terminal-overlay.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

body.terminal-open { overflow: hidden; }

#terminal-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-terminal, 700);
    display: flex;
    flex-direction: column;
    background: #050807;
    opacity: 0;
    transform: scale(1, 0.005);
    transform-origin: center;
    transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
                opacity 180ms ease-out;
}
#terminal-overlay[hidden] { display: none; }
#terminal-overlay.open {
    opacity: 1;
    transform: scale(1, 1);
}

/* chrome bar */
#terminal-overlay .terminal-chrome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 1rem;
    background: #0d0d0d;
    border-bottom: 1px solid #00ff41;
}
#terminal-overlay .terminal-chrome-title {
    color: #00ff41;
    opacity: 0.75;
    font-size: 0.75rem;
}
#terminal-overlay .terminal-close {
    background: transparent;
    border: 1px solid rgba(0, 255, 65, 0.4);
    border-radius: 6px;
    color: #00ff41;
    font-size: 0.75rem;
    padding: 0.3em 0.7em;
    cursor: pointer;
    transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
#terminal-overlay .terminal-close:hover {
    background: rgba(0, 255, 65, 0.12);
    border-color: #00ff41;
}

/* the terminal itself (ported from the original design) */
#terminal-overlay #terminal {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0d0d0d 0%, #131a13 100%);
    box-shadow: inset 0 0 24px rgba(0, 255, 65, 0.08);
    position: relative;
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 18px;
    line-height: 1.4;
    color: #00ff41;
}

/* scanlines */
#terminal-overlay #terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 255, 65, 0.04) 2px,
        rgba(0, 255, 65, 0.04) 4px
    );
    pointer-events: none;
}

#terminal-overlay #output {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.6);
}

#terminal-overlay .input-container {
    display: flex;
    align-items: center;
    border-top: 1px solid #00ff41;
    padding-top: 10px;
    margin-top: 10px;
}

#terminal-overlay #input {
    background: transparent;
    border: none;
    color: #00ff41;
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 18px;
    outline: none;
    flex: 1;
    padding: 0;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.6);
}

#terminal-overlay .prompt {
    color: #ff00ff;
    font-weight: bold;
    margin-right: 5px;
    flex-shrink: 0;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.6);
}

#terminal-overlay .cursor {
    display: inline-block;
    width: 12px;
    height: 20px;
    background-color: #00ff41;
    animation: t-blink 1s step-end infinite;
    margin-left: 2px;
}
@keyframes t-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

#terminal-overlay .clock {
    color: #00ccff;
    font-size: 16px;
    margin-left: auto;
    padding-left: 20px;
    opacity: 0.8;
    text-shadow: 0 0 5px #00ccff;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* text color classes used by terminal.js output */
#terminal-overlay .error { color: #ff0040; text-shadow: 0 0 5px rgba(255, 0, 64, 0.6); }
#terminal-overlay .success { color: #40ff00; }
#terminal-overlay .highlight { color: #ffff00; }
#terminal-overlay .warning { color: #ff8800; }
#terminal-overlay .info { color: #00aaff; }

#terminal-overlay .ascii-art,
#terminal-overlay .ascii-header {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.2;
    white-space: pre;
}

#terminal-overlay .filesystem .directory { color: #40ccff; font-weight: bold; }
#terminal-overlay .filesystem .executable { color: #ff8800; font-weight: bold; }
#terminal-overlay .filesystem .link { color: #ff00ff; }

#terminal-overlay a { color: #00aaff; text-decoration: none; }
#terminal-overlay a:hover { color: #40ccff; text-decoration: underline; }

/* scrollbar */
#terminal-overlay #output::-webkit-scrollbar { width: 8px; }
#terminal-overlay #output::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
#terminal-overlay #output::-webkit-scrollbar-thumb { background: #00ff41; border-radius: 4px; }

/* mobile */
@media (max-width: 768px) {
    #terminal-overlay #terminal { padding: 12px; font-size: 15px; }
    #terminal-overlay #terminal::after { display: none; }
    #terminal-overlay #input { font-size: 16px; } /* prevent iOS zoom */
    #terminal-overlay .ascii-art, #terminal-overlay .ascii-header { font-size: 11px; }
    #terminal-overlay .clock { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    #terminal-overlay { transition: none; }
    #terminal-overlay .cursor { animation: none; }
}
