.mediagallery-poster-gallery {
    margin: 0 auto;
}

/* Featured poster - natural aspect ratio */
.mediagallery-poster.featured {
    position: relative;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #333;
    border-radius: 6px;
    padding: 10px;
}

#mediagallery-featured-label {
    margin-top: 10px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    max-width: 90%;
    padding: 6px 12px;
    border-radius: 6px;
    background: #454545;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#mediagallery-featured-label:hover {
    background: #565656;
}

#mediagallery-featured-label a {
    color: inherit;
    font-size: 16px;
    text-decoration: underline;
    cursor: default;
}

.mediagallery-poster.featured img {
    max-width: 100%;
    max-height: 500px; /* prevents oversized images */
    height: auto;
    width: auto;
    object-fit: contain; /* full image visible */
    border-radius: 6px;
    box-shadow: 0 10px 35px rgba(0,0,0,.5);
}

/* Thumbnail grid */
.mediagallery-poster-grid {
    display: flex;
    flex-wrap: wrap; /* wrap naturally */
    gap: 12px;
}

/* Thumbnails - fixed aspect ratio */
.mediagallery-thumb {
    position: relative;
    width: 112px;       /* fixed width */
    aspect-ratio: 2/3;  /* fixed height relative to width */
    background: #000;
    border-radius: 5px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.7;
    transition: transform .15s ease, opacity .15s ease, outline .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
}

.mediagallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* fills thumbnail box */
    display: block;
}

.mediagallery-thumb:hover {
    transform: scale(1.05);
    opacity: 1;
}

.mediagallery-thumb.active {
    opacity: 1;
    outline: 2px solid #fff;
    outline-offset: 2px;
}


.mediagallery-thumb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 24px;
    border-radius: 4px;
    user-select: none;
    z-index: 10;
}

.mediagallery-thumb-nav.prev {
    left: 10px;
}

.mediagallery-thumb-nav.next {
    right: 10px;
}

.mediagallery-thumb-nav:hover {
    background: rgba(0,0,0,0.8);
}