/**
 * Games Hero Block Styles
 *
 * Animation Types:
 * - heart-ecg: Health-focused heart with ECG line
 * - adventure-run: Character running/jumping with food collectibles
 * - food-journey: Flowing line forming fruit/veggie shapes
 * - energy-bounce: Playful bouncing energy pattern
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.gb-games-hero {
    position: relative;
    padding: 4rem 2rem;
    overflow: hidden;
    text-align: center;
}

.gb-games-hero--align-left {
    text-align: left;
}

.gb-games-hero--align-center {
    text-align: center;
}

.gb-games-hero--align-right {
    text-align: right;
}

/* ==========================================================================
   Animation Container
   ========================================================================== */

.gb-games-hero__animation {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.gb-games-hero__svg {
    width: 100%;
    height: 100%;
    max-height: 400px;
}

/* Full-width animations */
.gb-games-hero__animation--full-width .gb-games-hero__svg {
    max-height: none;
    height: 100%;
}

/* ==========================================================================
   Heart ECG Animation (Original)
   ========================================================================== */

.gb-games-hero__heart {
    animation: heartPulse calc(2s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center;
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.05); }
    30% { transform: scale(1); }
    45% { transform: scale(1.03); }
    60% { transform: scale(1); }
}

.gb-games-hero__ecg {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: ecgDraw calc(2s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes ecgDraw {
    0% { stroke-dashoffset: 400; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -400; }
}

/* ==========================================================================
   Adventure Run Animation
   ========================================================================== */

/* Ground/platform line */
.gb-games-hero__ground {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: groundDraw calc(3s / var(--animation-speed, 1)) ease-out forwards;
}

@keyframes groundDraw {
    0% { stroke-dashoffset: 2000; }
    100% { stroke-dashoffset: 0; }
}

/* Running character */
.gb-games-hero__runner {
    animation: runnerMove calc(4s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center bottom;
}

@keyframes runnerMove {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(50px) translateY(-15px);
    }
    50% {
        transform: translateX(100px) translateY(0);
    }
    75% {
        transform: translateX(150px) translateY(-20px);
    }
}

/* Food collectibles bounce */
.gb-games-hero__collectible {
    animation: collectibleBounce calc(2s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center;
}

.gb-games-hero__collectible:nth-child(2) {
    animation-delay: calc(0.3s / var(--animation-speed, 1));
}

.gb-games-hero__collectible:nth-child(3) {
    animation-delay: calc(0.6s / var(--animation-speed, 1));
}

.gb-games-hero__collectible:nth-child(4) {
    animation-delay: calc(0.9s / var(--animation-speed, 1));
}

@keyframes collectibleBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.1); }
}

/* Jump arc trail */
.gb-games-hero__jump-trail {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: jumpTrailDraw calc(2s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes jumpTrailDraw {
    0%, 100% { stroke-dashoffset: 300; opacity: 0.3; }
    50% { stroke-dashoffset: 0; opacity: 1; }
}

/* ==========================================================================
   Food Journey Animation
   ========================================================================== */

/* Main flowing food line */
.gb-games-hero__food-path {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    animation: foodPathDraw calc(4s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes foodPathDraw {
    0% { stroke-dashoffset: 1500; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1500; }
}

/* Individual food items pulse */
.gb-games-hero__food-item {
    animation: foodPulse calc(3s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center;
}

.gb-games-hero__food-item--apple {
    animation-delay: 0s;
}

.gb-games-hero__food-item--banana {
    animation-delay: calc(0.5s / var(--animation-speed, 1));
}

.gb-games-hero__food-item--carrot {
    animation-delay: calc(1s / var(--animation-speed, 1));
}

.gb-games-hero__food-item--broccoli {
    animation-delay: calc(1.5s / var(--animation-speed, 1));
}

@keyframes foodPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.08); opacity: 1; }
}

/* Connecting flow line */
.gb-games-hero__flow-line {
    stroke-dasharray: 20 10;
    animation: flowMove calc(1.5s / var(--animation-speed, 1)) linear infinite;
}

@keyframes flowMove {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -30; }
}

/* ==========================================================================
   Energy Bounce Animation
   ========================================================================== */

/* Bouncing energy dots */
.gb-games-hero__energy-dot {
    animation: energyBounce calc(1.5s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center;
}

.gb-games-hero__energy-dot:nth-child(1) { animation-delay: 0s; }
.gb-games-hero__energy-dot:nth-child(2) { animation-delay: calc(0.15s / var(--animation-speed, 1)); }
.gb-games-hero__energy-dot:nth-child(3) { animation-delay: calc(0.3s / var(--animation-speed, 1)); }
.gb-games-hero__energy-dot:nth-child(4) { animation-delay: calc(0.45s / var(--animation-speed, 1)); }
.gb-games-hero__energy-dot:nth-child(5) { animation-delay: calc(0.6s / var(--animation-speed, 1)); }
.gb-games-hero__energy-dot:nth-child(6) { animation-delay: calc(0.75s / var(--animation-speed, 1)); }
.gb-games-hero__energy-dot:nth-child(7) { animation-delay: calc(0.9s / var(--animation-speed, 1)); }

@keyframes energyBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateY(-30px) scale(1.3);
        opacity: 1;
    }
}

/* Star sparkles */
.gb-games-hero__sparkle {
    animation: sparkle calc(2s / var(--animation-speed, 1)) ease-in-out infinite;
    transform-origin: center;
}

.gb-games-hero__sparkle:nth-child(odd) {
    animation-delay: calc(0.5s / var(--animation-speed, 1));
}

@keyframes sparkle {
    0%, 100% {
        transform: scale(0.8) rotate(0deg);
        opacity: 0.4;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }
}

/* Wave trail */
.gb-games-hero__wave {
    stroke-dasharray: 800;
    animation: waveFlow calc(3s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes waveFlow {
    0% { stroke-dashoffset: 800; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -800; }
}

/* ==========================================================================
   Playful Bubbles Animation
   ========================================================================== */

/* Base bubble styles */
.gb-games-hero__bubble {
    transform-origin: center;
}

/* Large bubbles - bounce up from bottom */
.gb-games-hero__bubble--large {
    animation: bubbleBounce calc(2.5s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes bubbleBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    30% {
        transform: translateY(-60px) scale(1.15);
    }
    50% {
        transform: translateY(-40px) scale(0.95);
    }
    70% {
        transform: translateY(-50px) scale(1.05);
    }
}

/* Medium bubbles - pulse and float */
.gb-games-hero__bubble--medium {
    animation: bubblePulse calc(3s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes bubblePulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }
    25% {
        transform: translateY(-15px) scale(1.2);
        opacity: 1;
    }
    50% {
        transform: translateY(-5px) scale(0.9);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-20px) scale(1.1);
        opacity: 0.9;
    }
}

/* Small bubbles - gentle float */
.gb-games-hero__bubble--small {
    animation: bubbleFloat calc(4s / var(--animation-speed, 1)) ease-in-out infinite;
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translateY(0) translateX(0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translateY(-10px) translateX(5px) scale(1.15);
        opacity: 0.9;
    }
    50% {
        transform: translateY(-5px) translateX(-3px) scale(0.9);
        opacity: 0.7;
    }
    75% {
        transform: translateY(-15px) translateX(2px) scale(1.1);
        opacity: 0.85;
    }
}

/* ==========================================================================
   Content Styles
   ========================================================================== */

.gb-games-hero__content {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
}

.gb-games-hero--align-left .gb-games-hero__content {
    margin-left: 0;
    margin-right: auto;
}

.gb-games-hero--align-right .gb-games-hero__content {
    margin-left: auto;
    margin-right: 0;
}

/* Headline - scales with block typography setting */
.gb-games-hero__headline {
    font-size: 2em;
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.5em 0;
    color: inherit;
}

/* Subheadline - scales with block typography setting */
.gb-games-hero__subheadline {
    font-size: 0.9em;
    line-height: 1.6;
    margin: 0 0 0.5em 0;
    color: inherit;
    opacity: 0.85;
}

/* Tagline - scales with block typography setting */
.gb-games-hero__tagline {
    font-size: 0.8em;
    line-height: 1.5;
    margin: 0;
    font-style: italic;
    color: inherit;
    opacity: 0.7;
}

/* ==========================================================================
   Editor Styles
   ========================================================================== */

.block-editor-block-list__block .gb-games-hero__headline,
.block-editor-block-list__block .gb-games-hero__subheadline,
.block-editor-block-list__block .gb-games-hero__tagline {
    background: transparent;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .gb-games-hero {
        padding: 3rem 1.5rem;
    }

    .gb-games-hero__svg {
        max-height: 300px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .gb-games-hero__heart,
    .gb-games-hero__ecg,
    .gb-games-hero__ground,
    .gb-games-hero__runner,
    .gb-games-hero__collectible,
    .gb-games-hero__jump-trail,
    .gb-games-hero__food-path,
    .gb-games-hero__food-item,
    .gb-games-hero__flow-line,
    .gb-games-hero__energy-dot,
    .gb-games-hero__sparkle,
    .gb-games-hero__wave,
    .gb-games-hero__bubble {
        animation: none;
    }
}

/* ==========================================================================
   Alignment Overrides
   ========================================================================== */

.gb-games-hero.alignfull {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.gb-games-hero.alignwide {
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin-left: auto;
    margin-right: auto;
}
