.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

.gallery-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background-color: var(--section-bg);
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(102, 204, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tianyi-blue);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: var(--tianyi-blue-dark);
    transform: translateX(-5px);
}

.gallery-header h1 {
    font-size: 2.5em;
    color: var(--tianyi-blue);
    margin: 0 0 10px 0;
}

.gallery-header p {
    color: var(--text-secondary-color);
    font-size: 1.1em;
    margin: 0;
}

.masonry-gallery {
    column-count: 3;
    column-gap: 20px;
}

.gallery-item {
    break-inside: avoid;
    margin-bottom: 20px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(102, 204, 255, 0.3);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-info {
    color: #ffffff;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-info {
    transform: translateY(0);
}

.gallery-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.2em;
}

.gallery-info p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.zoom-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tianyi-blue);
    font-size: 18px;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.gallery-item:hover .zoom-btn {
    opacity: 1;
    transform: scale(1);
}

.zoom-btn:hover {
    background-color: #ffffff;
    transform: scale(1.1);
}

.dark-mode .gallery-header {
    background-color: var(--section-bg);
    border-color: var(--border-color);
}

.dark-mode .back-link {
    color: var(--highlight-color);
}

.dark-mode .back-link:hover {
    color: #66CCFF;
}

.dark-mode .gallery-header h1 {
    color: var(--highlight-color);
}

.dark-mode .gallery-item:hover {
    box-shadow: 0 8px 16px rgba(136, 238, 255, 0.3);
}

.dark-mode .zoom-btn {
    color: var(--highlight-color);
}

@media (max-width: 1200px) {
    .masonry-gallery {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .gallery-container {
        padding: 20px 10px;
    }

    .gallery-header {
        padding: 20px;
    }

    .gallery-header h1 {
        font-size: 1.8em;
    }

    .gallery-header p {
        font-size: 1em;
    }

    .masonry-gallery {
        column-count: 1;
    }

    .gallery-item {
        margin-bottom: 15px;
    }
}

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
    color: #ffffff;
    text-align: center;
    margin-top: 20px;
}

.lightbox-caption h3 {
    margin: 0 0 5px 0;
    font-size: 1.5em;
}

.lightbox-caption p {
    margin: 0;
    font-size: 1em;
    opacity: 0.8;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

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

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

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

@media (max-width: 768px) {
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-caption h3 {
        font-size: 1.2em;
    }

    .lightbox-caption p {
        font-size: 0.9em;
    }
}