/* Joy Pixel portal homepage — fun, modern game arcade */

.portal-home {
    --bg: #0c1118;
    --bg-elevated: #141b24;
    --bg-panel: #1a2330;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #ffe14a;
    --accent-2: #3ddc97;
    --danger: #ff6b6b;
    --radius: 14px;
    --radius-sm: 10px;
    --shell: 1360px;
    font-family: "Outfit", "Pixelify Sans", system-ui, sans-serif;
    background:
        radial-gradient(1200px 500px at 10% -10%, rgba(255, 225, 74, 0.12), transparent 55%),
        radial-gradient(900px 400px at 90% 0%, rgba(61, 220, 151, 0.1), transparent 50%),
        linear-gradient(180deg, #101722 0%, var(--bg) 40%, #0a0e14 100%);
    color: var(--text);
    min-height: 100vh;
}

.portal-home a {
    color: inherit;
    text-decoration: none;
}

.portal-home .logo-image {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.portal-home .portal-brand:hover .logo-image {
    transform: scale(1.06) rotate(-3deg);
}

/* Shell */
.portal-main {
    padding: 18px 0 48px;
}

.portal-shell {
    max-width: var(--shell);
    margin: 0 auto;
    padding: 0 20px;
}

/* Genre rail */
.genre-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 14px;
    margin-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.genre-rail::-webkit-scrollbar {
    height: 6px;
}

.genre-rail::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
}

.genre-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--bg-elevated);
    color: var(--text);
    border-radius: 12px;
    padding: 9px 14px;
    font: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.genre-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.18);
}

.genre-chip.is-active {
    background: var(--accent);
    color: #111827;
    border-color: transparent;
}

.genre-chip-count {
    font-size: 0.75rem;
    font-weight: 700;
    opacity: 0.7;
    background: rgba(0, 0, 0, 0.18);
    padding: 2px 7px;
    border-radius: 8px;
}

.genre-chip.is-active .genre-chip-count {
    background: rgba(0, 0, 0, 0.12);
    color: #111827;
}

/* Sections */
.portal-section {
    margin-bottom: 28px;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
    font-family: "Pixelify Sans", "Outfit", sans-serif;
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

/* Featured rail */
.featured-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 260px);
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.featured-tile {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    animation: cardIn 0.45s ease both;
}

.featured-tile--hero {
    grid-column: span 1;
    grid-auto-columns: minmax(280px, 340px);
}

.featured-rail .featured-tile--hero {
    width: min(340px, 78vw);
}

.featured-tile-media {
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    transition: transform 0.22s ease, border-color 0.22s ease;
}

.featured-tile-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.featured-tile:hover .featured-tile-media {
    transform: translateY(-3px);
    border-color: rgba(255, 225, 74, 0.45);
}

.featured-tile:hover .featured-tile-media img {
    transform: scale(1.06);
}

.featured-tile-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 2px;
}

.featured-tile-title {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.featured-tile-tag {
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--danger);
    color: #fff;
    padding: 3px 7px;
    border-radius: 6px;
}

.featured-tile-tag--new {
    background: var(--accent-2);
    color: #062016;
}

/* Play burst */
.play-burst {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(8, 12, 18, 0.35);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.play-burst i {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #111827;
    font-size: 1rem;
    padding-left: 3px;
    transform: scale(0.85);
    transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.featured-tile:hover .play-burst,
.portal-card:hover .play-burst {
    opacity: 1;
}

.featured-tile:hover .play-burst i,
.portal-card:hover .play-burst i {
    transform: scale(1);
}

/* Game grid */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 12px;
}

.portal-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    animation: cardIn 0.5s ease both;
    animation-delay: var(--card-delay, 0ms);
}

.portal-card[hidden] {
    display: none !important;
}

.portal-card-media {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--line);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.portal-card-image,
.portal-card-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.portal-card-preview {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.portal-card:hover .portal-card-media {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(61, 220, 151, 0.45);
}

.portal-card:hover .portal-card-preview {
    opacity: 1;
}

.portal-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    color: #e2e8f0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.1em;
}

/* Empty / SEO */
.portal-empty {
    text-align: center;
    padding: 48px 20px;
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.02);
    color: var(--muted);
}

.portal-empty h3 {
    color: var(--text);
    margin-bottom: 8px;
    font-family: "Pixelify Sans", sans-serif;
}

.portal-seo {
    margin-top: 36px;
    padding: 28px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 1px solid var(--line);
}

.portal-seo h2 {
    font-family: "Pixelify Sans", sans-serif;
    font-size: 1.35rem;
    margin-bottom: 12px;
}

.portal-seo p {
    color: var(--muted);
    margin-bottom: 10px;
    line-height: 1.7;
    max-width: 75ch;
}

.portal-seo strong {
    color: var(--text);
}

/* Footer polish on homepage */
.portal-home .site-footer {
    background: #090d12;
    border-top: 1px solid var(--line);
    margin-top: 20px;
}

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

@media (min-width: 900px) {
    .portal-grid {
        grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
        gap: 14px;
    }

    .featured-rail {
        grid-auto-columns: minmax(240px, 280px);
    }
}

@media (max-width: 760px) {
    .portal-home .logo-image {
        height: 40px;
    }

    .portal-grid {
        grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
        gap: 10px;
    }

    .portal-seo {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-card,
    .featured-tile,
    .portal-card-media,
    .featured-tile-media,
    .play-burst,
    .play-burst i,
    .logo-image {
        animation: none !important;
        transition: none !important;
    }
}
