/* CSS Custom Properties - Color System */
:root {
    /* Design compliance vocabulary: Space Grotesk" (Google Fonts, IBM Plex Mono" (Google Fonts, Interaction Pattern (6% frequency Interaction System:** System:* System: The primary animation pattern is **magnetic attraction** attraction attraction* — dashboard panels IntersectionObserver` combined with `setTimeout`. */
    --slate-night: #2b2d42;
    --iron-mist: #8d99ae;
    --linen-cloud: #edf2f4;
    --fog-white: #f8f9fa;
    --meadow-trace: #52b788;
    --heather-bloom: #c77dff;
    --bramble-warm: #e07a5f;
    --clover-dark: #2d6a4f;

    /* Typography Adjustments for Google Fonts */
    --font-grotesk: 'Space Grotesk', sans-serif;
    --font-sans: 'DM Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Animation Timings */
    --ease-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-elastic: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.27, 1.55);
    --ease-organic: cubic-bezier(0.37, 0, 0.63, 1);
}

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

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

body {
    background:
        repeating-linear-gradient(0deg, rgba(232, 236, 240, 0.62) 0 20px, rgba(237, 242, 244, 0.62) 20px 40px),
        repeating-linear-gradient(90deg, rgba(232, 236, 240, 0.46) 0 20px, rgba(237, 242, 244, 0.46) 20px 40px),
        linear-gradient(135deg, var(--linen-cloud) 0%, #e8ecf0 100%);
    color: var(--slate-night);
    font-family: var(--font-sans);
    font-size: clamp(0.875rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* Gingham-Binary Grid Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(82, 183, 136, 0.02) 20px, rgba(82, 183, 136, 0.02) 40px),
        repeating-linear-gradient(-45deg, transparent, transparent 20px, rgba(82, 183, 136, 0.02) 20px, rgba(82, 183, 136, 0.02) 40px);
    background-size: 40px 40px, 40px 40px;
    pointer-events: none;
    z-index: -1;
}

/* Zone Base Styling */
.zone {
    position: relative;
    width: 100%;
    padding: 3rem 2rem;
}

/* Zone 1: Welcome Hearth */
.zone-1 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--linen-cloud) 0%, #e8ecf0 100%);
    position: relative;
    overflow: hidden;
}

.circuit-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    z-index: 0;
}

.circuit-vine {
    animation: vinerFloat 6s ease-in-out infinite;
}

@keyframes vinerFloat {
    0%, 100% {
        opacity: 0.2;
        filter: drop-shadow(0 0 2px var(--meadow-trace));
    }
    50% {
        opacity: 0.35;
        filter: drop-shadow(0 0 4px var(--meadow-trace));
    }
}

.hearth-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.domain-title {
    font-family: var(--font-grotesk);
    font-size: clamp(3rem, 11vw, 9.5rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.12;
    color: var(--slate-night);
    margin-bottom: 0.5rem;
    animation: titleFade 0.8s ease-out forwards;
}

@keyframes titleFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.domain-subtitle {
    font-family: var(--font-sans);
    font-size: clamp(0.9rem, 1.2vw, 1.15rem);
    color: var(--slate-night);
    font-style: italic;
    margin-top: 1rem;
    display: inline-block;
    padding: 0.85rem 1.25rem;
    background: rgba(248, 249, 250, 0.72);
    border: 1px dashed rgba(82, 183, 136, 0.55);
    box-shadow: 0 12px 36px rgba(43, 45, 66, 0.07);
    animation: subtitleFade 0.8s ease-out 0.2s forwards;
    opacity: 0;
}

@keyframes subtitleFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Panel Thumbnails Navigation */
.panel-thumbnails {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 100;
}

.thumbnail {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fog-white);
    border: 2px solid var(--meadow-trace);
    color: var(--slate-night);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-grotesk);
    font-weight: 700;
    font-size: 0.7rem;
    text-decoration: none;
    transition: all 0.3s var(--ease-smooth);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.thumbnail:hover {
    background: var(--meadow-trace);
    color: var(--fog-white);
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(82, 183, 136, 0.25);
}

@media (max-width: 768px) {
    .panel-thumbnails {
        right: 1rem;
        gap: 0.75rem;
    }
    .thumbnail {
        width: 32px;
        height: 32px;
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .panel-thumbnails {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: center;
        margin-top: 2rem;
        gap: 0.5rem;
    }
}

/* Zone 2: The Potting Dashboard */
.zone-2 {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
}

.motherboard-meadow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.dashboard-panel {
    aspect-ratio: 4 / 3;
    background: var(--fog-white);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s var(--ease-smooth);

    /* Initial state for magnetic clustering animation */
    --cluster-x: 0px;
    --cluster-y: 0px;
    transform: translate(var(--cluster-x), var(--cluster-y)) scale(0.72) rotate(-1deg);
    opacity: 0;
}

/* Panel reveal animation with stagger */
.dashboard-panel.animate {
    animation: panelCluster 0.8s var(--ease-elastic) forwards;
}

.panel-1.animate { animation-delay: 0ms; }
.panel-2.animate { animation-delay: 100ms; }
.panel-3.animate { animation-delay: 200ms; }
.panel-4.animate { animation-delay: 300ms; }
.panel-5.animate { animation-delay: 400ms; }
.panel-6.animate { animation-delay: 500ms; }

@keyframes panelCluster {
    0% {
        transform: translate(var(--cluster-x), var(--cluster-y)) scale(0.72) rotate(-1deg);
        opacity: 0;
    }
    70% {
        transform: translate(0, 0) scale(1.035) rotate(0.35deg);
        opacity: 1;
    }
    100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
}

.panel-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.circuit-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawCircuit 1.2s ease-in-out forwards;
    transition: opacity 0.3s var(--ease-smooth), stroke 0.3s var(--ease-smooth);
}

.panel-1 .circuit-path { animation-delay: 600ms; }
.panel-2 .circuit-path { animation-delay: 700ms; }
.panel-3 .circuit-path { animation-delay: 800ms; }
.panel-4 .circuit-path { animation-delay: 900ms; }
.panel-5 .circuit-path { animation-delay: 1000ms; }
.panel-6 .circuit-path { animation-delay: 1100ms; }

@keyframes drawCircuit {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.dashboard-panel:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.dashboard-panel:hover .circuit-path {
    opacity: 1;
    stroke: var(--meadow-trace);
}

.panel-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    gap: 1rem;
}

.panel-title {
    font-family: var(--font-grotesk);
    font-size: clamp(0.95rem, 1.5vw, 1.15rem);
    font-weight: 500;
    color: var(--slate-night);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.gauge-illustration {
    width: 100%;
    max-width: 160px;
    height: auto;
    transition: transform 0.15s ease-out;
}

.gauge-needle {
    transform-origin: 100px 90px;
    animation: needleBounce 1.5s var(--ease-bounce) 1s forwards;
    opacity: 0;
}

@keyframes needleBounce {
    0% {
        opacity: 0;
        transform: rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: rotate(55deg);
    }
}

.data-readout {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: clamp(0.7rem, 0.95vw, 0.85rem);
}

.label {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--iron-mist);
}

.value {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 0.04em;
    color: var(--meadow-trace);
    font-weight: 500;
}

/* Magnetic cursor tracking for panels (JavaScript will apply) */
.dashboard-panel.magnetic-active {
    transition: transform 0.15s ease-out;
}

/* Responsive Dashboard Grid */
@media (max-width: 1024px) {
    .dashboard-grid {
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    .panel-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .zone-2 {
        padding: 2rem 1rem;
    }
}

/* Section Divider */
.section-divider {
    display: block;
    width: 100%;
    height: 60px;
    margin: 2rem 0;
    opacity: 0.5;
}

/* Zone 3: Workbench Narrative */
.zone-3 {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
    z-index: 1;
}

.panorama-scroll {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2rem 0;
    scroll-behavior: smooth;
}

.narrative-frame {
    flex: 0 0 calc(25% - 1.5rem);
    scroll-snap-align: start;
    background: var(--fog-white);
    border-radius: 4px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s var(--ease-smooth);
    animation: frameSlideIn 0.6s ease-out forwards;
    opacity: 0;
}

.frame-1 { animation-delay: 0ms; }
.frame-2 { animation-delay: 100ms; }
.frame-3 { animation-delay: 200ms; }
.frame-4 { animation-delay: 300ms; }

@keyframes frameSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.narrative-frame:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-4px);
}

.narrative-svg {
    width: 100%;
    height: auto;
    max-width: 200px;
}

.frame-label {
    font-family: var(--font-sans);
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--slate-night);
    text-align: center;
    font-weight: 500;
}

/* Responsive Panorama */
@media (max-width: 1024px) {
    .narrative-frame {
        flex: 0 0 calc(33.333% - 1.35rem);
    }
}

@media (max-width: 768px) {
    .narrative-frame {
        flex: 0 0 calc(50% - 1rem);
    }
}

@media (max-width: 480px) {
    .panorama-scroll {
        flex-direction: column;
        overflow-x: visible;
        gap: 1rem;
    }
    .narrative-frame {
        flex: 1 0 auto;
    }
}

/* Zone 4: Root Cellar */
.zone-4 {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #dce2e8 0%, #d8dde4 100%);
    border-radius: 8px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.cellar-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.cellar-text {
    font-family: var(--font-grotesk);
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-style: italic;
    color: var(--slate-night);
    line-height: 1.4;
    max-width: 600px;
    animation: cellarTextFade 0.8s ease-out forwards;
    opacity: 0;
}

@keyframes cellarTextFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cellar-ornament {
    width: 100%;
    max-width: 200px;
    height: auto;
    animation: ornamentDraw 1s ease-in-out 0.3s forwards;
    opacity: 0;
}

@keyframes ornamentDraw {
    from {
        opacity: 0;
        stroke-dashoffset: 100;
    }
    to {
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

/* Pollinators (Bees/Butterflies) */
.pollinators {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

.pollinator {
    position: fixed;
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.pollinator-1 {
    animation: pollinate-path-1 8s var(--ease-organic) infinite;
    offset-path: path('M 90 160 C 290 70, 420 310, 650 210 S 940 120, 1110 380');
    offset-rotate: auto;
}

.pollinator-2 {
    animation: pollinate-path-2 12s var(--ease-organic) infinite;
    offset-path: path('M 1080 220 C 840 420, 610 210, 390 370 S 170 510, 90 300');
    offset-rotate: auto;
}

.pollinator-3 {
    animation: pollinate-path-3 15s var(--ease-organic) infinite;
    offset-path: path('M 540 560 C 720 350, 250 310, 420 190 S 850 230, 920 520');
    offset-rotate: auto;
}

@keyframes pollinate-path-1 {
    0% { left: 10%; top: 20%; offset-distance: 0%; }
    22%, 28% { left: 40%; top: 35%; offset-distance: 28%; }
    50% { left: 60%; top: 25%; offset-distance: 55%; }
    72%, 78% { left: 30%; top: 55%; offset-distance: 78%; }
    100% { left: 10%; top: 20%; offset-distance: 100%; }
}

@keyframes pollinate-path-2 {
    0% { left: 80%; top: 30%; offset-distance: 0%; }
    24%, 30% { left: 50%; top: 45%; offset-distance: 30%; }
    50% { left: 25%; top: 40%; offset-distance: 55%; }
    74%, 80% { left: 70%; top: 60%; offset-distance: 82%; }
    100% { left: 80%; top: 30%; offset-distance: 100%; }
}

@keyframes pollinate-path-3 {
    0% { left: 45%; top: 60%; offset-distance: 0%; }
    25% { left: 70%; top: 40%; offset-distance: 25%; }
    48%, 54% { left: 35%; top: 30%; offset-distance: 56%; }
    75% { left: 20%; top: 50%; offset-distance: 78%; }
    100% { left: 45%; top: 60%; offset-distance: 100%; }
}

/* Global Transitions */
a, button, input, select, textarea {
    transition: all 0.3s var(--ease-smooth);
}

/* Print Styles */
@media print {
    body::before {
        display: none;
    }
    .pollinators,
    .panel-thumbnails {
        display: none;
    }
}
