/* ============================================
   James's Game World — Pixel Arcade Theme
   ============================================ */

:root {
    --bg-dark: #0a0a1a;
    --bg-card: #12122a;
    --text-light: #e8e8f0;
    --text-muted: #8888aa;
    --neon-pink: #ff3c8e;
    --neon-blue: #00d4ff;
    --neon-yellow: #ffe034;
    --neon-green: #39ff6e;
    --neon-purple: #b44cff;
    --card-radius: 16px;
    --screen-radius: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Fredoka', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ---- Floating Stars Background ---- */
.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 0;
    animation: twinkle var(--duration) ease-in-out infinite alternate;
    opacity: 0;
}

@keyframes twinkle {
    0% { opacity: 0.1; transform: scale(0.8); }
    100% { opacity: var(--max-opacity, 0.9); transform: scale(1.2); }
}

/* Big sparkle stars */
.star--big {
    width: 6px;
    height: 6px;
    box-shadow: 0 0 6px 2px currentColor;
}

/* ---- Header ---- */
.site-header {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 1.5rem 1rem;
}

.title-wrapper {
    display: inline-block;
}

.site-title {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1.2rem, 4vw, 2.4rem);
    line-height: 1.6;
    letter-spacing: 0.05em;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
}

.title-letter {
    display: inline-block;
    color: hsl(var(--hue), 90%, 70%);
    text-shadow:
        0 0 6px hsl(var(--hue), 90%, 65%),
        0 0 15px hsl(var(--hue), 80%, 45%);
    animation: letterBounce 2s ease-in-out infinite;
    animation-delay: calc(var(--hue) * 8ms);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.title-spacer {
    width: 0.5em;
}

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

.subtitle {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    font-weight: 500;
    color: var(--neon-blue);
    margin-top: 1rem;
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
    letter-spacing: 0.02em;
}

/* ---- Games Grid ---- */
.games-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1100px;
    margin: 2rem auto;
    padding: 1.5rem;
}

/* ---- Game Card (Arcade Cabinet Style) ---- */
.game-card {
    background: var(--bg-card);
    border-radius: var(--card-radius);
    border: 3px solid hsl(var(--card-hue), 50%, 25%);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.game-card--active {
    cursor: pointer;
}

.game-card--active:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 12px 40px var(--card-glow),
        0 0 60px var(--card-glow),
        inset 0 0 30px rgba(255, 255, 255, 0.03);
    border-color: var(--card-accent);
}

.game-card--active:hover .card-screen {
    background: linear-gradient(
        135deg,
        hsl(var(--card-hue), 40%, 12%) 0%,
        hsl(var(--card-hue), 50%, 8%) 100%
    );
}

.game-card--active:hover .card-icon {
    animation: iconPulse 0.6s ease-in-out;
}

@keyframes iconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.game-card--coming-soon {
    opacity: 0.7;
    cursor: default;
}

.game-card--coming-soon:hover {
    opacity: 0.85;
    transform: translateY(-2px);
}

/* ---- Card Screen (the "display" part) ---- */
.card-screen {
    background: linear-gradient(
        135deg,
        hsl(var(--card-hue), 30%, 10%) 0%,
        hsl(var(--card-hue), 40%, 6%) 100%
    );
    margin: 12px 12px 0;
    border-radius: var(--screen-radius);
    padding: 1.8rem 1.5rem 1.5rem;
    position: relative;
    border: 2px solid hsl(var(--card-hue), 40%, 18%);
    transition: background 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Scanline overlay on screen */
.card-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--screen-radius);
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
}

/* ---- Badges ---- */
.card-badge {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    padding: 0.35em 0.8em;
    border-radius: 4px;
    position: absolute;
    top: 10px;
    right: 10px;
    letter-spacing: 0.05em;
    z-index: 2;
}

.card-badge--live {
    background: var(--neon-green);
    color: #0a1a0a;
    box-shadow: 0 0 12px rgba(57, 255, 110, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
}

.card-badge--soon {
    background: hsl(var(--card-hue), 60%, 50%);
    color: #fff;
    opacity: 0.9;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 12px rgba(57, 255, 110, 0.5); }
    50% { box-shadow: 0 0 20px rgba(57, 255, 110, 0.8); }
}

/* ---- Card Icon ---- */
.card-icon {
    width: 80px;
    height: 80px;
    margin: 0.5rem 0 1rem;
    color: var(--card-accent);
    filter: drop-shadow(0 0 10px var(--card-glow));
    transition: transform 0.3s ease;
}

.card-icon svg {
    width: 100%;
    height: 100%;
}

/* ---- Card Text ---- */
.card-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.85rem;
    color: var(--card-accent);
    text-shadow: 0 0 10px var(--card-glow);
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.card-desc {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---- Card Base (arcade controls) ---- */
.card-base {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(180deg, hsl(var(--card-hue), 20%, 14%) 0%, hsl(var(--card-hue), 20%, 10%) 100%);
}

.card-joystick {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, hsl(var(--card-hue), 20%, 35%), hsl(var(--card-hue), 20%, 18%));
    border: 2px solid hsl(var(--card-hue), 20%, 25%);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

.card-buttons {
    display: flex;
    gap: 8px;
}

.card-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 2px solid;
}

.card-btn--a {
    background: rgba(255, 60, 142, 0.2);
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.card-btn--b {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

/* ---- Vibe Coding Section ---- */
.vibe-coding {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1.5rem 0;
}

.vibe-coding-img {
    max-width: 450px;
    width: 100%;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: fadeUp 0.6s ease-out 0.8s forwards;
}

/* ---- Footer ---- */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2.5rem 1rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.heart {
    color: var(--neon-pink);
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
    font-size: 1.1em;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.25); }
    30% { transform: scale(1); }
    45% { transform: scale(1.2); }
}

/* ---- Entrance Animations ---- */
.game-card {
    opacity: 0;
    transform: translateY(30px);
    animation: cardEntrance 0.6s ease-out forwards;
}

.game-card:nth-child(1) { animation-delay: 0.2s; }
.game-card:nth-child(2) { animation-delay: 0.4s; }
.game-card:nth-child(3) { animation-delay: 0.6s; }

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

.game-card--coming-soon {
    animation-name: cardEntranceDim;
}

@keyframes cardEntranceDim {
    to {
        opacity: 0.7;
        transform: translateY(0);
    }
}

.site-title {
    opacity: 0;
    animation: titleDrop 0.8s ease-out 0.05s forwards;
}

@keyframes titleDrop {
    0% { opacity: 0; transform: translateY(-20px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.subtitle {
    opacity: 0;
    animation: fadeUp 0.6s ease-out 0.3s forwards;
}

@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .title-letter {
        text-shadow: 0 0 4px hsl(var(--hue), 80%, 55%);
    }

    .site-header {
        padding: 2rem 1rem 0.5rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
        margin-top: 1rem;
    }

    .card-screen {
        padding: 1.5rem 1.2rem 1.2rem;
    }

    .card-icon {
        width: 60px;
        height: 60px;
    }

    .card-title {
        font-size: 0.75rem;
    }

    .card-desc {
        font-size: 0.85rem;
    }

    .vibe-coding {
        padding: 1.5rem 1rem 0;
    }

    .vibe-coding-img {
        max-width: 90%;
    }
}

@media (min-width: 641px) and (max-width: 900px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
