/* ====================================================================
   TIV Event Gallery — swipebare Bilder-Galerie mit Lightbox
   ====================================================================*/

.tiv-gallery {
    position: relative;
    margin: 1.75rem 0 2.25rem;
    padding: 0;
}

.tiv-gallery-caption {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    font-weight: 600;
    margin: 0 0 0.75rem;
}

.tiv-gallery-track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    outline: none;
}

.tiv-gallery-track::-webkit-scrollbar { display: none; }

.tiv-gallery-item {
    flex: 0 0 88%;
    max-width: 720px;
    scroll-snap-align: center;
    margin: 0;
    position: relative;
}

@media (min-width: 768px) {
    .tiv-gallery-item { flex-basis: 56%; }
}

@media (min-width: 1100px) {
    .tiv-gallery-item { flex-basis: 48%; }
}

.tiv-gallery-trigger {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    cursor: zoom-in;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.tiv-gallery-trigger:focus-visible {
    outline: 3px solid #e59875;
    outline-offset: 2px;
}

.tiv-gallery-trigger img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform .4s ease;
}

.tiv-gallery-trigger:hover img { transform: scale(1.03); }

.tiv-gallery-figcaption {
    font-size: 0.85rem;
    color: #666;
    margin: 0.5rem 0 0;
    font-style: italic;
    text-align: center;
}

/* -- Pfeil-Buttons (nur Desktop) -- */
.tiv-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.95);
    color: #2d5e3e;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
    transition: all .15s ease;
    display: none;
    z-index: 2;
}

.tiv-gallery-nav:hover { transform: translateY(-50%) scale(1.08); }

.tiv-gallery-prev { left: 0.5rem; }
.tiv-gallery-next { right: 0.5rem; }

@media (min-width: 768px) {
    .tiv-gallery-nav { display: inline-flex; align-items: center; justify-content: center; }
}

/* -- Dots -- */
.tiv-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.75rem 0 0;
}

.tiv-gallery-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all .2s ease;
}

.tiv-gallery-dot.is-active {
    background: #2d5e3e;
    transform: scale(1.4);
}

.tiv-gallery-dot:hover { background: #888; }

/* ====================================================================
   Lightbox
   ====================================================================*/

.tiv-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

.tiv-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.tiv-lightbox-img-wrap {
    position: relative;
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiv-lightbox-img {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 16px 60px rgba(0,0,0,0.5);
}

.tiv-lightbox-caption {
    position: absolute;
    bottom: -2.5rem;
    left: 0;
    right: 0;
    color: #f5f5f5;
    text-align: center;
    font-size: 0.95rem;
    font-style: italic;
}

.tiv-lightbox-close,
.tiv-lightbox-prev,
.tiv-lightbox-next {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tiv-lightbox-close:hover,
.tiv-lightbox-prev:hover,
.tiv-lightbox-next:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.tiv-lightbox-prev,
.tiv-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
}

.tiv-lightbox-prev { left: 1rem; right: auto; }
.tiv-lightbox-next { right: 1rem; left: auto; }

.tiv-lightbox-prev:hover,
.tiv-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
    .tiv-gallery-trigger img,
    .tiv-gallery-nav,
    .tiv-gallery-dot,
    .tiv-lightbox,
    .tiv-lightbox-close,
    .tiv-lightbox-prev,
    .tiv-lightbox-next {
        transition: none !important;
    }
}
