/* ============================================================
   gabs.games — toy-box, candy-bright, bouncing arcade aesthetic
   ============================================================ */

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

html,
body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', system-ui, sans-serif;
    color: #3D1340;
    background-color: #FFF5E6;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- DESIGN TOKENS ---- */
:root {
    --c-pink: #FF3CAC;
    --c-coral: #FF6F61;
    --c-yellow: #FFD93D;
    --c-green: #6BCB77;
    --c-teal: #4ECDC4;
    --c-blue: #45B7D1;
    --c-violet: #784BA0;
    --c-magenta: #9B59B6;
    --c-plum: #3D1340;
    --c-cream: #FFF5E6;
    --c-white: #FFFFFF;

    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---- KEYFRAMES ---- */
@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; }
}

@keyframes letterBounceIn {
    0%   { transform: scale(0.3) translateY(60px) rotate(-8deg); opacity: 0; }
    50%  { transform: scale(1.15) translateY(-12px) rotate(4deg); opacity: 1; }
    70%  { transform: scale(0.92) translateY(4px) rotate(-2deg); }
    100% { transform: scale(1) translateY(0) rotate(0deg); opacity: 1; }
}

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

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

@keyframes wobble {
    0%, 100% { transform: rotate(-1deg); }
    50%      { transform: rotate(1deg); }
}

@keyframes driftLeft {
    0%   { transform: translateX(110vw); }
    100% { transform: translateX(-60vw); }
}

@keyframes shapeDrift {
    0%   { transform: translate(0, 0) rotate(0deg); }
    25%  { transform: translate(30px, -20px) rotate(90deg); }
    50%  { transform: translate(-20px, 30px) rotate(180deg); }
    75%  { transform: translate(20px, 20px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30%           { transform: translateY(-6px); opacity: 1; }
}

/* ---- SECTIONS ---- */
.section {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    padding: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   SECTION 1 — HERO
   ============================================================ */
.section-hero {
    background: radial-gradient(ellipse at 50% 40%, #FF3CAC 0%, #784BA0 70%, #3D1340 100%);
}

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

.bg-shape {
    position: absolute;
    will-change: transform;
    animation: shapeDrift var(--drift-duration, 14s) ease-in-out infinite;
}

.bg-shape.shape-circle {
    border-radius: 999px;
}

.bg-shape.shape-rounded-square {
    border-radius: 12px;
}

.bg-shape.shape-hexagon {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.bg-shape.shape-triangle {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.bg-shape.shape-star svg {
    width: 100%;
    height: 100%;
    display: block;
    animation: spin var(--drift-duration, 14s) linear infinite;
}

.hero-card {
    position: relative;
    z-index: 10;
    background: var(--c-cream);
    border: 5px solid var(--c-yellow);
    border-radius: 36px;
    padding: 64px 56px;
    max-width: 1100px;
    width: 100%;
    transform: rotate(2deg);
    box-shadow: 12px 12px 0px var(--c-plum);
    text-align: center;
    overflow: hidden;
}

.hero-card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
    border-radius: 36px;
}

.hero-logotype {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.04em;
    line-height: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.02em;
}

.hero-letter {
    display: inline-block;
    opacity: 0;
    animation: letterBounceIn 0.9s var(--spring) forwards;
    animation-delay: calc(0.1s + var(--letter-index) * 80ms);
    transform-origin: center bottom;
}

.hero-letter.dot {
    transform: translateY(0.05em);
}

.hero-letter.floating {
    animation: float var(--float-duration, 3s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
    opacity: 1;
}

.hero-tagline {
    margin-top: 28px;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--c-violet);
}

.scroll-chevron {
    position: absolute;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%);
    z-index: 20;
    animation: chevronBounce 1.6s ease-in-out infinite;
}

/* ============================================================
   SECTION 2 — GAME SHELF (CARD GRID)
   ============================================================ */
.section-shelf {
    background: var(--c-cream);
    flex-direction: column;
    padding: 80px 48px;
}

.dot-pattern {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(120, 75, 160, 0.12) 1.5px, transparent 1.6px);
    background-size: 40px 40px;
}

.shelf-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    gap: 56px;
}

.section-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.section-head-center {
    align-items: center;
    text-align: center;
    margin-bottom: 28px;
    position: relative;
    z-index: 5;
}

.section-eyebrow {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--c-violet);
}

.section-eyebrow.eyebrow-light {
    color: var(--c-yellow);
}

.section-heading {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
}

.heading-pink { color: var(--c-pink); }
.heading-plum { color: var(--c-plum); }

.squiggle {
    display: block;
}

.squiggle-large { margin: 24px auto 0; }

/* --- card grid --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.game-card {
    position: relative;
    background: var(--c-cream);
    border: 4px solid var(--card-color);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 8px 8px 0px var(--card-shadow);
    transition: transform 0.3s var(--spring),
                box-shadow 0.3s var(--spring),
                border-width 0.3s var(--spring);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.3) translateY(40px);
    will-change: transform;
}

.game-card.visible {
    animation: bounceIn 0.9s var(--spring) forwards;
    animation-delay: calc(var(--card-index) * 120ms);
}

.game-card:hover {
    transform: scale(1.06) rotate(-1deg);
    box-shadow: 12px 12px 0px var(--card-shadow);
    border-width: 6px;
}

.card-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
    border-radius: 20px;
}

.card-title {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    color: var(--card-color);
    margin: 24px 0 12px;
}

.card-body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--c-plum);
}

/* --- card icons (CSS-drawn) --- */
.icon {
    position: relative;
    width: 80px;
    height: 80px;
}

/* dice */
.icon-dice .dice-face {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    padding: 8px;
    gap: 2px;
}

.icon-dice .face-a {
    top: 0;
    left: 0;
    transform: rotate(-8deg);
}

.icon-dice .face-b {
    bottom: -4px;
    right: -4px;
    background: var(--c-cream);
    transform: rotate(10deg);
    z-index: 2;
}

.icon-dice .pip {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--c-plum);
    align-self: center;
    justify-self: center;
}

.icon-dice .face-a .p1 { grid-column: 1; grid-row: 1; }
.icon-dice .face-a .p2 { grid-column: 2; grid-row: 2; }
.icon-dice .face-a .p3 { grid-column: 1; grid-row: 3; }
.icon-dice .face-b .p1 { grid-column: 1; grid-row: 1; }
.icon-dice .face-b .p2 { grid-column: 2; grid-row: 3; }

/* controller */
.icon-controller .ctrl-body {
    position: absolute;
    width: 80px;
    height: 46px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    border-radius: 28px;
    top: 18px;
    left: 0;
}

.icon-controller .ctrl-dpad {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--c-plum);
    top: 33px;
    left: 14px;
    box-shadow:
        -8px 0 0 var(--c-plum),
        8px 0 0 var(--c-plum),
        0 8px 0 var(--c-plum),
        0 -8px 0 var(--c-plum);
}

.icon-controller .ctrl-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--c-cream);
    border: 3px solid var(--c-plum);
    border-radius: 999px;
    top: 33px;
    right: 12px;
}

/* chat bubble */
.icon-chat .bubble-body {
    position: absolute;
    top: 8px;
    left: 0;
    width: 76px;
    height: 50px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.icon-chat .bubble-tail {
    position: absolute;
    bottom: 8px;
    left: 18px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 0 solid transparent;
    border-top: 14px solid var(--card-color);
    filter: drop-shadow(0 2px 0 var(--c-plum));
}

.icon-chat .typing-dot {
    width: 8px;
    height: 8px;
    background: var(--c-plum);
    border-radius: 999px;
    animation: typingDot 1.2s ease-in-out infinite;
}

.icon-chat .typing-dot:nth-child(2) { animation-delay: 0.2s; }
.icon-chat .typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* trophy */
.icon-trophy {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-trophy .trophy-cup {
    position: absolute;
    width: 44px;
    height: 40px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    border-radius: 4px 4px 22px 22px;
    top: 14px;
    left: 18px;
}

.icon-trophy .trophy-handle {
    position: absolute;
    width: 14px;
    height: 22px;
    border: 3px solid var(--c-plum);
    border-radius: 12px;
    top: 18px;
}

.icon-trophy .trophy-handle-l {
    left: 8px;
    border-right: none;
}

.icon-trophy .trophy-handle-r {
    right: 8px;
    border-left: none;
}

.icon-trophy .trophy-base {
    position: absolute;
    width: 52px;
    height: 10px;
    background: var(--c-plum);
    border-radius: 4px;
    bottom: 10px;
    left: 14px;
}

.icon-trophy .trophy-star {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--c-yellow);
    top: 22px;
    left: 33px;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* puzzle */
.icon-puzzle .puzzle-base {
    position: absolute;
    top: 14px;
    left: 14px;
    width: 52px;
    height: 52px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    border-radius: 10px;
}

.icon-puzzle .puzzle-knob {
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
    border-radius: 999px;
}

.icon-puzzle .puzzle-knob-top {
    top: 4px;
    left: 31px;
}

.icon-puzzle .puzzle-knob-right {
    top: 31px;
    right: 4px;
}

/* lightning bolt */
.icon-bolt {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-bolt .bolt-piece {
    position: absolute;
    background: var(--card-color);
    border: 3px solid var(--c-plum);
}

.icon-bolt .bolt-top {
    width: 30px;
    height: 36px;
    top: 6px;
    left: 26px;
    clip-path: polygon(60% 0%, 100% 0%, 40% 100%, 0% 100%);
}

.icon-bolt .bolt-bottom {
    width: 30px;
    height: 36px;
    bottom: 6px;
    left: 26px;
    clip-path: polygon(60% 0%, 100% 0%, 40% 100%, 0% 100%);
    transform: rotate(180deg);
}

/* ============================================================
   SECTION 3 — CHAT BUBBLE RIVER
   ============================================================ */
.section-river {
    background: var(--c-cream);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: 80px;
    padding-bottom: 80px;
    position: relative;
}

.section-river::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(120, 75, 160, 0.10) 1.5px, transparent 1.6px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

.bubble-river {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 60vh;
    overflow: hidden;
    z-index: 2;
}

.chat-bubble {
    position: absolute;
    padding: 18px 26px;
    border-radius: 26px;
    border: 3px solid var(--c-plum);
    background: var(--bubble-color, #FF3CAC);
    color: var(--c-plum);
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 6px 6px 0 rgba(61, 19, 64, 0.65);
    white-space: nowrap;
    animation: driftLeft var(--drift-duration, 22s) linear infinite;
    animation-delay: var(--drift-delay, 0s);
    top: var(--bubble-top, 30%);
    will-change: transform;
}

.chat-bubble::after {
    content: "";
    position: absolute;
    bottom: -16px;
    left: 28px;
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 0 solid transparent;
    border-top: 18px solid var(--bubble-color, #FF3CAC);
    filter: drop-shadow(0 2px 0 var(--c-plum));
}

/* ============================================================
   SECTION 4 — SCOREBOARD
   ============================================================ */
.section-board {
    background: linear-gradient(180deg, var(--c-violet) 0%, #5b3580 100%);
}

.board-card {
    position: relative;
    background: var(--c-plum);
    border: 5px solid var(--c-yellow);
    border-radius: 28px;
    padding: 56px 48px;
    width: 100%;
    max-width: 880px;
    box-shadow: 12px 12px 0 #1a0820;
    overflow: hidden;
    animation: wobble 3.6s ease-in-out infinite;
}

.board-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
    border-radius: 24px;
}

.board-head {
    text-align: center;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.board-heading {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--c-cream);
    line-height: 1.1;
}

.rank-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 32px 0;
    padding: 0;
}

.rank-row {
    display: grid;
    grid-template-columns: 60px 140px 1fr 120px;
    align-items: center;
    gap: 18px;
}

.rank-place {
    font-family: 'Baloo 2', 'Quicksand', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    text-align: right;
}

.rank-name {
    font-family: 'Quicksand', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--c-cream);
}

.rank-bar-wrap {
    height: 20px;
    background: rgba(255, 245, 230, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.rank-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width 1.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rank-num {
    font-family: 'Baloo 2', 'Quicksand', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    color: var(--c-yellow);
    text-align: right;
    letter-spacing: 0.02em;
}

.board-foot {
    margin-top: 8px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-yellow);
}

/* ============================================================
   SECTION 5 — INVITATION
   ============================================================ */
.section-invite {
    background: var(--c-violet);
    text-align: center;
    overflow: hidden;
}

.shape-field-invite .bg-shape {
    animation-name: shapeDrift;
}

.invite-inner {
    position: relative;
    z-index: 10;
    max-width: 1100px;
    padding: 0 24px;
}

.invite-eyebrow {
    font-family: 'Nunito', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--c-yellow);
    margin-bottom: 28px;
}

.invite-line {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 5.5rem);
    line-height: 1.1;
    color: var(--c-white);
    letter-spacing: 0.01em;
}

.invite-foot {
    margin-top: 32px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--c-cream);
    opacity: 0.85;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .section {
        padding: 48px 32px;
    }

    .rank-row {
        grid-template-columns: 50px 110px 1fr 90px;
        gap: 12px;
    }

    .rank-num { font-size: 1.6rem; }
}

@media (max-width: 640px) {
    .section {
        padding: 40px 16px;
    }

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

    .hero-card {
        padding: 40px 28px;
        border-radius: 28px;
    }

    .board-card {
        padding: 36px 24px;
    }

    .rank-row {
        grid-template-columns: 44px 1fr 80px;
    }

    .rank-bar-wrap {
        grid-column: 1 / -1;
    }

    .rank-name {
        font-size: 0.95rem;
    }

    .rank-num { font-size: 1.4rem; }
}

/* ============================================================
   ENTRY-VISIBLE HELPERS (IntersectionObserver targets)
   ============================================================ */
.fade-up {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    transition: opacity 0.7s var(--spring), transform 0.7s var(--spring);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
