/* ============================================================
   Cursor blink
   ============================================================ */
@keyframes blink {
    0%, 49.9% { opacity: 1; }
    50%, 100%  { opacity: 0; }
}

#cursor {
    animation: blink 1s step-end infinite;
}

/* Pause blink while actively typing */
#cursor.typing {
    animation: none;
    opacity: 1;
}

/* ============================================================
   Output line fade-in
   ============================================================ */
@keyframes fadeInLine {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

.output-line {
    animation: fadeInLine 0.08s ease-out both;
}

/* ============================================================
   Terminal startup flicker (applied briefly on boot)
   ============================================================ */
@keyframes startup {
    0%   { opacity: 0; }
    8%   { opacity: 0.85; }
    10%  { opacity: 0.15; }
    13%  { opacity: 0.95; }
    15%  { opacity: 0.25; }
    18%  { opacity: 1; }
    100% { opacity: 1; }
}

#terminal-container.starting {
    animation: startup 0.55s ease-out both;
}

/* ============================================================
   CRT scanline overlay — add class "crt" to #terminal-container
   to enable. Optional aesthetic effect.
   ============================================================ */
#terminal-container.crt::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.04) 2px,
        rgba(0, 0, 0, 0.04) 4px
    );
    pointer-events: none;
    z-index: 100;
    border-radius: var(--border-radius);
}

/* ============================================================
   Boot line stagger — each boot line gets a slight offset
   ============================================================ */
.boot-line {
    animation: fadeInLine 0.12s ease-out both;
}

/* ============================================================
   Accent / success glow pulse (used sparingly)
   ============================================================ */
@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 4px rgba(0, 255, 65, 0.3); }
    50%       { text-shadow: 0 0 12px rgba(0, 255, 65, 0.7); }
}

.output-line.ascii {
    animation: fadeInLine 0.08s ease-out both, glowPulse 3s ease-in-out 1s infinite;
}

/* ============================================================
   Alarm / breach effect — add class "alarm" to body
   ============================================================ */
@keyframes alarmFlash {
    0%, 100% { background: #0d0d0d; }
    50%       { background: #1a0000; }
}

body.alarm #terminal-container {
    animation: alarmFlash 0.8s step-end infinite;
}
