/* ========================================
   PERFECT PHOTO GALLERY — STRUCTURE
   Functional styles only.
   Project-specific visual overrides can stay in style.css.
   ======================================== */

.ppg-gallery {
    /* Defaults are overridden by Elementor responsive controls. */
    --ppg-row-height: 280px;
    --ppg-gap: 10px;

    display: block;
    width: 100%;
}

/* One calculated justified row. */
.ppg-row {
    display: flex;
    width: 100%;
    margin: 0 0 var(--ppg-gap);
    align-items: stretch;
}

.ppg-row:last-child {
    margin-bottom: 0;
}

/* A photo keeps its calculated place but stays hidden until it enters
   the viewport and its image file has finished loading. */
.ppg-item.ppg-item-pending {
    opacity: 0;
}

.ppg-item.ppg-item-visible {
    opacity: 1;
}

/* Exact e-gallery lazy-load model: the unloaded image is transparent and
   scaled to half size, then transitions to its normal state. */
.ppg-gallery[data-photo-animation="fadeIn"] .ppg-image {
    transform-origin: center top;
    transition: var(--ppg-image-transition-duration, 350ms);
}

.ppg-gallery[data-photo-animation="fadeIn"] .ppg-image:not(.ppg-image-loaded) {
    filter: opacity(0);
    transform: scale(0.5);
}

@media (prefers-reduced-motion: reduce) {
    .ppg-item.ppg-item-pending {
        opacity: 1;
    }

    .ppg-gallery[data-photo-animation="fadeIn"] .ppg-image:not(.ppg-image-loaded) {
        filter: none;
        transform: none;
    }
}

/* One photo/link. Width and height are calculated by JS. */
.ppg-item {
    display: block;
    flex: 0 0 auto;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
}

/* Image fills a box with exactly the same aspect ratio, so it is not cropped. */
.ppg-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

/* Visible only in Elementor/editor when the chosen field is empty. */
.ppg-empty {
    padding: 12px;
    border: 1px dashed currentColor;
    opacity: 0.75;
}
