/* Container */
.salvant-polaroid-gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 40px;
    background: #f0f0f0;
    /* Optional: adds to the desk feel */
}

/* Polaroid Item */
.polaroid-item {
    background: #fff;
    padding: 10px 10px 25px 10px;
    /* Bottom padding for caption space */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transform-origin: center center;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, z-index 0s linear 0.3s;
    width: 200px;
    /* Or responsive */
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.polaroid-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    height: auto;
    border: 1px solid #eee;
    margin-bottom: 10px;
    object-position: top;
}

.image-wrapper {
    position: relative;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 14px solid #fff;
    margin-left: 3px;
    /* visual center adjustment */
}

/* Video Preview acts like the image */
.polaroid-content .image-wrapper video.video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    aspect-ratio: 1 / 1;
    background: #333;
    /* Dark background for videos with no thumb */
}

.polaroid-item .caption {
    font-family: 'Courier New', Courier, monospace;
    /* Classic polaroid font feel */
    text-align: center;
    font-size: 14px;
    color: #333;
    min-height: 1.2em;
}

.polaroid-description {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 5px;
    line-height: 1.3;
}

/* Hover Effect: Straighten & Scale */
.polaroid-item:hover {
    transform: scale(1.1) rotate(0deg) !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease, z-index 0s linear 0s;
}

/* Random Rotations via nth-child (adding more variety) */
.polaroid-item:nth-child(n) {
    transform: rotate(2deg);
}

.polaroid-item:nth-child(2n) {
    transform: rotate(-3deg);
}

.polaroid-item:nth-child(3n) {
    transform: rotate(4deg);
}

.polaroid-item:nth-child(4n) {
    transform: rotate(-5deg);
}

.polaroid-item:nth-child(5n) {
    transform: rotate(3deg);
}

.polaroid-item:nth-child(7n) {
    transform: rotate(-2deg);
}

/* Lightbox */
.salvant-polaroid-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Hidden state */
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 9999;
}

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

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 15px 15px 40px 15px;
    max-width: 90%;
    max-height: 90vh;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
    margin: 0 auto;
}

.lightbox-caption {
    margin-top: 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    color: #333;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: -40px;
    font-size: 40px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .salvant-polaroid-gallery {
        gap: 15px;
    }

    .polaroid-item {
        width: 150px;
    }
}