/* Gallery-specific styles */

.gallery-intro {
    margin: 4rem 0 6rem 0;
}

.gallery-intro p {
    font-size: clamp(1.25rem, 3vw, 2rem);
    line-height: 1.5;
    margin-bottom: 1rem;
    font-weight: 400;
}

.gallery-section {
    margin: 4rem 0;
}

/* Controls */
.gallery-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.shuffle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: var(--border);
    background: transparent;
    color: var(--fg);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.shuffle-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.shuffle-btn:active {
    transform: scale(0.95);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 3rem;
    padding: 2rem 0;
}

/* Polaroid Card - 3D flip container */
.polaroid {
    perspective: 1000px;
    cursor: pointer;
    transform: rotate(var(--rotation, 0deg));
    transition: transform 0.3s ease;
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.04) translateY(-6px);
}

.polaroid-inner {
    position: relative;
    width: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform-style: preserve-3d;
}

.polaroid.flipped .polaroid-inner {
    transform: rotateY(180deg);
}

/* Both faces */
.polaroid-front,
.polaroid-back {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Front face */
.polaroid-front {
    background: #fff;
    padding: 12px 12px 48px 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    position: relative;
}

.polaroid:hover .polaroid-front {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}

.polaroid-image-wrapper {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
}

.polaroid-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.9);
    transition: filter 0.3s;
}

.polaroid:hover .polaroid-image {
    filter: saturate(1);
}

.polaroid-caption {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: #666;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Back face */
.polaroid-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    transform: rotateY(180deg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.polaroid.flipped:hover .polaroid-back {
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}

.polaroid-back-caption {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 1rem;
    text-transform: lowercase;
}

.polaroid-back-description {
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--fg);
    font-weight: 400;
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-intro {
        margin: 2rem 0 3rem 0;
    }

    .gallery-section {
        margin: 2rem 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .gallery-intro p {
        font-size: 1.15rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
        margin: 0 auto;
        gap: 1.5rem;
    }

    .polaroid-back {
        padding: 1.5rem 1rem;
    }

    .polaroid-back-caption {
        font-size: 1rem;
    }

    .polaroid-back-description {
        font-size: 0.8rem;
    }
}
