/* --- Global Styles & Variables --- */
:root {
    --primary-color: #4a69bd;
    --secondary-color: #1e3799;
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333333;
    --light-gray: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* New Header Bar Colors */
    --header-gradient-start: #f5deb3; /* wheat/gold-like */
    --header-gradient-end: #e0c068;
    --header-border-color: #d4af37; /* rich gold */
    --header-title-color: #003366; /* deep blue */
    --header-button-bg: #003366;
    --header-button-hover: #0055aa;
}

/* --- Reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

main {
    padding: 1rem;
}

.section-title {
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    text-align: center;
    font-size: 1.8rem;
}

/* --- Enhanced Header --- */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8); /* Light background for title area */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center; /* Center the content */
}

.header-logo {
    position: absolute; /* Position the logo */
    top: 0;
    left: 0;
    height: 100%; /* Cover the header height */
    width: auto;
    opacity: 1; /* Make logo fully visible */
    pointer-events: none; /* Prevent interaction */
}

.header-content {
    display: flex;
    align-items: center;
    z-index: 1;
}

.header-title {
    font-size: 2.5rem; /* Larger title size */
    color: var(--header-title-color);
    font-weight: bold;
}

.header-year {
    font-size: 1.5rem; /* Adjust year size */
    color: var(--header-title-color);
    font-weight: bold;
    margin: 0 10px; /* Space between title and year */
}

.header-link {
    background-color: var(--header-button-bg);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-left: 20px; /* Space between title and button */
    font-weight: 600;
    transition: background-color 0.3s;
}

.header-link:hover, .header-link:focus-visible {
    background-color: var(--header-button-hover);
}


/* --- Summary Section --- */
.summary-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.summary-box {
    flex: 1 1 150px;
    background-color: var(--card-background);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.summary-box h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* --- Games Gallery --- */
.gallery-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.game-card {
    background-color: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 8px var(--shadow-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease-in-out;
}

.game-card:hover {
    transform: translateY(-5px);
}

.game-thumbnail {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.game-title {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.3rem;
}

/* --- NEW STYLES for Game Card Clickable Links --- */
.game-card > a {
    display: block;
    line-height: 0; /* Removes potential whitespace below the image */
}

.game-title a {
    color: inherit;
    text-decoration: none;
}

.game-title a:hover {
    text-decoration: underline;
}
/* --- END NEW STYLES --- */


.card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.toggle-button {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.toggle-button.primary {
    background-color: var(--primary-color);
    color: var(--card-background);
}

.toggle-button:hover, .toggle-button:focus-visible {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--card-background);
}

.collapsible-panel {
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.collapsible-panel a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.collapsible-panel a:hover {
    text-decoration: underline;
}

/* --- Styles for Detailed Results and Download Button --- */
.results-list-container {
    max-height: 200px; /* Limit height to encourage scrolling */
    overflow-y: auto;   /* Add a scrollbar only when needed */
    margin: 1rem 0;
    padding: 10px;      /* Add some internal padding */
    border-top: 1px solid var(--light-gray);
    border-bottom: 1px solid var(--light-gray);
}

.results-list-container h4 {
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.results-list-container p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.download-button {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    background-color: #28a745; /* Green for download/success action */
    color: white;
    border: 1px solid #28a745;
    transition: background-color 0.2s;
}

.download-button:hover {
    background-color: #218838;
    border-color: #1e7e34;
}


/* --- Media Queries --- */
@media (min-width: 600px) {
    .gallery-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .gallery-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* --- NEW: Mobile Responsive Header Styles --- */
@media (max-width: 768px) {
    /* Change the header to stack elements vertically */
    .sticky-header {
        justify-content: center;
        position: relative; /* Needed for the logo positioning context */
    }

    /* Make the logo a normal element, not absolute background */
    .header-logo {
        position: static; /* This is the key fix to prevent overlap */
        height: 200px; /* Make the logo smaller for mobile */
        margin-bottom: 10px; /* Add space below the logo */
        pointer-events: auto; /* Allow interaction if needed */
    }

    /* Change the content wrapper to stack its items */
    .header-content {
        flex-direction: column; /* Stack title and button */
        gap: 10px; /* Add space between title and button */
    }

    /* Adjust the title for mobile */
    .header-title {
        font-size: 1.8rem; /* Smaller font for mobile */
        text-align: center;
    }

    /* Reset the button's margin for the new layout */
    .header-link {
        margin-left: 0;
    }

    /* We need to re-center everything since the logo is now in the flow */
    .sticky-header {
        flex-direction: column;
        padding: 1rem;
    }
}