/* ============================================================
   lungi.dev — Styles
   Fabric-drape immersive experience
   Colors: #1B1F3B #E8ECF1 #00E5A0 #9B5DE5 #F15BB5 #FAF3E0 #6B1D3A #C08B5C
   Fonts: Josefin Sans, EB Garamond, Archivo Black
   ============================================================ */

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

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

body {
    background-color: #1B1F3B;
    color: #FAF3E0;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Fabric Noise Texture Overlay --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* --- Frost Overlay Layer --- */
#frost-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 900;
    background: linear-gradient(180deg, rgba(232,236,241,0.15) 0%, rgba(27,31,59,0.0) 100%);
    backdrop-filter: blur(0.5px);
    -webkit-backdrop-filter: blur(0.5px);
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* --- Navigation Thread (Selvedge Edge) --- */
#nav-thread {
    position: fixed;
    left: 24px;
    top: 0;
    height: 100%;
    z-index: 950;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40px;
}

.thread-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, #00E5A0 0%, #9B5DE5 50%, #F15BB5 100%);
    transform: translateX(-50%);
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

#nav-thread:hover .thread-line {
    width: 4px;
    transform: translateX(calc(-50% + 8px));
}

.thread-tooltip {
    position: absolute;
    left: 20px;
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #FAF3E0;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    white-space: nowrap;
}

.thread-tooltip[data-section="hero"] { top: 10%; }
.thread-tooltip[data-section="fold-1"] { top: 30%; }
.thread-tooltip[data-section="fold-2"] { top: 48%; }
.thread-tooltip[data-section="fold-3"] { top: 66%; }
.thread-tooltip[data-section="hem"] { top: 88%; }

#nav-thread:hover .thread-tooltip {
    opacity: 0.8;
    transform: translateX(0);
}

/* --- Botanical Overlays --- */
#botanical-overlays {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.botanical {
    position: absolute;
    opacity: 0.06;
    mix-blend-mode: overlay;
}

.botanical-monstera {
    width: 350px;
    height: 440px;
    top: 5%;
    right: -40px;
    transform: rotate(15deg);
}

.botanical-palm {
    width: 260px;
    height: 520px;
    top: 40%;
    left: -30px;
    transform: rotate(-10deg);
}

.botanical-banana {
    width: 300px;
    height: 430px;
    bottom: 5%;
    right: 10%;
    transform: rotate(8deg);
}

/* --- Section Base --- */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* --- Bounce Enter Animation --- */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    60% {
        transform: translateY(-8px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.bounce-enter {
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.bounce-hidden {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
}

/* --- Blur-Focus Depth Classes --- */
.depth-near {
    filter: blur(0px);
    transition: filter 0.5s ease;
}

.depth-mid {
    filter: blur(1px);
    transition: filter 0.5s ease;
}

.depth-far {
    filter: blur(3px);
    transition: filter 0.5s ease;
}

/* ============================================================
   HERO SECTION — The Unfurl
   ============================================================ */
#hero {
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.hero-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hero-blob {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-title-wrap {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #FAF3E0;
    text-shadow: 0 0 40px rgba(0, 229, 160, 0.3), 0 0 80px rgba(155, 93, 229, 0.15);
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.9rem, 2vw, 1.3rem);
    color: #C08B5C;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

/* --- Fish Base Styles --- */
.fish {
    position: absolute;
    pointer-events: auto;
    cursor: default;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                filter 0.5s ease;
}

.fish:hover {
    transform: scale(1.15);
}

/* --- Angelfish (Hero) --- */
.fish-angel {
    z-index: 5;
}

.fish-angel-1 {
    width: 90px;
    height: 105px;
    top: 25%;
    right: 15%;
    animation: fishDriftHorizontal 20s ease-in-out infinite;
}

.fish-angel-2 {
    width: 65px;
    height: 76px;
    bottom: 30%;
    left: 18%;
    animation: fishDriftHorizontal 20s ease-in-out infinite reverse;
    animation-delay: -7s;
}

@keyframes fishDriftHorizontal {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(30px) rotate(3deg); }
    50% { transform: translateX(0) rotate(0deg); }
    75% { transform: translateX(-30px) rotate(-3deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* --- Scroll Hint --- */
.scroll-hint {
    position: absolute;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: scrollHintPulse 2.5s ease-in-out infinite;
}

.scroll-hint-text {
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #FAF3E0;
    opacity: 0.5;
}

.scroll-hint-arrow {
    opacity: 0.5;
}

@keyframes scrollHintPulse {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* ============================================================
   CRYSTAL BOUNDARIES
   ============================================================ */
.crystal-boundary {
    display: flex;
    justify-content: center;
    gap: 3rem;
    padding: 3rem 0;
    position: relative;
    z-index: 5;
}

.crystal {
    width: 40px;
    height: 60px;
    filter: drop-shadow(0 4px 12px rgba(155, 93, 229, 0.3));
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.crystal:hover {
    transform: scale(1.2) rotate(10deg);
}

.crystal-boundary-1 .crystal { transform: scale(0.4); }
.crystal-boundary-2 .crystal { transform: scale(0.4); }
.crystal-boundary-3 .crystal { transform: scale(0.4); }

.crystal-boundary.crystal-grown .crystal {
    transform: scale(1);
}

/* ============================================================
   FOLD ZONE — Mid Section
   ============================================================ */
#fold-zone {
    min-height: auto;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6rem;
}

.fold-panel {
    position: relative;
    max-width: 700px;
    width: 90%;
    padding: 3rem 2.5rem;
    border-radius: 2rem 4rem 2rem 4rem;
    overflow: hidden;
}

.fold-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    border-radius: inherit;
}

.fold-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(232,236,241,0.15) 0%, rgba(27,31,59,0.0) 100%);
    z-index: 1;
    border-radius: inherit;
    pointer-events: none;
}

/* Dye-bleed edge effect */
.fold-panel .fold-panel-inner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 70%, rgba(107,29,58,0.2) 0%, transparent 60%);
    pointer-events: none;
    z-index: 2;
    border-radius: inherit;
}

.fold-panel-inner {
    position: relative;
    z-index: 3;
}

/* Panel 1 — Archive */
.fold-panel-1 {
    background: rgba(232, 236, 241, 0.08);
    transform: rotate(-2deg);
    clip-path: polygon(0% 3%, 100% 0%, 98% 97%, 2% 100%);
}

/* Panel 2 — Craft */
.fold-panel-2 {
    background: rgba(155, 93, 229, 0.06);
    transform: rotate(0deg);
    clip-path: polygon(2% 0%, 100% 2%, 99% 100%, 0% 98%);
}

/* Panel 3 — Signal */
.fold-panel-3 {
    background: rgba(0, 229, 160, 0.06);
    transform: rotate(3deg);
    clip-path: polygon(1% 2%, 99% 0%, 100% 96%, 0% 100%);
}

/* Panel Shape Pusher (shape-outside circles for organic text flow) */
.panel-shape-pusher {
    float: right;
    width: 120px;
    height: 120px;
    shape-outside: circle(60px at 60px 60px);
    margin: 0 0 1rem 1.5rem;
}

.fold-panel-2 .panel-shape-pusher {
    float: left;
    margin: 0 1.5rem 1rem 0;
}

/* Panel Labels */
.panel-label {
    display: inline-block;
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #6B1D3A;
    background: rgba(250, 243, 224, 0.1);
    padding: 0.3rem 1rem;
    border-radius: 2rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(192, 139, 92, 0.3);
}

/* Fold Titles */
.fold-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #FAF3E0;
    margin-bottom: 1.2rem;
    text-shadow: 0 0 20px rgba(0, 229, 160, 0.15);
}

.fold-panel-1 .fold-title {
    color: #FAF3E0;
}

/* Fold Text */
.fold-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    color: #FAF3E0;
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
}

.fold-text-italic {
    font-style: italic;
    font-weight: 500;
    opacity: 0.85;
    padding-left: 1rem;
    border-left: 2px solid rgba(192, 139, 92, 0.3);
}

/* Butterflyfish in Fold Panels */
.fish-butterfly {
    width: 60px;
    height: 60px;
    bottom: -10px;
    right: 20px;
    z-index: 4;
    animation: fishDriftHorizontal 20s ease-in-out infinite;
    animation-delay: -3s;
}

.fish-butterfly-2 {
    left: 20px;
    right: auto;
    animation-delay: -10s;
    animation-direction: reverse;
}

.fish-butterfly-3 {
    right: 40px;
    bottom: 10px;
    animation-delay: -15s;
}

/* ============================================================
   HEM SECTION — Footer Zone
   ============================================================ */
#hem {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    position: relative;
}

#hem::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(27, 31, 59, 0) 0%,
        rgba(27, 31, 59, 0.4) 40%,
        rgba(27, 31, 59, 0.8) 100%);
    pointer-events: none;
}

.hem-container {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.hem-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #C08B5C;
    opacity: 0.6;
    letter-spacing: 0.1em;
}

/* Wrasse Fish (Hem zone) */
.fish-wrasse {
    z-index: 4;
}

.fish-wrasse-1 {
    width: 130px;
    height: 50px;
    animation: wrasseSwimUp 20s ease-in-out infinite;
}

.fish-wrasse-2 {
    width: 100px;
    height: 38px;
    animation: wrasseSwimUp 20s ease-in-out infinite reverse;
    animation-delay: -8s;
}

@keyframes wrasseSwimUp {
    0% { transform: translateY(0) translateX(0) rotate(0deg); }
    25% { transform: translateY(-20px) translateX(15px) rotate(2deg); }
    50% { transform: translateY(-35px) translateX(0) rotate(0deg); }
    75% { transform: translateY(-20px) translateX(-15px) rotate(-2deg); }
    100% { transform: translateY(0) translateX(0) rotate(0deg); }
}

/* Hem Jewel */
.hem-jewel-container {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hem-jewel {
    width: 100%;
    height: 100%;
    animation: jewelRotate 20s linear infinite;
    filter: drop-shadow(0 0 12px rgba(155, 93, 229, 0.4))
            drop-shadow(0 0 24px rgba(0, 229, 160, 0.2));
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    #nav-thread {
        left: 8px;
    }

    .thread-tooltip {
        display: none;
    }

    .hero-container {
        max-width: 95vw;
    }

    .fold-panel {
        width: 95%;
        padding: 2rem 1.5rem;
    }

    .fold-panel-1 { transform: rotate(-1deg); }
    .fold-panel-3 { transform: rotate(1.5deg); }

    .botanical {
        opacity: 0.03;
    }

    .fish-angel-1 {
        width: 60px;
        height: 70px;
    }

    .fish-angel-2 {
        width: 45px;
        height: 53px;
    }

    .panel-shape-pusher {
        width: 80px;
        height: 80px;
        shape-outside: circle(40px at 40px 40px);
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .fold-panel {
        border-radius: 1.5rem 2.5rem 1.5rem 2.5rem;
        padding: 1.5rem 1rem;
    }

    .fold-title {
        font-size: clamp(1.3rem, 5vw, 1.8rem);
    }

    .crystal-boundary {
        gap: 1.5rem;
    }
}
