/* ============================================================
   gabs.reviews - Dopamine Design / Bubble-Playful
   ============================================================
   Design Notes:
   - Interaction Details:** Card Interaction Details:** bounce-enter, hover lift, active squish
   - IntersectionObserver with a `0.15` threshold: for viewport detection
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bubble-red: #FF6B6B;
    --bubble-orange: #FFA94D;
    --bubble-yellow: #FFE066;
    --bubble-green: #69DB7C;
    --bubble-teal: #38D9A9;
    --bubble-blue: #4DABF7;
    --bubble-indigo: #7950F2;
    --bubble-pink: #F06595;
    --bg-marshmallow: #FFF9F0;
    --surface-white: #FFFFFF;
    --text-primary: #2B2B3D;
    --text-secondary: #6B7280;
    --radius-card: 24px;
    --radius-pill: 999px;
    --radius-hero: 48px;
}

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

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

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.5rem, 1.15rem);
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-marshmallow);
    overflow-x: hidden;
}

/* --- Rainbow Gradient Scrollbar (Webkit) --- */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(
        to bottom,
        #FF6B6B,
        #FFA94D,
        #FFE066,
        #69DB7C,
        #38D9A9,
        #4DABF7,
        #7950F2,
        #F06595
    );
    border-radius: var(--radius-pill);
}

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

.bg-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.8), transparent 70%);
    will-change: transform;
    opacity: 0.5;
}

@keyframes float-up {
    0% {
        transform: translateY(100vh) translateX(0) scale(1);
        opacity: 0;
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-120px) translateX(var(--drift, 30px)) scale(var(--end-scale, 1.1));
        opacity: 0;
    }
}

/* --- Cursor Trail --- */
#cursor-trail {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.trail-dot {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes trail-fade {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(0.1);
        opacity: 0;
    }
}

/* --- Hero Section --- */
#hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: sticky;
    top: 0;
    z-index: 1;
}

.hero-bubble {
    position: relative;
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    background: linear-gradient(135deg, rgba(121, 80, 242, 0.08), rgba(240, 101, 149, 0.08), rgba(255, 169, 77, 0.06));
    border-radius: var(--radius-hero);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        0 8px 60px rgba(121, 80, 242, 0.1),
        0 2px 20px rgba(240, 101, 149, 0.08),
        inset 0 0 100px rgba(255, 255, 255, 0.5);
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.hero-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    font-size: clamp(2.5rem, 8vw + 1rem, 7rem);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--bubble-red), var(--bubble-orange), var(--bubble-yellow), var(--bubble-green), var(--bubble-teal), var(--bubble-blue), var(--bubble-indigo), var(--bubble-pink));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-shift 8s ease-in-out infinite, float 6s ease-in-out infinite;
    text-align: center;
    position: relative;
    z-index: 2;
}

@keyframes rainbow-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

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

.hero-tagline {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: clamp(1rem, 2vw + 0.3rem, 1.6rem);
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    margin-top: 0.5rem;
    position: relative;
    z-index: 2;
}

/* Hero Decorative Bubbles */
.hero-deco-bubble {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9), transparent 70%);
    will-change: transform;
}

.hero-deco-1 {
    width: 80px;
    height: 80px;
    top: 12%;
    left: 8%;
    border: 2px solid rgba(255, 107, 107, 0.3);
    animation: float-deco 7s ease-in-out infinite;
}

.hero-deco-2 {
    width: 50px;
    height: 50px;
    top: 20%;
    right: 12%;
    border: 2px solid rgba(255, 169, 77, 0.3);
    animation: float-deco 9s ease-in-out infinite 1s;
}

.hero-deco-3 {
    width: 120px;
    height: 120px;
    bottom: 15%;
    left: 15%;
    border: 2px solid rgba(121, 80, 242, 0.2);
    animation: float-deco 11s ease-in-out infinite 2s;
}

.hero-deco-4 {
    width: 40px;
    height: 40px;
    top: 35%;
    right: 25%;
    border: 2px solid rgba(56, 217, 169, 0.3);
    animation: float-deco 8s ease-in-out infinite 0.5s;
}

.hero-deco-5 {
    width: 65px;
    height: 65px;
    bottom: 25%;
    right: 10%;
    border: 2px solid rgba(240, 101, 149, 0.3);
    animation: float-deco 10s ease-in-out infinite 3s;
}

.hero-deco-6 {
    width: 35px;
    height: 35px;
    top: 55%;
    left: 5%;
    border: 2px solid rgba(105, 219, 124, 0.3);
    animation: float-deco 6s ease-in-out infinite 1.5s;
}

@keyframes float-deco {
    0%, 100% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    25% {
        transform: translateY(-15px) translateX(8px) rotate(5deg);
    }
    50% {
        transform: translateY(-8px) translateX(-5px) rotate(-3deg);
    }
    75% {
        transform: translateY(-20px) translateX(12px) rotate(7deg);
    }
}

/* Hero scroll-driven pop effect */
.hero-bubble.hero-popped {
    transform: scale(0.85);
    opacity: 0;
}

/* --- Bubble Dividers --- */
.bubble-divider {
    width: 100%;
    padding: 1rem 0;
    position: relative;
    z-index: 2;
}

.bubble-divider svg {
    width: 100%;
    height: 80px;
    display: block;
}

/* --- Sections --- */
.section {
    position: relative;
    z-index: 2;
    padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 3vw, 3rem);
    max-width: 1400px;
    margin: 0 auto;
}

.section-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw + 0.5rem, 4.5rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: clamp(1.5rem, 3vw, 3rem);
}

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

/* --- Review Cards --- */
.review-card {
    background: var(--surface-white);
    background-image: linear-gradient(135deg, color-mix(in srgb, var(--card-color) 3%, transparent), color-mix(in srgb, var(--card-color) 8%, transparent));
    border-radius: var(--radius-card);
    padding: clamp(1.2rem, 2vw, 2rem);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow:
        0 4px 16px rgba(43, 43, 61, 0.06),
        0 1px 4px rgba(43, 43, 61, 0.04);
    transition:
        transform 300ms ease-out,
        box-shadow 300ms ease-out,
        filter 300ms ease-out;
    cursor: default;
    /* Bounce-enter hidden by default */
    opacity: 0;
    transform: scale(0.3) translateY(40px);
}

.review-card.bounced-in {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: bounceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounceIn {
    0% { transform: scale(0.3) translateY(40px); opacity: 0; }
    50% { transform: scale(1.08) translateY(-8px); opacity: 1; }
    70% { transform: scale(0.95) translateY(2px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.review-card:hover {
    transform: translateY(-8px) !important;
    box-shadow:
        0 12px 40px rgba(43, 43, 61, 0.12),
        0 4px 12px rgba(43, 43, 61, 0.08);
    filter: hue-rotate(15deg);
}

.review-card:active {
    transform: scale(0.96) !important;
    transition: transform 100ms ease-out;
}

/* Bubble hover effect container */
.review-card .hover-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.hover-bubble-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes pop-out {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) translate(var(--dx), var(--dy));
        opacity: 0;
    }
}

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

/* Card Tall */
.card-tall {
    grid-row: span 2;
}

/* Card Badge */
.card-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-pill {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
}

.cat-icon {
    flex-shrink: 0;
}

/* Card Avatar */
.card-avatar {
    display: flex;
    align-items: center;
}

.card-avatar svg {
    filter: drop-shadow(0 2px 4px rgba(43, 43, 61, 0.1));
}

/* Card Title */
.card-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: clamp(1.1rem, 1.5vw + 0.5rem, 1.5rem);
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Star Rating Bubbles */
.star-rating {
    display: flex;
    gap: 4px;
    align-items: center;
}

.star-bubble {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: transform 200ms ease;
}

.star-bubble.filled {
    background: radial-gradient(circle at 35% 35%, #FFDD57, var(--bubble-orange));
    box-shadow: 0 2px 8px rgba(255, 169, 77, 0.4);
}

.star-bubble.empty {
    background: transparent;
    border: 2px dashed var(--text-secondary);
    opacity: 0.4;
}

.star-bubble:hover {
    transform: scale(1.2);
}

/* Speech Bubble */
.speech-bubble {
    position: relative;
    background: linear-gradient(135deg, color-mix(in srgb, var(--card-color) 5%, var(--bg-marshmallow)), color-mix(in srgb, var(--card-color) 10%, var(--bg-marshmallow)));
    border-radius: 16px;
    padding: 0.8rem 1rem;
    margin-top: 0.2rem;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 16px;
    height: 16px;
    background: inherit;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.speech-bubble p {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1vw + 0.4rem, 1.05rem);
    line-height: 1.6;
    color: var(--text-primary);
    font-style: italic;
}

/* Card Author */
.card-author {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
    padding-top: 0.4rem;
}

/* --- Categories Section --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: clamp(16px, 3vw, 24px);
    max-width: 900px;
    margin: 0 auto;
}

.category-bubble {
    background: var(--surface-white);
    border-radius: var(--radius-card);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    box-shadow:
        0 4px 16px rgba(43, 43, 61, 0.06),
        0 1px 4px rgba(43, 43, 61, 0.04);
    transition: transform 300ms ease-out, box-shadow 300ms ease-out;
    cursor: pointer;
    border: 2px solid transparent;
    /* Bounce-enter hidden */
    opacity: 0;
    transform: scale(0.3) translateY(40px);
}

.category-bubble.bounced-in {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: bounceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.category-bubble:hover {
    transform: translateY(-6px) scale(1.04) !important;
    box-shadow:
        0 8px 30px rgba(43, 43, 61, 0.1),
        0 2px 8px rgba(43, 43, 61, 0.06);
    border-color: var(--cat-color);
}

.category-bubble:active {
    transform: scale(0.95) !important;
}

.category-label {
    font-family: 'Baloo 2', cursive;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.category-count {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Floating Navigation --- */
#float-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: center;
}

.nav-pill {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow:
        0 4px 16px rgba(43, 43, 61, 0.1),
        0 1px 4px rgba(43, 43, 61, 0.06);
    transition: transform 300ms ease-out, background 200ms ease, box-shadow 200ms ease;
}

.nav-pill:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow:
        0 6px 24px rgba(43, 43, 61, 0.14),
        0 2px 6px rgba(43, 43, 61, 0.08);
}

/* Radial repel on hover group */
#float-nav:hover .nav-pill-1 {
    transform: translateY(-4px) translateX(-3px);
}

#float-nav:hover .nav-pill-2 {
    transform: translateX(-5px);
}

#float-nav:hover .nav-pill-3 {
    transform: translateX(-3px) translateY(2px);
}

#float-nav:hover .nav-pill-4 {
    transform: translateY(4px) translateX(-2px);
}

.nav-pill svg {
    flex-shrink: 0;
}

/* --- Footer --- */
#footer {
    position: relative;
    z-index: 2;
    margin-top: 2rem;
    padding: 3rem 2rem 2rem;
    background: linear-gradient(180deg, transparent, rgba(121, 80, 242, 0.04), rgba(240, 101, 149, 0.04));
    border-radius: 48px 48px 0 0;
    overflow: hidden;
}

.footer-bubbles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.footer-bubbles svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
}

.footer-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.8rem;
    padding: 2rem 0;
}

.footer-title {
    font-family: 'Baloo 2', cursive;
    font-weight: 800;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--bubble-indigo), var(--bubble-pink), var(--bubble-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

.footer-link {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--bubble-teal);
    text-decoration: none;
    padding: 0.35rem 1rem;
    border-radius: var(--radius-pill);
    background: rgba(56, 217, 169, 0.1);
    transition: background 200ms ease, transform 200ms ease;
}

.footer-link:hover {
    background: rgba(56, 217, 169, 0.2);
    transform: translateY(-2px);
}

.footer-copy {
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    opacity: 0.7;
}

/* --- Bounce Target (generic for section titles etc.) --- */
.bounce-target {
    opacity: 0;
    transform: scale(0.3) translateY(40px);
}

.bounce-target.bounced-in {
    opacity: 1;
    transform: scale(1) translateY(0);
    animation: bounceIn 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .card-wide {
        grid-column: span 1;
    }

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

    .hero-bubble {
        width: 95vw;
        height: 80vh;
        border-radius: 32px;
    }

    .hero-deco-3 {
        width: 70px;
        height: 70px;
    }

    #float-nav {
        bottom: 1rem;
        right: 1rem;
    }

    .nav-pill {
        width: 38px;
        height: 38px;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
}

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

    .hero-bubble {
        height: 75vh;
        border-radius: 24px;
    }

    .hero-deco-1,
    .hero-deco-4,
    .hero-deco-6 {
        display: none;
    }
}
