/* Main Container - Masonry */
.wp-photo-wall-container {
    display: block;
    margin: 20px auto;
    padding: 0;

    /* RESTORE: Respect Theme Constraints */
    width: 100%;
    max-width: 100%;
}

/* Photo Items (Masonry Tiles) */
.wp-photo-wall-item {
    float: left;
    width: 50%;
    /* Mobile: 2 columns */
    padding: 0 6px 12px;
    /* Reduced gutter for refined look */
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .wp-photo-wall-item {
        width: 33.333%;
        /* Tablet Small: 3 columns */
    }
}

@media (min-width: 900px) {
    .wp-photo-wall-item {
        width: 25%;
        /* Desktop Standard: 4 columns */
    }
}

/* 5 and 6 column breakpoints removed to enforce 4-column standard */

/* Item Inner Styling */
.wp-photo-wall-item-inner {
    position: relative;
    border-radius: 8px;
    /* Slightly smaller radius for denser grid */
    overflow: hidden;
    background: #f5f5f7;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s ease;
    cursor: zoom-in;

    /* ENFORCE VERTICAL RATIO (3:4) via Padding Hack */
    /* This ensures strict ratio and NO whitespace */
    width: 100%;
    height: 0;
    padding-bottom: 133.333%;
    /* 4/3 aspect ratio */
}

.wp-photo-wall-item-inner:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    z-index: 2;
}

/* Ensure trigger FILLS the padded inner container */
.wp-photo-wall-lightbox-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
    display: block;
    z-index: 1;
}

.wp-photo-wall-item img {
    /* ABSOLUTE FORCE: Ignore theme constraints */
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;

    /* Crop to fit uniformly */
    object-fit: cover !important;
    object-position: center center !important;

    display: block !important;
    transition: opacity 0.3s ease;

    /* Protection */
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Aggressive Shield */
.wp-photo-wall-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    /* Above image */
    background: transparent;
    /* Invisible */
}

/* Lightbox (Minimalist) */
.wp-photo-wall-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wp-photo-wall-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.wp-photo-wall-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    /* Dark overlay */
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: zoom-out;
}

.wp-photo-wall-lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    z-index: 100001;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wp-photo-wall-lightbox.active .wp-photo-wall-lightbox-content {
    transform: scale(1);
}

.wp-photo-wall-lightbox-content img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    /* Protection */
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Close Button */
/* Close Button */
.wp-photo-wall-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 100002;
    /* Ensure above content */
}

.wp-photo-wall-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Navigation Buttons */
.wp-photo-wall-prev,
.wp-photo-wall-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 100002;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wp-photo-wall-prev:hover,
.wp-photo-wall-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

.wp-photo-wall-prev {
    left: 20px;
}

.wp-photo-wall-next {
    right: 20px;
}

/* Loader Styling */
#wp-photo-wall-loader {
    text-align: center;
    padding: 40px 0;
    color: #888;
    font-size: 14px;
    display: none;
    clear: both;
}

#wp-photo-wall-loader .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
    animation: wp-photo-wall-spin 2s infinite linear;
}

@keyframes wp-photo-wall-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}