/* ===== Gallery Single Page (immersive viewer) ===== */

#gallery-single {
    padding: 4rem 0;
}

#gallery-single .container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Title / description */

.gallery-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.gallery-title {
    font-size: 2.4rem;
    margin-bottom: 0.25rem;
}

.gallery-description {
    font-size: 0.98rem;
    opacity: 0.8;
}

/* Optional intro text from markdown */

.gallery-body {
    margin: 0 auto 2rem;
    max-width: 760px;
    line-height: 1.7;
    font-size: 0.97rem;
}

/* ===== Main viewer ===== */

.gallery-main-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.2rem;
}

/* Big image + caption */

.gallery-main {
    flex: 1 1 auto;
    margin: 0;
}

.gallery-main-image-wrapper {
    width: 100%;
    height: 70vh;               /* 🔹 fixed vertical height for all images */
    max-height: 780px;          /* optional safety cap */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 18px;
    background-color: rgba(255, 255, 255, 0.02); /* keeps a subtle frame */
}

.gallery-main-image-wrapper img {
    height: 100%;               /* 🔹 always fill the frame vertically */
    width: auto;                /* width adapts to aspect ratio */
    max-width: 100%;            /* don’t overflow horizontally */
    object-fit: contain;        /* 🔹 keep full image; blank space on sides if needed */
    display: block;
}

/* Caption under main image */

.gallery-main-caption {
    margin-top: 0.85rem;
}

.gallery-main-title {
    font-weight: 600;
    font-size: 0.96rem;
}

.gallery-main-comment {
    font-size: 0.86rem;
    opacity: 0.85;
    margin-top: 0.15rem;
}

/* Nav arrows */

.gallery-nav-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.gallery-nav-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
    background-color: rgba(255, 255, 255, 0.06);
}

/* ===== Thumbnail strip ===== */

.gallery-thumbs-wrapper {
    margin-top: 0.5rem;
    padding-bottom: 0.6rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumbs {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Each thumbnail is a button for accessibility */

.gallery-thumb {
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
    flex: 0 0 auto;
    height: 80px;
    opacity: 0.7;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.gallery-thumb img {
    height: 100%;
    width: auto;
    display: block;
    object-fit: cover; /* 保证缩略图高度统一 */
}

.gallery-thumb:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.gallery-thumb.is-active {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* Empty state */

.gallery-empty-hint {
    margin-top: 2rem;
    font-size: 0.9rem;
    opacity: 0.7;
    text-align: center;
}

/* ===== Responsiveness ===== */

@media (max-width: 900px) {
    .gallery-main-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .gallery-nav-btn {
        display: none; /* on small screens, swipe / tap thumbnails is enough */
    }

    .gallery-title {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    #gallery-single {
        padding: 2.5rem 0;
    }

    .gallery-thumb {
        height: 70px;
    }

    .gallery-main-image-wrapper {
        border-radius: 14px;
    }
}
