/* ============================================
   lovebot.dev - Techno-Pastoral Formalism
   Fairycore x Artificial Intelligence
   ============================================ */

/* CSS Custom Properties */
:root {
    /* Palette - Muted Vintage Enchantment */
    --bg-primary: #F4EDE4;         /* Parchment Mist */
    --bg-secondary: #E8DFD2;       /* Moth Wing */
    --text-primary: #4A3728;       /* Deep Bark */
    --text-secondary: #5C4A3E;     /* Warm Umber */
    --accent-primary: #9B7EA6;     /* Dried Lavender */
    --accent-secondary: #C4928B;   /* Faded Rose */
    --utility-green: #6B8F71;      /* Lichen Green */
    --utility-dark: #3D3A4A;       /* Twilight Slate */
    --subtle: #8B7D6B;             /* Sage Mist */
    --highlight: #7BA3B8;          /* Bioluminescent Blue */

    /* Signature Gradient */
    --iridescent: linear-gradient(135deg, #9B7EA6 0%, #C4928B 40%, #7BA3B8 100%);

    /* Typography Sizes */
    --heading-size: clamp(2.2rem, 4.5vw, 3.8rem);
    --body-size: clamp(1.05rem, 1.8vw, 1.25rem);
    --meta-size: 0.75rem;
    --code-size: 0.9rem;
}

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

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

body {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: var(--body-size);
    line-height: 1.72;
    color: var(--text-secondary);
    background: linear-gradient(
        to bottom,
        var(--bg-primary) 0%,
        var(--bg-primary) 20%,
        var(--bg-secondary) 50%,
        color-mix(in srgb, var(--utility-dark) 15%, var(--bg-secondary)) 85%,
        color-mix(in srgb, var(--utility-dark) 22%, var(--bg-secondary)) 100%
    );
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ============================================
   Typography
   ============================================ */

h1, h2, h3 {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.15;
    font-variant-ligatures: common-ligatures;
}

h1 {
    font-size: var(--heading-size);
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
}

.meta-label {
    font-family: 'Libre Franklin', 'Helvetica Neue', sans-serif;
    font-weight: 300;
    font-size: var(--meta-size);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--subtle);
    display: block;
    margin-bottom: 1.2rem;
}

.body-text {
    margin-bottom: 1.4rem;
    max-width: 600px;
}

/* Text Breath Animation */
.text-breath {
    animation: textBreath 8s ease-in-out infinite;
}

@keyframes textBreath {
    0%, 100% { letter-spacing: 0em; }
    50% { letter-spacing: 0.003em; }
}

/* Links */
a {
    color: var(--accent-primary);
    text-decoration: none;
    position: relative;
    display: inline-block;
}

a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--iridescent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 300ms ease-out;
}

a:hover::after {
    transform: scaleX(1);
}

/* Code Blocks */
.code-block {
    font-family: 'Inconsolata', 'Courier New', monospace;
    font-weight: 400;
    font-size: var(--code-size);
    color: var(--utility-green);
    background: rgba(107, 143, 113, 0.08);
    padding: 1.2rem 1.6rem;
    border-radius: 4px;
    margin-top: 1.5rem;
    border-left: 2px solid rgba(107, 143, 113, 0.25);
}

.code-block code {
    display: block;
    line-height: 1.7;
    font-family: inherit;
}

/* ============================================
   Section Layout - Mycelial Grid
   ============================================ */

.section {
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}

.section-grid {
    display: contents;
}

/* ============================================
   Section 1: The Canopy
   ============================================ */

.section-canopy {
    align-items: center;
    align-content: center;
    padding-top: 8vh;
    padding-bottom: 4vh;
}

.canopy-statement {
    grid-column: 2 / 7;
    grid-row: 1;
    z-index: 2;
}

.canopy-heading {
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
}

.canopy-body {
    max-width: 480px;
    font-size: var(--body-size);
    line-height: 1.72;
}

.canopy-orbs {
    grid-column: 8 / 12;
    grid-row: 1;
    position: relative;
    min-height: 300px;
    align-self: end;
}

.orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    animation: orbDrift 20s ease-in-out infinite;
}

.orb-1 { width: 18px; height: 18px; top: 60%; left: 20%; animation-duration: 22s; animation-delay: 0s; }
.orb-2 { width: 14px; height: 14px; top: 40%; left: 50%; animation-duration: 18s; animation-delay: -4s; }
.orb-3 { width: 20px; height: 20px; top: 75%; left: 70%; animation-duration: 25s; animation-delay: -8s; }
.orb-4 { width: 12px; height: 12px; top: 30%; left: 80%; animation-duration: 20s; animation-delay: -12s; }
.orb-5 { width: 16px; height: 16px; top: 85%; left: 40%; animation-duration: 23s; animation-delay: -6s; }

@keyframes orbDrift {
    0% { transform: translate(0, 0); opacity: 0.4; }
    25% { transform: translate(15px, -20px); opacity: 0.7; }
    50% { transform: translate(-10px, -35px); opacity: 0.5; }
    75% { transform: translate(20px, -15px); opacity: 0.8; }
    100% { transform: translate(0, 0); opacity: 0.4; }
}

/* Scroll Chevron */
.scroll-chevron {
    grid-column: 6 / 8;
    grid-row: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 2rem;
    animation: chevronPulse 2.5s ease-in-out infinite;
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
}

.chevron-line {
    width: 18px;
    height: 2px;
    background: var(--subtle);
    opacity: 0.6;
}

.chevron-left {
    transform: rotate(40deg);
    transform-origin: right center;
}

.chevron-right {
    transform: rotate(-40deg);
    transform-origin: left center;
}

@keyframes chevronPulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) translateY(0); }
    50% { opacity: 0.8; transform: translateX(-50%) translateY(6px); }
}

/* ============================================
   Sections 2-4: The Understory
   ============================================ */

/* Section 2: Content right, card left */
.section-understory-1 .specimen-card {
    grid-column: 2 / 5;
    align-self: center;
}

.section-understory-1 .understory-content {
    grid-column: 6 / 11;
    align-self: center;
}

/* Section 3: Content left, card right */
.section-understory-2 .understory-content {
    grid-column: 2 / 7;
    align-self: center;
}

.section-understory-2 .specimen-card {
    grid-column: 8 / 11;
    align-self: center;
}

/* Section 4: Card left, content right */
.section-understory-3 .specimen-card {
    grid-column: 2 / 5;
    align-self: center;
}

.section-understory-3 .understory-content {
    grid-column: 6 / 11;
    align-self: center;
}

/* Specimen Cards */
.specimen-card {
    aspect-ratio: 3 / 4;
    border: 1px solid rgba(182, 167, 152, 0.3);
    position: relative;
    overflow: hidden;
    max-width: 320px;
    transition: border-color 400ms ease-out, transform 300ms ease-out, box-shadow 300ms ease-out;
}

.specimen-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(155, 126, 166, 0.12);
}

.specimen-card:hover .card-geometric-layer {
    opacity: 0.4;
}

.card-noise-layer {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    filter: url(#noise);
    z-index: 0;
}

.card-geometric-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 1;
    transition: opacity 400ms ease-out;
}

.geo-shape {
    width: 100%;
    height: 100%;
}

.card-lineart-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lineart-svg {
    width: 80%;
    height: 80%;
}

.card-watermark {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 3.5rem;
    color: var(--text-primary);
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
}

/* Understory Content */
.understory-content h2 {
    margin-bottom: 1.2rem;
}

/* Card rotations for scattered field-note feel */
.card-1 {
    transform: rotate(-0.8deg);
}

.card-1:hover {
    transform: rotate(-0.8deg) translateY(-2px);
}

.card-2 {
    transform: rotate(1.2deg);
}

.card-2:hover {
    transform: rotate(1.2deg) translateY(-2px);
}

.card-3 {
    transform: rotate(-0.5deg);
}

.card-3:hover {
    transform: rotate(-0.5deg) translateY(-2px);
}

/* Circuit-Botanical Lines */
.circuit-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 1;
    pointer-events: none;
}

/* ============================================
   Section 5: The Root System
   ============================================ */

.section-roots {
    align-content: center;
    position: relative;
    padding-bottom: 8rem;
}

.root-lines {
    grid-column: 1 / -1;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.root-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    opacity: 0.25;
}

.root-line-1 { top: 8%; background: linear-gradient(90deg, transparent 0%, var(--subtle) 20%, var(--accent-primary) 50%, var(--subtle) 80%, transparent 100%); }
.root-line-2 { top: 18%; background: linear-gradient(90deg, transparent 0%, var(--subtle) 30%, transparent 60%, var(--subtle) 85%, transparent 100%); }
.root-line-3 { top: 31%; background: linear-gradient(90deg, transparent 5%, var(--subtle) 15%, var(--highlight) 45%, transparent 70%); }
.root-line-4 { top: 42%; background: linear-gradient(90deg, transparent 0%, var(--accent-secondary) 25%, var(--subtle) 55%, transparent 100%); }
.root-line-5 { top: 56%; background: linear-gradient(90deg, transparent 10%, var(--subtle) 40%, var(--accent-primary) 65%, transparent 90%); }
.root-line-6 { top: 67%; background: linear-gradient(90deg, transparent 0%, var(--subtle) 20%, transparent 50%, var(--highlight) 75%, transparent 100%); }
.root-line-7 { top: 78%; background: linear-gradient(90deg, transparent 5%, var(--accent-secondary) 30%, var(--subtle) 60%, transparent 85%); }
.root-line-8 { top: 89%; background: linear-gradient(90deg, transparent 0%, var(--subtle) 35%, var(--accent-primary) 55%, transparent 100%); }

.roots-content {
    grid-column: 1 / -1;
    max-width: 380px;
    margin-left: 61.8%;
    transform: translateX(-50%);
    position: relative;
    z-index: 2;
}

.roots-content h2 {
    margin-bottom: 1.2rem;
}

.roots-footer {
    grid-column: 1 / -1;
    text-align: center;
    margin-top: 6rem;
    position: relative;
    z-index: 2;
}

.footer-line {
    width: 60px;
    height: 1px;
    background: var(--iridescent);
    margin: 0 auto 1.5rem;
}

.footer-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    margin-bottom: 0.3rem;
}

.footer-meta {
    font-family: 'Libre Franklin', 'Helvetica Neue', sans-serif;
    font-weight: 300;
    font-size: var(--meta-size);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--subtle);
}

/* ============================================
   Navigation Dots
   ============================================ */

.section-nav {
    position: fixed;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--subtle);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background-color 300ms ease, border-color 300ms ease, transform 300ms ease;
}

.nav-dot.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    animation: navPulse 3s ease-in-out infinite;
}

@keyframes navPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================================
   Firefly System
   ============================================ */

.firefly-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.firefly {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    pointer-events: none;
    animation-timing-function: cubic-bezier(0.4, 0, 0.6, 1);
    transition: opacity 600ms ease, transform 600ms ease;
}

.firefly-1 {
    width: 14px; height: 14px;
    top: 15%; left: 10%;
    animation: fireflyPath1 28s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: 0s;
}

.firefly-2 {
    width: 18px; height: 18px;
    top: 35%; left: 75%;
    animation: fireflyPath2 35s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -5s;
}

.firefly-3 {
    width: 12px; height: 12px;
    top: 55%; left: 30%;
    animation: fireflyPath3 22s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -10s;
}

.firefly-4 {
    width: 16px; height: 16px;
    top: 70%; left: 60%;
    animation: fireflyPath4 30s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -15s;
}

.firefly-5 {
    width: 14px; height: 14px;
    top: 25%; left: 85%;
    animation: fireflyPath5 40s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -20s;
}

.firefly-6 {
    width: 20px; height: 20px;
    top: 80%; left: 15%;
    animation: fireflyPath6 33s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -25s;
}

.firefly-7 {
    width: 15px; height: 15px;
    top: 45%; left: 50%;
    animation: fireflyPath7 26s infinite cubic-bezier(0.4, 0, 0.6, 1);
    animation-delay: -30s;
}

@keyframes fireflyPath1 {
    0% { transform: translate(0, 0); opacity: 0.3; }
    15% { transform: translate(80px, -40px); opacity: 0.6; }
    30% { transform: translate(40px, -100px); opacity: 0.8; }
    50% { transform: translate(120px, -60px); opacity: 0.4; }
    70% { transform: translate(60px, -120px); opacity: 0.7; }
    85% { transform: translate(20px, -30px); opacity: 0.5; }
    100% { transform: translate(0, 0); opacity: 0.3; }
}

@keyframes fireflyPath2 {
    0% { transform: translate(0, 0); opacity: 0.5; }
    20% { transform: translate(-60px, 50px); opacity: 0.8; }
    40% { transform: translate(-100px, 20px); opacity: 0.3; }
    60% { transform: translate(-40px, 80px); opacity: 0.7; }
    80% { transform: translate(-80px, 40px); opacity: 0.5; }
    100% { transform: translate(0, 0); opacity: 0.5; }
}

@keyframes fireflyPath3 {
    0% { transform: translate(0, 0); opacity: 0.6; }
    25% { transform: translate(50px, 30px); opacity: 0.3; }
    50% { transform: translate(-30px, 70px); opacity: 0.8; }
    75% { transform: translate(70px, 50px); opacity: 0.4; }
    100% { transform: translate(0, 0); opacity: 0.6; }
}

@keyframes fireflyPath4 {
    0% { transform: translate(0, 0); opacity: 0.4; }
    20% { transform: translate(-50px, -40px); opacity: 0.7; }
    45% { transform: translate(30px, -80px); opacity: 0.3; }
    65% { transform: translate(-70px, -20px); opacity: 0.8; }
    85% { transform: translate(-20px, -60px); opacity: 0.5; }
    100% { transform: translate(0, 0); opacity: 0.4; }
}

@keyframes fireflyPath5 {
    0% { transform: translate(0, 0); opacity: 0.7; }
    30% { transform: translate(-90px, 60px); opacity: 0.3; }
    55% { transform: translate(-40px, 100px); opacity: 0.6; }
    80% { transform: translate(-100px, 30px); opacity: 0.8; }
    100% { transform: translate(0, 0); opacity: 0.7; }
}

@keyframes fireflyPath6 {
    0% { transform: translate(0, 0); opacity: 0.5; }
    20% { transform: translate(70px, -50px); opacity: 0.8; }
    40% { transform: translate(100px, -20px); opacity: 0.3; }
    60% { transform: translate(40px, -70px); opacity: 0.6; }
    80% { transform: translate(90px, -40px); opacity: 0.7; }
    100% { transform: translate(0, 0); opacity: 0.5; }
}

@keyframes fireflyPath7 {
    0% { transform: translate(0, 0); opacity: 0.4; }
    15% { transform: translate(-30px, -50px); opacity: 0.7; }
    35% { transform: translate(50px, -90px); opacity: 0.5; }
    55% { transform: translate(-20px, -40px); opacity: 0.8; }
    75% { transform: translate(40px, -70px); opacity: 0.3; }
    100% { transform: translate(0, 0); opacity: 0.4; }
}

/* Firefly startled state (applied via JS) */
.firefly.startled {
    opacity: 1 !important;
    transform: scale(1.2) !important;
}

/* ============================================
   Abstract Tech Motifs
   ============================================ */

.tech-motifs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.motif {
    position: absolute;
    font-family: 'Inconsolata', monospace;
    font-size: 11px;
    color: var(--subtle);
    opacity: 0.08;
    user-select: none;
}

.motif-1 { top: 12%; left: 5%; transform: rotate(-15deg); }
.motif-2 { top: 28%; left: 92%; transform: rotate(8deg); }
.motif-3 { top: 45%; left: 3%; transform: rotate(-5deg); }
.motif-4 { top: 62%; left: 88%; transform: rotate(12deg); }
.motif-5 { top: 78%; left: 7%; transform: rotate(-8deg); }
.motif-6 { top: 38%; left: 96%; transform: rotate(20deg); }
.motif-7 { top: 85%; left: 93%; transform: rotate(-10deg); }
.motif-8 { top: 55%; left: 2%; transform: rotate(6deg); }

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 900px) {
    .section {
        padding: 3rem 1.5rem;
    }

    /* Stack canopy content */
    .canopy-statement {
        grid-column: 1 / -1;
    }

    .canopy-orbs {
        grid-column: 1 / -1;
        min-height: 150px;
    }

    /* Stack understory sections */
    .section-understory-1 .specimen-card,
    .section-understory-2 .specimen-card,
    .section-understory-3 .specimen-card {
        grid-column: 2 / 6;
        max-width: 240px;
    }

    .section-understory-1 .understory-content,
    .section-understory-2 .understory-content,
    .section-understory-3 .understory-content {
        grid-column: 1 / -1;
    }

    /* Roots */
    .roots-content {
        margin-left: 50%;
        max-width: 90%;
    }

    .section-nav {
        right: 1rem;
    }
}

@media (max-width: 600px) {
    .section {
        display: flex;
        flex-direction: column;
        padding: 2rem 1.2rem;
        gap: 2rem;
    }

    .section-grid {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .specimen-card {
        max-width: 260px;
        align-self: center;
    }

    .roots-content {
        margin-left: 0;
        transform: none;
        max-width: 100%;
    }

    .section-nav {
        right: 0.6rem;
        gap: 10px;
    }

    .nav-dot {
        width: 6px;
        height: 6px;
    }

    .canopy-orbs {
        min-height: 120px;
    }
}
