.gallery-section {
    padding-top: 8rem;
    padding-bottom: 4rem;
    background-color: transparent;
    min-height: 100vh;
    overflow: hidden; /* Hide carousel scrollbar */
}

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

.gallery-title {
    font-family: var(--luxury-font);
    font-size: clamp(2.5rem, 5vw, var(--biggest-font-size));
    color: var(--first-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
}

.gallery-subtitle {
    font-family: var(--body-font);
    color: var(--first-color-alt);
    font-size: var(--normal-font-size);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Piwigo iframe gallery */
.piwigo-wrapper {
    max-width: 1200px;
    margin: 0 auto 6rem;
    padding: 0 1.5rem;
}

.piwigo-frame {
    width: 100%;
    height: 80vh;
    min-height: 600px;
    border: 1px solid rgba(var(--shadow-rgb), 0.03);
    border-radius: 2rem;
    background: var(--white-color);
    box-shadow: 0 20px 60px rgba(var(--shadow-rgb), 0.05);
    display: block;
}

@media screen and (max-width: 768px) {
    .piwigo-wrapper {
        padding: 0 0.75rem;
    }
    .piwigo-frame {
        height: 70vh;
        min-height: 450px;
        border-radius: 1.25rem;
    }
}

/* 3D carousel */
.carousel-container {
    position: relative;
    width: 100%;
    height: 400px; /* Match image height */
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1200px;
    margin-bottom: 5rem;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
}

/* Carousel item (polaroid card) */
.gallery-item {
    position: absolute;
    width: 500px;
    height: 350px;
    border-radius: 8px;
    background: var(--white-color);
    padding: 10px;
    box-shadow: 0 15px 35px rgba(var(--shadow-rgb),0.4);
    cursor: pointer;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s ease, z-index 0.6s step-end;
    transform-origin: center center;
    left: 50%;
    top: 50%;
    margin-left: -250px;
    margin-top: -175px;
}

/* Carousel mobile sizing */
@media screen and (max-width: 768px) {
    .gallery-item {
        width: 300px;
        height: 250px;
        margin-left: -150px;
        margin-top: -125px;
        padding: 6px;
    }
    .carousel-container {
        height: 300px;
    }
}

.gallery-item img {
    width: 100%;
    height: calc(100% - 40px); /* Leave room for title below image */
    object-fit: cover;
    border-radius: 4px;
    display: block;
    /* Copy protection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

.gallery-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    background: var(--white-color);
    color: var(--title-color);
}

.gallery-item-title {
    font-family: var(--luxury-font);
    font-size: 1.5rem;
    margin: 0;
    color: var(--first-color);
    font-style: normal;
    font-weight: 700;
}

.gallery-item-desc {
    display: none; /* Shown only in lightbox */
}


/* Carousel position states (set by JS) */
.gallery-item.center {
    transform: translateX(0) translateZ(100px) rotateY(0deg);
    z-index: 10;
    opacity: 1;
    box-shadow: 0 25px 50px rgba(var(--shadow-rgb),0.5);
}

.gallery-item.left-1 {
    transform: translateX(-40%) translateZ(0px) rotateY(35deg);
    z-index: 9;
    opacity: 0.9;
}
.gallery-item.left-2 {
    transform: translateX(-70%) translateZ(-100px) rotateY(45deg);
    z-index: 8;
    opacity: 0.7;
}
.gallery-item.left-3 {
    transform: translateX(-90%) translateZ(-200px) rotateY(55deg);
    z-index: 7;
    opacity: 0.4;
}

.gallery-item.right-1 {
    transform: translateX(40%) translateZ(0px) rotateY(-35deg);
    z-index: 9;
    opacity: 0.9;
}
.gallery-item.right-2 {
    transform: translateX(70%) translateZ(-100px) rotateY(-45deg);
    z-index: 8;
    opacity: 0.7;
}
.gallery-item.right-3 {
    transform: translateX(90%) translateZ(-200px) rotateY(-55deg);
    z-index: 7;
    opacity: 0.4;
}

.gallery-item.hidden-left {
    transform: translateX(-120%) translateZ(-300px) rotateY(65deg);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}
.gallery-item.hidden-right {
    transform: translateX(120%) translateZ(-300px) rotateY(-65deg);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
}

/* Carousel controls */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(var(--white-rgb), 0.7);
    font-size: 3rem;
    cursor: pointer;
    z-index: 20;
    transition: color 0.3s, transform 0.3s;
    padding: 20px;
}

.carousel-btn:hover {
    color: var(--white-color);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 2%;
}

.carousel-next {
    right: 2%;
}

/* Info section below gallery */
.dynamic-info-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
    color: var(--title-color);
}

.dynamic-info-section .dynamic-title {
    font-family: var(--luxury-font);
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
    color: var(--first-color);
    font-weight: 700;
    transition: opacity 0.3s ease;
}

.dynamic-info-section .dynamic-desc {
    font-family: var(--body-font);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 0;
    transition: opacity 0.3s ease;
    color: var(--text-color);
}


/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--shadow-rgb), 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    flex-direction: column;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
}

.lightbox-protect-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.lightbox-content {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(var(--shadow-rgb),0.5);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.lightbox-text {
    text-align: center;
    margin-top: 1.5rem;
}

.lightbox-title {
    color: var(--white-color);
    font-family: var(--luxury-font);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.lightbox-desc {
    display: none;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 3rem;
    color: var(--white-color);
    font-size: 3rem;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 10000;
}

.lightbox-close:hover {
    color: var(--first-color);
}
