/*
  _games.css: Updated to match the "Matches" layout.
  Includes specific fixes for Image Tag vs Background Image handling.
*/

/* ⚡️ CLEANUP: Layout is handled by .homepage-layout */
.main-content-wrapper.games-listing-page {
    /* Styles inherited from homepage-layout */
}

/* --- 1. SECTION STYLES --- */
.games-hero {
    margin-bottom: 2rem;
}

.games-list-section {
    margin-bottom: 4rem;
}

.games-section-title {
    font-family: var(--font-heading);
    border-bottom: 2px solid var(--color-light);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-process-black);
    font-size: 1.8rem;
}

/* --- 2. GRID LAYOUT --- */
.games-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin-top: 1.5rem;
}

/* --- 3. CARD STYLES --- */
.game-card {
    background-color: var(--color-white);
    border: 1px solid var(--color-light);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.game-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* IMAGE AREA - ROBUST FIX */
.game-card-image {
    width: 100%;
    height: 180px; 
    
    /* 1. FOR BACKGROUND IMAGES (New PHP) */
    background-size: contain !important; 
    background-position: center;
    background-repeat: no-repeat;
    
    /* Neutral background */
    background-color: #f4f4f4; 
    border-bottom: 1px solid var(--color-light);
    
    /* Layout centering */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    
    /* Default text color if image missing */
    color: var(--color-grey);
    position: relative;
}

/* 2. FAIL-SAFE FOR STANDARD IMG TAGS (Old PHP) */
/* If the PHP still outputs an <img> tag, this forces it to fit. */
.game-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain !important; /* Ensures the whole image is visible */
    object-position: center;
    display: block;
}

/* Fallback text */
.game-card-image span {
    color: var(--color-process-black);
    font-weight: 600;
    padding: 1rem;
    text-align: center;
    z-index: 1;
}

/* CONTENT AREA */
.game-card-content {
    padding: 1.5rem;
    text-align: center; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

/* TITLE */
.game-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-process-black);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

/* PLATFORM (Meta Info) */
.game-meta-platform {
    font-size: 0.85rem;
    color: var(--color-primary-red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* EXCERPT */
.game-excerpt {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #4a4a4a; /* was --color-grey: 2.3:1 on the white card, now 8.9:1 */
    margin-top: auto;
}

.game-excerpt .read-more {
    display: block; 
    margin-top: 0.5rem;
    color: var(--color-primary-red);
    font-weight: 600;
    font-size: 0.85rem;
}

/* --- 4. DETAIL PAGE STYLES --- */
.game-hero-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.roster-list li {
    background-color: var(--color-mh-light-grey);
    padding: 0.8rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.player-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
    border: 1px solid var(--color-primary-red);
}

/* --- 5. RESPONSIVE GRID --- */
@media (min-width: 48em) {
    .games-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 64em) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* Wide screens: four cards per row (a full row for four teams) */
@media (min-width: 80em) {
    .games-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* --- Every game available through PlayVS --- */
.playvs-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
}

.playvs-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.85rem 1.1rem;
    background-color: var(--color-mh-dark-grey);
    border-left: 4px solid var(--color-medium-grey);
    border-radius: 0 8px 8px 0;
}

.playvs-item.is-ours {
    border-left-color: var(--color-primary-red);
}

.playvs-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-white);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.playvs-title a {
    color: var(--color-white);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.playvs-title a:hover {
    color: var(--color-red-on-dark);
}

.playvs-meta {
    font-size: 0.9rem;
    color: #ccc;
}

.badge {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background-color: var(--color-primary-red);
    color: var(--color-white);
}

.playvs-source {
    margin: 1rem 0 0;
    font-family: var(--font-heading);
    font-weight: 700;
}

.playvs-source a {
    color: var(--color-red-on-dark);
}
