/* Announcement image gallery (carousel + lightbox) */
.announcement-detail .announcement-gallery {
    clear: both;
    width: 100%;
    max-width: 1100px;
    margin: 30px auto 0;
}

.announcement-detail .announcement-gallery-title {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1.35rem;
}

.announcement-detail .announcement-gallery-title i { margin-right: 8px; }

.gallery-carousel {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.gallery-viewport { overflow: hidden; touch-action: pan-y; }

.gallery-track {
    display: flex;
    transition: transform 0.45s ease;
    will-change: transform;
}

.gallery-slide {
    flex: 0 0 100%;
    margin: 0;
    position: relative;
}

.gallery-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
    position: relative;
}

.gallery-open img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    background: #111;
    user-select: none;
    -webkit-user-drag: none;
}

.gallery-zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.gallery-open:hover .gallery-zoom,
.gallery-open:focus-visible .gallery-zoom { opacity: 1; }

.gallery-slide figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 36px 70px 16px 20px;
    color: #fff;
    font-weight: 600;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    pointer-events: none;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    z-index: 2;
}

.gallery-nav:hover,
.gallery-nav:focus-visible { background: var(--accent); color: var(--dark); }
.gallery-prev { left: 14px; }
.gallery-next { right: 14px; }

.gallery-counter {
    position: absolute;
    right: 14px;
    bottom: 14px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.85rem;
    z-index: 2;
}

.gallery-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.gallery-dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #c8d3c8;
    cursor: pointer;
    transition: var(--transition);
}

.gallery-dot.active {
    width: 26px;
    border-radius: 5px;
    background: var(--primary);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 70px;
}

.gallery-lightbox[hidden] { display: none; }

.lightbox-figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-figure img {
    max-width: 100%;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: 6px;
}

.lightbox-figure figcaption {
    color: #fff;
    margin-top: 12px;
    text-align: center;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.lightbox-close { top: 16px; right: 16px; width: 44px; height: 44px; font-size: 1.2rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); width: 50px; height: 50px; font-size: 1.1rem; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-close:hover, .lightbox-nav:hover,
.lightbox-close:focus-visible, .lightbox-nav:focus-visible { background: var(--accent); color: var(--dark); }

body.gallery-lightbox-open { overflow: hidden; }

@media (max-width: 600px) {
    .gallery-nav { width: 36px; height: 36px; font-size: 0.85rem; }
    .gallery-prev { left: 8px; }
    .gallery-next { right: 8px; }
    .gallery-open img { aspect-ratio: 4 / 3; }
    .gallery-slide figcaption { padding: 28px 60px 12px 14px; font-size: 0.9rem; }
    .gallery-zoom { opacity: 1; width: 32px; height: 32px; }
    .gallery-lightbox { padding: 60px 10px; }
    .lightbox-nav { top: auto; bottom: 16px; transform: none; width: 44px; height: 44px; }
    .lightbox-prev { left: calc(50% - 54px); }
    .lightbox-next { right: calc(50% - 54px); }
    .lightbox-figure img { max-height: calc(100vh - 200px); }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-track { transition: none; }
}


/* Placeholder when an image file is missing on the server */
.gallery-open.is-broken {
    cursor: default;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1d1d1d;
    color: #8a8a8a;
}

.gallery-open.is-broken img { display: none; }
.gallery-open.is-broken .gallery-zoom { display: none; }
.gallery-open.is-broken::before {
    content: "\f03e";
    font-family: "Font Awesome 6 Free";
    font-weight: 400;
    font-size: 3rem;
}

@media (max-width: 600px) {
    .gallery-open.is-broken { aspect-ratio: 4 / 3; }
}
