/* thesecond.world — terminal aesthetic, ethereal blue palette */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #010408;
    color: #4fc3f7;
    font-family: 'Space Mono', monospace;
    font-size: 16px;
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    /* #0d1b2a secondary bg, #ffffff for line illustrations */
}

/* Secondary background sections */
.world-sector:nth-child(even) {
    background-color: rgba(13, 27, 42, 0.3);
    /* #0d1b2a at low opacity */
}

/* Fixed background grid — world coordinate system */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 39px, #1e3a5f 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, #1e3a5f 40px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* SVG world map underlays */
.world-map-underlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
    opacity: 0.12;
    transition: opacity 0.6s ease;
}

#worldMap1 {
    opacity: 0.12;
}

#worldMap2 {
    opacity: 0;
    top: 100vh;
}

#worldMap3 {
    opacity: 0;
    top: 200vh;
}

.world-map-underlay svg {
    width: 100vw;
    max-width: 1200px;
    height: auto;
    stroke: #ffffff;
}

/* Line illustrations use #ffffff, background alternates use #0d1b2a */

/* Coordinate labels */
.coord-label {
    position: absolute;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    color: #1e3a5f;
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

/* Terminal container */
.terminal-container {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 20vh 20px 30vh;
}

/* World sector */
.world-sector {
    margin-bottom: 15vh;
    position: relative;
}

/* Sector ID stamps */
.sector-id {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 4px;
    color: #0a3d62;
    text-transform: uppercase;
    margin-bottom: 20px;
    padding: 4px 0;
    border-left: 3px solid #0a3d62;
    padding-left: 12px;
}

/* Terminal blocks */
.terminal-block {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 1.2s ease, opacity 0.8s ease;
    border-left: 1px solid #1e3a5f;
    padding-left: 20px;
}

.terminal-block.revealed {
    max-height: 2000px;
    opacity: 1;
}

.terminal-block p {
    margin-bottom: 2px;
}

/* Phosphor glow on text */
.terminal-block p {
    text-shadow: 0 0 6px #4fc3f7, 0 0 12px rgba(79, 195, 247, 0.4);
}

/* Prompt character */
.prompt {
    color: #4fc3f7;
    font-weight: 700;
    margin-right: 4px;
}

/* Status label */
.status {
    color: #7ed4fa;
    font-weight: 700;
}

/* Error label */
.error {
    color: #ff5252;
    font-weight: 700;
}

/* Comment lines */
.comment {
    color: #1e3a5f;
    font-style: italic;
    text-shadow: none;
}

/* Highlighted text */
.highlight {
    color: #7ed4fa;
    font-weight: 700;
    text-shadow: 0 0 8px #7ed4fa, 0 0 16px rgba(126, 212, 250, 0.5);
}

/* Blinking cursor */
.cursor {
    animation: blink 1s step-end infinite;
    color: #4fc3f7;
}

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

/* Glitch animation */
@keyframes glitch {
    0% {
        transform: translateX(0);
        filter: none;
    }
    33% {
        transform: translateX(-4px);
        filter: hue-rotate(90deg);
    }
    66% {
        transform: translateX(4px);
        filter: hue-rotate(-90deg);
    }
    100% {
        transform: translateX(0);
        filter: none;
    }
}

.glitching {
    animation: glitch 0.08s linear 3;
}

/* Typewriter effect — characters hidden until typed */
.terminal-block.typewriting p {
    visibility: hidden;
}

.terminal-block.typewriting p.typed {
    visibility: visible;
}

.terminal-block.typewriting p.typing {
    visibility: visible;
}

/* Scanline overlay effect */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.05) 2px,
        rgba(0, 0, 0, 0.05) 4px
    );
    pointer-events: none;
    z-index: 999;
}

/* Selection styling */
::selection {
    background: #0a3d62;
    color: #7ed4fa;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #1e3a5f;
}

::-webkit-scrollbar-thumb:hover {
    background: #0a3d62;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        font-size: 14px;
    }

    .terminal-container {
        padding: 15vh 16px 20vh;
    }

    .world-sector {
        margin-bottom: 10vh;
    }

    .coord-label {
        display: none;
    }
}
