/* ============================================================================
   SECRET TERMINAL — Spencer's Website v7.5
   Hacker aesthetic: green-on-black CRT with scanlines.
   ============================================================================ */

.term-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(4, 4, 10, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    padding: 24px;
}
.term-overlay.active {
    display: flex;
    animation: term-fade-in 0.25s ease both;
}
@keyframes term-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.term-window {
    width: 100%;
    max-width: 720px;
    height: 420px;
    background: #0a0a12;
    border: 1px solid rgba(29, 255, 196, 0.25);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(29, 255, 196, 0.08),
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(29, 255, 196, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Courier New', monospace;
}

/* CRT scanline effect */
.term-window::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
    z-index: 2;
    opacity: 0.4;
}

.term-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(29, 255, 196, 0.12);
    font-size: 12px;
    color: #64748b;
    z-index: 3;
    position: relative;
}
.term-dots {
    display: flex;
    gap: 6px;
}
.term-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.term-dot--red    { background: #ef4444; }
.term-dot--yellow { background: #fbbf24; }
.term-dot--green  { background: #22c55e; }

.term-title {
    color: #1dffc4;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.term-hint {
    font-size: 10px;
    color: #475569;
    letter-spacing: 0.08em;
}

.term-body {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.65;
    color: #a7f3d0;
    z-index: 3;
    position: relative;
}

/* Scrollbar styling */
.term-body::-webkit-scrollbar { width: 6px; }
.term-body::-webkit-scrollbar-track { background: transparent; }
.term-body::-webkit-scrollbar-thumb { background: rgba(29, 255, 196, 0.2); border-radius: 3px; }

.term-line {
    margin-bottom: 2px;
}
.term-line--welcome {
    animation: term-blink 1s steps(2) 3;
}
@keyframes term-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.term-prompt {
    color: #1dffc4;
    margin-right: 8px;
    font-weight: 700;
    -webkit-user-select: none;
    user-select: none;
}

.term-cmd {
    color: #e2e8f0;
}

.term-output {
    margin: 6px 0 10px 20px;
    white-space: pre-wrap;
    word-break: break-word;
}

.term-output .term-row {
    margin-bottom: 2px;
}

/* Syntax highlighting within terminal */
.term-output .term-accent { color: #a09aff; }
.term-output .term-warn  { color: #fbbf24; }
.term-output .term-error { color: #f87171; }
.term-output .term-success { color: #22c55e; }
.term-output .term-dim { color: #64748b; }

/* Typed text animation */
.term-typing {
    overflow: hidden;
    border-right: 2px solid #1dffc4;
    white-space: nowrap;
    animation: term-typing 0.6s steps(20, end) forwards, term-blink-cursor 0.75s step-end infinite;
}
@keyframes term-typing {
    from { width: 0; }
    to   { width: 100%; }
}
@keyframes term-blink-cursor {
    0%, 100% { border-color: #1dffc4; }
    50% { border-color: transparent; }
}

.term-input-line {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-top: 1px solid rgba(29, 255, 196, 0.12);
    background: rgba(255, 255, 255, 0.02);
    z-index: 3;
    position: relative;
}

.term-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: inherit;
    font-size: 13px;
    caret-color: #1dffc4;
    margin-left: 8px;
}

.term-cursor {
    color: #1dffc4;
    animation: term-blink-cursor 1s step-end infinite;
    font-weight: 700;
    margin-left: 2px;
}

.term-input:focus + .term-cursor {
    animation: none;
    opacity: 1;
}

/* Mobile: smaller terminal */
@media (max-width: 600px) {
    .term-window { height: 60vh; border-radius: 8px; }
    .term-body { font-size: 12px; padding: 10px 12px; }
    .term-header { padding: 8px 10px; font-size: 11px; }
    .term-hint { display: none; }
}

/* Accessibility: respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .term-overlay { animation: none !important; }
    .term-typing { animation: none !important; border-right: none !important; }
    .term-cursor { animation: none !important; }
}
