/* xbom.wiki - Bio-Digital Fae Living Archive */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --woodland-dusk: #1E2318;
    --mossy-shadow: #3A3D2F;
    --honeyed-parchment: #F5EBDA;
    --deep-forest-ink: #2C3024;
    --birch-cream: #F0E6CF;
    --warm-gold: #C4A265;
    --fern-blush: #A8B88C;
    --moth-wing-rose: #D4A89A;
    --dew-glow: #E8D8A0;
    --forest-floor: #161A12;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--woodland-dusk);
    color: var(--deep-forest-ink);
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ===== BACKDROP LAYER (z-0) ===== */
.backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    will-change: transform;
}

.hex-grid {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(58, 61, 47, 0.06) 28px, rgba(58, 61, 47, 0.06) 29px),
        repeating-linear-gradient(60deg, transparent, transparent 28px, rgba(58, 61, 47, 0.06) 28px, rgba(58, 61, 47, 0.06) 29px),
        repeating-linear-gradient(120deg, transparent, transparent 28px, rgba(58, 61, 47, 0.06) 28px, rgba(58, 61, 47, 0.06) 29px);
}

.fern {
    position: absolute;
    bottom: 0;
    height: 80vh;
    width: auto;
}

.fern-left {
    left: 5%;
}

.fern-right {
    right: 5%;
}

.fern-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1200ms ease-out;
}

.fern-path.revealed {
    stroke-dashoffset: 0;
}

.birch {
    position: absolute;
    top: 0;
    height: 100vh;
}

.birch-left {
    left: 2%;
}

.birch-right {
    right: 3%;
}

.scanning-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--warm-gold) 50%, transparent 100%);
    opacity: 0.08;
    animation: scanDown 30s linear infinite;
}

@keyframes scanDown {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ===== HUD FRAME (z-1) ===== */
.hud-frame {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1500ms ease-out;
}

.hud-frame.visible {
    opacity: 1;
}

.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: var(--warm-gold);
    border-style: solid;
    border-width: 0;
    transition: all 800ms ease-out;
}

.hud-corner-tl {
    top: 16px;
    left: 16px;
    border-top-width: 1px;
    border-left-width: 1px;
}

.hud-corner-tr {
    top: 16px;
    right: 16px;
    border-top-width: 1px;
    border-right-width: 1px;
}

.hud-corner-bl {
    bottom: 16px;
    left: 16px;
    border-bottom-width: 1px;
    border-left-width: 1px;
}

.hud-corner-br {
    bottom: 16px;
    right: 16px;
    border-bottom-width: 1px;
    border-right-width: 1px;
}

.hud-logo {
    position: absolute;
    top: 20px;
    left: 64px;
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--birch-cream);
    letter-spacing: 0.08em;
    pointer-events: auto;
}

.hud-nav {
    position: absolute;
    top: 20px;
    right: 64px;
    display: flex;
    gap: 24px;
    pointer-events: auto;
}

.hud-nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gold);
    opacity: 0.7;
    text-decoration: none;
    transition: opacity 300ms ease, color 300ms ease;
}

.hud-nav-link:hover {
    opacity: 1;
    color: var(--moth-wing-rose);
}

.hud-ticker {
    position: absolute;
    bottom: 20px;
    left: 64px;
    right: 64px;
    height: 18px;
    overflow: hidden;
    pointer-events: none;
}

.ticker-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gold);
    opacity: 0.5;
    white-space: nowrap;
    display: inline-block;
    animation: tickerScroll 40s linear infinite;
}

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

/* ===== MOTH ANIMATIONS ===== */
.moth {
    position: fixed;
    z-index: 5;
    pointer-events: none;
    transition: opacity 300ms ease;
}

.moth-hero {
    width: 60px;
    height: 40px;
    top: 20%;
    left: -60px;
    animation: mothDrift 25s ease-in-out infinite;
}

@keyframes mothDrift {
    0% { left: -60px; top: 20%; transform: rotate(-5deg); }
    25% { left: 30%; top: 15%; transform: rotate(3deg); }
    50% { left: 60%; top: 25%; transform: rotate(-2deg); }
    75% { left: 80%; top: 18%; transform: rotate(4deg); }
    100% { left: 110%; top: 22%; transform: rotate(-5deg); }
}

.moth-specimen-1 {
    width: 40px;
    height: 28px;
    top: 40%;
    right: 8%;
    animation: mothFloat1 120s linear infinite;
}

.moth-specimen-2 {
    width: 35px;
    height: 24px;
    top: 65%;
    left: 6%;
    animation: mothFloat2 120s linear infinite;
}

@keyframes mothFloat1 {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes mothFloat2 {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(-360deg); }
}

.moth-canopy {
    width: 80px;
    height: 56px;
    position: absolute;
    top: 30%;
    left: 50%;
    z-index: 2;
    animation: mothFigureEight 20s ease-in-out infinite;
}

@keyframes mothFigureEight {
    0% { transform: translate(-50%, 0) rotate(0deg); }
    25% { transform: translate(calc(-50% + 100px), -60px) rotate(5deg); }
    50% { transform: translate(-50%, 0) rotate(0deg); }
    75% { transform: translate(calc(-50% - 100px), 60px) rotate(-5deg); }
    100% { transform: translate(-50%, 0) rotate(0deg); }
}

.moth:hover {
    opacity: 0.8;
}

.moth:hover path {
    transform: scaleX(1.05);
    transform-origin: center;
}

/* ===== DEWDROPS ===== */
.dewdrop {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.dew-1 {
    width: 12px;
    height: 12px;
    top: 30%;
    left: 20%;
    background: radial-gradient(circle, var(--dew-glow) 0%, transparent 70%);
}

.dew-2 {
    width: 8px;
    height: 8px;
    top: 60%;
    right: 25%;
    background: radial-gradient(circle, var(--dew-glow) 0%, transparent 70%);
}

.dew-3 {
    width: 16px;
    height: 16px;
    top: 75%;
    left: 45%;
    background: radial-gradient(circle, var(--dew-glow) 0%, transparent 70%);
}

/* ===== SCENES ===== */
.scene {
    position: relative;
    z-index: 2;
    min-height: 100vh;
}

/* Scene 1: The Clearing */
.scene-clearing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.clearing-content {
    text-align: center;
    max-width: 800px;
    padding: 0 48px;
}

.site-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5.5rem);
    color: var(--birch-cream);
    letter-spacing: 0.04em;
    line-height: 1.15;
    margin-bottom: 24px;
    min-height: 1.2em;
}

.site-title .char {
    display: inline-block;
    opacity: 0;
    animation: charReveal 100ms ease-out forwards;
}

@keyframes charReveal {
    to { opacity: 1; }
}

.tagline {
    font-family: 'Source Sans 3', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--birch-cream);
    opacity: 0;
    transition: opacity 800ms ease-out;
    line-height: 1.72;
}

.tagline.visible {
    opacity: 0.85;
}

/* Scene 2: Specimen Cases */
.scene-specimens {
    padding: 80px 0 120px;
}

/* ===== CONTENT PANELS ===== */
.content-panel {
    position: relative;
    max-width: 720px;
    background: rgba(245, 235, 218, 0.88);
    border: 1px solid var(--warm-gold);
    border-radius: 12px;
    padding: 48px 40px;
    margin-bottom: 80px;
    box-shadow: 0 8px 32px rgba(168, 132, 72, 0.10);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 500ms cubic-bezier(0.33, 0, 0.2, 1), transform 500ms cubic-bezier(0.33, 0, 0.2, 1), border-color 300ms ease;
}

.content-panel.revealed {
    opacity: 1;
    transform: translateY(0);
}

.content-panel:hover {
    border-color: var(--moth-wing-rose);
}

.panel-left {
    margin-left: 10%;
    margin-right: auto;
}

.panel-right {
    margin-right: 10%;
    margin-left: auto;
}

.panel-center {
    margin-left: auto;
    margin-right: auto;
}

.content-panel h2 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--deep-forest-ink);
    letter-spacing: 0.04em;
    line-height: 1.15;
    margin-bottom: 20px;
}

.content-panel p {
    margin-bottom: 16px;
    color: var(--deep-forest-ink);
}

.content-panel p:last-of-type {
    margin-bottom: 0;
}

/* Pressed Flower Specimens */
.pressed-flower {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 80px;
    height: 80px;
}

/* ===== ANNOTATION BADGES ===== */
.annotation-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(245, 235, 218, 0.92);
    border: 1px solid var(--warm-gold);
    border-radius: 20px;
    cursor: pointer;
    position: relative;
    transition: transform 600ms ease-out, background 300ms ease;
    margin-bottom: 16px;
}

.annotation-badge:hover {
    transform: scale(1.08);
    background: rgba(232, 216, 160, 0.3);
}

.badge-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gold);
}

.badge-connector {
    position: absolute;
    top: 50%;
    right: -30px;
    width: 24px;
    height: 1px;
    background: repeating-linear-gradient(90deg, var(--warm-gold) 0px, var(--warm-gold) 4px, transparent 4px, transparent 6px);
    opacity: 0.5;
}

.annotation-badge .tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: rgba(245, 235, 218, 0.95);
    border: 1px solid var(--moth-wing-rose);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.85rem;
    color: var(--deep-forest-ink);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease-out, transform 200ms ease-out;
    box-shadow: 0 4px 16px rgba(168, 132, 72, 0.12);
    z-index: 20;
}

.annotation-badge .tooltip.active {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
    pointer-events: auto;
}

/* Birch Bark Separators */
.birch-separator {
    height: 4px;
    background: repeating-linear-gradient(90deg, var(--honeyed-parchment) 0px, var(--honeyed-parchment) 2px, var(--birch-cream) 2px, var(--birch-cream) 4px);
    margin: 40px 10%;
    opacity: 0.3;
}

/* Scene 3: The Canopy View */
.scene-canopy {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

.pull-quote {
    max-width: 700px;
    padding: 32px 40px 32px 40px;
    border-left: 3px solid var(--moth-wing-rose);
    margin: 0 48px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 500ms cubic-bezier(0.33, 0, 0.2, 1), transform 500ms cubic-bezier(0.33, 0, 0.2, 1);
}

.pull-quote.revealed {
    opacity: 1;
    transform: translateY(0);
}

.pull-quote p {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--birch-cream);
    line-height: 1.5;
    letter-spacing: 0.02em;
}

/* Scene 4: The Root Network */
.scene-roots {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 80px 48px;
    background: linear-gradient(180deg, transparent 0%, rgba(22, 26, 18, 0.4) 100%);
}

.panel-closing {
    text-align: center;
}

.root-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.root-link {
    text-decoration: none;
    cursor: pointer;
}

.root-link:hover .badge-text {
    color: var(--moth-wing-rose);
}

.closing-timestamp {
    margin-top: 60px;
    opacity: 0;
    transition: opacity 1000ms ease-out;
}

.closing-timestamp.visible {
    opacity: 1;
}

.mono-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-gold);
    opacity: 0.6;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .panel-left,
    .panel-right {
        margin-left: 24px;
        margin-right: 24px;
    }

    .content-panel {
        padding: 36px 28px;
    }

    .hud-nav {
        display: none;
    }

    .hud-logo {
        left: 40px;
    }

    .hud-ticker {
        left: 40px;
        right: 40px;
    }

    .hud-corner-tl,
    .hud-corner-bl {
        left: 8px;
    }

    .hud-corner-tr,
    .hud-corner-br {
        right: 8px;
    }

    .moth-hero {
        width: 40px;
    }

    .pressed-flower {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .clearing-content {
        padding: 0 24px;
    }

    .pull-quote {
        margin: 0 24px;
        padding: 24px 20px 24px 20px;
    }

    .scene-roots {
        padding: 60px 24px;
    }
}
