/* =========================================
   recycle.digital — Styles
   Blobitecture + Art Deco + Candlelit Tutorial
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Courier+Prime&family=Nunito:wght@300;400;600&family=Poiret+One&display=swap');

/* --- Custom Properties --- */
:root {
    --bg-primary: #f5efe6;
    --bg-secondary: #e8dfd0;
    --text-primary: #3a3530;
    --text-secondary: #7a6e5e;
    --accent-gold: #c9a96e;
    --accent-warm: #e8c87a;
    --blob-fill: #d4c8b0;
    --decorative: #c4a08a;
    --deep-anchor: #2c2418;
    --basin-bg: #f5efe6;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    line-height: 1.75;
    overflow-x: hidden;
    /* Paper grain texture via SVG */
    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.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* --- Typography --- */
h1, h2, .stage__number, .basin__title {
    font-family: 'Poiret One', cursive;
}

.stage__title, .basin__title {
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.stage__number {
    display: block;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--accent-gold);
    letter-spacing: 0.12em;
    margin-bottom: 0.5rem;
}

p {
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    margin-bottom: 1.2rem;
    max-width: 55ch;
}

.text-emphasis {
    font-weight: 600;
    color: var(--accent-gold);
}

.text-caption {
    font-weight: 300;
    font-style: italic;
    color: var(--text-secondary);
    font-size: clamp(0.9rem, 1.4vw, 1.05rem);
}

.inline-code {
    font-family: 'Courier Prime', monospace;
    font-size: 0.9em;
    background: var(--bg-secondary);
    border-left: 1px solid var(--accent-gold);
    padding: 0.1em 0.4em;
    border-radius: 2px;
}

/* --- Candle Navigation --- */
.candle-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
}

.candle-nav .flame {
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.6s ease, transform 0.6s ease;
    padding: 0;
}

.candle-nav .flame.active {
    opacity: 1;
}

.candle-nav .flame svg {
    display: block;
    transition: transform 0.6s ease;
    filter: drop-shadow(0 0 4px rgba(232, 200, 122, 0));
}

.candle-nav .flame.active svg {
    filter: drop-shadow(0 0 8px rgba(232, 200, 122, 0.6));
}

/* --- Vestibule (Hero) --- */
.vestibule {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-blob {
    width: 70vw;
    max-width: 800px;
    height: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.hero-blob-path {
    animation: heroMorph 10s ease-in-out infinite alternate;
}

@keyframes heroMorph {
    0% { d: path("M400 80 C540 80 680 160 700 300 C720 440 620 520 480 540 C340 560 180 500 120 380 C60 260 200 80 400 80Z"); }
    50% { d: path("M400 90 C560 70 700 170 690 310 C680 450 600 530 460 540 C320 550 160 480 130 370 C100 260 220 90 400 90Z"); }
    100% { d: path("M410 75 C550 85 670 165 695 305 C710 445 610 525 470 535 C330 555 170 490 125 375 C70 255 210 75 410 75Z"); }
}

.title--typewriter {
    position: relative;
    z-index: 2;
    font-family: 'Poiret One', cursive;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: 0.08em;
    color: var(--text-primary);
    white-space: nowrap;
}

.title--typewriter .cursor {
    display: inline-block;
    color: var(--accent-gold);
    font-family: 'Courier Prime', monospace;
    animation: blink 0.6s step-end 6 forwards;
    margin-left: 2px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cursor--fade {
    animation: cursorFade 0.4s ease forwards !important;
}

@keyframes cursorFade {
    to { opacity: 0; }
}

.vestibule__arrow {
    position: absolute;
    bottom: 40px;
    z-index: 2;
    animation: bobArrow 2s ease-in-out infinite;
}

@keyframes bobArrow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

.candle-glow {
    position: absolute;
    top: 30px;
    right: 60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 200, 122, 0.15) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* --- Stage Sections (Diagonal) --- */
.stage {
    position: relative;
    min-height: 100vh;
    padding: 120px 5vw 120px;
    background: var(--bg-primary);
}

.stage--collect {
    clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 92%);
}

.stage--sort {
    clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
    margin-top: -8vh;
}

.stage--decompose {
    clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 92%);
    margin-top: -8vh;
}

.stage--reconstruct {
    clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
    margin-top: -8vh;
}

.stage--release {
    clip-path: polygon(0 0, 100% 8%, 100% 100%, 0 92%);
    margin-top: -8vh;
}

.stage__deco-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    opacity: 0.6;
}

.stage__content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4vw;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 70vh;
}

.stage__text {
    opacity: 0;
    transform: translateX(-40px) rotate(-2deg);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage__text.visible {
    opacity: 1;
    transform: translateX(0) rotate(0);
}

.stage__diagram {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transform: translateX(40px) rotate(2deg);
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
}

.stage__diagram.visible {
    opacity: 1;
    transform: translateX(0) rotate(0);
}

.blob-diagram {
    width: 100%;
    max-width: 400px;
    height: auto;
}

/* --- Intersection Blobs (Medallions) --- */
.stage::after {
    content: '';
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(212, 200, 176, 0.4);
    border: 2px solid var(--accent-gold);
    z-index: 3;
}

/* --- Basin (Final Section) --- */
.basin {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: -8vh;
    overflow: hidden;
    background-color: var(--basin-bg);
    transition: background-color 0.3s ease;
}

.release-blob {
    position: absolute;
    width: 30vw;
    height: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0.1s linear;
    z-index: 1;
}

.basin__text {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.basin__title {
    margin-bottom: 2rem;
}

.basin__text p {
    max-width: 55ch;
    margin-left: auto;
    margin-right: auto;
}

.basin__closing {
    font-family: 'Poiret One', cursive;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    color: var(--accent-gold);
    margin-top: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .stage__content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .stage__diagram {
        order: -1;
    }

    .blob-diagram {
        max-width: 280px;
    }

    .candle-nav {
        right: 10px;
    }

    .candle-nav .flame svg {
        width: 16px;
        height: 32px;
    }

    .stage {
        padding: 100px 4vw 100px;
    }
}
