/* recycle.games - McBling Recycling Experience */
/* Palette: Sunset Warm */
:root {
    --bg-primary: #fdf0e2;
    --bg-secondary: #f5dcc4;
    --accent-primary: #e8a87c;
    --accent-secondary: #c96832;
    --accent-tertiary: #d4577a;
    --text-primary: #2d1b0e;
    --text-secondary: #4a3728;
    --text-tertiary: #8b6f5c;
    --mcbling-gold: #d4a94e;
    --mcbling-gold-light: #e8c97a;
    --dark-anchor: #3a1f2b;
    --dark-deep: #2d1b0e;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h2 {
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
}

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.decorative-numeral {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(6rem, 15vw, 14rem);
    opacity: 0.06;
    color: var(--accent-secondary);
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

/* ===== PHASE INDICATOR ===== */
#phase-indicator {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.4;
    transition: opacity 0.4s ease;
}

#phase-indicator:hover {
    opacity: 1;
}

.phase-ring {
    width: 36px;
    height: 36px;
}

#phase-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ===== RIVER PATH ===== */
#river-path-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
}

/* ===== LOGO WATERMARK ===== */
#logo-watermark {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 60px;
    transform: rotate(35deg);
    animation: watermark-drift 60s linear infinite;
}

#logo-watermark span {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 3rem;
    opacity: 0.02;
    color: var(--text-primary);
    white-space: nowrap;
}

@keyframes watermark-drift {
    from { transform: rotate(35deg) translateY(0); }
    to { transform: rotate(35deg) translateY(-200px); }
}

/* ===== EDDY SECTIONS ===== */
.eddy {
    position: relative;
    min-height: 100vh;
    padding: 10vh 8vw;
    z-index: 2;
}

.eddy-content {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== WAVE DIVIDERS ===== */
.wave-divider {
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 3;
}

.wave-1 {
    clip-path: polygon(
        0% 60%, 5% 55%, 10% 50%, 15% 48%, 20% 50%, 25% 55%, 30% 58%,
        35% 55%, 40% 48%, 45% 42%, 50% 40%, 55% 42%, 60% 48%, 65% 55%,
        70% 58%, 75% 55%, 80% 50%, 85% 48%, 90% 50%, 95% 55%, 100% 60%,
        100% 100%, 0% 100%
    );
    background: var(--bg-secondary);
}

.wave-2 {
    clip-path: polygon(
        0% 55%, 8% 48%, 16% 42%, 24% 45%, 32% 52%, 40% 55%,
        48% 50%, 56% 42%, 64% 38%, 72% 42%, 80% 50%, 88% 55%,
        96% 48%, 100% 45%,
        100% 100%, 0% 100%
    );
    background: var(--bg-primary);
}

.wave-3 {
    clip-path: polygon(
        0% 50%, 7% 45%, 14% 40%, 21% 42%, 28% 48%, 35% 52%,
        42% 48%, 49% 40%, 56% 35%, 63% 38%, 70% 45%, 77% 52%,
        84% 50%, 91% 42%, 100% 40%,
        100% 100%, 0% 100%
    );
    background: var(--dark-anchor);
}

.wave-4 {
    clip-path: polygon(
        0% 45%, 10% 50%, 20% 55%, 30% 50%, 40% 42%, 50% 38%,
        60% 42%, 70% 50%, 80% 55%, 90% 50%, 100% 45%,
        100% 100%, 0% 100%
    );
    background: var(--bg-primary);
}

/* ===== EDDY 1: HERO ===== */
#eddy-1 {
    background: linear-gradient(160deg, #fdf0e2 0%, #f5dcc4 35%, #e8a87c 70%, #d4577a 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    padding-bottom: 15vh;
}

.hero-title {
    font-size: clamp(3rem, 10vw, 7rem);
    color: var(--text-primary);
    position: relative;
    margin-left: 15%;
    margin-top: 15vh;
}

.hero-viz {
    position: relative;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-right: 10%;
    margin-top: 5vh;
}

.progress-ring {
    width: min(60vw, 400px);
    height: min(60vw, 400px);
    position: relative;
    z-index: 2;
}

.ring-percent {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2.4rem;
}

.ring-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.85rem;
}

#hero-bg-numeral {
    top: -2rem;
    left: 10%;
    font-size: 12rem;
}

/* Crystal decorations */
.crystal {
    position: absolute;
    width: 16px;
    height: 16px;
    opacity: 0;
    animation: crystal-sparkle 3s ease-in-out infinite;
    filter: drop-shadow(0 0 4px #d4a94e55);
}

.crystal-1 { top: 10%; right: 15%; animation-delay: 0s; }
.crystal-2 { top: 50%; right: 5%; animation-delay: 1s; }
.crystal-3 { bottom: 20%; right: 25%; animation-delay: 2s; }

@keyframes crystal-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5) rotate(0deg); }
    50% { opacity: 0.8; transform: scale(1.2) rotate(45deg); }
}

.hero-tagline {
    position: relative;
    margin-top: auto;
    margin-left: 5%;
    max-width: 500px;
    padding-top: 8vh;
    color: var(--text-secondary);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
}

/* ===== EDDY 2: THE STREAM ===== */
#eddy-2 {
    background: var(--bg-secondary);
    padding-top: 15vh;
    padding-bottom: 15vh;
}

#eddy-2 .eddy-content {
    display: flex;
    flex-wrap: wrap;
    gap: 5vw;
    align-items: flex-start;
}

.stream-viz {
    flex: 1 1 55%;
    min-width: 300px;
}

.stream-path-svg {
    width: 100%;
    height: auto;
    margin-bottom: 4vh;
}

.draw-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2s ease-out;
}

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

/* Particle animation along path */
.particle {
    opacity: 0;
}

.particle.flowing {
    opacity: 0.8;
    animation: flow-along 6s linear infinite;
}

.p-glass.flowing { animation-delay: 0s; }
.p-metal.flowing { animation-delay: 1.5s; }
.p-plastic.flowing { animation-delay: 3s; }
.p-paper.flowing { animation-delay: 4.5s; }

@keyframes flow-along {
    0% { transform: translateX(0); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateX(800px); opacity: 0; }
}

/* Sankey Diagram */
.sankey-container {
    position: relative;
}

.sankey-svg {
    width: 100%;
    height: auto;
}

.sankey-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    fill: var(--text-tertiary);
}

.sankey-label-right {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    fill: var(--text-tertiary);
}

.sankey-flow {
    transition: opacity 0.3s ease, stroke-width 0.3s ease;
    cursor: pointer;
}

.sankey-flow:hover {
    opacity: 0.7 !important;
    stroke-width: 32;
}

.sankey-tooltip {
    position: absolute;
    background: var(--bg-primary);
    border: 2px solid;
    border-image: linear-gradient(90deg, #d4a94e, #e8c97a, #d4a94e) 1;
    padding: 12px 16px;
    display: none;
    flex-direction: column;
    gap: 4px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
    border-radius: 0;
}

.sankey-tooltip.visible {
    display: flex;
}

.tooltip-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.tooltip-stat {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--mcbling-gold);
}

.tooltip-detail {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.stream-text {
    flex: 1 1 35%;
    min-width: 250px;
    padding-top: 8vh;
}

.stream-text h2 {
    margin-bottom: 2rem;
}

.stream-text .body-text {
    margin-bottom: 1.5rem;
}

/* ===== EDDY 3: SORTING GAME ===== */
#eddy-3 {
    background: var(--bg-primary);
    padding-top: 15vh;
    padding-bottom: 15vh;
}

.sorting-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

.sorting-subtitle {
    text-align: center;
    margin-bottom: 5vh;
}

.game-arena {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 400px;
    max-height: 700px;
    overflow: hidden;
    border-radius: 40% 60% 55% 45% / 60% 40% 45% 55%;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

/* Cursor beam */
.cursor-beam {
    position: absolute;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, #d4577a33 0%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 5;
    transition: left 0.05s, top 0.05s;
    left: 50%;
    top: 50%;
}

/* Material items */
.material-item {
    position: absolute;
    width: 40px;
    height: 40px;
    left: var(--start-x);
    top: -50px;
    z-index: 4;
    animation: material-fall 10s ease-in var(--delay) infinite;
    cursor: default;
    transition: transform 0.3s ease-out;
}

@keyframes material-fall {
    0% { top: -50px; opacity: 0; }
    5% { opacity: 1; }
    85% { opacity: 1; }
    100% { top: calc(100% - 80px); opacity: 0.5; }
}

.material-item.sorted {
    animation: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Sparkle animation */
.sparkle {
    position: absolute;
    width: 20px;
    height: 20px;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
}

.sparkle.active {
    animation: sparkle-pop 0.6s ease-out forwards;
}

@keyframes sparkle-pop {
    0% { opacity: 0; transform: scale(0) rotate(0deg); }
    40% { opacity: 1; transform: scale(1.5) rotate(45deg); }
    100% { opacity: 0; transform: scale(0.5) rotate(90deg); }
}

/* Sorting bins */
.sorting-bins {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
    z-index: 6;
}

.bin {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.bin:hover,
.bin.active {
    opacity: 1;
    transform: scale(1.1);
}

.bin svg {
    width: 48px;
    height: 48px;
}

.bin-label {
    font-size: 0.7rem;
}

/* Score display */
.score-display {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    z-index: 6;
}

.score-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2.4rem;
    color: var(--mcbling-gold);
    text-shadow: 0 0 20px #d4a94e33;
}

.score-label {
    font-size: 0.7rem;
}

/* ===== EDDY 4: TRANSFORMATION ===== */
#eddy-4 {
    background: linear-gradient(180deg, #3a1f2b 0%, #2d1b0e 100%);
    padding-top: 15vh;
    padding-bottom: 15vh;
    color: var(--bg-primary);
}

#eddy-4 h2 {
    color: var(--bg-primary);
}

.dark-numeral {
    color: var(--accent-secondary);
    font-size: clamp(8rem, 20vw, 18rem);
    opacity: 0.06;
    top: 5%;
    right: 10%;
}

.transform-title {
    text-align: center;
    margin-bottom: 8vh;
    position: relative;
    z-index: 2;
}

.transform-viz {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5vw;
    margin-bottom: 8vh;
}

.transform-ring-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

.transform-ring {
    width: 200px;
    height: 200px;
    mix-blend-mode: screen;
}

.ring-animated {
    transition: stroke-dashoffset 1.5s ease-out;
}

.transform-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--bg-primary);
}

.stat-unit {
    color: var(--text-tertiary);
}

.transform-result {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-arrow {
    font-size: 1.5rem;
    color: var(--accent-primary);
}

.result-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    color: var(--bg-secondary);
    font-size: 1rem;
}

.transform-text {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    color: var(--bg-secondary);
    position: relative;
    z-index: 2;
    margin-bottom: 6vh;
}

.horizontal-wave {
    width: 100%;
    height: 60px;
    margin-top: 4vh;
}

.hw-2 {
    margin-top: -40px;
}

/* ===== EDDY 5: REBIRTH ===== */
#eddy-5 {
    background: var(--bg-primary);
    padding-top: 15vh;
    padding-bottom: 10vh;
    text-align: center;
}

.rebirth-title {
    margin-bottom: 5vh;
}

.loop-path {
    width: min(300px, 60vw);
    height: auto;
    margin: 0 auto 5vh;
    display: block;
}

.loop-path .draw-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2.5s ease-out;
}

.loop-path .draw-path.animated {
    stroke-dashoffset: 0;
}

/* Achievement Badge */
.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 5vh;
}

.badge-ring {
    position: relative;
    width: 200px;
    height: 200px;
}

.badge-svg {
    width: 100%;
    height: 100%;
}

.badge-crystal {
    position: absolute;
    width: 16px;
    height: 16px;
    filter: drop-shadow(0 0 6px #d4a94e55);
    animation: crystal-sparkle 3s ease-in-out infinite;
}

.bc-12 { top: -4px; left: 50%; transform: translateX(-50%); animation-delay: 0s; }
.bc-3 { top: 50%; right: -4px; transform: translateY(-50%); animation-delay: 0.75s; }
.bc-6 { bottom: -4px; left: 50%; transform: translateX(-50%); animation-delay: 1.5s; }
.bc-9 { top: 50%; left: -4px; transform: translateY(-50%); animation-delay: 2.25s; }

.badge-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.badge-score-value {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 2.8rem;
    color: var(--mcbling-gold);
    text-shadow: 0 0 30px #d4a94e22;
}

.badge-score-label {
    font-size: 0.7rem;
}

.rebirth-text {
    max-width: 500px;
    margin: 0 auto 5vh;
    color: var(--text-secondary);
}

.upward-wave {
    width: 100%;
    height: 80px;
    margin-top: 5vh;
}

/* ===== PROGRESSIVE DISCLOSURE ===== */
.reveal-item {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-item.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-item:nth-child(even) {
    transform: translateX(40px);
}

.reveal-item:nth-child(even).revealed {
    transform: translateX(0);
}

/* Stagger delays for progressive disclosure */
.reveal-group .reveal-item:nth-child(1) { transition-delay: 0s; }
.reveal-group .reveal-item:nth-child(2) { transition-delay: 0.3s; }
.reveal-group .reveal-item:nth-child(3) { transition-delay: 0.6s; }
.reveal-group .reveal-item:nth-child(4) { transition-delay: 0.9s; }

/* ===== MICRO WAVE UNDERLINES ===== */
h2::after {
    content: '';
    display: block;
    width: 80px;
    height: 8px;
    margin-top: 0.5rem;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 80 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,4 C10,1 20,7 30,4 C40,1 50,7 60,4 C70,1 80,7 80,4' fill='none' stroke='%23e8a87c' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
    background-size: contain;
}

#eddy-4 h2::after {
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 80 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0,4 C10,1 20,7 30,4 C40,1 50,7 60,4 C70,1 80,7 80,4' fill='none' stroke='%23e8a87c' stroke-width='2'/%3E%3C/svg%3E") no-repeat;
    background-size: contain;
}

.sorting-title::after,
.rebirth-title::after {
    margin-left: auto;
    margin-right: auto;
}

/* ===== GOLD SHIMMER BORDER ===== */
.gold-border {
    border: 2px solid transparent;
    border-image: linear-gradient(90deg, #d4a94e, #e8c97a, #d4a94e) 1;
    background-size: 200% 100%;
    animation: shimmer-border 3s linear infinite;
}

@keyframes shimmer-border {
    0% { border-image-source: linear-gradient(90deg, #d4a94e, #e8c97a, #d4a94e); }
    50% { border-image-source: linear-gradient(90deg, #e8c97a, #d4a94e, #e8c97a); }
    100% { border-image-source: linear-gradient(90deg, #d4a94e, #e8c97a, #d4a94e); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .eddy {
        padding: 8vh 5vw;
    }

    .hero-title {
        margin-left: 5%;
    }

    .hero-viz {
        margin-right: 0;
        justify-content: center;
    }

    #eddy-2 .eddy-content {
        flex-direction: column;
    }

    .stream-viz,
    .stream-text {
        flex: 1 1 100%;
    }

    .transform-viz {
        gap: 8vh;
    }

    .sorting-bins {
        gap: 15px;
    }

    .bin svg {
        width: 36px;
        height: 36px;
    }

    .game-arena {
        border-radius: 30% 50% 45% 35% / 50% 30% 35% 45%;
    }
}

@media (max-width: 480px) {
    .hero-title {
        margin-left: 0;
    }

    .sorting-bins {
        gap: 10px;
    }

    .score-value {
        font-size: 1.8rem;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .crystal,
    .badge-crystal {
        animation: none;
        opacity: 0.6;
    }

    .material-item {
        animation: none;
        top: 50%;
        opacity: 0.7;
    }

    .particle {
        animation: none;
    }

    #logo-watermark {
        animation: none;
    }

    .reveal-item {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
