/* ============================================
   bada.systems - Goblincore Command Center
   Palette: Terracotta-Warm + Aurora Accents
   ============================================ */

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

:root {
    --peat-black: #1A1210;
    --loam-dark: #2A1F1A;
    --oxidized-copper: #C67A4E;
    --deep-terracotta: #A85A3A;
    --fired-clay: #D4956B;
    --pale-terracotta: #E8C9A0;
    --muted-earth: #9A8B78;
    --bio-green: #4AE8A0;
    --spore-violet: #8A5AE8;
    --mid-brown: #1E1815;
    --deep-green: #1A1510;
    --deep-night: #0A0A1A;
    --text-secondary: #D4C1A8;
    --hud-timing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
    background-color: var(--peat-black);
    color: var(--pale-terracotta);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1.8vw, 19px);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background gradient that shifts with scroll */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
        #1A1210 0%,
        #2A1F1A 20%,
        #1E1815 40%,
        #1A1510 60%,
        #0D1A15 80%,
        #0A0A1A 100%
    );
    background-size: 100% 500vh;
    background-position: 0% var(--bg-offset, 0%);
    z-index: -10;
    pointer-events: none;
}

/* --- Scanline Overlay --- */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(198, 122, 78, 0.04) 1px,
        rgba(198, 122, 78, 0.04) 2px
    );
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease-in-out;
}

.scanline-overlay.active {
    opacity: 1;
}

/* --- Rust Texture Overlay --- */
.rust-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    z-index: 999;
    pointer-events: none;
    opacity: 0.6;
}

/* --- Aurora Layers --- */
.aurora-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 2s ease-in-out;
}

.aurora-green {
    background: radial-gradient(ellipse 80vw 40vh at 30% 20%, rgba(74, 232, 160, 0.08), transparent);
    animation: auroraShift1 35s ease-in-out infinite alternate;
}

.aurora-violet {
    background: radial-gradient(ellipse 60vw 50vh at 70% 30%, rgba(138, 90, 232, 0.06), transparent);
    animation: auroraShift2 42s ease-in-out infinite alternate;
}

.aurora-warm {
    background: radial-gradient(ellipse 90vw 30vh at 50% 10%, rgba(212, 149, 107, 0.05), transparent);
    animation: auroraShift3 50s ease-in-out infinite alternate;
}

@keyframes auroraShift1 {
    0% { transform: translate(0, 0); }
    50% { transform: translate(5vw, 3vh); }
    100% { transform: translate(-3vw, -2vh); }
}

@keyframes auroraShift2 {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-4vw, 5vh); }
    100% { transform: translate(6vw, -3vh); }
}

@keyframes auroraShift3 {
    0% { transform: translate(0, 0); }
    50% { transform: translate(3vw, -4vh); }
    100% { transform: translate(-5vw, 2vh); }
}

.aurora-layer.intensified {
    opacity: 0.15;
}

/* --- Spore Particles --- */
.spore-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.spore {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0;
    transition: opacity 2s ease;
}

.spore.visible {
    opacity: 1;
}

@keyframes sporeFloat1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(8px, -15px); }
    50% { transform: translate(-5px, -20px); }
    75% { transform: translate(10px, -8px); }
}

@keyframes sporeFloat2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-10px, 12px); }
    50% { transform: translate(7px, 18px); }
    75% { transform: translate(-6px, -10px); }
}

@keyframes sporeFloat3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(12px, -6px); }
    50% { transform: translate(-8px, 15px); }
    75% { transform: translate(-12px, -12px); }
}

/* --- Mycelium Network --- */
.mycelium-network {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.mycelium-path {
    fill: none;
    stroke: var(--deep-terracotta);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: var(--path-length);
    stroke-dashoffset: var(--path-length);
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.mycelium-path.drawn {
    stroke-dashoffset: 0;
}

.mycelium-node {
    fill: var(--fired-clay);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.mycelium-node.active {
    opacity: 1;
    animation: nodePulse 3s ease-in-out infinite;
}

@keyframes nodePulse {
    0%, 100% { r: 4; opacity: 0.7; }
    50% { r: 6; opacity: 1; }
}

/* --- Telemetry Tickers --- */
.telemetry-ticker {
    position: fixed;
    left: 0;
    width: 100%;
    height: 16px;
    overflow: hidden;
    z-index: 100;
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    color: var(--muted-earth);
    opacity: 0.4;
    white-space: nowrap;
}

.telemetry-top {
    top: 0;
}

.telemetry-bottom {
    bottom: 0;
}

.ticker-content {
    display: inline-block;
    animation: tickerScroll 60s linear infinite;
    padding-left: 100%;
}

.telemetry-bottom .ticker-content {
    animation-direction: reverse;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- System Status (top-left fixed) --- */
.system-status {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Silkscreen', cursive;
    font-size: clamp(11px, 1.5vw, 14px);
    letter-spacing: 0.12em;
    color: var(--pale-terracotta);
    text-shadow: 0 0 8px rgba(232, 201, 160, 0.3);
    opacity: 0;
    transition: opacity 0.6s ease;
}

.system-status.visible {
    opacity: 1;
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--bio-green);
    box-shadow: 0 0 6px var(--bio-green);
    animation: statusBlink 2s ease-in-out infinite;
}

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

.status-depth {
    color: var(--muted-earth);
    font-size: 10px;
}

/* --- Navigation Glyphs (top-right fixed) --- */
.nav-glyphs {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.nav-glyphs.visible {
    opacity: 1;
}

.glyph {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--oxidized-copper);
    font-size: 16px;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.3s var(--hud-timing);
}

.glyph:hover {
    color: var(--fired-clay);
    border-color: var(--oxidized-copper);
    text-shadow: 0 0 8px rgba(198, 122, 78, 0.4);
}

.glyph.active {
    color: var(--pale-terracotta);
    border-color: var(--oxidized-copper);
}

/* --- Scroll Canvas --- */
.scroll-canvas {
    position: relative;
    z-index: 10;
    min-height: 500vh;
    padding: 10vh 0;
}

/* --- Zones --- */
.zone {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 5vh 5vw;
    position: relative;
}

.zone-surface {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
}

.zone-soil {
    gap: 40px;
}

.zone-network {
    align-items: flex-end;
}

.zone-cavern {
    align-items: center;
}

.zone-sky {
    align-items: center;
    min-height: 80vh;
}

/* --- HUD Panels --- */
.hud-panel {
    position: relative;
    background: rgba(26, 18, 16, 0.85);
    border: 1px solid var(--oxidized-copper);
    border-radius: 6px;
    padding: 32px;
    max-width: 640px;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s var(--hud-timing), transform 0.8s var(--hud-timing);
}

.hud-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.panel-identity {
    max-width: 720px;
    text-align: center;
    position: sticky;
    top: 15vh;
}

.panel-mission {
    position: sticky;
    top: 10vh;
}

.panel-readings {
    position: sticky;
    top: 45vh;
    align-self: flex-end;
    max-width: 400px;
}

.panel-projects {
    position: sticky;
    top: 8vh;
    max-width: 600px;
}

.panel-showcase {
    max-width: 800px;
    position: sticky;
    top: 10vh;
}

.panel-contact {
    max-width: 580px;
    text-align: center;
}

/* --- Corner Brackets --- */
.corner-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    pointer-events: none;
}

.corner-bracket::before,
.corner-bracket::after {
    content: '';
    position: absolute;
    background: var(--oxidized-copper);
    opacity: 0;
    transition: opacity 0.4s var(--hud-timing);
}

.hud-panel.visible .corner-bracket::before,
.hud-panel.visible .corner-bracket::after {
    opacity: 1;
}

.corner-tl {
    top: -4px;
    left: -4px;
}
.corner-tl::before {
    top: 0;
    left: 0;
    width: 12px;
    height: 1px;
}
.corner-tl::after {
    top: 0;
    left: 0;
    width: 1px;
    height: 12px;
}

.corner-tr {
    top: -4px;
    right: -4px;
}
.corner-tr::before {
    top: 0;
    right: 0;
    width: 12px;
    height: 1px;
}
.corner-tr::after {
    top: 0;
    right: 0;
    width: 1px;
    height: 12px;
}

.corner-bl {
    bottom: -4px;
    left: -4px;
}
.corner-bl::before {
    bottom: 0;
    left: 0;
    width: 12px;
    height: 1px;
}
.corner-bl::after {
    bottom: 0;
    left: 0;
    width: 1px;
    height: 12px;
}

.corner-br {
    bottom: -4px;
    right: -4px;
}
.corner-br::before {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 1px;
}
.corner-br::after {
    bottom: 0;
    right: 0;
    width: 1px;
    height: 12px;
}

/* --- HUD Labels --- */
.hud-label {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(10px, 1.5vw, 14px);
    letter-spacing: 0.12em;
    color: var(--oxidized-copper);
    margin-bottom: 16px;
    text-transform: uppercase;
}

/* --- Typography --- */
.site-title {
    font-family: 'Silkscreen', cursive;
    font-weight: 400;
    font-size: clamp(28px, 5vw, 64px);
    letter-spacing: 0.12em;
    color: var(--pale-terracotta);
    text-shadow: 0 0 8px rgba(232, 201, 160, 0.3);
    margin-bottom: 16px;
    min-height: 1.2em;
}

.site-title .cursor {
    display: inline-block;
    width: 0.6em;
    height: 1em;
    background: var(--oxidized-copper);
    margin-left: 2px;
    animation: cursorBlink 0.8s step-end infinite;
    vertical-align: text-bottom;
}

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

.section-title {
    font-family: 'Bungee Shade', cursive;
    font-weight: 400;
    font-size: clamp(22px, 3.5vw, 44px);
    letter-spacing: 0.06em;
    color: var(--oxidized-copper);
    margin-bottom: 20px;
}

.body-text {
    color: var(--text-secondary);
    max-width: 52ch;
    margin-bottom: 12px;
    line-height: 1.65;
}

.secondary-text {
    color: var(--muted-earth);
}

/* --- HUD Readout --- */
.hud-readout {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.readout-item {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--muted-earth);
}

/* --- Data Grid --- */
.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.data-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.data-label {
    font-family: 'Silkscreen', cursive;
    font-size: 9px;
    letter-spacing: 0.12em;
    color: var(--muted-earth);
}

.data-value {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(18px, 2.5vw, 28px);
    color: var(--fired-clay);
}

/* --- Project List --- */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.project-node {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.node-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fired-clay);
    margin-top: 8px;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(212, 149, 107, 0.4);
    animation: nodePulse 3s ease-in-out infinite;
}

.project-node:nth-child(2) .node-indicator { animation-delay: 0.5s; }
.project-node:nth-child(3) .node-indicator { animation-delay: 1s; }
.project-node:nth-child(4) .node-indicator { animation-delay: 1.5s; }

.project-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-name {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(12px, 1.8vw, 16px);
    letter-spacing: 0.12em;
    color: var(--pale-terracotta);
    text-shadow: 0 0 8px rgba(232, 201, 160, 0.2);
}

.project-desc {
    font-size: clamp(13px, 1.5vw, 16px);
    color: var(--muted-earth);
    max-width: 48ch;
    line-height: 1.5;
}

/* --- Specimen Display --- */
.specimen-display {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.specimen-image {
    position: relative;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--deep-terracotta);
    border-radius: 4px;
    overflow: hidden;
    animation: imageBorderPulse 4s ease-in-out infinite;
}

@keyframes imageBorderPulse {
    0%, 100% { border-color: var(--deep-terracotta); }
    50% { border-color: var(--oxidized-copper); }
}

.specimen-svg {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(100%) sepia(40%) saturate(150%) hue-rotate(-10deg) contrast(1.1);
}

.image-frame-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--oxidized-copper);
    mix-blend-mode: multiply;
    opacity: 0.15;
    pointer-events: none;
}

.specimen-data {
    flex: 1;
    min-width: 240px;
}

.specimen-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-label {
    font-family: 'Silkscreen', cursive;
    font-size: 9px;
    letter-spacing: 0.12em;
    color: var(--muted-earth);
    width: 100px;
    flex-shrink: 0;
}

.stat-bar {
    flex: 1;
    height: 4px;
    background: rgba(42, 31, 26, 0.8);
    border-radius: 2px;
    overflow: hidden;
}

.stat-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--deep-terracotta), var(--fired-clay));
    border-radius: 2px;
    transition: width 1.5s var(--hud-timing);
}

/* --- Contact Links --- */
.contact-links {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 24px 0;
}

.contact-item {
    font-family: 'Silkscreen', cursive;
    font-size: clamp(11px, 1.5vw, 14px);
    letter-spacing: 0.12em;
    color: var(--oxidized-copper);
    cursor: pointer;
    transition: all 0.3s var(--hud-timing);
}

.contact-item:hover {
    color: var(--fired-clay);
    text-shadow: 0 0 12px rgba(212, 149, 107, 0.4);
}

.link-bracket {
    color: var(--deep-terracotta);
}

.link-text {
    margin: 0 4px;
}

/* --- Closing Readout --- */
.closing-readout {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 32px;
}

.readout-line {
    font-family: 'Silkscreen', cursive;
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--muted-earth);
    opacity: 0.6;
}

/* --- SVG Spore animations --- */
.svg-spore {
    animation: svgSporeFloat 6s ease-in-out infinite alternate;
}

.svg-spore:nth-child(2) { animation-delay: -1.5s; animation-duration: 8s; }
.svg-spore:nth-child(3) { animation-delay: -3s; animation-duration: 7s; }
.svg-spore:nth-child(4) { animation-delay: -0.5s; animation-duration: 9s; }
.svg-spore:nth-child(5) { animation-delay: -2s; animation-duration: 6s; }

@keyframes svgSporeFloat {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5px, -10px); }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .aurora-layer {
        animation: none;
    }

    .scanline-overlay.active {
        opacity: 1;
    }

    .aurora-layer.intensified {
        opacity: 0.08;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .zone {
        padding: 5vh 4vw;
    }

    .hud-panel {
        padding: 24px 18px;
        max-width: 100%;
    }

    .panel-readings {
        align-self: flex-start;
        max-width: 100%;
    }

    .panel-projects {
        max-width: 100%;
    }

    .zone-network {
        align-items: flex-start;
    }

    .specimen-display {
        flex-direction: column;
    }

    .specimen-image {
        max-width: 100%;
    }

    .hud-readout {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .contact-links {
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }

    .data-grid {
        grid-template-columns: 1fr;
    }

    .system-status {
        top: 20px;
        left: 12px;
        font-size: 10px;
    }

    .nav-glyphs {
        top: 20px;
        right: 12px;
        gap: 8px;
    }

    .glyph {
        width: 24px;
        height: 24px;
        font-size: 13px;
    }
}
