/* ============================================================
   ACF Gallery Slider — Standalone Plugin CSS
   ============================================================ */

/* ----------------------------------------------------------
   Wrapper layout
   ---------------------------------------------------------- */
.agsld-wrap {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

.agsld-wrap--left  { flex-direction: row; }
.agsld-wrap--right { flex-direction: row-reverse; }
.agsld-wrap--top   { flex-direction: column; align-items: stretch; }

/* ----------------------------------------------------------
   Preview pane
   ---------------------------------------------------------- */
.agsld-preview {
    flex: 0 0 70%;
    width: 70%;
    min-width: 0;
    position: relative;
}

.agsld-wrap--top .agsld-preview {
    width: 100%;
    flex: 1 1 auto;
    margin-bottom: 12px;
}

.agsld-slider-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

/* ----------------------------------------------------------
   Main Swiper
   ---------------------------------------------------------- */
.agsld-main-swiper {
    width: 100%;
    overflow: hidden;
}

.agsld-slide {
    width: 100%;
}

.agsld-main-swiper,
.agsld-main-swiper .swiper-wrapper,
.agsld-main-swiper .swiper-slide {
    height: 100% !important;
}

/* Fixed-ratio container using explicit height via aspect-ratio on the swiper */
.agsld-slider-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    aspect-ratio: 3 / 2; /* adjust: 16/9, 4/3, etc */
}

.agsld-slide-media {
    width: 100%;
    max-height: 700px;
    overflow: hidden;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image fills the box, letterboxed if portrait */
.agsld-slide-media img {
    display: block;
    width: 100%;
    max-height: 700px; /* set this to whatever fixed height you want */
    object-fit: contain;
    margin: 0 auto;
}


@media (max-width: 600px) {
    .agsld-slide-media,
    .agsld-slide-media img {
        max-height: 280px;
    }
}

@media (min-width: 601px) and (max-width: 1024px) {
    .agsld-slide-media,
    .agsld-slide-media img {
        max-height: 460px;
    }
}

/* Lightbox trigger: empty <a> overlaid on top of the image */
.agsld-lightbox-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: zoom-in;
}

/* Caption sits above the trigger overlay */
.agsld-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 12px;
    margin: 0;
}

/* ----------------------------------------------------------
   Navigation arrows
   ---------------------------------------------------------- */
.agsld-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.agsld-btn:hover { background: #fff; }
.agsld-btn--prev { left: 10px; }
.agsld-btn--next { right: 10px; }

.agsld-btn svg {
    width: 18px;
    height: 18px;
    stroke: #333;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.agsld-btn.swiper-button-disabled {
    opacity: 0.35;
    cursor: default;
}

/* ----------------------------------------------------------
   Thumbnail gallery
   ---------------------------------------------------------- */
.agsld-gallery {
    flex: 1 1 auto;
    width: calc(30% - 16px);
    display: grid;
    grid-template-columns: repeat(var(--agsld-columns, 6), 1fr);
    gap: 6px;
    align-content: start;
    min-width: 0;
}

.agsld-wrap--top .agsld-gallery {
    width: 100%;
    grid-template-columns: repeat(var(--agsld-columns, 6), 1fr);
}

.agsld-thumb-item {
    cursor: pointer;
    overflow: hidden;
    border-radius: 3px;
    opacity: 0.65;
    transition: opacity 0.2s, box-shadow 0.2s;
    aspect-ratio: 1 / 1;
}

.agsld-thumb-item:hover  { opacity: 0.9; }
.agsld-thumb-item.is--active {
    opacity: 1;
    box-shadow: 0 0 0 2px #333;
}

.agsld-thumb-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.agsld-thumb-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
    .agsld-wrap--left,
    .agsld-wrap--right {
        flex-direction: column;
    }

    .agsld-preview,
    .agsld-gallery {
        width: 100% !important;
        flex: 1 1 auto;
    }

    .agsld-gallery {
        grid-template-columns: repeat(6, 1fr);
        margin-top: 10px;
    }
}

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

    .agsld-btn {
        width: 28px;
        height: 28px;
    }

    .agsld-btn svg {
        width: 14px;
        height: 14px;
    }
}

/* ----------------------------------------------------------
   Error notice
   ---------------------------------------------------------- */
.agsld-error {
    color: #c00;
    font-style: italic;
}
