/* ===================================================
   footprint.broker - Forest Terminal Operating System
   Terminal-organic aesthetic: CRT phosphor green
   =================================================== */

/* Custom Properties */
:root {
    /* Palette - Forest Green Terminal */
    --void-black: #0A0F0A;
    --phosphor-green: #33FF00;
    --crystal-mint: #A8FFD4;
    --moss-dim: #4A7C59;
    --neon-chartreuse: #BFFF00;
    --ice-emerald: #00FFC8;
    --undergrowth: #0D2818;
    --amber-sap: #C8A832;
    --pure-black: #000000;

    /* Typography */
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Glow system */
    --glow-intensity: 0;
    --pulse-phase: 0;

    /* Fibonacci spacing */
    --sp-1: 8px;
    --sp-2: 13px;
    --sp-3: 21px;
    --sp-4: 34px;
    --sp-5: 55px;
    --sp-6: 89px;
}

/* Pulse-attention heartbeat - 4 second cycle */
@keyframes pulse-heartbeat {
    0%, 100% { --pulse-phase: 0; }
    50% { --pulse-phase: 1; }
}

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

@keyframes scan-expand {
    0% { transform: scale(0); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

@keyframes glow-in {
    0% { opacity: 0; text-shadow: none; }
    100% { opacity: 1; }
}

@keyframes hex-pulse {
    0%, 100% {
        border-color: rgba(51, 255, 0, 0.3);
        box-shadow: 0 0 8px rgba(51, 255, 0, 0.1), inset 0 0 8px rgba(51, 255, 0, 0.05);
    }
    50% {
        border-color: rgba(51, 255, 0, 0.6);
        box-shadow: 0 0 16px rgba(51, 255, 0, 0.2), inset 0 0 16px rgba(51, 255, 0, 0.1);
    }
}

@keyframes grow-up {
    0% { transform: scaleY(0); opacity: 0; }
    100% { transform: scaleY(1); opacity: 1; }
}

@keyframes float-glow {
    0%, 100% {
        text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2), 0 0 16px rgba(51, 255, 0, 0.07);
    }
    50% {
        text-shadow: 0 0 4px rgba(51, 255, 0, 0.8), 0 0 12px rgba(51, 255, 0, 0.53), 0 0 24px rgba(51, 255, 0, 0.27), 0 0 48px rgba(51, 255, 0, 0.13);
    }
}

@keyframes root-descend {
    0% { transform: translateY(-20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--void-black);
    color: var(--phosphor-green);
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    line-height: 1.75;
    overflow-x: hidden;
    animation: pulse-heartbeat 4s ease-in-out infinite;
}

/* CRT Scanline Overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(255, 255, 255, 0.02) 2px,
        rgba(255, 255, 255, 0.02) 3px
    );
}

/* Sections - Full viewport */
.section {
    width: 100vw;
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Utility */
.hidden {
    display: none !important;
}

.mono-label {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--moss-dim);
}

/* ===================== SECTION 1: Boot Sequence ===================== */
#boot-sequence {
    background-color: var(--void-black);
    align-items: flex-start;
    justify-content: flex-start;
}

.terminal-content {
    padding: var(--sp-4) var(--sp-4);
    width: 100%;
    max-width: 900px;
    padding-top: var(--sp-5);
}

.boot-log .boot-line {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.75;
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2), 0 0 16px rgba(51, 255, 0, 0.07);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.boot-log .boot-line.visible {
    opacity: 1;
}

.boot-log .boot-line .timestamp {
    color: var(--moss-dim);
}

.boot-log .boot-line .keyword {
    color: var(--crystal-mint);
    text-shadow: 0 0 6px rgba(168, 255, 212, 0.53), 0 0 18px rgba(168, 255, 212, 0.27), 0 0 36px rgba(168, 255, 212, 0.13);
}

.prompt-line {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.75;
    margin-top: var(--sp-3);
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2), 0 0 16px rgba(51, 255, 0, 0.07);
}

.prompt-text {
    color: var(--phosphor-green);
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--amber-sap);
    animation: cursor-blink 1s step-end infinite;
    vertical-align: text-bottom;
    box-shadow: 0 0 6px rgba(200, 168, 50, 0.6), 0 0 12px rgba(200, 168, 50, 0.3);
}

.typed-command {
    color: var(--neon-chartreuse);
    text-shadow: 0 0 4px rgba(191, 255, 0, 0.6), 0 0 8px rgba(191, 255, 0, 0.3);
}

/* ===================== SECTION 2: Forest Scan ===================== */
#forest-scan {
    background-color: var(--void-black);
    overflow: hidden;
}

.scan-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.scan-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.scan-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: -50px;
    border: 1px solid var(--phosphor-green);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0);
}

.scan-rings.active .ring-1 {
    animation: scan-expand 2s ease-out 0s infinite;
}
.scan-rings.active .ring-2 {
    animation: scan-expand 2s ease-out 0.5s infinite;
}
.scan-rings.active .ring-3 {
    animation: scan-expand 2s ease-out 1s infinite;
}
.scan-rings.active .ring-4 {
    animation: scan-expand 2s ease-out 1.5s infinite;
}

.topo-map {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease 0.8s;
    max-width: 700px;
    width: 100%;
    padding: 0 var(--sp-3);
}

.topo-map.visible {
    opacity: 1;
}

.topo-header {
    margin-bottom: var(--sp-3);
}

.topo-header .mono-label {
    color: var(--ice-emerald);
    text-shadow: 0 0 6px rgba(0, 255, 200, 0.53), 0 0 18px rgba(0, 255, 200, 0.27), 0 0 36px rgba(0, 255, 200, 0.13);
}

.topo-art {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.4;
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2);
    white-space: pre;
    overflow-x: auto;
    text-align: left;
    display: inline-block;
}

.topo-stats {
    margin-top: var(--sp-4);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: var(--sp-1) var(--sp-2);
    border-bottom: 1px solid rgba(51, 255, 0, 0.15);
}

.stat-label {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--moss-dim);
}

.stat-value {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 14px;
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2);
}

/* ===================== SECTION 3: Data Grove ===================== */
#data-grove {
    background-color: var(--void-black);
    min-height: 100vh;
    padding: var(--sp-6) 0;
}

.grove-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--sp-4);
    text-align: center;
}

.grove-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 6vw, 72px);
    color: var(--crystal-mint);
    letter-spacing: -0.02em;
    text-shadow: 0 0 6px rgba(168, 255, 212, 0.53), 0 0 18px rgba(168, 255, 212, 0.27), 0 0 36px rgba(168, 255, 212, 0.13);
    margin-bottom: var(--sp-2);
}

.grove-subtitle {
    margin-bottom: var(--sp-6);
}

.tree-formation {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-5);
    margin-bottom: var(--sp-5);
}

.ascii-tree {
    text-align: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.ascii-tree.visible {
    opacity: 1;
    transform: translateY(0);
}

.canopy {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.3;
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2);
    transform-origin: bottom center;
}

.canopy-row {
    letter-spacing: 0.1em;
}

.trunk {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.3;
    color: var(--amber-sap);
    text-shadow: 0 0 6px rgba(200, 168, 50, 0.4);
}

.tree-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    color: var(--crystal-mint);
    letter-spacing: -0.02em;
    margin-top: var(--sp-3);
    margin-bottom: var(--sp-2);
    text-shadow: 0 0 6px rgba(168, 255, 212, 0.53), 0 0 18px rgba(168, 255, 212, 0.27);
}

.tree-description {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.75;
    color: var(--moss-dim);
    text-align: left;
}

.grove-footer {
    border-top: 1px solid rgba(51, 255, 0, 0.15);
    padding-top: var(--sp-3);
}

/* ===================== SECTION 4: Crystal Cache ===================== */
#crystal-cache {
    background: linear-gradient(180deg, var(--void-black) 0%, var(--undergrowth) 100%);
    min-height: 100vh;
    padding: var(--sp-6) 0;
}

.cache-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 var(--sp-4);
    text-align: center;
}

.cache-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 6vw, 72px);
    color: var(--ice-emerald);
    letter-spacing: -0.02em;
    text-shadow: 0 0 6px rgba(0, 255, 200, 0.53), 0 0 18px rgba(0, 255, 200, 0.27), 0 0 36px rgba(0, 255, 200, 0.13);
    margin-bottom: var(--sp-2);
}

.cache-subtitle {
    margin-bottom: var(--sp-6);
}

.hex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-3);
    max-width: 800px;
    margin: 0 auto;
}

.hex-cell {
    width: 200px;
    height: 200px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, rgba(51, 255, 0, 0.05), rgba(0, 255, 200, 0.08));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--void-black);
    z-index: 0;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: linear-gradient(135deg, rgba(51, 255, 0, 0.1), rgba(0, 255, 200, 0.15));
    animation: hex-pulse 4s ease-in-out infinite;
    z-index: 0;
}

.hex-cell.visible:nth-child(1) { transition-delay: 0s; }
.hex-cell.visible:nth-child(2) { transition-delay: 0.1s; }
.hex-cell.visible:nth-child(3) { transition-delay: 0.2s; }
.hex-cell.visible:nth-child(4) { transition-delay: 0.3s; }
.hex-cell.visible:nth-child(5) { transition-delay: 0.4s; }
.hex-cell.visible:nth-child(6) { transition-delay: 0.5s; }
.hex-cell.visible:nth-child(7) { transition-delay: 0.6s; }

.hex-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--sp-3);
}

.hex-label {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--moss-dim);
}

.hex-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    color: var(--ice-emerald);
    text-shadow: 0 0 6px rgba(0, 255, 200, 0.53), 0 0 18px rgba(0, 255, 200, 0.27);
}

.hex-detail {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 11px;
    color: var(--moss-dim);
}

/* ===================== SECTION 5: Root System ===================== */
#root-system {
    background: linear-gradient(180deg, var(--undergrowth) 0%, #0A0800 60%, #1A1008 100%);
    min-height: 100vh;
    padding: var(--sp-6) 0;
    transition: background-color 2s ease;
}

.root-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--sp-4);
}

.root-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 6vw, 72px);
    color: var(--crystal-mint);
    letter-spacing: -0.02em;
    text-shadow: 0 0 6px rgba(168, 255, 212, 0.53), 0 0 18px rgba(168, 255, 212, 0.27), 0 0 36px rgba(168, 255, 212, 0.13);
    text-align: center;
    margin-bottom: var(--sp-2);
}

.root-subtitle {
    text-align: center;
    margin-bottom: var(--sp-6);
}

.root-branches {
    margin-bottom: var(--sp-6);
}

.root-main-trunk {
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 2;
}

.root-line {
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2);
    opacity: 0;
    transform: translateY(-13px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.root-line.rl-1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
    color: var(--crystal-mint);
    text-shadow: 0 0 6px rgba(168, 255, 212, 0.53), 0 0 18px rgba(168, 255, 212, 0.27);
    margin-bottom: var(--sp-2);
}

.root-line.rl-2 {
    color: var(--neon-chartreuse);
    text-shadow: 0 0 4px rgba(191, 255, 0, 0.4), 0 0 8px rgba(191, 255, 0, 0.2);
    font-weight: 600;
    font-size: 15px;
    margin-top: var(--sp-2);
}

.root-line.rl-3 {
    color: var(--moss-dim);
    font-size: 14px;
    padding-left: var(--sp-3);
}

.root-closing {
    border-top: 1px solid rgba(51, 255, 0, 0.15);
    padding-top: var(--sp-5);
    text-align: center;
}

.closing-text {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.75;
    color: var(--moss-dim);
    max-width: 600px;
    margin: 0 auto var(--sp-5);
    animation: float-glow 4s ease-in-out infinite;
}

.root-prompt {
    font-family: var(--font-mono);
    font-size: 14px;
    text-align: left;
    display: inline-block;
}

.root-prompt .prompt-text {
    color: var(--phosphor-green);
    text-shadow: 0 0 4px rgba(51, 255, 0, 0.4), 0 0 8px rgba(51, 255, 0, 0.2);
}

.closing-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--amber-sap);
    animation: cursor-blink 1s step-end infinite;
    vertical-align: text-bottom;
    box-shadow: 0 0 6px rgba(200, 168, 50, 0.6), 0 0 12px rgba(200, 168, 50, 0.3);
}

/* ===================== Responsive ===================== */
@media (max-width: 768px) {
    .tree-formation {
        grid-template-columns: 1fr;
        gap: var(--sp-5);
    }

    .topo-stats {
        grid-template-columns: 1fr;
    }

    .hex-cell {
        width: 160px;
        height: 160px;
    }

    .hex-value {
        font-size: 20px;
    }

    .topo-art {
        font-size: 8px;
    }

    .terminal-content {
        padding: var(--sp-3);
        padding-top: var(--sp-4);
    }

    .root-main-trunk {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .hex-cell {
        width: 130px;
        height: 130px;
    }

    .hex-value {
        font-size: 16px;
    }

    .hex-label, .hex-detail {
        font-size: 8px;
    }

    .topo-art {
        font-size: 6px;
    }
}
