/* the games page: the numbers of the site at the top, the single and the multiplayer games in two columns under them */

.game-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.game-filter-search {
    flex: 2 1 17rem;
}

.game-filter-mode {
    flex: 1 1 12rem;
}

.game-filter-results {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}

.game-details {
    max-width: 72rem;
    padding-block: 1.5rem 2rem;
}

.game-details-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    min-height: 2.5rem;
    padding: 0.38rem 0.8rem;
    border: 1px solid #c7d2fe;
    border-radius: 0.65rem;
    background: #f5f7ff;
    color: #3730a3;
    font-weight: 600;
    text-decoration: none;
}

.game-details-back:hover {
    border-color: #a5b4fc;
    background: #e0e7ff;
    color: #312e81;
}

.game-details-back .bi {
    display: inline-flex;
    font-size: 0.8rem;
    line-height: 1;
}

.game-details-cover {
    display: block;
    width: 100%;
    height: auto;
}

.game-details-summary, .game-details-description .card-body {
    padding: clamp(1rem, 3vw, 2rem);
}

.game-details-mode {
    color: var(--bs-secondary-color);
    margin-bottom: 0.5rem;
}

.game-details-description {
    margin-top: 1rem;
}

/* ---------- the numbers ---------- */

.game-stats {
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.stat-tile {
    height: 100%;
    padding: 0.6rem 0.75rem;
    border: var(--bs-border-width) solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-tertiary-bg);
    text-align: center;
}

.stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;

    i {
        font-size: 1.05rem;
        color: var(--bs-secondary-color);
    }
}

.stat-label {
    font-size: 0.8rem;
    line-height: 1.25;
    color: var(--bs-secondary-color);
}

/* the players of now stand out */
.stat-online {
    border-color: rgba(var(--bs-success-rgb), 0.45);
    background: rgba(var(--bs-success-rgb), 0.08);

    .stat-value {
        color: var(--bs-success-text-emphasis);
    }
}

/* a dot that breathes while someone is playing; grey when nobody is */
.live-dot {
    position: relative;
    display: inline-block;
    flex: none;
    width: 0.6em;
    height: 0.6em;
    border-radius: 50%;
    background: var(--bs-secondary-color);
    opacity: 0.6;

    &.is-live {
        background: var(--bs-success);
        opacity: 1;

        &::after {
            content: "";
            position: absolute;
            inset: 0;
            border-radius: 50%;
            background: var(--bs-success);
            animation: live-dot-pulse 1.8s ease-out infinite;
        }
    }
}

@keyframes live-dot-pulse {
    from {
        transform: scale(1);
        opacity: 0.7;
    }
    to {
        transform: scale(2.6);
        opacity: 0;
    }
}

.game-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;

    i {
        color: var(--bs-warning);
    }

    a {
        font-weight: 600;
    }
}

/* ---------- the columns ---------- */

.game-column-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-primary);
    font-size: 1.15rem;
    font-weight: 700;
    overflow-wrap: anywhere;

    .badge {
        font-size: 0.75rem;
    }
}

.column-online {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bs-success-text-emphasis);
}

/* a game: a picture next to its text, compact, so many fit on the screen */
.game-item {
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 0.5rem 1.2rem rgba(0, 0, 0, 0.16);
    }
}

/* as high as the text next to it, but at least 16:9; grey while the game has no picture */
.game-cover {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    background: var(--bs-secondary-bg);
    border-right: var(--bs-card-border-width) solid var(--bs-card-border-color);

    &::before {
        content: "";
        display: block;
        padding-top: 56.25%;
    }

    img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.4s ease;
    }
}

.game-item:hover .game-cover img {
    transform: scale(1.05);
}

.game-new {
    position: absolute;
    top: 6px;
    left: 6px;
    letter-spacing: 0.04em;
}

.game-item-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.55rem 0.75rem;
}

.game-item-title {
    margin-bottom: 0.2rem;
    font-size: 1.05rem;
    font-weight: 700;
    overflow-wrap: anywhere;

    a {
        color: inherit;
        text-decoration: none;

        &:hover {
            color: var(--bs-primary);
        }
    }
}

.game-item-short {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    line-height: 1.3;
    color: var(--bs-secondary-color);
}

.game-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.9rem;
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--bs-secondary-color);

    > span {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
    }

    .meta-online {
        font-weight: 600;
        color: var(--bs-success-text-emphasis);
    }
}

.game-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.45rem;
}

@media (max-width: 575.98px) {
    .game-catalogue > .card-body {
        padding-inline: 0.5rem;
    }

    .game-filter-search, .game-filter-mode {
        flex-basis: 100%;
    }

    .game-filters .btn {
        width: 100%;
    }

    .stat-tile {
        padding: 0.45rem 0.3rem;
    }

    .stat-value {
        gap: 0.3rem;
        font-size: 1.1rem;

        i {
            font-size: 0.9rem;
        }
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .game-column-title {
        gap: 0.25rem;
        font-size: 0.9rem;
    }

    .game-item-body {
        padding: 0.5rem;
    }
}

@media (max-width: 991.98px) {
    .game-cover {
        border-right: 0;
        border-bottom: var(--bs-card-border-width) solid var(--bs-card-border-color);
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-item, .game-cover img {
        transition: none;
    }

    .live-dot.is-live::after {
        animation: none;
    }
}
