/* ============================================
   p9r.st - Terminal Aesthetic
   Palette: Analogous Green / CRT Phosphor
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0A2818;
    color: #30D070;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(14px, 0.9vw, 16px);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Color Utility Classes --- */
.text-phosphor { color: #30D070; }
.text-cyan { color: #40C8B0; }
.text-amber { color: #D0A030; }
.text-dim { color: #408858; }

/* --- Phosphor Glow Elements --- */
.phosphor-glow {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, #185040 0%, transparent 70%);
    pointer-events: none;
    animation: phosphorPulse 4s ease-in-out infinite;
}

@keyframes phosphorPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* ============================================
   BOOT SEQUENCE
   ============================================ */
#boot-sequence {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    background: linear-gradient(160deg, #0A2818 0%, #185040 50%, #0A2818 100%);
    overflow: hidden;
    padding: 15vh 0 0;
}

#boot-sequence .glow-1 {
    width: 400px;
    height: 400px;
    top: 20%;
    left: 10%;
}

#boot-sequence .glow-2 {
    width: 300px;
    height: 300px;
    top: 50%;
    right: 15%;
    animation-delay: 1.3s;
}

#boot-sequence .glow-3 {
    width: 250px;
    height: 250px;
    bottom: 15%;
    left: 40%;
    animation-delay: 2.6s;
}

#boot-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 0 32px;
}

/* --- Kinetic Type Reveal --- */
#title-line {
    font-size: clamp(24px, 3vw, 44px);
    font-weight: 700;
    color: #30D070;
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(48, 208, 112, 0.5), 0 0 40px rgba(48, 208, 112, 0.2);
    display: flex;
    align-items: center;
}

#title-text {
    white-space: pre;
}

#cursor {
    display: inline-block;
    animation: cursorBlink 800ms step-end infinite;
    color: #30D070;
    font-size: clamp(24px, 3vw, 44px);
    line-height: 1;
}

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

/* Boot status and output */
#boot-status {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#boot-status.visible {
    opacity: 1;
}

.boot-cmd {
    color: #40C8B0;
}

#boot-output .output-line {
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#boot-output .output-line.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Prompt Markers --- */
.prompt-dollar {
    color: #D0A030;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(208, 160, 48, 0.5);
    margin-right: 4px;
}

.prompt-chevron {
    color: #40C8B0;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(64, 200, 176, 0.5);
    margin-right: 4px;
}

/* ============================================
   TROPICAL FISH
   ============================================ */
.fish {
    position: absolute;
    pointer-events: none;
    z-index: 5;
}

/* Boot screen fish */
.fish-boot-1 {
    top: 35%;
    animation: swimRight 10s linear infinite;
    animation-delay: 1s;
}

.fish-boot-2 {
    top: 55%;
    animation: swimLeft 12s linear infinite;
    animation-delay: 2.5s;
}

.fish-boot-3 {
    top: 72%;
    animation: swimRight 8s linear infinite;
    animation-delay: 4s;
}

@keyframes swimRight {
    0% {
        left: -30px;
        transform: scaleX(1);
    }
    100% {
        left: calc(100% + 30px);
        transform: scaleX(1);
    }
}

@keyframes swimLeft {
    0% {
        left: calc(100% + 30px);
        transform: scaleX(-1);
    }
    100% {
        left: -30px;
        transform: scaleX(-1);
    }
}

/* Stream fish */
#fish-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.swim-fish-1 {
    top: 15%;
    animation: swimRight 13s linear infinite;
    animation-delay: 0s;
}

.swim-fish-2 {
    top: 30%;
    animation: swimLeft 10s linear infinite;
    animation-delay: 3s;
}

.swim-fish-3 {
    top: 50%;
    animation: swimRight 15s linear infinite;
    animation-delay: 5s;
}

.swim-fish-4 {
    top: 70%;
    animation: swimLeft 9s linear infinite;
    animation-delay: 1.5s;
}

.swim-fish-5 {
    top: 85%;
    animation: swimRight 11s linear infinite;
    animation-delay: 7s;
}

/* Fish glitch at command boundaries */
@keyframes fishGlitch {
    0%, 90%, 100% { filter: none; }
    92% {
        transform: translateY(-3px);
        filter: hue-rotate(90deg) brightness(1.5);
    }
    95% {
        transform: translateY(2px);
        filter: hue-rotate(-45deg);
    }
}

/* ============================================
   COMMAND STREAM
   ============================================ */
#command-stream {
    position: relative;
    background-color: #0A2818;
    padding: 64px 0 120px;
}

.stream-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* --- Command Blocks --- */
.command-block {
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 2px solid transparent;
    padding-left: 16px;
}

.command-block.in-view {
    opacity: 1;
    transform: translateY(0);
}

.command-block:hover {
    border-left-color: #30D070;
    border-left-width: 3px;
}

.command-block:hover .block-glow {
    opacity: 0.7 !important;
}

.command-block:hover .prompt-dollar,
.command-block:hover .prompt-chevron {
    text-shadow: 0 0 14px rgba(208, 160, 48, 0.8), 0 0 28px rgba(208, 160, 48, 0.4);
}

/* Block phosphor glow */
.block-glow {
    position: absolute;
    width: 300px;
    height: 200px;
    top: 50%;
    left: -50px;
    transform: translateY(-50%);
    background: radial-gradient(ellipse, #185040 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.3;
    animation: phosphorPulse 4s ease-in-out infinite;
    z-index: -1;
}

/* --- Command Lines --- */
.command-line {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.cmd-text {
    color: #30D070;
}

/* --- Output Blocks --- */
.output-block {
    padding-left: 20px;
}

.output-block .output-line {
    color: #30D070;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.output-block .output-line.line-visible {
    opacity: 1;
    transform: translateY(0);
}

.output-block .output-line.comment {
    color: #408858;
    font-style: italic;
    font-size: 13px;
}

/* ============================================
   SYSTEM STATUS FOOTER
   ============================================ */
#system-status {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #061810;
    border-top: 1px solid #185040;
    z-index: 100;
    padding: 8px 0;
}

.status-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 12px;
    font-weight: 700;
    color: #408858;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #408858;
}

.status-dot.active {
    background-color: #30D070;
    box-shadow: 0 0 6px rgba(48, 208, 112, 0.6);
    animation: statusBounce 2s ease-in-out infinite;
}

@keyframes statusBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #061810;
}

::-webkit-scrollbar-thumb {
    background: #185040;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #30D070;
}

/* ============================================
   CRT SCANLINE OVERLAY
   ============================================ */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    #boot-content {
        padding: 0 16px;
    }

    .stream-container {
        padding: 0 16px;
    }

    .status-container {
        padding: 0 16px;
        gap: 12px;
        font-size: 10px;
    }

    .command-block {
        padding-left: 10px;
    }

    .output-block {
        padding-left: 12px;
    }
}
