.acl-single-gallery-container {
    width: 100%;
}

.acl-main-image-wrapper {
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: 8px; /* Optional: adds rounded corners */
    position: relative; /* allow absolutely positioned media for sliding */
}

/* Main preview media (image or video) - absolutely positioned for sliding transitions */
.acl-main-media {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.acl-main-media.video {
    background: #000;
}

/* Ensure images and videos fill their container */
.acl-main-image-wrapper img.acl-main-media,
.acl-main-image-wrapper video.acl-main-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.acl-main-image-wrapper a {
    cursor: zoom-in;
}

.acl-thumbnails-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.acl-thumbnails-wrapper {
    flex-grow: 1;
    overflow: hidden;
}

.acl-thumbnails-track {
    display: flex;
    gap: 0.75rem;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.acl-thumbnail-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
    /* The width is calculated in JS based on the data-visible-thumbnails attribute */
}

.acl-thumbnail-item:not(.active) {
    opacity: 0.7;
}
.acl-thumbnail-item:not(.active):hover {
    opacity: 1;
}

.acl-thumbnail-item:hover {
    border-color: #ddd;
}

.acl-thumbnail-item.active {
    border-color: #6c5ce7; /* Example active color */
}

.acl-thumbnail-item img {
    width: 100%;
    height: auto;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* No play overlay for video thumbnails */
.acl-thumbnail-item { position: relative; }

/* Poster fallback for videos (when no poster image is available) */
.acl-video-poster-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #000; /* overridable via element control */
}
.acl-video-placeholder-text {
    color: #fff; /* overridable via typography control */
    font-size: 14px;
    font-weight: 600;
}

/* Modal video styling */
.acl-gallery-modal-content video.acl-modal-media {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    border-radius: 8px;
    background: #000;
}

.acl-thumbnail-nav {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    color: #555;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.acl-thumbnail-nav:hover {
    background: #e0e0e0;
    color: #000;
}

/* --- Modal Styles --- */
.acl-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.acl-gallery-modal.show {
    opacity: 1;
    visibility: visible;
}

.acl-gallery-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transition: overflow 0.3s;
}

.acl-gallery-modal-content.zoomed-in {
    overflow: auto; /* Allow scrolling when zoomed */
}

.acl-gallery-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.acl-gallery-modal-content img.zoomed {
    transform: scale(1.75);
    cursor: zoom-out;
}

/* --- Modal Close Button --- */
.acl-gallery-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 100001; /* Above nav arrows */
    cursor: pointer;
}

.acl-gallery-modal-close:hover,
.acl-gallery-modal-close:focus {
    color: #bbb;
}
/* --- Modal Navigation --- */
.acl-gallery-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    padding: 0;
    cursor: pointer;
    z-index: 100000; /* Ensure it's above the modal content */
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.acl-gallery-modal-nav:hover {
    background: rgba(255,255,255,0.06);
}

.acl-gallery-modal-nav.hidden {
    display: none;
}

.acl-gallery-modal-prev {
    left: 2vw;
}

.acl-gallery-modal-next {
    right: 2vw;
}

.acl-gallery-modal-nav svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
}

/* --- Modal Counter --- */
.acl-gallery-modal-counter {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.2;
    z-index: 10;
    user-select: none;
}