/* ==========================================================================
   mythos152.com — Pathfinder terminal styling
   Level 0 surface: green monospace on black, in-character cold UI
   ========================================================================== */

body {
    background: var(--pf-bg);
    color: var(--pf-fg);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.6;
    padding: 0;
    /* Subtle CRT scanline effect */
    background-image:
        linear-gradient(
            transparent 50%,
            rgba(0, 217, 102, 0.025) 50%
        );
    background-size: 100% 3px;
}

/* ==========================================================================
   Terminal layout
   ========================================================================== */

#terminal {
    max-width: 920px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#banner {
    color: var(--pf-fg);
    margin-bottom: 1.5rem;
    font-size: 0.75rem;
    line-height: 1.3;
    overflow-x: auto;
    white-space: pre;
    user-select: none;
    /* Faint glow */
    text-shadow: 0 0 4px rgba(0, 217, 102, 0.4);
}

#output {
    flex: 1;
    margin-bottom: 1rem;
    min-height: 4rem;
}

#output .line {
    margin: 0.3em 0;
    white-space: pre-wrap;
    word-break: break-word;
}

#output .line.user-input {
    color: var(--pf-fg-dim);
}

#output .line.user-input::before {
    content: "> ";
    color: var(--pf-fg-soft);
}

#output .line.system {
    color: var(--pf-fg);
}

#output .line.system.warm {
    color: var(--my-fg);
    text-shadow: 0 0 8px var(--my-glow);
    transition: color 1.2s ease;
}

#output .line.flicker {
    animation: flicker 0.4s ease-in-out;
}

#output .line.warning {
    color: var(--pf-warn);
}

#output .line.dim {
    color: var(--pf-fg-soft);
    font-size: 0.85rem;
}

#output .empty-line {
    height: 0.6em;
}

/* ==========================================================================
   Prompt
   ========================================================================== */

#prompt-form {
    display: flex;
    align-items: baseline;
    gap: 0;
    padding: 0.4em 0;
}

#prompt-marker {
    color: var(--pf-fg);
    user-select: none;
    flex-shrink: 0;
}

#prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--pf-fg);
    font: inherit;
    font-family: var(--font-mono);
    font-size: inherit;
    line-height: inherit;
    caret-color: transparent; /* We render our own cursor */
    padding: 0;
    margin: 0;
    width: 100%;
}

#prompt-input::placeholder {
    color: var(--pf-fg-soft);
    opacity: 0.5;
}

#prompt-input:focus {
    outline: none;
}

#cursor {
    color: var(--pf-fg);
    user-select: none;
    flex-shrink: 0;
    margin-left: -0.3em;
    font-weight: bold;
    /* 1.4Hz pulse — Doc's subroutine */
    animation: pulse var(--pulse-rate) steps(2, jump-end) infinite;
}

/* When the user is typing, cursor stops blinking briefly */
#prompt-form.typing #cursor {
    animation: none;
    opacity: 1;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes pulse {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    20%, 60% { opacity: 0.4; }
    40%, 80% { opacity: 0.7; }
}

@keyframes warm-pulse {
    0%, 100% {
        text-shadow: 0 0 4px var(--my-glow);
    }
    50% {
        text-shadow: 0 0 12px var(--my-glow), 0 0 24px var(--my-glow);
    }
}

/* ==========================================================================
   Screen breaks for special events
   ========================================================================== */

#terminal.flickering {
    animation: flicker 0.5s ease-in-out 2;
}

#terminal.warming {
    transition: background-color 1.5s ease;
}

#terminal.warming #banner,
#terminal.warming #output .line:not(.warm) {
    transition: color 1.5s ease, opacity 1.5s ease;
    opacity: 0.3;
}

/* ==========================================================================
   Noscript fallback
   ========================================================================== */

.noscript-fallback {
    background: var(--pf-bg);
    color: var(--pf-fg);
    padding: 4rem 2rem;
    text-align: center;
    font-family: var(--font-mono);
    line-height: 2;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
    body {
        font-size: 15px;
    }
    #terminal {
        padding: 1rem 1rem 3rem;
    }
    #banner {
        font-size: 0.62rem;
        line-height: 1.2;
    }
}

@media (max-width: 480px) {
    #banner {
        font-size: 0.52rem;
    }
}

/* ==========================================================================
   Accessibility — respect reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    #cursor {
        animation: pulse 1s steps(2, jump-end) infinite;
    }
    body {
        background-image: none;
    }
    .flicker, .warming, .flickering {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================================
   Node-status footer — Stage 1
   Shows visitors how many of the 5 unlock nodes they have indexed.
   Persistent, dim, non-interactive.
   ========================================================================== */

.status-footer {
    position: sticky;
    bottom: 0;
    margin-top: 2rem;
    padding: 0.7em 1em;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: rgba(0, 217, 102, 0.45);
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.92) 60%,
        rgba(0, 0, 0, 0)
    );
    text-align: center;
    user-select: none;
    z-index: 5;
    pointer-events: none;
}

@media (max-width: 600px) {
    .status-footer {
        font-size: 0.7rem;
        letter-spacing: 0.1em;
        padding: 0.5em 0.6em;
    }
}
