/* ===========================================
   lunar.bar - Moonlit Botanical Greenhouse
   =========================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0b2618;
    color: #c8e6c9;
    font-family: 'Alegreya', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    cursor: crosshair;
    overflow-x: hidden;
    position: relative;
}

/* --- Greenhouse Glass Texture Overlay --- */
#glass-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 120px,
        rgba(125, 184, 143, 0.03) 120px,
        rgba(125, 184, 143, 0.03) 121px
    );
}

/* --- Scroll Progress Line --- */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 2px;
    height: 0%;
    background-color: #7db88f;
    z-index: 1000;
    transition: height 0.1s linear;
}

/* --- Moon Phase Indicator --- */
#moon-phase {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    opacity: 0.9;
}

#moon-shadow {
    transition: clip-path 0.3s ease;
}

/* --- Fireflies --- */
#fireflies {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.firefly {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #f0e68c;
    box-shadow: 0 0 8px 2px rgba(240, 230, 140, 0.4);
    opacity: 0;
    animation: fireflyGlow var(--glow-duration, 4s) ease-in-out infinite,
               fireflyDrift var(--drift-duration, 12s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes fireflyGlow {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.8; }
}

@keyframes fireflyDrift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(var(--dx1, 30px), var(--dy1, -20px)); }
    50% { transform: translate(var(--dx2, -10px), var(--dy2, 15px)); }
    75% { transform: translate(var(--dx3, 20px), var(--dy3, -30px)); }
    100% { transform: translate(0, 0); }
}

/* --- Typography --- */
.section-heading {
    font-family: 'Zilla Slab', 'Rockwell', serif;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: #e8f5e9;
}

.body-text {
    font-family: 'Alegreya', Georgia, serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #c8e6c9;
    max-width: 65ch;
    margin-bottom: 1.25em;
}

.specimen-label {
    font-family: 'Overpass Mono', 'Courier New', monospace;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #7db88f;
    display: block;
    margin-bottom: 8px;
}

/* --- Zoom Focus Animation --- */
.zoom-focus {
    opacity: 0;
    transform: scale(1.8);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-focus.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- Hero Title Character Animation --- */
#hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: scale(2.5);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#hero-title .char.visible {
    opacity: 1;
    transform: scale(1);
}

/* --- SVG Path Drawing --- */
.draw-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 2.5s ease-out;
}

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

/* ===========================================
   SECTION: CANOPY (Hero)
   =========================================== */
.section-canopy {
    position: relative;
    height: 100vh;
    background-color: #0b2618;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 3;
}

.bg-fern {
    position: absolute;
    opacity: 0.08;
    z-index: 0;
    animation: fernSway 12s ease-in-out infinite;
}

.fern-1 {
    width: 200px;
    top: 5%;
    left: 5%;
    animation-delay: 0s;
}

.fern-2 {
    width: 180px;
    top: 10%;
    right: 8%;
    animation-delay: -3s;
    transform: scaleX(-1);
}

.fern-3 {
    width: 150px;
    bottom: 15%;
    left: 15%;
    animation-delay: -6s;
}

.fern-4 {
    width: 250px;
    top: 20%;
    right: 20%;
    animation-delay: -2s;
}

.fern-5 {
    width: 160px;
    bottom: 10%;
    right: 5%;
    animation-delay: -8s;
    transform: scaleX(-1);
}

@keyframes fernSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1.5deg); }
    75% { transform: rotate(-1.5deg); }
}

.fern-2 {
    animation-name: fernSwayFlipped;
}

.fern-5 {
    animation-name: fernSwayFlipped;
}

@keyframes fernSwayFlipped {
    0%, 100% { transform: scaleX(-1) rotate(0deg); }
    25% { transform: scaleX(-1) rotate(1.5deg); }
    75% { transform: scaleX(-1) rotate(-1.5deg); }
}

.hero-content {
    position: relative;
    z-index: 5;
    text-align: center;
    margin-top: 23.6vh;
}

#hero-title {
    font-family: 'Zilla Slab', 'Rockwell', serif;
    font-size: clamp(48px, 10vw, 96px);
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: #e8f5e9;
    margin-bottom: 24px;
}

.hero-tagline {
    font-family: 'Overpass Mono', 'Courier New', monospace;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #7db88f;
}

/* ===========================================
   BREATHING STRIPS
   =========================================== */
.breathing-strip {
    height: 200px;
    background-color: #0b2618;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 3;
}

.breathing-fern {
    width: 100%;
    height: 60px;
    opacity: 0.5;
}

/* ===========================================
   SECTION: UPPER CANOPY
   =========================================== */
.section-upper-canopy {
    background-color: #0b2618;
    padding: 120px 0;
    position: relative;
    z-index: 3;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
}

.content-block {
    position: relative;
    padding: 48px;
    padding-left: 56px;
}

.block-border {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background-color: #2e7d4f;
    transition: height 0.8s ease-out;
}

.content-block.visible .block-border {
    height: 100%;
}

.block-left {
    grid-column: 2 / 7;
    margin-bottom: 80px;
}

.block-right {
    grid-column: 6 / 12;
    margin-bottom: 80px;
}

.block-center {
    grid-column: 3 / 9;
    margin-bottom: 40px;
}

.section-heading {
    font-size: clamp(32px, 4vw, 48px);
    margin-bottom: 24px;
}

.botanical-illustration {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 40px 0;
    margin-bottom: 60px;
}

.illustration-monstera svg {
    width: 250px;
    height: 250px;
}

.illustration-fern-detail svg {
    width: 400px;
    height: 200px;
}

/* ===========================================
   PATTERN BANDS
   =========================================== */
.pattern-band {
    height: 60px;
    position: relative;
    z-index: 3;
}

.batik-pattern {
    background-color: #0b2618;
    background-image:
        repeating-linear-gradient(
            135deg,
            transparent,
            transparent 20px,
            rgba(201, 168, 76, 0.08) 20px,
            rgba(201, 168, 76, 0.08) 21px
        ),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 20px,
            rgba(201, 168, 76, 0.08) 20px,
            rgba(201, 168, 76, 0.08) 21px
        );
}

.celadon-pattern {
    background-color: #0b2618;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 30%, rgba(201, 168, 76, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 80%, rgba(201, 168, 76, 0.04) 0%, transparent 40%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 15px,
            rgba(201, 168, 76, 0.05) 15px,
            rgba(201, 168, 76, 0.05) 16px
        );
}

/* ===========================================
   SECTION: MID-CANOPY (Specimen Cards)
   =========================================== */
.section-mid-canopy {
    background-color: #1b3a2a;
    padding: 120px 40px;
    position: relative;
    z-index: 3;
}

.mid-heading {
    text-align: center;
    font-size: clamp(36px, 5vw, 64px);
    margin-bottom: 80px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 0;
    max-width: 1200px;
    margin: 0 auto;
}

.specimen-card {
    border: 1px solid #3e2723;
    padding: 32px;
    margin: -8px;
    position: relative;
    background-color: #1b3a2a;
    transition: border-color 0.4s ease;
}

.specimen-card:hover {
    border-color: #c9a84c;
}

.specimen-card:hover .specimen-label {
    color: #f0e68c;
    transition: color 0.4s ease;
}

.specimen-name {
    font-family: 'Zilla Slab', 'Rockwell', serif;
    font-weight: 700;
    font-size: 24px;
    color: #e8f5e9;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.specimen-desc {
    font-family: 'Alegreya', Georgia, serif;
    font-size: 16px;
    line-height: 1.7;
    color: #c8e6c9;
}

/* ===========================================
   SECTION: FLOOR
   =========================================== */
.section-floor {
    background: linear-gradient(to bottom, #1b3a2a, #0b2618);
    padding: 120px 40px 160px;
    position: relative;
    z-index: 3;
    min-height: 100vh;
}

.floor-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 80px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.floor-illustration {
    flex: 0 0 auto;
    width: 60%;
    max-width: 500px;
}

.cereus-flower {
    width: 100%;
    height: auto;
}

.floor-text {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
}

.floor-heading {
    font-size: clamp(36px, 5vw, 64px);
    margin-bottom: 32px;
}

.floor-closing {
    font-style: italic;
    color: #7db88f;
}

.floor-label {
    margin-top: 48px;
    color: #c9a84c;
}

/* ===========================================
   KARAKUSA LEFT MARGIN PATTERN
   =========================================== */
body::before {
    content: '';
    position: fixed;
    left: 8px;
    top: 0;
    width: 20px;
    height: 100%;
    z-index: 999;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            180deg,
            transparent,
            transparent 40px,
            rgba(125, 184, 143, 0.06) 40px,
            rgba(125, 184, 143, 0.06) 42px
        ),
        repeating-linear-gradient(
            160deg,
            transparent,
            transparent 30px,
            rgba(201, 168, 76, 0.04) 30px,
            rgba(201, 168, 76, 0.04) 31px
        );
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 768px) {
    .block-left,
    .block-right,
    .block-center {
        grid-column: 1 / -1;
    }

    .content-block {
        padding: 32px;
        padding-left: 40px;
    }

    .floor-content {
        flex-direction: column;
        gap: 40px;
    }

    .floor-illustration {
        width: 80%;
    }

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

    .specimen-card {
        margin: -4px 0;
    }

    .grid-container {
        padding: 0 20px;
    }

    .section-mid-canopy {
        padding: 80px 20px;
    }
}
