/* ============================================
   gabs.quest - Styles
   Rainbow dopamine playground
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Rainbow Palette */
    --gumdrop-red: #FF4F6D;
    --tangerine-pop: #FF8A3D;
    --sunshine-fizz: #FFD23F;
    --minty-fresh: #3DD9A0;
    --bubble-blue: #4DA8FF;
    --berry-swirl: #7B61FF;
    --cotton-candy: #FF6FB7;

    /* Neutrals */
    --cloud-white: #FAFBFE;
    --marshmallow: #F0F1F7;
    --charcoal-soft: #2D2D3A;
    --pebble-gray: #7A7A8E;
    --mist: #E2E3EE;

    /* Typography */
    --font-headline: 'Nunito', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --font-accent: 'Baloo 2', cursive;

    /* Spacing */
    --container-max: 1400px;
    --container-padding: clamp(1.5rem, 4vw, 4rem);
    --card-radius: 24px;
    --card-padding: clamp(1.2rem, 3vw, 2rem);
    --grid-gap: clamp(16px, 2.5vw, 28px);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    color: var(--charcoal-soft);
    background-color: var(--cloud-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--marshmallow);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gumdrop-red), var(--tangerine-pop), var(--sunshine-fizz), var(--minty-fresh), var(--bubble-blue), var(--berry-swirl), var(--cotton-candy));
    border-radius: 10px;
}

/* --- Background Floating Bubbles --- */
.bg-bubbles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
    animation: bgBubbleFloat var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

@keyframes bgBubbleFloat {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(var(--sway-x), calc(var(--drift-y) * -0.5));
    }
    50% {
        transform: translate(calc(var(--sway-x) * -0.5), var(--drift-y));
    }
    75% {
        transform: translate(calc(var(--sway-x) * 0.3), calc(var(--drift-y) * -0.3));
    }
}

/* --- Hero Splash Zone --- */
.hero-splash {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem var(--container-padding);
    z-index: 1;
    overflow: hidden;
}

.hero-speech-bubble {
    position: relative;
    background: white;
    border-radius: 60px;
    padding: clamp(2rem, 5vw, 4rem) clamp(3rem, 8vw, 6rem);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.08);
    border: 3px solid var(--cotton-candy);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.08), inset 0 0 30px rgba(255, 111, 183, 0.06);
    animation: bounceEnterHero 900ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transform: translateY(-100vh);
    will-change: transform, opacity;
}

.hero-speech-bubble .speech-tail {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 24px solid white;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.04));
}

.hero-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -23px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-top: 26px solid var(--cotton-candy);
    z-index: -1;
}

@keyframes bounceEnterHero {
    0% {
        transform: translateY(-100vh);
        opacity: 0;
    }
    60% {
        transform: translateY(20px);
        opacity: 1;
    }
    80% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: clamp(3rem, 8vw + 1rem, 7rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--gumdrop-red), var(--tangerine-pop), var(--sunshine-fizz), var(--minty-fresh), var(--bubble-blue), var(--berry-swirl), var(--cotton-candy));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

.hero-thought-cloud {
    position: relative;
    margin-top: 3rem;
    background: var(--marshmallow);
    border-radius: 40px;
    padding: 1.2rem 2.5rem;
    animation: thoughtCloudEnter 1000ms cubic-bezier(0.34, 1.56, 0.64, 1) 400ms forwards;
    transform: translateY(40px);
    opacity: 0;
    will-change: transform, opacity;
}

.hero-thought-cloud::before,
.hero-thought-cloud::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: var(--marshmallow);
}

.hero-thought-cloud::before {
    width: 20px;
    height: 20px;
    bottom: -12px;
    left: 30%;
}

.hero-thought-cloud::after {
    width: 12px;
    height: 12px;
    bottom: -22px;
    left: 25%;
}

@keyframes thoughtCloudEnter {
    0% {
        transform: translateY(40px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.hero-thought-cloud.entered {
    animation: thoughtCloudFloat 4s ease-in-out infinite;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    color: var(--pebble-gray);
    text-align: center;
}

/* --- Bubble Creatures --- */
.bubble-creature {
    position: absolute;
    will-change: transform;
    animation: creatureWiggle 3s ease-in-out infinite;
    z-index: 2;
}

.creature-pink {
    bottom: 20%;
    left: 8%;
    animation-delay: 0s;
}

.creature-blue {
    top: 25%;
    right: 8%;
    animation-delay: 0.5s;
}

.creature-green {
    bottom: 30%;
    right: 15%;
    animation-delay: 1s;
}

.creature-orange {
    top: 18%;
    left: 12%;
    animation-delay: 1.5s;
}

.creature-yellow {
    bottom: 15%;
    right: 25%;
    animation-delay: 2s;
}

@keyframes creatureWiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    33% {
        transform: rotate(8deg);
    }
    66% {
        transform: rotate(-8deg);
    }
}

/* --- Squiggle Dividers --- */
.squiggle-divider {
    width: 100%;
    max-width: var(--container-max);
    margin: 1rem auto;
    padding: 0 var(--container-padding);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.squiggle-svg {
    width: 100%;
    height: 40px;
    display: block;
}

.squiggle-svg path {
    stroke-dasharray: 3200;
    stroke-dashoffset: 3200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.squiggle-svg.drawn path {
    stroke-dashoffset: 0;
}

/* --- Chapters --- */
.chapter {
    position: relative;
    z-index: 1;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: clamp(2rem, 5vw, 4rem) var(--container-padding);
}

.chapter-header {
    text-align: center;
    margin-bottom: clamp(2rem, 4vw, 3rem);
}

.chapter-title {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--charcoal-soft);
    margin-bottom: 1rem;
}

.chapter-intro {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--pebble-gray);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* --- Speech Bubble / Thought Cloud / Exclamation Frames --- */
.thought-cloud-frame {
    display: inline-block;
    position: relative;
    background: white;
    border-radius: 50px;
    padding: 0.8rem 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--mist);
    margin-bottom: 0.5rem;
}

.thought-cloud-frame::before,
.thought-cloud-frame::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--mist);
}

.thought-cloud-frame::before {
    width: 16px;
    height: 16px;
    bottom: -10px;
    left: 40%;
}

.thought-cloud-frame::after {
    width: 10px;
    height: 10px;
    bottom: -18px;
    left: 35%;
}

.exclamation-burst-frame {
    display: inline-block;
    position: relative;
    background: white;
    padding: 0.8rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--sunshine-fizz);
    margin-bottom: 0.5rem;
}

.exclamation-burst-frame::before {
    content: '';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: var(--sunshine-fizz);
    border-radius: 50%;
}

.exclamation-burst-frame::after {
    content: '!';
    position: absolute;
    top: -7px;
    right: -1px;
    width: 24px;
    height: 24px;
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: 14px;
    color: var(--charcoal-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* --- Card Grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--grid-gap);
}

/* --- Cards --- */
.card {
    position: relative;
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.7);
    cursor: pointer;
    will-change: transform, opacity;
    transition: transform 200ms ease-out, box-shadow 200ms ease-out, border-radius 200ms ease-out;
    /* Initial state for bounce-enter animation */
    opacity: 0;
    transform: translateY(60px);
}

.card.entered {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1);
    border-radius: 28px;
}

.card:active {
    transform: scale(0.97);
}

/* Card category backgrounds (12-18% opacity tints) */
.card-conversation {
    background: rgba(255, 111, 183, 0.14);
    border-color: rgba(255, 111, 183, 0.25);
}

.card-story {
    background: rgba(123, 97, 255, 0.14);
    border-color: rgba(123, 97, 255, 0.25);
}

.card-quest {
    background: rgba(61, 217, 160, 0.14);
    border-color: rgba(61, 217, 160, 0.25);
}

.card-community {
    background: rgba(255, 210, 63, 0.14);
    border-color: rgba(255, 210, 63, 0.25);
}

.card-info {
    background: rgba(77, 168, 255, 0.14);
    border-color: rgba(77, 168, 255, 0.25);
}

/* Card size variations */
.card-wide {
    grid-column: span 2;
}

.card-tall {
    grid-row: span 2;
}

/* Card inner elements */
.card-bubble-accent {
    position: absolute;
    top: -10px;
    right: 16px;
    animation: creatureWiggle 3s ease-in-out infinite;
}

.card-tag {
    display: inline-block;
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    margin-bottom: 0.8rem;
    color: white;
}

.tag-conversation {
    background: var(--cotton-candy);
}

.tag-story {
    background: var(--berry-swirl);
}

.tag-quest {
    background: var(--minty-fresh);
}

.tag-community {
    background: var(--sunshine-fizz);
    color: var(--charcoal-soft);
}

.tag-info {
    background: var(--bubble-blue);
}

.card-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: var(--charcoal-soft);
    margin-bottom: 0.6rem;
}

.card-body {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    color: var(--pebble-gray);
    line-height: 1.65;
}

/* --- Floating Navigation --- */
.floating-nav {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.6rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 2px solid var(--mist);
}

.nav-pill {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 150ms cubic-bezier(0.22, 1.5, 0.36, 1), box-shadow 150ms ease-out;
    will-change: transform;
    letter-spacing: 0.02em;
}

.nav-pill:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.nav-pill:active {
    transform: scale(0.95);
}

.pill-red {
    background: var(--gumdrop-red);
}

.pill-orange {
    background: var(--tangerine-pop);
}

.pill-green {
    background: var(--minty-fresh);
}

.pill-blue {
    background: var(--bubble-blue);
}

.pill-purple {
    background: var(--berry-swirl);
}

/* --- Mobile FAB --- */
.mobile-fab {
    display: none;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    z-index: 101;
    background: linear-gradient(135deg, var(--gumdrop-red), var(--tangerine-pop), var(--sunshine-fizz), var(--minty-fresh), var(--bubble-blue), var(--berry-swirl), var(--cotton-candy));
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
    transition: transform 200ms cubic-bezier(0.22, 1.5, 0.36, 1);
    align-items: center;
    justify-content: center;
}

.mobile-fab:hover {
    transform: scale(1.1);
}

.mobile-fab:active {
    transform: scale(0.9);
}

/* --- Footer --- */
.footer-bubbles {
    position: relative;
    z-index: 1;
    padding: clamp(4rem, 8vw, 8rem) var(--container-padding) clamp(6rem, 10vw, 10rem);
    text-align: center;
    overflow: hidden;
    min-height: 400px;
}

.footer-content {
    position: relative;
    z-index: 2;
}

.footer-speech-bubble {
    display: inline-block;
    background: white;
    border-radius: 40px;
    padding: 1rem 2.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    border: 2px solid var(--mist);
    position: relative;
    margin-bottom: 2rem;
}

.footer-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 16px solid white;
}

.footer-text {
    font-family: var(--font-headline);
    font-weight: 800;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--charcoal-soft);
    letter-spacing: 0.02em;
}

.footer-creatures {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-creatures svg {
    animation: creatureWiggle 3s ease-in-out infinite;
}

.footer-creatures svg:nth-child(2) { animation-delay: 0.3s; }
.footer-creatures svg:nth-child(3) { animation-delay: 0.6s; }
.footer-creatures svg:nth-child(4) { animation-delay: 0.9s; }
.footer-creatures svg:nth-child(5) { animation-delay: 1.2s; }
.footer-creatures svg:nth-child(6) { animation-delay: 1.5s; }
.footer-creatures svg:nth-child(7) { animation-delay: 1.8s; }

/* Rising footer bubbles */
.rising-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: riseBubble var(--rise-duration) linear infinite;
    animation-delay: var(--rise-delay);
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes riseBubble {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-400px) scale(1);
        opacity: 0;
    }
}

/* --- Confetti --- */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}

.confetti-particle {
    position: fixed;
    pointer-events: none;
    will-change: transform, opacity;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .floating-nav {
        display: none;
        position: fixed;
        bottom: 6rem;
        right: 2rem;
        left: auto;
        transform: none;
        flex-direction: column;
        padding: 0.8rem;
        border-radius: 24px;
    }

    .floating-nav.mobile-open {
        display: flex;
    }

    .mobile-fab {
        display: flex;
    }

    .card-wide {
        grid-column: span 1;
    }

    .card-tall {
        grid-row: span 1;
    }

    .bubble-creature {
        display: none;
    }

    .hero-speech-bubble {
        padding: 1.5rem 2rem;
        border-radius: 40px;
    }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .nav-pill {
        font-size: 0.8rem;
        padding: 0.45rem 1rem;
    }
}
