/* ============================================
   luminescence.dev - Styles
   Swiss + Bioluminescent Botanical Design
   ============================================ */

/* CSS Custom Properties */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

:root {
    --deep-night: #0A0E27;
    --emerald-glow: #00E89D;
    --sapphire-depth: #1B3A8C;
    --ruby-pulse: #C4244A;
    --amethyst-mist: #8B7BB5;
    --topaz-warmth: #E8A838;
    --bone-white: #F0EDE4;
    --twilight-gray: #3A3F5C;
    --border-angle: 0deg;
}

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

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

body {
    background-color: var(--deep-night);
    color: var(--bone-white);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ============================================
   Luminous Spine - Scroll Progress
   ============================================ */
#luminous-spine {
    position: fixed;
    left: calc(100% / 12);
    top: 0;
    width: 1px;
    height: 100vh;
    background: rgba(0, 232, 157, 0.1);
    z-index: 100;
    pointer-events: none;
}

#spine-fill {
    width: 100%;
    height: 0%;
    background: var(--emerald-glow);
    box-shadow: 0 0 8px var(--emerald-glow), 0 0 20px rgba(0, 232, 157, 0.3);
    transition: height 0.1s linear;
    animation: spinePulse 3s ease-in-out infinite;
}

@keyframes spinePulse {
    0%, 100% { opacity: 0.7; box-shadow: 0 0 8px var(--emerald-glow), 0 0 20px rgba(0, 232, 157, 0.3); }
    50% { opacity: 1; box-shadow: 0 0 12px var(--emerald-glow), 0 0 30px rgba(0, 232, 157, 0.5); }
}

/* ============================================
   Panels - Full Viewport Sections
   ============================================ */
.panel {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    padding: 60px calc(100% / 12 + 40px) 60px 60px;
    z-index: 2;
}

/* ============================================
   Typography
   ============================================ */
h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--bone-white);
}

h1 {
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    line-height: 1.05;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.15;
    margin-bottom: 0.6em;
    letter-spacing: 0.02em;
}

/* Variable weight breathing animation */
[data-breathe] {
    animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { font-weight: 380; }
    50% { font-weight: 420; }
}

[data-breathe]:hover {
    animation: none;
    font-weight: 600;
    transition: font-weight 400ms ease;
}

.specimen-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--amethyst-mist);
    display: block;
    margin-bottom: 0.8em;
}

p {
    margin-bottom: 1.2em;
    color: var(--bone-white);
}

/* ============================================
   Border Animation System
   ============================================ */
@keyframes borderRotate {
    0% { --border-angle: 0deg; }
    100% { --border-angle: 360deg; }
}

[data-border-animate] {
    border: 1px solid var(--twilight-gray);
    position: relative;
    animation: borderRotate 8s linear infinite;
    border-image: conic-gradient(from var(--border-angle), #00E89D, #1B3A8C, #8B7BB5, #C4244A, #E8A838, #00E89D) 1;
}

/* Border draw-in effect */
[data-border-animate].in-view {
    animation: borderRotate 8s linear infinite, borderDrawIn 1.2s ease-out forwards;
}

@keyframes borderDrawIn {
    0% { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
    25% { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); }
    50% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 0); }
    75% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
    100% { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
}

/* ============================================
   Panel 1: Genesis
   ============================================ */
#panel-genesis {
    background: radial-gradient(ellipse at center, rgba(27, 58, 140, 0.15) 0%, var(--deep-night) 70%);
}

.genesis-word-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 80vh;
}

.genesis-title {
    font-size: clamp(3.5rem, 10vw, 8rem);
    letter-spacing: 0.06em;
    text-align: center;
    position: relative;
    z-index: 3;
    text-shadow: 0 0 40px rgba(0, 232, 157, 0.15), 0 0 80px rgba(27, 58, 140, 0.1);
}

.anglerfish-svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 800px;
    height: auto;
    z-index: 2;
    opacity: 0.85;
    pointer-events: none;
}

.genesis-radial-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 232, 157, 0.08) 0%, rgba(27, 58, 140, 0.05) 40%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    animation: glowPulse 6s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
}

/* ============================================
   SVG Drawing Animation
   ============================================ */
.draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0;
}

.draw-path.animate-draw {
    opacity: 1;
}

.draw-path.primary-draw.animate-draw {
    animation: drawStroke 800ms ease-out forwards;
}

.draw-path.detail-draw.animate-draw {
    animation: drawStroke 600ms ease-out forwards;
    animation-delay: 400ms;
    stroke-dashoffset: 1000;
}

.stipple-dot.animate-draw {
    animation: fadeInDot 300ms ease-out forwards;
    animation-delay: 1000ms;
}

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

@keyframes fadeInDot {
    to {
        opacity: 0.8;
    }
}

/* ============================================
   Panel 2: Taxonomy
   ============================================ */
#panel-taxonomy {
    background: var(--deep-night);
}

.taxonomy-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    padding-top: 80px;
    padding-bottom: 80px;
    position: relative;
}

.taxonomy-block {
    padding: 32px;
    background: rgba(10, 14, 39, 0.8);
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

.taxonomy-block h2 {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
    margin-bottom: 0.5em;
}

.taxonomy-block p {
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.72;
    color: rgba(240, 237, 228, 0.85);
}

.taxonomy-firefly {
    position: absolute;
    right: -40px;
    top: 60px;
    width: 180px;
    height: 180px;
    opacity: 0.7;
    pointer-events: none;
    z-index: 3;
}

.taxonomy-mushroom {
    position: absolute;
    left: -30px;
    bottom: 80px;
    width: 160px;
    height: 160px;
    opacity: 0.7;
    pointer-events: none;
    z-index: 3;
}

/* ============================================
   Panel 3: Spectrum
   ============================================ */
#panel-spectrum {
    background: var(--deep-night);
}

.spectrum-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    padding-top: 60px;
    padding-bottom: 60px;
}

.spectrum-title {
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
}

.spectrum-band {
    display: flex;
    width: 100%;
    gap: 0;
    height: 60vh;
    min-height: 400px;
}

.spectrum-swatch {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: flex 0.5s ease;
}

.spectrum-swatch:hover {
    flex: 1.5;
}

.swatch-emerald { background: rgba(0, 232, 157, 0.08); }
.swatch-sapphire { background: rgba(27, 58, 140, 0.12); }
.swatch-ruby { background: rgba(196, 36, 74, 0.08); }
.swatch-amethyst { background: rgba(139, 123, 181, 0.08); }
.swatch-topaz { background: rgba(232, 168, 56, 0.08); }

.swatch-organism {
    width: 100%;
    max-width: 140px;
    height: auto;
    margin-bottom: 20px;
}

.swatch-hex {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--amethyst-mist);
    margin-top: 8px;
}

/* ============================================
   Panel 4: Field Notes
   ============================================ */
#panel-fieldnotes {
    background: var(--deep-night);
}

.fieldnotes-layout {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 48px;
    padding-top: 80px;
    padding-bottom: 80px;
    align-items: start;
}

.fieldnotes-main h2 {
    font-size: clamp(2rem, 4vw, 3.5rem);
    margin-bottom: 0.3em;
}

.fieldnotes-date {
    margin-bottom: 2em;
}

.fieldnotes-main p {
    margin-bottom: 1.5em;
    color: rgba(240, 237, 228, 0.9);
}

.fieldnotes-main p em,
.fieldnotes-main p i {
    color: var(--amethyst-mist);
    font-style: italic;
}

.fieldnotes-margin {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-top: 60px;
}

.margin-note {
    padding: 20px;
    background: rgba(10, 14, 39, 0.6);
}

.margin-sketch {
    width: 100%;
    max-width: 150px;
    height: auto;
    margin: 10px auto;
    display: block;
}

.margin-caption {
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(240, 237, 228, 0.7);
    margin-bottom: 0;
}

/* ============================================
   Panel 5: Afterglow
   ============================================ */
#panel-afterglow {
    background: var(--deep-night);
}

.afterglow-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 30px;
    text-align: center;
}

.afterglow-domain {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    letter-spacing: 0.08em;
    color: var(--bone-white);
    opacity: 0.9;
    margin-bottom: 0;
}

.afterglow-whisper {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    letter-spacing: 0.12em;
    color: var(--bone-white);
    opacity: 0.4;
    margin-bottom: 0;
}

.afterglow-whisper.faint {
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    opacity: 0.2;
}

.afterglow-whisper.faintest {
    font-size: clamp(0.5rem, 0.7vw, 0.7rem);
    opacity: 0.08;
}

/* ============================================
   Firefly Particle System
   ============================================ */
.fireflies {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.firefly {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.firefly-emerald {
    background: radial-gradient(circle, rgba(0, 232, 157, 1) 0%, rgba(0, 232, 157, 0.4) 40%, transparent 70%);
}

.firefly-topaz {
    background: radial-gradient(circle, rgba(232, 168, 56, 1) 0%, rgba(232, 168, 56, 0.4) 40%, transparent 70%);
}

/* Firefly drift animations - unique paths */
@keyframes fireflyDrift1 {
    0% { transform: translate(0, 0); opacity: 0.2; }
    25% { transform: translate(40px, -60px); opacity: 0.9; }
    50% { transform: translate(-20px, -30px); opacity: 0.3; }
    75% { transform: translate(60px, 20px); opacity: 0.8; }
    100% { transform: translate(0, 0); opacity: 0.2; }
}

@keyframes fireflyDrift2 {
    0% { transform: translate(0, 0); opacity: 0.5; }
    20% { transform: translate(-50px, 30px); opacity: 0.2; }
    40% { transform: translate(-80px, -20px); opacity: 0.9; }
    60% { transform: translate(-30px, -50px); opacity: 0.4; }
    80% { transform: translate(20px, -10px); opacity: 0.7; }
    100% { transform: translate(0, 0); opacity: 0.5; }
}

@keyframes fireflyDrift3 {
    0% { transform: translate(0, 0); opacity: 0.7; }
    33% { transform: translate(70px, 40px); opacity: 0.2; }
    66% { transform: translate(-40px, 60px); opacity: 0.9; }
    100% { transform: translate(0, 0); opacity: 0.7; }
}

@keyframes fireflyDrift4 {
    0% { transform: translate(0, 0); opacity: 0.3; }
    15% { transform: translate(-30px, -70px); opacity: 0.8; }
    45% { transform: translate(50px, -40px); opacity: 0.2; }
    70% { transform: translate(20px, 30px); opacity: 0.9; }
    100% { transform: translate(0, 0); opacity: 0.3; }
}

@keyframes fireflyDrift5 {
    0% { transform: translate(0, 0); opacity: 0.6; }
    30% { transform: translate(80px, -20px); opacity: 0.2; }
    60% { transform: translate(40px, 50px); opacity: 0.8; }
    100% { transform: translate(0, 0); opacity: 0.6; }
}

@keyframes fireflyDrift6 {
    0% { transform: translate(0, 0); opacity: 0.4; }
    25% { transform: translate(-60px, 50px); opacity: 0.9; }
    50% { transform: translate(-20px, -40px); opacity: 0.2; }
    75% { transform: translate(40px, -20px); opacity: 0.7; }
    100% { transform: translate(0, 0); opacity: 0.4; }
}

@keyframes fireflyDrift7 {
    0% { transform: translate(0, 0); opacity: 0.8; }
    20% { transform: translate(30px, 70px); opacity: 0.3; }
    50% { transform: translate(-50px, 30px); opacity: 0.9; }
    80% { transform: translate(-10px, -30px); opacity: 0.2; }
    100% { transform: translate(0, 0); opacity: 0.8; }
}

@keyframes fireflyDrift8 {
    0% { transform: translate(0, 0); opacity: 0.5; }
    35% { transform: translate(-70px, -50px); opacity: 0.9; }
    65% { transform: translate(30px, -80px); opacity: 0.3; }
    100% { transform: translate(0, 0); opacity: 0.5; }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .taxonomy-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .fieldnotes-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .fieldnotes-margin {
        padding-top: 0;
    }

    .spectrum-band {
        height: auto;
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .panel-content {
        padding: 40px 24px 40px calc(100% / 12 + 24px);
    }

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

    .taxonomy-firefly,
    .taxonomy-mushroom {
        display: none;
    }

    .spectrum-band {
        flex-direction: column;
        height: auto;
    }

    .spectrum-swatch {
        padding: 30px 20px;
    }

    .spectrum-swatch:hover {
        flex: 1;
    }

    .genesis-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .anglerfish-svg {
        width: 90%;
    }

    .fieldnotes-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .panel-content {
        padding: 30px 16px 30px calc(100% / 12 + 16px);
    }

    .genesis-title {
        font-size: clamp(2rem, 14vw, 3.5rem);
        letter-spacing: 0.03em;
    }
}
