/**
 * Seva Gallery - auto-advancing image carousel
 *
 * Scroll-snap does the paging; JS only nudges scrollLeft. No carousel library.
 *
 * @package DaanSetu
 */

.ds-gallery {
    --ds-g-primary: #8B2252;
    --ds-g-primary-dark: #1A0514;
    --ds-g-white: #ffffff;
    --ds-g-muted: #6b7280;
    --ds-g-border: #f3f4f6;
    --ds-g-radius: 16px;
    --ds-g-shadow: 0 4px 16px rgba(26, 5, 20, 0.08);

    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
}

.ds-gallery * { box-sizing: border-box; }

.ds-gallery-head { margin-bottom: 1rem; }

.ds-gallery-title {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ds-g-primary);
    margin: 0 0 0.4rem;
}

.ds-gallery-subtitle { color: var(--ds-g-muted); font-size: 0.9rem; margin: 0; }

/* ── Frame ── */
.ds-gallery-frame {
    position: relative;
    background: var(--ds-g-white);
    border: 1px solid var(--ds-g-border);
    border-radius: var(--ds-g-radius);
    box-shadow: var(--ds-g-shadow);
    overflow: hidden;
}

.ds-gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ds-gallery-track::-webkit-scrollbar { display: none; }
.ds-gallery-track:focus-visible { outline: 3px solid var(--ds-g-primary); outline-offset: -3px; }

.ds-gallery-slide {
    position: relative;
    flex: 0 0 100%;
    scroll-snap-align: center;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-gallery-img {
    display: block;
    width: 100%;
    height: auto;
}

/* Natural: no crop at all. The flex row takes the tallest image's height, so
   the frame never jumps between slides - shorter images just centre in it. */
.ds-gallery--auto .ds-gallery-img {
    max-height: 80vh;
    object-fit: contain;
}

/* Fixed shapes crop to fill. Only safe for photography - a poster with text
   in the margins will lose it. */
.ds-gallery--4-3 .ds-gallery-img  { aspect-ratio: 4 / 3;  height: 100%; object-fit: cover; }
.ds-gallery--16-9 .ds-gallery-img { aspect-ratio: 16 / 9; height: 100%; object-fit: cover; }
.ds-gallery--1-1 .ds-gallery-img  { aspect-ratio: 1 / 1;  height: 100%; object-fit: cover; }
.ds-gallery--3-4 .ds-gallery-img  { aspect-ratio: 3 / 4;  height: 100%; object-fit: cover; }

.ds-gallery-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 1rem 0.9rem;
    background: linear-gradient(to top, rgba(26, 5, 20, 0.78), transparent);
    color: var(--ds-g-white);
    font-size: 0.86rem;
    line-height: 1.4;
}

/* ── Arrows ── */
.ds-gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ds-g-primary-dark);
    box-shadow: 0 2px 8px rgba(26, 5, 20, 0.18);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ds-gallery-frame:hover .ds-gallery-arrow,
.ds-gallery-arrow:focus-visible { opacity: 1; }

/* Touch devices get no hover, so keep the arrows visible there. */
@media (hover: none) {
    .ds-gallery-arrow { opacity: 1; }
}

.ds-gallery-arrow:hover { background: var(--ds-g-primary); color: var(--ds-g-white); }
.ds-gallery-arrow:focus-visible { outline: 3px solid var(--ds-g-primary); outline-offset: 2px; }

.ds-gallery-prev { left: 0.7rem; }
.ds-gallery-next { right: 0.7rem; }

/* ── Dots ── */
.ds-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.85rem;
}

.ds-gallery-dot {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(139, 34, 82, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ds-gallery-dot:hover { background: rgba(139, 34, 82, 0.5); }
.ds-gallery-dot.is-active { background: var(--ds-g-primary); width: 1.35rem; border-radius: 999px; }
.ds-gallery-dot:focus-visible { outline: 2px solid var(--ds-g-primary); outline-offset: 2px; }

.ds-gallery-empty {
    padding: 1rem;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    color: #6b7280;
    font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
    .ds-gallery-track { scroll-behavior: auto; }
}
