/* ============================================
   gabs.news - Dopamine-Maximizing News Design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --strawberry: #FF6B8A;
    --tangerine: #FF9F43;
    --lemon: #FFD93D;
    --lime: #6BCB77;
    --blueberry: #4D96FF;
    --grape: #9B59B6;
    --bubblegum: #FF78C4;
    --cloud-white: #FEFCF8;
    --ink-soft: #2D3436;
    --mist-gray: #B2BEC3;
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.65;
    color: var(--ink-soft);
    background-color: var(--cloud-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Entry Sequence Overlay --- */
#entry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cloud-white);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

#entry-overlay.skip {
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#entry-overlay.done {
    display: none;
}

#logo-bubble {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blueberry), var(--bubblegum));
    color: var(--cloud-white);
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.02em;
    box-shadow: 0 8px 40px rgba(77, 150, 255, 0.3);
    opacity: 0;
    transform: translateY(-100vh);
}

#logo-bubble.drop {
    animation: bubbleDrop 800ms var(--spring-ease) forwards;
}

#logo-bubble.pop {
    animation: bubblePop 400ms ease-out forwards;
}

@keyframes bubbleDrop {
    0% {
        opacity: 1;
        transform: translateY(-100vh);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bubblePop {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(0);
    }
}

#burst-container {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
}

.burst-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
}

.burst-bubble.animate {
    animation: burstScatter 700ms ease-out forwards;
}

@keyframes burstScatter {
    0% {
        opacity: 0.9;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0.3);
    }
}

/* Content hidden during entry */
.main-content {
    opacity: 0;
    transition: opacity 500ms ease;
}

.main-content.visible {
    opacity: 1;
}

.header {
    opacity: 0;
    transition: opacity 500ms ease;
}

.header.visible {
    opacity: 1;
}

/* --- 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;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--color);
    left: var(--left);
    bottom: -80px;
    animation: floatUp var(--duration) var(--delay) linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(calc(-100vh - 160px)) translateX(30px);
        opacity: 0;
    }
}

/* --- Sticky Header --- */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    background: rgba(254, 252, 248, 0.85);
    border-bottom: 2px solid;
    border-image: linear-gradient(90deg, #FF6B8A, #FF9F43, #FFD93D, #6BCB77, #4D96FF, #9B59B6, #FF78C4) 1;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    gap: 16px;
}

.header-logo {
    display: flex;
    align-items: baseline;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    color: var(--ink-soft);
    letter-spacing: -0.02em;
}

.logo-dot {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    color: var(--blueberry);
}

.logo-news {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    color: var(--mist-gray);
    letter-spacing: -0.02em;
}

/* --- Category Selector Pills --- */
.category-selector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 0;
    flex: 1;
    justify-content: center;
}

.category-selector::-webkit-scrollbar {
    display: none;
}

.cat-pill {
    font-family: 'Baloo 2', cursive;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 999px;
    border: 2px solid var(--pill-color);
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    white-space: nowrap;
    scroll-snap-align: center;
    transition: all 250ms var(--spring-ease);
    flex-shrink: 0;
}

.cat-pill:hover {
    background: var(--pill-color);
    color: var(--cloud-white);
    transform: scale(1.05);
}

.cat-pill.active {
    background: var(--pill-color);
    color: var(--cloud-white);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

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

/* --- Header Actions --- */
.header-actions {
    flex-shrink: 0;
}

.search-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(178, 190, 195, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms ease;
}

.search-btn:hover {
    background: rgba(178, 190, 195, 0.3);
    transform: scale(1.05);
}

/* --- Main Content --- */
.main-content {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* --- Hero Section --- */
.hero-section {
    margin-bottom: 0;
}

.card-featured {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border-radius: 24px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 250ms var(--spring-ease), box-shadow 250ms ease;
}

.card-featured:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-featured .card-illustration {
    display: flex;
    align-items: stretch;
}

.card-featured .card-illustration svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card-featured .card-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}

.featured-headline {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink-soft);
}

/* --- Bubble Section Divider --- */
.bubble-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 32px 0;
    position: relative;
}

.divider-bubble {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--b-color);
    opacity: 0.35;
    margin: 0 -4px;
    transition: transform 300ms var(--spring-ease), opacity 300ms ease;
}

.divider-bubble:hover {
    transform: scale(1.3);
    opacity: 0.6;
}

.divider-bubble:nth-child(1) { width: 22px; height: 22px; }
.divider-bubble:nth-child(2) { width: 30px; height: 30px; }
.divider-bubble:nth-child(3) { width: 26px; height: 26px; }
.divider-bubble:nth-child(4) { width: 34px; height: 34px; }
.divider-bubble:nth-child(5) { width: 26px; height: 26px; }
.divider-bubble:nth-child(6) { width: 30px; height: 30px; }
.divider-bubble:nth-child(7) { width: 22px; height: 22px; }

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

/* --- Base Card Styles --- */
.card {
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: transform 250ms var(--spring-ease), box-shadow 250ms ease, background-color 200ms ease;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Hover glow-up: increase background tint */
.card:hover {
    --card-bg-hover: 1;
}

/* --- Card Variants --- */

/* Standard Card */
.card-standard .card-illustration {
    width: 100%;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
}

.card-standard .card-illustration svg {
    width: 100%;
    height: auto;
    display: block;
}

.card-standard .card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Compact Card */
.card-compact {
    min-height: auto;
}

.card-compact .card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Visual Card */
.card-visual {
    grid-row: span 2;
}

.card-visual .card-illustration-full {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 300px;
}

.card-visual .card-illustration-full svg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.visual-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px;
    background: linear-gradient(to top, rgba(254, 252, 248, 0.95) 0%, rgba(254, 252, 248, 0.7) 60%, transparent 100%);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

/* --- Card Inner Elements --- */
.card-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tag {
    font-family: 'Baloo 2', cursive;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--tag-color);
    color: var(--cloud-white);
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.02em;
}

.spot-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--spot-color);
    opacity: 0.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    margin-left: auto;
}

.spot-icon svg {
    width: 16px;
    height: 16px;
}

.card-headline {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink-soft);
}

.card-excerpt {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--ink-soft);
    opacity: 0.8;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 8px;
}

.meta-time {
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--mist-gray);
}

.read-btn {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 24px;
    border-radius: 999px;
    border: none;
    background: var(--blueberry);
    color: var(--cloud-white);
    cursor: pointer;
    transition: transform 300ms var(--spring-ease), box-shadow 200ms ease;
    box-shadow: 0 2px 12px rgba(77, 150, 255, 0.3);
}

.read-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(77, 150, 255, 0.4);
}

.read-btn:active {
    transform: scale(0.95);
}

/* --- Bounce Enter Animation --- */
.card.card-hidden {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.card.card-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 500ms var(--spring-ease), transform 500ms var(--spring-ease);
}

/* Featured card also gets bounce enter */
.card-featured.card-hidden {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

.card-featured.card-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 500ms var(--spring-ease), transform 500ms var(--spring-ease);
}

/* --- Caught Up Section --- */
.caught-up {
    text-align: center;
    padding: 60px 24px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.caught-up-bubble {
    width: 120px;
    height: 120px;
    animation: gentleBounce 2s ease-in-out infinite;
}

.caught-up-character {
    width: 100%;
    height: 100%;
}

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

.caught-up-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--ink-soft);
}

.caught-up-sub {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--mist-gray);
}

/* --- Particle Container (Bubble Pop) --- */
#particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.pop-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* --- Category Filter Animations --- */
.card.filtered-out {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    position: absolute;
    visibility: hidden;
}

.card.filtered-in {
    opacity: 1;
    transform: scale(1);
    transition: opacity 300ms ease, transform 300ms var(--spring-ease);
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
    .card-featured {
        grid-template-columns: 1fr;
    }

    .card-featured .card-illustration {
        max-height: 240px;
    }

    .card-featured .card-body {
        padding: 24px;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .header-inner {
        padding: 0 16px;
    }

    .category-selector {
        justify-content: flex-start;
    }

    .cat-pill {
        font-size: 0.8rem;
        padding: 5px 14px;
    }

    .main-content {
        padding: 16px;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

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

    .card-visual .card-illustration-full {
        min-height: 220px;
    }

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

    .featured-headline {
        font-size: clamp(1.5rem, 5vw, 2.2rem);
    }

    .bubble-divider {
        padding: 24px 0;
    }

    .caught-up {
        padding: 40px 16px 60px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .logo-news {
        display: none;
    }

    .card-headline {
        font-size: 1.1rem;
    }
}
