/* Session-Aware Fast Boot Skip (Direct to Hero) */
html.fast-boot #terminal-loader {
    display: none !important;
}
html.fast-boot #portfolio-content {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Terminal Loader Styles - Windows Mode */
#terminal-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0a0a0a;
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
    transition: opacity 0.6s ease-out, visibility 0.6s;
    cursor: none;
    /* Hide browser cursor */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    touch-action: none;
}

#terminal-loader * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

/* Shutter Panel System */
.terminal-shutter {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    background-color: #0c0c0c;
    z-index: 4;
    transition: transform 0.8s cubic-bezier(0.76, 0, 0.24, 1);
    pointer-events: none;
}

.shutter-top {
    top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.shutter-bottom {
    bottom: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#terminal-loader.shutters-open .shutter-top {
    transform: translateY(-100%);
}

#terminal-loader.shutters-open .shutter-bottom {
    transform: translateY(100%);
}

/* When shutters open, make the loader background transparent so
   the particle blast canvas (z-index 10001) shows through the gap */
#terminal-loader.shutters-open {
    background-color: transparent;
}

#terminal-loader.transition-complete {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* CRT monitor power-off collapse animation */
.terminal-window.crt-off {
    animation: crtOff 0.45s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes crtOff {
    0% {
        transform: scale(1) scaleY(1);
        filter: brightness(1);
    }
    40% {
        transform: scale(1.02) scaleY(0.01);
        filter: brightness(3);
        background: #ffffff;
    }
    80% {
        transform: scale(0.05) scaleY(0.01);
        filter: brightness(8);
        background: #ffffff;
        opacity: 1;
    }
    100% {
        transform: scale(0) scaleY(0);
        filter: brightness(15);
        opacity: 0;
    }
}

/* Glitch Flash Overlay */
.glitch-flash {
    position: fixed;
    inset: 0;
    z-index: 10001;
    pointer-events: none;
    background: transparent;
    opacity: 0;
}

.glitch-flash.active {
    animation: glitchFlashAnim 0.35s ease-out forwards;
}

@keyframes glitchFlashAnim {
    0% {
        opacity: 1;
        background: rgba(0, 245, 255, 0.35); /* Luminous Cyan */
        box-shadow: inset 0 0 100px rgba(254, 53, 154, 0.5); /* Magenta */
    }
    20% {
        background: rgba(254, 53, 154, 0.4);
        transform: skewX(6deg) scaleY(1.04);
        filter: contrast(1.5);
    }
    40% {
        background: rgba(0, 245, 255, 0.3);
        transform: skewX(-6deg) scaleY(0.96);
        filter: hue-rotate(90deg);
    }
    60% {
        background: rgba(255, 255, 255, 0.7);
        transform: skewX(3deg);
    }
    80% {
        background: rgba(254, 53, 154, 0.15);
        transform: skewX(0);
    }
    100% {
        opacity: 0;
        background: transparent;
    }
}

/* Stable Scanlines effect */
#terminal-loader::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    z-index: 2;
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    opacity: 0.4;
}

/* Terminal Window Wrapper (Windows style) */
.terminal-window {
    width: 100%;
    max-width: 850px;
    height: 520px;
    background: #0c0c0c;
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 5;
    background-image: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.05) 50%);
    background-size: 100% 2px;
}

/* Windows Title Bar Styling */
.terminal-titlebar {
    height: 32px;
    background: #2d2d2d;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0 10px;
    border-bottom: 1px solid #333;
    user-select: none;
}

.window-title {
    color: #cccccc;
    font-size: 0.75rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
}

.window-title::before {
    content: ">_";
    font-weight: bold;
    color: #888;
}

.terminal-titlebar-right {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 12px;
}

.terminal-skip-btn {
    background: rgba(0, 245, 255, 0.08);
    border: 1px solid rgba(0, 245, 255, 0.35);
    color: #00f5ff;
    font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    text-shadow: 0 0 8px rgba(0, 245, 255, 0.4);
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.1);
    user-select: none;
    outline: none;
    animation: skipGlowPulse 2.4s infinite ease-in-out;
}

@keyframes skipGlowPulse {
    0%, 100% {
        border-color: rgba(0, 245, 255, 0.35);
        box-shadow: 0 0 8px rgba(0, 245, 255, 0.15);
    }
    50% {
        border-color: rgba(0, 245, 255, 0.8);
        box-shadow: 0 0 14px rgba(0, 245, 255, 0.45);
        color: #ffffff;
    }
}

.terminal-skip-btn:hover {
    background: rgba(0, 245, 255, 0.25);
    border-color: #00f5ff;
    color: #ffffff;
    box-shadow: 0 0 18px rgba(0, 245, 255, 0.5);
    transform: translateY(-1px);
}

.terminal-skip-btn:active {
    transform: scale(0.96);
}

.skip-btn-desktop {
    display: inline;
}

.skip-btn-mobile {
    display: none;
}

@media (max-width: 768px), (pointer: coarse), (hover: none) {
    #terminal-loader {
        cursor: pointer !important;
    }

    .skip-btn-desktop {
        display: none !important;
    }

    .skip-btn-mobile {
        display: inline !important;
    }

    .terminal-skip-btn {
        font-size: 0.68rem;
        padding: 3px 8px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

.window-controls {
    display: flex;
    height: 100%;
}

.control-btn {
    width: 46px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}

.control-btn svg {
    width: 10px;
    height: 10px;
    fill: #ffffff;
}

.btn-close {
    background: #c42b1c;
}

.btn-close:hover {
    background: #e81123;
}

.btn-min:hover,
.btn-max:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Terminal Body Styling */
.terminal-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    color: #ffffff;
    background: #000000;
    font-family: 'DotGothic16', 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 0.05em;
    padding: 25px;
}

.terminal-body::-webkit-scrollbar {
    width: 12px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #333;
    border: 3px solid #1e1e1e;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Line & Cursor Styles */
.terminal-line {
    margin-bottom: 2px;
    opacity: 0;
    transition: opacity 0.1s ease-in;
}

.terminal-line.visible {
    opacity: 1;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: #cccccc;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

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

.status-ok {
    color: #50fa7b;
    font-weight: bold;
}

.status-wait {
    color: #f1fa8c;
    font-weight: bold;
}

.status-connected {
    color: #8be9fd;
    font-weight: bold;
}

/* ASCII Logo style */
.ascii-logo {
    font-size: 0.5rem;
    line-height: 1.25;
    margin-bottom: 20px;
    color: #bd93f9;
    white-space: pre;
}

/* Reveal Animation for Portfolio Content */
.reveal-content {
    opacity: 0;
    pointer-events: none;
    position: relative;
    width: 100%;
    min-height: 100vh;
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-content.active {
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Responsiveness for Terminal Window */
@media (max-width: 768px) {
    .terminal-window {
        height: 65vh;
        width: 95%;
        margin: 10px;
    }

    .terminal-body {
        padding: 12px;
        font-size: 12px;
    }

    .ascii-logo {
        font-size: 0.35rem;
        margin-bottom: 15px;
    }

    .window-title {
        font-size: 0.65rem;
    }

    .control-btn {
        width: 36px;
    }
}

@media (max-width: 480px) {
    .terminal-window {
        height: 75vh;
    }

    .ascii-logo {
        font-size: 0.25rem;
    }

    #terminal-loader {
        padding: 10px;
    }
}
