/* Gallery single styles (add near bottom of file) */
.single-activity-gallery .sag-hero {
    padding: 2rem 0 1rem;
    color: white;
}

.single-activity-gallery .section-title {
    margin-bottom: 1.5rem;
    position: relative;
    margin: 1rem 0 0px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: left;
    text-align: center;
    background-image: url("../images/about_title_bg.png");
    background-repeat: no-repeat;
    background-size: auto;
    height: 6rem;
    width: 22rem;
    z-index: 5;
}

.single-activity-gallery .title-cn,
.single-activity-gallery .title-eng {
    max-width: 17rem;
    max-height: 5rem;
    padding-left: 4rem;
    line-height: 1.5;
    font-weight: 700;
    color: #fff;
    font-size: clamp(0.9rem, 1.1rem + 0.8vw, 1.6rem);
    overflow: hidden;
    display: inline-block;
    box-sizing: border-box;
}


.single-activity-gallery .ga-body {
    background-image: url("../images/bgBlurredBlack.png");
    background-repeat: no-repeat;
    background-size: cover;
    padding: 2rem 3rem;
    margin-bottom: 5rem;
}

.single-activity-gallery .ga-gallery {
    margin: 1.5rem 2.5rem 5rem;
}

.single-activity-gallery .sag-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.sag-nav-arrows {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.sag-nav-arrows .sag-prev,
.sag-nav-arrows .sag-next {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: contain;
}

.sag-nav-arrows .sag-nav-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.65);
}

.sag-nav-arrows .sag-prev.sag-nav-disabled,
.sag-nav-arrows .sag-next.sag-nav-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.sag-nav-arrows .sag-prev {
    background-image: url('../images/left.png');
}

.sag-nav-arrows .sag-next {
    background-image: url('../images/right.png');
}

.sag-nav-arrows .sag-prev a,
.sag-nav-arrows .sag-next a {
    display: block;
    width: 100%;
    height: 100%;
    text-indent: -9999px;
    overflow: hidden;
    white-space: nowrap;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    line-height: 0;
    cursor: pointer;
}

.sag-gallery-title {
    margin: 0 auto;
}

.sag-gallery-title .sag-title {
    flex: 1 1 auto;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.sag-meta {
    text-align: center;
    margin-top: 0.4rem;
}

.sag-date {
    color: rgba(255, 255, 255, 0.85);
}

/* Masonry-like gallery using CSS columns so images "stick together" with small gap */
.sag-gallery-wrap {
    padding: 0.5rem 0 0;
}

.sag-gallery {
    column-count: 4;
    column-gap: 12px;
}

.sag-gallery-item {
    break-inside: avoid;
    display: inline-block;
    width: 100%;
    margin: 0 0 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    overflow: hidden;
}

.sag-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Related posts */
.sag-related-wrap {}

.sag-related-title {
    margin-bottom: 1.5rem;
    position: relative;
    margin: 60px 0 0px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: left;
    text-align: center;
    background-image: url("../images/relate_title_bg.png");
    background-repeat: no-repeat;
    background-size: contain;
    height: 6rem;
    width: 22rem;
    z-index: 5;
}

.related-title-cn,
.related-title-eng {
    max-width: 15rem;
    max-height: 5rem;
    padding-left: 5rem;
    line-height: 1.5;
    font-weight: 700;
    color: #fff;
    font-size: clamp(0.9rem, 1.1rem + 0.8vw, 1.6rem);
    overflow: hidden;
    display: inline-block;
    box-sizing: border-box;
}

.related-grid-background {
    background-image: url("../images/bgBlurredBlack.png");
    background-repeat: no-repeat;
    background-size: cover;
    padding: 2rem 3rem;
    margin-bottom: 5rem;
}

/* Related cards: match Past Activities card style */
.sag-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin: 1rem 10rem 5rem 10rem;
}

/* Card container */
.sag-related-item {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.04));
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* Make the whole card clickable */
.sag-related-item a {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

/* Thumbnail area */
.sag-related-thumb {
    background: rgba(255, 255, 255, 0.04);
    width: 100%;
    height: 28rem;
    overflow: hidden;
    display: block;
}

.sag-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Body area */
.sag-related-body {
    padding: 1rem;
    background-color: transparent;
    background-image: url("../images/activities_bottom_bg.png");
    background-position: center center;
    background-size: auto;
    background-repeat: no-repeat;
}

/* Title + meta */
.sag-related-body .related-title {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    line-height: 1;
    text-align: left;
    color: #fff;
    font-weight: bold;
}

.related-date {
    color: white;
    font-size: 0.85rem;
}

/* Hover effect consistent with pa-card */
.sag-related-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* Gallery overlay / lightbox */
.sag-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 6, 18, 0.72);
    backdrop-filter: blur(8px) saturate(1.05);
    -webkit-backdrop-filter: blur(8px);
}

.sag-overlay.open {
    display: flex;
}

/* inner container centers content and holds nav/close */
.sag-overlay__inner {
    position: relative;
    width: 90%;
    height: 90%;
    padding: 2rem 3rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* close button top-right */
.sag-overlay__close-wrap {
    position: absolute;
    top: 18px;
    right: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    z-index: 20;
}

.sag-overlay__close-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    color: #ffffff;
    line-height: 1;
    font-size: 0.85rem;
    white-space: nowrap;
}

.sag-overlay__close-cn {
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
}

.sag-overlay__close-eng {
    display: block;
    font-size: 0.8rem;
    opacity: 0.85;
}

.sag-overlay__close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.95);
    color: #111;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    z-index: 20;
}

/* overlay navigation arrows (left/right) */
.sag-overlay__nav {
    position: absolute;
    bottom: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    background-color: transparent;
    color: #fff;
    font-size: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
}

.sag-overlay__prev {
    left: 47%;
}

.sag-overlay__next {
    right: 47%;
}

.sag-overlay__nav:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* horizontal track with scroll-snap */
.sag-overlay__track {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    /* prevent vertical scrollbar */
    padding: 0 max(0px, calc((100% - min(64vw, 500px)) / 2));
    scroll-padding-inline: max(0px, calc((100% - min(64vw, 500px)) / 2));
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    align-items: center;
    width: 100%;
    justify-content: flex-start;
    box-sizing: border-box;
    outline: none;
}

.sag-overlay__track.revamp-overlay-no-snap {
    scroll-snap-type: none;
}

.sag-overlay__track::-webkit-scrollbar {
    /* WebKit */
    display: none;
    /* hide scrollbars cross-browser */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
    height: 0;
}

/* Each item: base sizing and smooth transform */
.sag-overlay__item {
    transition: transform .28s cubic-bezier(.2, .9, .2, 1), opacity .22s ease;
    will-change: transform, opacity;
    transform-origin: center center;
    z-index: 1;
    opacity: 0.85;
    flex: 0 0 auto;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(64vw, 500px);
    max-height: 100vh;
    /* allow items to grow taller */
    box-sizing: border-box;
    transform: scale(0.75);
    /* slight shrink for non-active by default */
}

/* Ensure image fills item height (no vertical scrollbar) */
.sag-overlay__item img {
    max-width: 100%;
    height: 80vh;
    /* fit to viewport height */
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

/* Active item: 15% larger than normal */
.sag-overlay__item.active {
    z-index: 3;
    opacity: 1;
    transform: scale(1.15);
    /* active scale = +15% */
}

/* Slightly dim non-active items to emphasize active */
.sag-overlay__item:not(.active) {
    opacity: 0.72;
}

/* Maintain responsive behavior */
/* Small-screen overrides to make active item fill viewport and ensure title/controls visible */
.sag-overlay__track {
    gap: 1.25rem;
    /* consistent gap like smartteen */
    padding-inline-start: 1rem;
    padding-inline-end: 1rem;
}

.sag-overlay__item {
    width: min(64vw, 540px);
    max-height: 100vh;
    transform: scale(0.82);
    transition: transform .28s cubic-bezier(.2, .9, .2, 1), opacity .22s ease;
}

.sag-overlay__item.active {
    transform: scale(1);
    z-index: 6;
    opacity: 1;
}

/* Make sure images fit inside the item and don't overflow */
.sag-overlay__item img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    height: auto;
    display: block;
    object-fit: contain;
}


@media (max-width: 720px) {
    .single-activity-gallery .ga-body {
        background-image: url("../images/bgBlurredBlack.png");
        background-repeat: no-repeat;
        background-size: cover;
        padding: 2rem 1rem;
        margin-bottom: 5rem;
    }

    /* On small screens, make active item occupy most of width */
    .sag-overlay__item {
        width: 88vw;
        max-height: 78vh;
        transform: scale(0.9);
    }

    .sag-overlay__item.active {
        transform: scale(1.03);
    }

    .sag-overlay__item img {
        height: 72vh;
        max-height: 72vh;
    }

    .sag-overlay__track {
        padding-inline-start: calc((100% - 88vw) / 2);
        padding-inline-end: calc((100% - 88vw) / 2);
        scroll-padding-inline: calc((100% - 88vw) / 2);
    }

    .sag-overlay__prev {
        left: 0.5rem;
    }

    .sag-overlay__next {
        right: 0.5rem;
    }

    .sag-related-grid {
        display: flex;
        gap: 3rem;
        flex-direction: column;
        margin: auto;
    }
}