/**
 * games-cards.css - Game Card Styling
 *
 * Game card styling, float/entrance animations, hidden card effects,
 * flappy reveal, workshop reveal, and responsive card rules.
 */

/* ========================================
   KEYFRAME ANIMATIONS — Cards
   ======================================== */

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

@keyframes cardEntrance {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes iconBounce {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.2); }
    60% { transform: scale(0.95); }
    80% { transform: scale(1.05); }
}

@keyframes secretSpin {
    to { transform: rotate(360deg); }
}

@keyframes mysteryPulse {
    0%, 100% { transform: scale(1); filter: hue-rotate(0deg); }
    50% { transform: scale(1.1); filter: hue-rotate(30deg); }
}

@keyframes flappyPopIn {
    0% { transform: scale(0) rotate(-10deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes workshopRevealSpin {
    0% { opacity: 0; transform: translateY(60px) scale(0.5); }
    60% { opacity: 1; transform: translateY(-8px) scale(1.05); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========================================
   GAME CARDS
   ======================================== */

.game-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    text-decoration: none;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: cardEntrance 0.5s ease-out backwards, cardFloat 5s ease-in-out 0.8s infinite;
    position: relative;
    z-index: 1;
}

.game-card:nth-child(1) { animation-delay: 0.2s, 1.0s; }
.game-card:nth-child(2) { animation-delay: 0.27s, 1.07s; }
.game-card:nth-child(3) { animation-delay: 0.34s, 1.14s; }
.game-card:nth-child(4) { animation-delay: 0.41s, 1.21s; }
.game-card:nth-child(5) { animation-delay: 0.48s, 1.28s; }
.game-card:nth-child(6) { animation-delay: 0.55s, 1.35s; }
.game-card:nth-child(7) { animation-delay: 0.62s, 1.42s; }
.game-card:nth-child(8) { animation-delay: 0.69s, 1.49s; }
.game-card:nth-child(9) { animation-delay: 0.76s, 1.56s; }
.game-card:nth-child(10) { animation-delay: 0.83s, 1.63s; }
.game-card:nth-child(11) { animation-delay: 0.90s, 1.70s; }
.game-card:nth-child(12) { animation-delay: 0.97s, 1.77s; }
.game-card:nth-child(13) { animation-delay: 1.04s, 1.84s; }
.game-card:nth-child(14) { animation-delay: 1.11s, 1.91s; }
.game-card:nth-child(15) { animation-delay: 1.18s, 1.98s; }
.game-card:nth-child(16) { animation-delay: 1.25s, 2.05s; }

/* Cancel float animation during easter egg states */
.game-card.shuffling {
    animation: none !important;
}
.game-card.sleepy {
    animation: none;
}
.game-card.drag-source {
    animation: none !important;
}
.game-card.drag-target {
    animation: none;
}

/* After entrance completes, switch to float-only (no replay of cardEntrance) */
.game-card.entered {
    animation: cardFloat 5s ease-in-out infinite;
}

.game-card:hover, .game-card:active {
    transform: translateY(-10px) scale(1.03);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 20px rgba(0, 210, 255, 0.3), 0 0 40px rgba(123, 47, 247, 0.15);
    animation-play-state: paused, paused;
    border-color: rgba(255, 255, 255, 0.6);
}

.game-card.entered:hover, .game-card.entered:active {
    animation: none;
}

.game-card:hover .game-icon {
    animation: iconBounce 0.5s ease;
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
}

.game-card h2 {
    color: #11998e;
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.game-card p {
    color: #666;
    font-size: 1rem;
    line-height: 1.4;
}

/* ========================================
   HIDDEN GAME CARD
   ======================================== */

.hidden-game-card {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.95), rgba(75, 0, 130, 0.95));
    border-radius: 25px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(138, 43, 226, 0.4);
    text-decoration: none;
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s ease, transform 2s ease;
    border: 3px dashed rgba(255,255,255,0.5);
    position: relative;
    overflow: hidden;
    pointer-events: none;
}

.hidden-game-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hidden-game-card.clickable {
    pointer-events: auto;
}

.hidden-game-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: secretSpin 4s linear infinite;
    pointer-events: none;
}

.hidden-game-card .game-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    display: block;
    animation: mysteryPulse 2s ease infinite;
}

.hidden-game-card h2 {
    color: #ffd700;
    font-size: 1.5rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255,215,0,0.5);
}

.hidden-game-card p {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    line-height: 1.4;
}

.hidden-game-card:hover, .hidden-game-card:active {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(138, 43, 226, 0.6);
}

/* ========================================
   FLAPPY REVEAL (CARD SHUFFLE)
   ======================================== */

.flappy-reveal {
    animation: flappyPopIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ========================================
   WORKSHOP REVEAL (UPSIDE-DOWN SHAKE)
   ======================================== */

.workshop-reveal {
    animation: workshopRevealSpin 1.2s ease-out;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 600px) {
    .game-card {
        padding: 25px 20px;
        /* Kill expensive infinite float + blur on mobile */
        animation: cardEntrance 0.5s ease-out backwards;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: white;
    }

    .game-card:nth-child(1) { animation-delay: 0.1s; }
    .game-card:nth-child(2) { animation-delay: 0.15s; }
    .game-card:nth-child(3) { animation-delay: 0.2s; }
    .game-card:nth-child(4) { animation-delay: 0.25s; }
    .game-card:nth-child(5) { animation-delay: 0.3s; }
    .game-card:nth-child(6) { animation-delay: 0.35s; }
    .game-card:nth-child(7) { animation-delay: 0.4s; }
    .game-card:nth-child(8) { animation-delay: 0.45s; }
    .game-card:nth-child(9) { animation-delay: 0.5s; }
    .game-card:nth-child(10) { animation-delay: 0.55s; }
    .game-card:nth-child(11) { animation-delay: 0.6s; }
    .game-card:nth-child(12) { animation-delay: 0.65s; }
    .game-card:nth-child(13) { animation-delay: 0.7s; }
    .game-card:nth-child(14) { animation-delay: 0.75s; }
    .game-card:nth-child(15) { animation-delay: 0.8s; }
    .game-card:nth-child(16) { animation-delay: 0.85s; }

    .game-card.entered {
        animation: none;
    }

    .game-card:hover, .game-card:active {
        animation-play-state: paused;
    }

    .game-icon {
        font-size: 3rem;
    }

    .game-card h2 {
        font-size: 1.3rem;
    }
}

/* ========================================
   GAME CARD TAGS & FLAGSHIP
   ======================================== */

.game-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    justify-content: center;
}

.game-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
    color: inherit;
    opacity: 0.85;
}

.game-card--flagship {
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(240, 248, 255, 0.88) 100%);
}
