/* ========================================
   GENERAL PAGE
======================================== */

body {
    background-color: #121212;
    color: #ffffff;
    margin: 0;
    font-family: Arial, sans-serif;
}


/* ========================================
   HEADER
======================================== */

.title-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;

    background-color: #252525;
    color: #7d7d7d;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;

    padding-left: 20px;
    box-sizing: border-box;
    z-index: 1000;
}

.site-title {
    color: #7d7d7d;
    text-decoration: none;
}

.site-title h1 {
    margin: 0;
    font-size: 28px;
    font-weight: bold;
}

.site-author {
    margin: 2px 0 0;
    font-size: 12px;
    color: #999999;
}

/* Contact Us button */

.contact-button {
    position: absolute;
    top: 28px;
    right: 25px;

    display: inline-block;
    padding: 10px 15px;

    background-color: #353535;
    color: #ffffff;

    border: 1px solid #505050;
    border-radius: 7px;

    font-size: 14px;
    text-decoration: none;

    transition: background-color 0.2s ease;
}

.contact-button:hover {
    background-color: #454545;
}


/* ========================================
   MAIN CONTENT
======================================== */

.content {
    padding-top: 120px;
    padding-left: 30px;
    padding-right: 30px;
    padding-bottom: 40px;
}

.section-title {
    margin-bottom: 8px;
    font-size: 28px;
    color: #ffffff;
}

.section-description {
    margin-top: 0;
    margin-bottom: 25px;
    color: #aaaaaa;
    font-size: 15px;
}


/* ========================================
   GAME SEARCH
======================================== */

.game-search {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin-bottom: 25px;
    z-index: 10;
}

.search-input {
    display: block;
    width: 100%;
    height: 46px;
    box-sizing: border-box;

    padding: 12px 15px;

    background-color: #252525;
    color: #ffffff;

    border: 1px solid #454545;
    border-radius: 8px;

    font-family: Arial, sans-serif;
    font-size: 15px;
}

.search-input::placeholder {
    color: #888888;
}

.search-input:focus {
    outline: none;
    border-color: #888888;
}


/* Search dropdown */

.search-results {
    position: absolute;
    top: calc(100% + 7px);
    left: 0;
    right: 0;

    max-height: 360px;
    overflow-y: auto;
    padding: 5px;

    background-color: #202020;
    border: 1px solid #414141;
    border-radius: 9px;

    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.search-results[hidden] {
    display: none;
}


/* Individual search result */

.search-result {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px;

    color: #ffffff;
    text-decoration: none;
    border-radius: 6px;

    transition: background-color 0.15s ease;
}

.search-result:hover,
.search-result:focus-visible {
    background-color: #353535;
    outline: none;
}

.search-result-image {
    display: block;
    flex-shrink: 0;

    width: 80px;
    height: 50px;

    object-fit: contain;
    background-color: #121212;
    border-radius: 4px;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: bold;
    color: #ffffff;
}

.search-result-description {
    margin: 0;
    color: #aaaaaa;
    font-size: 12px;
    line-height: 1.4;

    max-height: 2.8em;
    overflow: hidden;
}

.search-no-results {
    padding: 16px 12px;
    color: #aaaaaa;
    font-size: 14px;
    text-align: center;
}

/* Screen-reader-only labels */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ========================================
   GAME CARD GRID
======================================== */

.game-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(220px, 1fr)
    );
    gap: 20px;
}


/* Individual game card */

.game-card {
    display: block;
    min-width: 0;

    background-color: #252525;
    border: 1px solid #383838;
    border-radius: 10px;
    overflow: hidden;

    color: #ffffff;
    text-decoration: none;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    background-color: #303030;
    border-color: #666666;
}


/* ========================================
   GAME IMAGE AND HOVER VIDEO
======================================== */

.game-preview-container {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    background-color: #121212;
}

.game-preview-image,
.game-preview-video {
    position: absolute;
    top: 0;
    left: 0;

    display: block;
    width: 100%;
    height: 100%;

    /* Show the entire image without cropping */
    object-fit: contain;
    object-position: center;

    background-color: #121212;
    pointer-events: none;

    transition: opacity 0.2s ease;
}

/* Display the image by default */

.game-preview-image {
    opacity: 1;
}

/* Keep the video hidden until hover */

.game-preview-video {
    opacity: 0;
}

/* Show video when JavaScript activates the preview */

.game-card.is-preview-playing .game-preview-image {
    opacity: 0;
}

.game-card.is-preview-playing .game-preview-video {
    opacity: 1;
}


/* ========================================
   GAME CARD INFORMATION
======================================== */

.game-info {
    padding: 15px;
}

.game-info h3 {
    margin: 0 0 8px;
    font-size: 20px;
    color: #ffffff;
}

.game-info p {
    margin: 0;
    color: #aaaaaa;
    font-size: 14px;
    line-height: 1.5;
}


/* ========================================
   KEYBOARD ACCESSIBILITY
======================================== */

.game-card:focus-visible,
.site-title:focus-visible,
.contact-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}


/* ========================================
   MOBILE LAYOUT
======================================== */

@media (max-width: 500px) {

    .content {
        padding-left: 15px;
        padding-right: 15px;
    }

    .title-bar {
        padding-left: 15px;
    }

    .site-title h1 {
        font-size: 24px;
    }

    .contact-button {
        top: 29px;
        right: 12px;
        padding: 9px 10px;
        font-size: 13px;
    }

    .game-grid {
        grid-template-columns: repeat(
            auto-fill,
            minmax(160px, 1fr)
        );
        gap: 12px;
    }

    .game-preview-container {
        height: 120px;
    }

    .game-info {
        padding: 12px;
    }

    .search-result-image {
        width: 65px;
        height: 45px;
    }
}