.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.gallery-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.41; /* A4 ratio approx */
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease-in-out;
}

.gallery-main img.fade-out {
    opacity: 0.5;
}

.gallery-thumbs {
    display: flex;
    gap: 0.5em;
    overflow-x: auto;
    padding-bottom: 0.5em;
}

.gallery-thumb {
    width: 60px;
    height: 85px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 2px;
    cursor: pointer;
    transition: border 0.2s;
}

.gallery-thumb:hover, .gallery-thumb.active {
    border-color: #333;
    border-width: 5px;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.5);
    color: black;
    padding: 30px 20px;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-main:hover .gallery-nav {
    opacity: 1;
}

.gallery-prev {
    left: 0;
}

.gallery-next {
    right: 0;
}
