/* ============================================================
   TERMINAL SECTION
   Inspired by macOS + GitHub Dark + Neofetch
   ============================================================ */

.terminal {
    padding: 140px 0;
    position: relative;
}

.terminal__window {
    width: 100%;
    max-width: 1100px;
    margin: auto;
    overflow: hidden;
    border-radius: 24px;
    /* Added a subtle gradient over the base color for depth */
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
    border: 1px solid rgba(255,255,255,.08);
    box-shadow:
        0 25px 70px rgba(0,0,0,.55),
        0 0 0 1px rgba(255,255,255,.05);
    transition: .4s ease;
}

.terminal__window:hover {
    transform: translateY(-6px);
    box-shadow:
        0 35px 90px rgba(0,0,0,.65),
        0 0 50px rgba(139, 92, 246, 0.15); /* Shifted glow to match your purple ASCII theme */
}

/* ============================================================
   HEADER
   ============================================================ */

.terminal__top {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    background: #161b22;
    border-bottom: 1px solid rgba(255,255,255,.05);
}

.terminal__dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* Added inner shadow to make the buttons look spherical/illuminated */
    box-shadow: inset 0 1px 3px rgba(255,255,255,0.4), 0 1px 2px rgba(0,0,0,0.5);
}

.terminal__dot--red {
    background: #ff5f57;
}

.terminal__dot--yellow {
    background: #febc2e;
}

.terminal__dot--green {
    background: #28c840;
}

.terminal__title {
    margin-left: 18px;
    color: #8b949e;
    font-size: .9rem;
    font-family: "SF Mono", monospace;
    font-weight: 500;
}

/* ============================================================
   BODY
   ============================================================ */

.terminal__body {
    padding: 42px;
    background: transparent; /* Changed to inherit window gradient */
    overflow-x: auto;
}

.terminal__body pre {
    margin: 0;
    white-space: pre;
    overflow-x: auto;
    font-family:
        "JetBrains Mono",
        "Fira Code",
        "SF Mono",
        monospace;
    font-size: 15px;
    line-height: 1.85;
    color: #c9d1d9;
    /* Added a very subtle text shadow for screen glare effect */
    text-shadow: 0 0 1px rgba(201, 209, 217, 0.2); 
}

/* ============================================================
   COLORS
   ============================================================ */

.prompt {
    color: #58a6ff;
    font-weight: 700;
}

.output {
    color: #c9d1d9;
}

.command {
    color: #79c0ff;
}

.keyword {
    color: #ff7b72;
    font-weight: 600; /* Made keys stand out more */
}

.highlight {
    color: #d2a8ff;
}

.success {
    color: #3fb950;
}

.warning {
    color: #f2cc60;
}

.error {
    color: #ff7b72;
}

/* ============================================================
   ASCII ART
   ============================================================ */

/* Replaced basic ASCII class with a gradient for a modern feel */
/* ============================================================
   UPDATED CURSOR (Fixes positioning)
   ============================================================ */
/* We use a pure CSS block instead of text to prevent baseline/spacing drops */
.terminal__cursor {
    display: inline-block;
    width: 9px;
    height: 16px;
    background-color: #c9d1d9;
    vertical-align: text-bottom;
    margin-left: 6px;
    animation: terminal-cursor-blink 1s step-end infinite;
}

/* ============================================================
   UPDATED ASCII ART (Adds flowing animation)
   ============================================================ */
/* Expanding the gradient and animating the background position makes it feel alive */
.ascii-gradient {
    background: linear-gradient(-45deg, #8b5cf6, #3b82f6, #d2a8ff, #79c0ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    display: inline-block;
    animation: gradientFlow 6s ease infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ============================================================
   NEW SCANLINE OVERLAY (The "Real Good" Aesthetic)
   ============================================================ */
/* Adds a very subtle CRT monitor texture over the entire window */
.terminal__window {
    position: relative; /* Ensure this is here if it wasn't already */
}

.terminal__window::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.1) 50%
    );
    background-size: 100% 4px;
    z-index: 10;
    pointer-events: none; /* Prevents the overlay from blocking text selection */
    opacity: 0.6;
    border-radius: 24px; /* Matches your window radius */
}

@keyframes terminal-cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */

.terminal__body::-webkit-scrollbar {
    height: 8px;
}

.terminal__body::-webkit-scrollbar-track {
    background: transparent;
}

.terminal__body::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 10px;
}

.terminal__body::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* ============================================================
   SELECTION
   ============================================================ */

.terminal__body ::selection {
    background: rgba(88,166,255,.3);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 992px) {
    .terminal {
        padding: 100px 0;
    }
    .terminal__window {
        border-radius: 18px;
    }
}

@media (max-width:768px) {
    .terminal__body {
        padding: 22px;
    }
    .terminal__body pre {
        font-size: 12px;
        line-height: 1.65;
    }
    .terminal__title {
        font-size: .75rem;
    }
}

@media (max-width:480px) {
    .terminal__body pre {
        font-size: 11px;
    }
}
