/* =============================================
   SSETTL.com - Botanical Research Station
   Color Palette:
   - Fog White:        #F0F3EF
   - Pale Sage:        #D4E4D9
   - Soft Lavender:    #C8B8D9
   - Muted Rose:       #D9B8C4
   - Deep Fern:        #3A5F4B
   - Twilight Slate:   #2E3A40
   - Lichen:           #8FA89A
   - Blush Peach:      #E8CFC0
   - Isometric Shadow: #B4BFB8
   ============================================= */

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    font-size: 16px;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    color: #3A5F4B;
    background-color: #F0F3EF;
    background-image: radial-gradient(ellipse at 30% 20%, rgba(200,184,217,0.2) 0%, transparent 50%);
    line-height: 1.65;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: rgba(212, 228, 217, 0.85);
    backdrop-filter: blur(12px) saturate(1.2);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    border-right: 1px solid rgba(58, 95, 75, 0.15);
    padding: 2rem 1rem;
    overflow: hidden;
}

#sidebar-wordmark {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #2E3A40;
    letter-spacing: -0.04em;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    margin: 0 auto 2rem;
    line-height: 0.95;
    text-transform: uppercase;
    height: auto;
    align-self: center;
}

#sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.nav-tile {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    background: rgba(212, 228, 217, 0.6);
    border: 1px solid rgba(58, 95, 75, 0.12);
    text-decoration: none;
    color: #3A5F4B;
    transform: perspective(600px) rotateX(10deg) rotateY(-15deg);
    transform-style: preserve-3d;
    box-shadow: 2px 2px 4px rgba(46, 58, 64, 0.08);
    transition: transform 250ms ease, box-shadow 250ms ease, background 250ms ease, border-left 250ms ease;
    opacity: 0;
    animation: navSlideIn 400ms ease forwards;
}

.nav-tile:nth-child(1) { animation-delay: 200ms; }
.nav-tile:nth-child(2) { animation-delay: 300ms; }
.nav-tile:nth-child(3) { animation-delay: 400ms; }
.nav-tile:nth-child(4) { animation-delay: 500ms; }
.nav-tile:nth-child(5) { animation-delay: 600ms; }

@keyframes navSlideIn {
    from {
        opacity: 0;
        transform: perspective(600px) rotateX(10deg) rotateY(-15deg) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: perspective(600px) rotateX(10deg) rotateY(-15deg) translateX(0);
    }
}

.nav-tile:hover {
    transform: perspective(600px) rotateX(8deg) rotateY(-12deg);
    box-shadow: 4px 6px 12px rgba(46, 58, 64, 0.12);
    background: #E8CFC0;
}

.nav-tile.active {
    border-left: 3px solid #C8B8D9;
    background: rgba(232, 207, 192, 0.5);
    transform: perspective(600px) rotateX(8deg) rotateY(-12deg) translateZ(4px);
}

.nav-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    color: #2E3A40;
}

.nav-code {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #8FA89A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.2rem;
}

#sidebar-terrarium {
    margin-top: auto;
    padding-top: 1rem;
    display: flex;
    justify-content: center;
}

#sidebar-terrarium-svg {
    width: 160px;
    height: auto;
}

/* Fern frond draw animation */
.fern-frond {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: drawFrond 4s ease forwards;
}

.fern-1, .fern-1-leaf { animation-delay: 1s; }
.fern-2, .fern-2-leaf { animation-delay: 1.5s; }
.fern-3, .fern-3-leaf { animation-delay: 2s; }

@keyframes drawFrond {
    to {
        stroke-dashoffset: 0;
    }
}

/* ---- Main Content ---- */
#main-content {
    margin-left: 280px;
    width: calc(100vw - 280px);
    position: relative;
}

/* ---- Spore Particles ---- */
#spore-particles {
    position: fixed;
    top: 0;
    left: 280px;
    width: calc(100vw - 280px);
    height: 100vh;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.spore {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: sporeDrift linear infinite;
}

@keyframes sporeDrift {
    0% {
        transform: translateX(0) translateY(0);
        opacity: var(--spore-opacity);
    }
    25% {
        transform: translateX(20px) translateY(-25vh);
    }
    50% {
        transform: translateX(-15px) translateY(-50vh);
    }
    75% {
        transform: translateX(25px) translateY(-75vh);
    }
    100% {
        transform: translateX(0) translateY(-105vh);
        opacity: 0;
    }
}

/* ---- Observation Panels ---- */
.observation-panel {
    width: 100%;
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    scroll-snap-align: start;
    background-color: #F0F3EF;
    background-image: radial-gradient(ellipse at 30% 20%, rgba(200,184,217,0.15) 0%, transparent 50%);
}

/* Isometric grid overlay */
.isometric-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.12;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='85' height='85'%3E%3Cpath d='M0 42.5 L42.5 0 L85 42.5 L42.5 85 Z' fill='none' stroke='%23B4BFB8' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 60px 60px;
}

/* Panel zoom-focus states */
.observation-panel {
    opacity: 0.4;
    transform: scale(0.88);
    filter: blur(5px);
    transition: opacity 900ms ease-out, transform 900ms ease-out, filter 900ms ease-out;
}

.observation-panel.in-view {
    opacity: 1;
    transform: scale(1.0);
    filter: blur(0px);
}

.observation-panel.exiting {
    opacity: 0.2;
    transform: scale(1.12);
    filter: blur(4px);
}

/* ---- Panel Content ---- */
.panel-content {
    position: relative;
    width: 100%;
    max-width: 1000px;
    padding: 4rem 3rem;
    z-index: 2;
}

/* ---- Hero Panel ---- */
#hero-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    color: #2E3A40;
    letter-spacing: -0.04em;
    line-height: 0.95;
    transform: perspective(800px) rotateX(5deg) rotateY(-8deg);
    animation: heroZoomIn 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    opacity: 0;
    filter: blur(8px);
}

@keyframes heroZoomIn {
    0% {
        opacity: 0.3;
        filter: blur(8px);
        transform: scale(1.3) perspective(800px) rotateX(5deg) rotateY(-8deg);
    }
    100% {
        opacity: 1;
        filter: blur(0px);
        transform: scale(1.0) perspective(800px) rotateX(5deg) rotateY(-8deg);
    }
}

#hero-tagline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    color: #8FA89A;
    margin-top: 1.5rem;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: typewriter 1.8s steps(48, end) 0.6s forwards;
}

@keyframes typewriter {
    to {
        width: 100%;
    }
}

#hero-terrarium {
    position: absolute;
    bottom: 5%;
    right: 5%;
    width: 280px;
    height: auto;
}

#hero-terrarium .fern-frond {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawFrond 4s ease forwards;
}

.hero-fern-1, .hero-fern-1a, .hero-fern-1b { animation-delay: 1s !important; }
.hero-fern-2, .hero-fern-2a, .hero-fern-2b { animation-delay: 1.6s !important; }
.hero-fern-3, .hero-fern-3a, .hero-fern-3b { animation-delay: 2.2s !important; }

/* ---- Panel Headings ---- */
.panel-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: #2E3A40;
    letter-spacing: -0.04em;
    line-height: 0.95;
    margin-bottom: 2.5rem;
    transform: perspective(800px) rotateX(3deg) rotateY(-5deg);
}

/* ---- Isometric Containers ---- */
.isometric-container {
    margin-bottom: 2rem;
}

.iso-card {
    background: rgba(212, 228, 217, 0.45);
    border: 1px solid rgba(58, 95, 75, 0.12);
    padding: 2rem;
    transform: perspective(800px) rotateX(5deg) rotateY(-8deg);
    box-shadow: 4px 4px 12px rgba(180, 191, 184, 0.4);
    transition: transform 300ms ease, box-shadow 300ms ease;
}

.iso-card:hover {
    transform: perspective(800px) rotateX(3deg) rotateY(-5deg);
    box-shadow: 6px 8px 20px rgba(180, 191, 184, 0.5);
}

.iso-card h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 1.4rem;
    color: #2E3A40;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.iso-card p {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    color: #3A5F4B;
    line-height: 1.65;
}

.specimen-code {
    display: inline-block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #8FA89A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 1rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid rgba(143, 168, 154, 0.3);
}

/* Layout variants */
.iso-left {
    max-width: 460px;
}

.iso-right {
    max-width: 460px;
    margin-left: auto;
}

.iso-center {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.iso-wide {
    max-width: 800px;
}

.iso-left-small {
    max-width: 380px;
    margin-top: 1.5rem;
}

.iso-center-narrow {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
    margin-top: 2rem;
}

/* ---- Research Stats ---- */
.research-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(58, 95, 75, 0.12);
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 1.8rem;
    color: #2E3A40;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #8FA89A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.3rem;
}

/* ---- Circuit Root Networks ---- */
.circuit-roots {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    z-index: 1;
}

.circuit-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease;
}

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

/* ---- Network Visualization ---- */
.network-visualization {
    width: 100%;
    margin-bottom: 2rem;
}

.network-svg {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    display: block;
}

/* ---- Data Readouts ---- */
.data-readout {
    position: absolute;
    width: 140px;
    height: 40px;
    border: 1px solid #8FA89A;
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    background: rgba(240, 243, 239, 0.8);
    z-index: 3;
}

.readout-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #8FA89A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    overflow: hidden;
    white-space: nowrap;
    animation: readoutType 3s steps(20, end) infinite alternate;
}

@keyframes readoutType {
    0% { width: 0; }
    50% { width: 100%; }
    100% { width: 100%; }
}

.readout-top-right {
    top: 2rem;
    right: 2rem;
}

.readout-top-left {
    top: 2rem;
    left: 2rem;
}

.readout-bottom-left {
    bottom: 2rem;
    left: 2rem;
}

.readout-bottom-right {
    bottom: 2rem;
    right: 2rem;
}

/* ---- Hexagonal Status Indicators ---- */
.hex-cluster {
    position: absolute;
    display: flex;
    gap: 4px;
    z-index: 3;
}

.hex-indicator {
    width: 24px;
    height: 24px;
}

.hex-indicator.pulse {
    animation: hexPulse 3s ease-in-out infinite;
}

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

.hex-cluster-1 {
    bottom: 2rem;
    left: 2rem;
}

.hex-cluster-2 {
    top: 2rem;
    right: 2rem;
}

.hex-cluster-3 {
    bottom: 3rem;
    right: 3rem;
}

.hex-cluster-4 {
    top: 3rem;
    left: 2rem;
}

/* ---- Log Strips ---- */
.log-strip {
    width: 100%;
    height: 80px;
    background: rgba(46, 58, 64, 0.95);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.log-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    color: #8FA89A;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    animation: marqueeScroll 30s linear infinite;
    padding-left: 100%;
}

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

/* ---- Panel Terrarium Decorations ---- */
.panel-terrarium {
    position: absolute;
    bottom: 10%;
    right: 5%;
    width: 160px;
    z-index: 1;
    opacity: 0.7;
}

/* ---- Archive Grid ---- */
.archive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 800px;
}

.archive-entry {
    position: relative;
}

.archive-date {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    color: #C8B8D9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.iso-archive-1 .iso-card,
.iso-archive-3 .iso-card {
    border-left: 3px solid #C8B8D9;
}

.iso-archive-2 .iso-card,
.iso-archive-4 .iso-card {
    border-left: 3px solid #D9B8C4;
}

.archive-terrariums {
    position: absolute;
    bottom: 5%;
    right: 5%;
    display: flex;
    gap: 1rem;
    z-index: 1;
    opacity: 0.5;
}

.mini-terrarium {
    width: 80px;
    height: auto;
}

/* ---- Responsive / Tablet ---- */
@media (max-width: 1024px) {
    #sidebar {
        width: 72px;
        padding: 1rem 0.5rem;
    }

    #sidebar-wordmark {
        font-size: 1rem;
    }

    .nav-label {
        display: none;
    }

    .nav-code {
        font-size: 0.6rem;
        text-align: center;
    }

    .nav-tile {
        padding: 0.5rem;
        align-items: center;
    }

    #sidebar-terrarium-svg {
        width: 50px;
    }

    #main-content {
        margin-left: 72px;
        width: calc(100vw - 72px);
    }

    #spore-particles {
        left: 72px;
        width: calc(100vw - 72px);
    }
}

@media (max-width: 768px) {
    #sidebar {
        width: 60px;
        padding: 0.75rem 0.25rem;
    }

    #sidebar-wordmark {
        font-size: 0.85rem;
    }

    #main-content {
        margin-left: 60px;
        width: calc(100vw - 60px);
    }

    #spore-particles {
        left: 60px;
        width: calc(100vw - 60px);
    }

    .panel-content {
        padding: 2rem 1.5rem;
    }

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

    .research-stats {
        flex-direction: column;
        gap: 1rem;
    }

    #hero-terrarium {
        width: 160px;
        bottom: 2%;
        right: 2%;
    }

    .iso-right {
        margin-left: 0;
    }
}
