* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: transparent;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, Arial, sans-serif;
}

.wrap {
    width: 100%;
    padding: 12px;
    display: flex;
    justify-content: center;
}

.grid {
    width: 100%;
    /* Limit the width so 3 columns don't get massive on desktop */
    max-width: 860px;
    margin: 0 auto;

    display: grid;
    gap: 12px;

    /* Max 3 columns */
    grid-template-columns: repeat(3, 1fr);
    place-content: center;
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.05);
}

.tile a,
.tile .fallback-link {
    display: block;
    width: 100%;
    height: 100%;
}

.media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;

    transform: scale(1);
    transition: transform 180ms ease;
}

.tile:hover .media {
    transform: scale(1.04);
}


/* Boost brightness for dark thumbnails to make them visible */
/* Added blur(0.5px) to smooth out JPEG compression artifacts from brightness boost */
.dark-thumb {
    filter: brightness(3.5) contrast(1.1) saturate(0.9) blur(0.5px);
    transition: filter 0.3s ease;
}

.tile:hover .dark-thumb {
    filter: brightness(4) contrast(1.2) blur(0.5px);
}

.play-button {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Let clicks pass through to the tile listener */
    z-index: 10;
    transition: transform 180ms ease;
    /* Optional: subtle dark overlay to enhance button? */
    /* background: rgba(0,0,0,0.2); */
}

.play-icon-bg {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s, transform 0.2s;
}

.tile:hover .play-button {
    transform: scale(1.1);
}

.tile:hover .play-icon-bg {
    background: rgba(188, 140, 78, 0.9);
    /* #bc8c4e (Gold/Bronze) */
    border-color: rgba(255, 255, 255, 0.8);
}

iframe.media {
    width: 177.78%;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

.tile:hover iframe.media {
    transform: translateX(-50%) scale(1.04);
}