/* p9r.st - Generative Botanical Control Room */
/* Design: HUD-overlay architecture with retro-futuristic botanical palette */

:root {
    --void: #0a0e1a;
    --panel: #141b2d;
    --phosphor: #39ff85;
    --amber: #ffb347;
    --rose: #e85d75;
    --bone: #e8e0d4;
    --ghost: #3a5f5f;
    --grid: #1a3a2a;
    --violet: #9b7fea;
    --accent: var(--phosphor);
}

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

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--void);
    color: var(--bone);
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0.3, 'wght' 400, 'slnt' 0;
}

/* HUD Grid Overlay */
#hud-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    background-image:
        linear-gradient(to right, var(--grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid) 1px, transparent 1px),
        linear-gradient(to right, rgba(26, 58, 42, 0.5) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26, 58, 42, 0.5) 1px, transparent 1px);
    background-size:
        50% 50%,
        50% 50%,
        10% 10%,
        10% 10%;
    background-position: center center;
    opacity: 0.3;
}

/* Canvases */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
}

#specimen-canvas {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    pointer-events: none;
}

/* HUD Panels - Common styles */
.hud-panel {
    position: fixed;
    z-index: 10;
    background: rgba(20, 27, 45, 0.85);
    border: 1px solid rgba(58, 95, 95, 0.3);
    backdrop-filter: blur(4px);
    padding: clamp(8px, 1.2vw, 16px);
}

/* Panel Brackets - corner decorations */
.panel-brackets {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--ghost);
    border-style: solid;
    border-width: 0;
}

.bracket.tl {
    top: -1px;
    left: -1px;
    border-top-width: 2px;
    border-left-width: 2px;
}

.bracket.tr {
    top: -1px;
    right: -1px;
    border-top-width: 2px;
    border-right-width: 2px;
}

.bracket.bl {
    bottom: -1px;
    left: -1px;
    border-bottom-width: 2px;
    border-left-width: 2px;
}

.bracket.br {
    bottom: -1px;
    right: -1px;
    border-bottom-width: 2px;
    border-right-width: 2px;
}

/* North Panel */
#north-panel {
    top: 2vh;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(300px, 65vw, 900px);
    text-align: center;
    padding: clamp(10px, 1.5vh, 20px) clamp(16px, 2vw, 32px);
}

#domain-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0, 'wght' 100;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--bone);
    letter-spacing: 0.15em;
    animation: titleBreathe 8s ease-in-out infinite, titleLoad 2.4s ease-out forwards;
    line-height: 1;
    margin-bottom: 0.5em;
}

@keyframes titleBreathe {
    0%, 100% { font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0, 'wght' 300; }
    50% { font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0, 'wght' 600; }
}

@keyframes titleLoad {
    0% { font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0, 'wght' 100; opacity: 0; }
    100% { font-variation-settings: 'opsz' 144, 'SOFT' 0, 'WONK' 0, 'wght' 900; opacity: 1; }
}

#status-readout {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: clamp(0.6rem, 1vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--ghost);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8em;
    flex-wrap: wrap;
}

.readout-label {
    color: var(--ghost);
    opacity: 0.7;
}

.readout-value {
    color: var(--accent);
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    transition: font-variation-settings 0.3s ease;
}

.readout-value.pulse {
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 800, 'slnt' 0;
    color: var(--phosphor);
}

.readout-sep {
    color: var(--ghost);
    opacity: 0.4;
}

/* East Panel */
#east-panel {
    top: 15vh;
    right: 2vw;
    width: clamp(180px, 28vw, 320px);
    height: 70vh;
    overflow: hidden;
}

.data-label {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 600, 'slnt' 0;
    font-size: clamp(0.6rem, 0.9vw, 0.75rem);
    letter-spacing: 0.15em;
    color: var(--accent);
    margin-bottom: 1em;
    border-bottom: 1px solid rgba(58, 95, 95, 0.3);
    padding-bottom: 0.5em;
}

#data-stream {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: clamp(0.55rem, 0.9vw, 0.75rem);
    letter-spacing: 0.08em;
    line-height: 2;
    transition: transform 0.3s ease;
}

.data-line.even {
    color: var(--bone);
    opacity: 1;
}

.data-line.odd {
    color: var(--bone);
    opacity: 0.4;
}

.data-line.highlight {
    color: var(--accent);
    opacity: 1;
}

/* South Panel */
#south-panel {
    bottom: 2vh;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(300px, 80vw, 960px);
    max-height: 18vh;
    overflow: hidden;
    padding: clamp(12px, 1.5vh, 24px) clamp(16px, 2vw, 40px);
}

#narrative {
    position: relative;
}

.narrative-text {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'opsz' 14, 'SOFT' 50, 'WONK' 1, 'wght' 300;
    font-size: clamp(0.9rem, 1.5vw, 1.25rem);
    line-height: 1.72;
    color: var(--bone);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    display: none;
}

.narrative-text.visible {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

/* West Panel */
#west-panel {
    top: 20vh;
    left: 2vw;
    width: clamp(120px, 22vw, 240px);
    height: 60vh;
}

#growth-timeline {
    position: relative;
    height: calc(100% - 2em);
    padding-left: 24px;
}

.timeline-line {
    position: absolute;
    left: 6px;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--ghost);
    opacity: 0.4;
}

.timeline-marker {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.3s ease;
}

.timeline-marker[data-gen='0'] { top: 0%; }
.timeline-marker[data-gen='1'] { top: 16%; }
.timeline-marker[data-gen='3'] { top: 34%; }
.timeline-marker[data-gen='5'] { top: 52%; }
.timeline-marker[data-gen='7'] { top: 70%; }
.timeline-marker[data-gen='9'] { top: 88%; }

.marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1.5px solid var(--ghost);
    background: transparent;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.marker-dot.active {
    border-color: var(--accent);
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.marker-dot.passed {
    border-color: var(--accent);
    background: rgba(57, 255, 133, 0.3);
}

.marker-label {
    font-family: 'Recursive', monospace;
    font-variation-settings: 'MONO' 1, 'CASL' 0, 'wght' 400, 'slnt' 0;
    font-size: clamp(0.5rem, 0.7vw, 0.65rem);
    letter-spacing: 0.1em;
    color: var(--ghost);
    white-space: nowrap;
    transition: color 0.3s ease;
}

.timeline-marker.active .marker-label {
    color: var(--accent);
}

/* Cross Sections - Pure CSS botanical illustrations */
.cross-section {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.timeline-marker.active .cross-section {
    opacity: 1;
}

.seed-section {
    width: 16px;
    height: 20px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: radial-gradient(ellipse at center, var(--amber) 30%, rgba(255, 179, 71, 0.3) 70%);
    border: 1px solid var(--amber);
}

.stem-section {
    border-radius: 50%;
    background: radial-gradient(circle, var(--phosphor) 20%, rgba(57, 255, 133, 0.2) 40%, rgba(26, 58, 42, 0.4) 60%, var(--ghost) 80%);
    border: 1px solid var(--ghost);
    width: 24px;
    height: 24px;
}

.branch-section {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--phosphor) 0deg, rgba(57, 255, 133, 0.2) 60deg, var(--phosphor) 120deg, rgba(57, 255, 133, 0.2) 180deg, var(--phosphor) 240deg, rgba(57, 255, 133, 0.2) 300deg, var(--phosphor) 360deg);
    border: 1px solid var(--ghost);
}

.leaf-section {
    width: 32px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(57, 255, 133, 0.1) 0%, var(--phosphor) 50%, rgba(57, 255, 133, 0.1) 100%);
    border: 1px solid var(--phosphor);
}

.flower-section {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--amber) 15%, var(--rose) 40%, rgba(232, 93, 117, 0.2) 70%);
    border: 1px solid var(--rose);
    box-shadow: 0 0 6px rgba(232, 93, 117, 0.3);
}

.fruit-section {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, var(--rose) 20%, var(--amber) 50%, rgba(255, 179, 71, 0.3) 80%);
    border: 1px solid var(--amber);
}

/* Specimen Selector */
#specimen-selector {
    position: fixed;
    bottom: 22vh;
    left: 3vw;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.specimen-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--ghost);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.specimen-dot[data-color='#39ff85'] { border-color: #39ff85; }
.specimen-dot[data-color='#ffb347'] { border-color: #ffb347; }
.specimen-dot[data-color='#e85d75'] { border-color: #e85d75; }
.specimen-dot[data-color='#9b7fea'] { border-color: #9b7fea; }

.specimen-dot.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.specimen-dot[data-color='#39ff85'].active { background: #39ff85; border-color: #39ff85; box-shadow: 0 0 10px #39ff85; }
.specimen-dot[data-color='#ffb347'].active { background: #ffb347; border-color: #ffb347; box-shadow: 0 0 10px #ffb347; }
.specimen-dot[data-color='#e85d75'].active { background: #e85d75; border-color: #e85d75; box-shadow: 0 0 10px #e85d75; }
.specimen-dot[data-color='#9b7fea'].active { background: #9b7fea; border-color: #9b7fea; box-shadow: 0 0 10px #9b7fea; }

/* Connector SVG */
.connector-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 5;
    pointer-events: none;
}

.connector {
    stroke: var(--ghost);
    stroke-width: 1;
    stroke-dasharray: 4 8;
    opacity: 0.3;
}

/* Scrollbar hidden */
::-webkit-scrollbar { display: none; }

/* Grid intersection pulse dots */
#hud-grid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    background: var(--ghost);
    transform: translate(-50%, -50%);
    animation: gridPulse 3s ease-in-out infinite;
}

@keyframes gridPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #east-panel {
        display: none;
    }

    #west-panel {
        display: none;
    }

    #north-panel {
        width: 90vw;
    }

    #south-panel {
        width: 94vw;
    }

    #specimen-selector {
        bottom: 22vh;
        left: auto;
        right: 3vw;
        flex-direction: row;
    }
}
