/* ========================================
   bable.pro - Candy Probability Machine
   ======================================== */

/* CSS Custom Properties */
:root {
    --candy-pink: #FF6B9D;
    --electric-violet: #C147E9;
    --lemon-fizz: #FFD93D;
    --mint-pop: #6BCB77;
    --sky-candy: #4FC3F7;
    --soft-cream: #FFF8F0;
    --deep-grape: #2D1B3D;
    --cloud-white: #FFFFFF;
    --light-lavender: #F3E8FF;

    --font-display: 'Baloo 2', cursive;
    --font-body: 'Nunito', sans-serif;
    --font-accent: 'Caveat', cursive;

    --spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --bounce: cubic-bezier(0.36, 0.07, 0.19, 0.97);

    --scroll-y: 0;
}

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

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--deep-grape);
    background-color: var(--soft-cream);
    line-height: 1.7;
    font-size: 1rem;
    overflow-x: hidden;
}

/* ========================================
   Navigation
   ======================================== */
#main-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 600px;
}

.nav-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 40px;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(45, 27, 61, 0.08);
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--deep-grape);
    text-decoration: none;
    padding: 4px 14px;
    border-radius: 14px;
    transition: all 0.3s var(--spring);
    white-space: nowrap;
}

.nav-link:hover {
    transform: scale(1.08);
    background: rgba(255, 107, 157, 0.12);
}

.nav-link.active {
    background: linear-gradient(135deg, var(--candy-pink), var(--electric-violet));
    color: var(--cloud-white);
}

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

.section + .section {
    margin-top: -100px;
}

.section-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.section-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    padding: 40px 24px;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    color: var(--deep-grape);
    margin-bottom: 20px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s var(--spring), transform 0.6s var(--spring);
}

.section-heading.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--deep-grape);
    max-width: 540px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--spring) 0.15s, transform 0.6s var(--spring) 0.15s;
}

.section-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Caveat annotations */
.caveat-annotation {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--candy-pink);
    display: inline-block;
    transform: rotate(-2deg);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 0.5s var(--spring) 0.3s, transform 0.5s var(--spring) 0.3s;
}

.caveat-annotation.visible {
    opacity: 1;
    transform: rotate(-2deg) translateY(0);
}

/* ========================================
   Section 1: Hero
   ======================================== */
.section-hero {
    background: var(--soft-cream);
    z-index: 5;
}

.hero-bg-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, var(--lemon-fizz), var(--candy-pink) 50%, var(--electric-violet) 100%);
    opacity: 0.18;
    animation: rotateGradient 20s linear infinite;
    z-index: 0;
}

@keyframes rotateGradient {
    0% { transform: rotate(0deg) scale(1.5); }
    100% { transform: rotate(360deg) scale(1.5); }
}

/* Probability Cloud */
.probability-cloud {
    position: relative;
    z-index: 1;
}

.cloud-hero {
    width: clamp(260px, 45vw, 500px);
    height: clamp(260px, 45vw, 500px);
    margin: 0 auto 30px;
}

.cloud-hero .cloud-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--candy-pink), var(--electric-violet), var(--sky-candy));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 8s ease-in-out infinite;
    box-shadow: 0 6px 0 rgba(45, 27, 61, 0.1);
    opacity: 0.85;
    position: relative;
}

.cloud-hero .cloud-inner::after {
    content: '';
    position: absolute;
    inset: 8%;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
    animation: morph 8s ease-in-out infinite reverse;
}

@keyframes morph {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    25% { border-radius: 58% 42% 56% 44% / 34% 66% 34% 66%; }
    50% { border-radius: 50% 50% 34% 66% / 56% 44% 58% 42%; }
    75% { border-radius: 42% 58% 44% 56% / 66% 34% 66% 34%; }
    100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

/* Hero Title */
.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3rem, 12vw, 10rem);
    color: var(--deep-grape);
    text-align: center;
    position: relative;
    z-index: 3;
    line-height: 1;
    margin-bottom: 16px;
}

.letter {
    display: inline-block;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.5s var(--spring), transform 0.5s var(--spring);
    transition-delay: calc(var(--i) * 60ms);
}

.letter.visible {
    opacity: 1;
    transform: scale(1);
}

.letter.dot {
    color: var(--candy-pink);
}

/* Hero Tagline */
.hero-tagline {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.5vw, 1.6rem);
    color: var(--deep-grape);
    text-align: center;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--spring) 0.8s, transform 0.6s var(--spring) 0.8s;
}

.hero-tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.6s var(--spring) 1.2s;
}

.scroll-indicator.visible {
    opacity: 0.7;
}

.scroll-text {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--deep-grape);
    display: block;
    margin-bottom: 8px;
}

.scroll-arrow {
    animation: bobDown 2s var(--bounce) infinite;
    color: var(--deep-grape);
}

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

/* Confetti Container */
.confetti-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.confetti-q {
    position: absolute;
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: var(--size, 16px);
    color: var(--color);
    opacity: 0.4;
    animation: confettiFall var(--duration, 8s) linear infinite;
    animation-delay: var(--delay, 0s);
    top: -30px;
    left: var(--x);
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.4;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

/* Floating Shapes */
.floating-shapes {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.shape {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    animation: floatShape 3s var(--bounce) infinite;
    animation-delay: var(--delay);
    transform: translateY(calc(var(--scroll-y) * -0.3px));
}

@keyframes floatShape {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.05); }
}

.shape-star {
    background: var(--color);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    border-radius: 20%;
}

.shape-star::after {
    content: '';
    position: absolute;
    inset: 0;
    background: inherit;
    clip-path: inherit;
    transform: translate(4px, 4px);
    opacity: 0.25;
    z-index: -1;
}

.shape-pill {
    background: var(--color);
    border-radius: 50px;
    width: var(--size);
    height: calc(var(--size) * 0.45);
    border: 2.5px solid var(--deep-grape);
    box-shadow: 4px 4px 0 rgba(45, 27, 61, 0.15);
}

.shape-triangle {
    width: 0;
    height: 0;
    border-left: calc(var(--size) * 0.5) solid transparent;
    border-right: calc(var(--size) * 0.5) solid transparent;
    border-bottom: var(--size) solid var(--color);
    border-radius: 20%;
    background: none;
    filter: drop-shadow(4px 4px 0 rgba(45, 27, 61, 0.15));
}

.shape-bubble {
    background: var(--color);
    border-radius: 50% 50% 50% 20%;
    border: 2.5px solid var(--deep-grape);
    box-shadow: 4px 4px 0 rgba(45, 27, 61, 0.15);
}

/* ========================================
   Section 2: Possibilities
   ======================================== */
.section-possibilities {
    background: var(--light-lavender);
}

.section-possibilities .section-bg {
    background: linear-gradient(180deg, var(--soft-cream) 0%, var(--light-lavender) 30%, var(--light-lavender) 100%);
}

.orbs-container {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    background: var(--orb-color);
    width: var(--orb-size);
    height: var(--orb-size);
    border: 2.5px solid var(--deep-grape);
    box-shadow: 3px 3px 0 rgba(45, 27, 61, 0.12);
    opacity: 0;
    transform: scale(0) translate(-50%, -50%);
    transition: opacity 0.6s var(--spring), transform 0.8s var(--spring);
    transition-delay: var(--orb-delay);
    left: var(--orb-x);
    top: var(--orb-y);
}

.orb.burst {
    opacity: 0.85;
    transform: scale(1) translate(-50%, -50%);
    animation: orbBounce var(--orb-duration) var(--bounce) infinite;
    animation-delay: var(--orb-delay);
}

@keyframes orbBounce {
    0%, 100% { transform: scale(1) translate(-50%, -50%) translateY(0); }
    50% { transform: scale(1.08) translate(-50%, -50%) translateY(-15px); }
}

/* Small probability cloud for sections */
.cloud-small {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.cloud-possibilities {
    background: linear-gradient(135deg, var(--lemon-fizz), var(--mint-pop));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 8s ease-in-out infinite;
    box-shadow: 0 4px 0 rgba(45, 27, 61, 0.1);
}

/* ========================================
   Section 3: Paths
   ======================================== */
.section-paths {
    background: var(--soft-cream);
}

.section-paths .section-bg {
    background: linear-gradient(180deg, var(--light-lavender) 0%, var(--soft-cream) 30%, var(--soft-cream) 100%);
}

.paths-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.meandering-path {
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

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

.waypoint {
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.4s var(--spring), transform 0.4s var(--spring);
}

.waypoint.visible {
    opacity: 1;
    transform: scale(1);
}

.cloud-paths {
    background: linear-gradient(135deg, var(--sky-candy), var(--electric-violet));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 8s ease-in-out infinite;
    animation-delay: -3s;
    box-shadow: 0 4px 0 rgba(45, 27, 61, 0.1);
}

/* ========================================
   Section 4: Outcome
   ======================================== */
.section-outcome {
    background: var(--light-lavender);
}

.section-outcome .section-bg {
    background: linear-gradient(180deg, var(--soft-cream) 0%, var(--light-lavender) 30%, var(--soft-cream) 100%);
}

.cloud-resolved {
    width: clamp(140px, 22vw, 240px);
    height: clamp(140px, 22vw, 240px);
    margin: 0 auto 24px;
}

.cloud-resolved .cloud-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--lemon-fizz), var(--candy-pink), var(--electric-violet));
    animation: morphToStar 4s var(--spring) forwards;
    animation-play-state: paused;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    box-shadow: 0 6px 0 rgba(45, 27, 61, 0.1);
    opacity: 0.9;
}

.cloud-resolved.settled .cloud-inner {
    animation-play-state: running;
}

@keyframes morphToStar {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    50% { border-radius: 42% 58% 44% 56% / 66% 34% 66% 34%; }
    100% {
        border-radius: 50% 10% 50% 10% / 10% 50% 10% 50%;
        transform: rotate(22.5deg);
    }
}

.connecting-dots {
    position: absolute;
    top: -60px;
    left: 50%;
    width: 2px;
    height: 120px;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
        to bottom,
        var(--candy-pink) 0px,
        var(--candy-pink) 8px,
        transparent 8px,
        transparent 16px
    );
    opacity: 0.3;
    z-index: 1;
}

/* ========================================
   Footer
   ======================================== */
.site-footer {
    position: relative;
    padding: 60px 24px;
    text-align: center;
    background: var(--soft-cream);
    overflow: hidden;
}

.footer-cloud {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--candy-pink), var(--electric-violet));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morph 8s ease-in-out infinite;
    opacity: 0.6;
}

.footer-text {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--deep-grape);
    opacity: 0.6;
}

/* ========================================
   Radial Layout
   ======================================== */
.radial-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .nav-link {
        font-size: 0.72rem;
        padding: 4px 10px;
    }

    .section-heading {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .section-text {
        font-size: 1rem;
        padding: 0 16px;
    }

    .hero-title {
        font-size: clamp(2.5rem, 14vw, 5rem);
    }

    .cloud-hero {
        width: clamp(180px, 60vw, 300px);
        height: clamp(180px, 60vw, 300px);
    }

    .paths-svg {
        opacity: 0.5;
    }
}

@media (max-width: 480px) {
    .nav-inner {
        gap: 2px;
        padding: 0 4px;
    }

    .nav-link {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}
