/* ============================================
   JUSTIFIED HORIZONTAL MASONRY GALLERY
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-height: 100%;
    background: url('https://www.toowang.space/Section_BG.webp') center/cover no-repeat;
}

html::-webkit-scrollbar {
    display: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    position: relative;
    min-height: 100vh;
    background: url('https://www.toowang.space/Section_BG.webp') center/cover no-repeat;
    background-attachment: fixed;
    color: #333;
    padding: 0;
}


.gallery-container {
    width: 100%;
    max-width: 80vw;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 4rem;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
    width: 100%;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: #333;
}

header p {
    font-size: 1rem;
    color: #999;
    margin-top: 2.5rem;
    font-weight: 300;
    letter-spacing: 1px;
}

/* Gallery Sections */
.gallery-section {
    width: 100%;
    margin-bottom: 4rem;
}

.section-title {
    text-align: center;
    margin-bottom: -1.5rem;
    font-size: 3rem;
    color: #333;
    width: 100%;
    position: relative;
    z-index: 2;
}

/* Subtitle under section title, centered like homepage gallery */
.section-subtitle {
    text-align: center;
    font-weight: 100;
    letter-spacing: 2rem;
    font-size: 2.5rem;
    margin-top: -4rem;
    margin-bottom: 2rem;
    color: rgba(0, 0, 0, 0.5);
    width: 100%;
    position: relative;
    z-index: 1;
}

.section-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* Masonry Grid */
.masonry-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 3rem;
    align-items: center;
}

.masonry-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: center;
}

/* Gallery Items */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    background: #fff;
    opacity: 0;
    transform: translateY(24px);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.6s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.gallery-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 0.5s ease;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.gallery-item img[src] {
    animation: none;
    background: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    padding: 2rem 1.5rem 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

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

.gallery-item-title {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
    line-height: 1.3;
}

.gallery-item-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.3;
    margin-top: 0.5rem;
}

/* Lightbox Modal */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.lightbox.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    animation: slideIn 0.3s ease;
    transition: all 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-info {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    max-width: 600px;
    z-index: 1001;
}

.lightbox-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.lightbox-info p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

/* Responsive */
@media (max-width: 1024px) {
    body {
        padding: 3rem 1.5rem;
    }

    header h1 {
        font-size: 2.5rem;
        letter-spacing: 2px;
    }

    .masonry-grid {
        gap: 10px;
    }

    .masonry-row {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 2rem 1rem;
    }

    .gallery-container {
        max-width: 90vh;
    }

    header h1 {
        font-size: 2rem;
        letter-spacing: 1px;
    }

    header h1::after {
        width: 60px;
        height: 2px;
    }

    .masonry-grid {
        gap: 8px;
    }

    .masonry-row {
        gap: 8px;
    }

    .gallery-item-overlay {
        padding: 1rem;
    }

    .gallery-item-title {
        font-size: 0.9rem;
    }

    .gallery-item-subtitle {
        font-size: 0.7rem;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 1.5rem 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
        letter-spacing: 0.5px;
    }

    header h1::after {
        width: 50px;
        height: 2px;
    }

    header p {
        font-size: 0.9rem;
    }

    .masonry-grid {
        gap: 6px;
    }

    .masonry-row {
        gap: 6px;
    }

    .gallery-item-overlay {
        padding: 0.75rem;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    }

    .gallery-item-title {
        font-size: 0.8rem;
    }

    .gallery-item-subtitle {
        display: none;
    }

    .lightbox-nav {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .lightbox-info h2 {
        font-size: 1.2rem;
    }

    .lightbox-info p {
        font-size: 0.8rem;
    }
}
