/* === CSS Custom Properties === */
:root {
    --reactor-concrete: #2d2b28;
    --overgrowth: #4a6b2f;
    --harvest-warning: #c4943a;
    --foxglove: #b8607a;
    --pressed-linen: #f0e8d8;
    --phosphor: #7aab5c;
    --loam: #3a3228;
    --flare-gold: #e8d090;
    --fallout-haze: #c8bfa8;
    --core-warm: #d4864a;
    --deep-green: #2d3a1f;
    --panel-border: #4a5638;

    --elastic-ease: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --elastic-duration: 800ms;
    --elastic-overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--reactor-concrete);
    font-family: 'Literata', serif;
    color: var(--pressed-linen);
}

/* === Dashboard Grid === */
.dashboard {
    display: grid;
    width: 100vw;
    height: 100vh;
    grid-template-columns: 180px 1fr 1fr 180px;
    grid-template-rows: 80px 1fr 100px 200px 48px;
    grid-template-areas:
        "header  header  header  header"
        "rad-l   main    main    rad-r"
        "status  status  status  status"
        "log     log     bloom   bloom"
        "footer  footer  footer  footer";
    gap: 4px;
    padding: 4px;
}

/* === Panel Base === */
.panel {
    background: var(--reactor-concrete);
    border: 1px solid var(--panel-border);
    border-radius: 4px;
    box-shadow: inset 0 0 20px rgba(74, 107, 47, 0.08);
    position: relative;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity var(--elastic-duration) var(--elastic-ease),
                transform var(--elastic-duration) var(--elastic-ease);
}

.panel.visible {
    opacity: 1;
    transform: scale(1);
}

.panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to top, rgba(74, 107, 47, 0.25), transparent);
    filter: blur(2px);
    border-radius: 0 0 4px 4px;
    pointer-events: none;
}

.panel:hover {
    transform: scale(1.015);
    transition: transform 600ms var(--elastic-ease);
}

.panel.visible:hover {
    transform: scale(1.015);
}

/* === Header === */
.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(180deg, #2d2b28 0%, #3a3228 100%);
}

.header-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--phosphor);
    display: block;
}

.header-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--harvest-warning);
}

.site-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'WONK' 1, 'SOFT' 100, 'opsz' 72;
    font-weight: 900;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.08em;
    background: linear-gradient(135deg, var(--phosphor), var(--overgrowth));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-left, .header-right {
    text-align: center;
}

/* === Sidebars === */
.sidebar-left { grid-area: rad-l; }
.sidebar-right { grid-area: rad-r; }

.sidebar {
    padding: 16px 12px;
    overflow: hidden;
}

.sidebar-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--phosphor);
    margin-bottom: 16px;
    text-align: center;
}

.rad-reading {
    margin-bottom: 12px;
}

.rad-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--fallout-haze);
    display: block;
    margin-bottom: 4px;
}

.rad-bar {
    height: 6px;
    background: rgba(74, 107, 47, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.rad-fill {
    height: 100%;
    width: 0%;
    background: var(--phosphor);
    border-radius: 3px;
    transition: width 2s var(--elastic-overshoot);
}

.rad-fill-gold { background: var(--harvest-warning); }
.rad-fill-pink { background: var(--foxglove); }

.rad-fill.animated {
    width: var(--target);
}

/* Vine decorations */
.vine {
    position: absolute;
    bottom: 20px;
    width: 3px;
    height: 120px;
    background: linear-gradient(to top, var(--overgrowth), transparent);
    border-radius: 2px;
}

.vine-left { left: 50%; transform: translateX(-50%) rotate(-2deg); }
.vine-right { right: 50%; transform: translateX(50%) rotate(3deg); }

.vine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -6px;
    width: 15px;
    height: 15px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: radial-gradient(circle at 40% 30%, #c87a92, var(--foxglove));
}

/* === Main Panel === */
.main-panel {
    grid-area: main;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px;
    background: var(--pressed-linen);
    color: var(--deep-green);
    scroll-behavior: smooth;
}

.main-panel::-webkit-scrollbar {
    width: 6px;
}

.main-panel::-webkit-scrollbar-track {
    background: var(--fallout-haze);
}

.main-panel::-webkit-scrollbar-thumb {
    background: var(--overgrowth);
    border-radius: 3px;
}

.main-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-title-area {
    text-align: center;
    align-items: center;
}

.main-title {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'WONK' var(--wonk, 0), 'SOFT' 100, 'opsz' 72;
    font-weight: 900;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    letter-spacing: 0.08em;
    color: var(--deep-green);
    background: linear-gradient(135deg, var(--phosphor), var(--overgrowth));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}

.main-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--phosphor);
}

/* Narrative */
.narrative-block {
    position: relative;
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 800ms var(--elastic-ease), transform 800ms var(--elastic-ease);
}

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

.narrative-text {
    font-family: 'Literata', serif;
    font-variation-settings: 'opsz' 14;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: #4a5638;
    letter-spacing: 0.005em;
    max-width: 58ch;
}

/* Foxglove CSS illustrations */
.foxglove {
    position: absolute;
    right: -30px;
    width: 4px;
    height: 150px;
    background: linear-gradient(to top, var(--overgrowth), rgba(74, 107, 47, 0.3));
    border-radius: 2px;
}

.foxglove::before, .foxglove::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 20px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    background: radial-gradient(circle at 40% 30%, #c87a92, var(--foxglove));
}

.foxglove::before { top: 10px; left: -8px; }
.foxglove::after { top: 40px; left: -10px; transform: rotate(10deg); }

.foxglove-1 { top: 20px; right: -20px; height: 180px; transform: rotate(-2deg); }
.foxglove-2 { top: 10px; right: -35px; height: 160px; transform: rotate(2deg); }
.foxglove-3 { top: 30px; right: -25px; height: 140px; transform: rotate(-1deg); }

/* Bloom Census */
.section-heading {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'WONK' 1, 'SOFT' 50, 'opsz' 72;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--deep-green);
    margin-bottom: 32px;
    text-align: center;
}

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
}

.specimen-card {
    background: rgba(240, 232, 216, 0.7);
    backdrop-filter: blur(4px);
    border: 1px solid var(--fallout-haze);
    border-radius: 8px;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 600ms var(--elastic-ease), transform 600ms var(--elastic-overshoot);
}

.specimen-card.in-view {
    opacity: 1;
    transform: scale(1);
}

.specimen-flower {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 12px;
    opacity: 0.7;
    filter: blur(0.5px);
}

.flower-rosa { background: radial-gradient(circle at 40% 30%, #e8a0a0, #c87070); }
.flower-digitalis { background: radial-gradient(circle at 40% 30%, #c87a92, var(--foxglove)); }
.flower-ipomoea { background: conic-gradient(from 0deg, #6a5acd, #7a6ad0, #8a7ad8, #6a5acd); }
.flower-hedera { background: radial-gradient(circle, #5a8a3a, var(--overgrowth)); }
.flower-pteridium { background: radial-gradient(circle at 50% 80%, #6a8a3a, #3a5a1a); }
.flower-campanula { background: radial-gradient(circle at 40% 30%, #8a7ad8, #6a5acd); }

.specimen-name {
    font-family: 'Fraunces', serif;
    font-weight: 200;
    font-style: italic;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a6a4a;
    margin-bottom: 4px;
}

.specimen-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.04em;
    color: var(--overgrowth);
}

/* Finale */
.section-finale {
    align-items: center;
    text-align: center;
}

.landscape {
    width: 100%;
    height: 200px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 32px;
}

.landscape-soil {
    position: absolute; bottom: 0; left: 0; right: 0; height: 40px;
    background: linear-gradient(to top, var(--loam), #5a4a3a);
}

.landscape-grass {
    position: absolute; bottom: 35px; left: 0; right: 0; height: 30px;
    background: linear-gradient(to top, var(--overgrowth), #6a9a4a);
}

.landscape-flowers {
    position: absolute; bottom: 55px; left: 0; right: 0; height: 50px;
    background: linear-gradient(to top, transparent, rgba(184, 96, 122, 0.3), rgba(106, 90, 205, 0.2), transparent);
}

.landscape-sky {
    position: absolute; top: 0; left: 0; right: 0; bottom: 80px;
    background: linear-gradient(to bottom, #c8d8e8, var(--fallout-haze));
}

.landscape-sun {
    position: absolute; top: 20px; right: 30%;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 208, 144, 0.8), rgba(232, 208, 144, 0) 70%);
}

.finale-text {
    font-family: 'Fraunces', serif;
    font-variation-settings: 'WONK' 1, 'SOFT' 100, 'opsz' 72;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--deep-green);
}

/* === Status Bar === */
.status-bar {
    grid-area: status;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 12px;
    overflow-x: auto;
}

.gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gauge-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(var(--phosphor) 0%, transparent 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.gauge-ring::before {
    content: '';
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--reactor-concrete);
}

.gauge-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    color: var(--fallout-haze);
    text-transform: uppercase;
}

.gauge-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    color: var(--phosphor);
}

/* === Log Panel === */
.log-panel {
    grid-area: log;
    padding: 12px;
    overflow: hidden;
}

.panel-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--phosphor);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.log-content {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    line-height: 1.8;
    color: var(--phosphor);
    height: calc(100% - 24px);
    overflow: hidden;
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.log-entry {
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 4px;
}

/* === Bloom Panel === */
.bloom-panel {
    grid-area: bloom;
    padding: 12px;
    overflow: hidden;
}

.bloom-garden {
    position: relative;
    width: 100%;
    height: calc(100% - 24px);
}

.bloom-flower {
    position: absolute;
    border-radius: 50%;
    opacity: 0.5;
    filter: blur(1px);
}

.bf-1 { width: 40px; height: 40px; top: 20%; left: 10%; background: radial-gradient(circle, #c87a92, transparent); }
.bf-2 { width: 30px; height: 30px; top: 50%; left: 30%; background: radial-gradient(circle, #6a5acd, transparent); }
.bf-3 { width: 50px; height: 50px; top: 30%; left: 55%; background: radial-gradient(circle, var(--foxglove), transparent); }
.bf-4 { width: 25px; height: 25px; top: 60%; left: 70%; background: radial-gradient(circle, #e8a0a0, transparent); }
.bf-5 { width: 35px; height: 35px; top: 10%; left: 75%; background: radial-gradient(circle, #8a7ad8, transparent); }
.bf-6 { width: 45px; height: 45px; top: 70%; left: 50%; background: radial-gradient(circle, var(--harvest-warning), transparent); opacity: 0.3; }
.bf-7 { width: 20px; height: 20px; top: 40%; left: 85%; background: radial-gradient(circle, var(--phosphor), transparent); }

/* === Footer === */
.footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--loam);
}

.footer-coords {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    color: var(--fallout-haze);
}

.footer-monitor {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    color: var(--phosphor);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--phosphor);
    animation: pulse 2s ease-in-out infinite;
}

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

/* === Lens Flares === */
.flare {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    z-index: 1000;
    opacity: 0;
    transition: opacity 2s ease;
}

.flare.active { opacity: 1; }

.flare-1 {
    width: 340px; height: 340px;
    background: radial-gradient(circle, rgba(232, 208, 144, 0.3), transparent 70%);
}

.flare-2 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(232, 208, 144, 0.2), transparent 70%);
}

.flare-3 {
    width: 120px; height: 120px;
    background: radial-gradient(circle, rgba(232, 208, 144, 0.25), transparent 70%);
}

.flare-hex {
    position: fixed;
    pointer-events: none;
    width: 40px;
    height: 40px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: rgba(232, 208, 144, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: opacity 2s ease;
}

.flare-hex.active { opacity: 1; }

/* === Spore Particles === */
.spore {
    position: fixed;
    pointer-events: none;
    border-radius: 50%;
    background: rgba(232, 208, 144, 0.4);
    z-index: 999;
    animation: float-up linear infinite;
}

.spore-1 { width: 4px; height: 4px; left: 10%; animation-duration: 25s; animation-delay: 0s; }
.spore-2 { width: 6px; height: 6px; left: 25%; animation-duration: 32s; animation-delay: 3s; }
.spore-3 { width: 3px; height: 3px; left: 40%; animation-duration: 28s; animation-delay: 7s; }
.spore-4 { width: 5px; height: 5px; left: 55%; animation-duration: 35s; animation-delay: 2s; }
.spore-5 { width: 4px; height: 4px; left: 70%; animation-duration: 22s; animation-delay: 10s; }
.spore-6 { width: 6px; height: 6px; left: 82%; animation-duration: 30s; animation-delay: 5s; }
.spore-7 { width: 3px; height: 3px; left: 92%; animation-duration: 27s; animation-delay: 8s; }
.spore-8 { width: 5px; height: 5px; left: 35%; animation-duration: 40s; animation-delay: 12s; }

@keyframes float-up {
    0% { transform: translateY(100vh); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh); opacity: 0; }
}

/* === Mobile === */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
        grid-template-rows: 60px auto auto 80px 160px 160px 40px;
        grid-template-areas:
            "header"
            "main"
            "status"
            "log"
            "bloom"
            "footer"
            "footer";
        height: auto;
        min-height: 100vh;
    }

    .sidebar-left, .sidebar-right {
        display: none;
    }

    .main-panel {
        min-height: 70vh;
        max-height: 80vh;
    }

    .status-bar {
        overflow-x: auto;
        justify-content: flex-start;
        gap: 20px;
        padding: 12px 20px;
    }

    .header-left, .header-right { display: none; }
    
    .site-title { font-size: 1.2rem; }
}
