/* =============================
   Wallpaper Gallery – Frontend
   ============================= */

.wpg-grid {
    display: grid;
    grid-template-columns: repeat(var(--wpg-cols, 3), 1fr);
    gap: var(--wpg-gap, 8px);
    width: 100%;
    box-sizing: border-box;
}

/* Tablet */
@media (max-width: 900px) {
    .wpg-grid {
        grid-template-columns: repeat(var(--wpg-cols-tab, 2), 1fr);
    }
}

/* Mobile */
@media (max-width: 560px) {
    .wpg-grid {
        grid-template-columns: repeat(var(--wpg-cols-mob, 1), 1fr);
    }
}

/* ---- Item ---- */
.wpg-item {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #1a1a2e;
    text-decoration: none;
}

.wpg-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease, opacity 0.25s ease;
    opacity: 0;
}

/* Fixed aspect ratio when not "auto" */
.wpg-grid:not([style*="--wpg-aspect: auto"]) .wpg-item {
    aspect-ratio: var(--wpg-aspect, 16/9);
}

.wpg-item img.wpg-loaded {
    opacity: 1;
}

.wpg-item:hover img {
    transform: scale(1.06);
}

/* ---- Zoom icon ---- */
.wpg-zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #fff;
    background: rgba(0,0,0,0);
    opacity: 0;
    transition: opacity 0.25s ease, background 0.25s ease;
    pointer-events: none;
}

.wpg-item:hover .wpg-zoom {
    opacity: 1;
    background: rgba(0,0,0,0.35);
}

/* ---- Empty ---- */
.wpg-empty {
    color: #888;
    font-style: italic;
}

/* =============================
   Lightbox
   ============================= */
.wpg-lb-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: wpgFadeIn 0.2s ease;
}

@keyframes wpgFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.wpg-lb-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpg-lb-wrap img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    transition: opacity 0.2s ease;
}

.wpg-lb-close,
.wpg-lb-prev,
.wpg-lb-next {
    position: fixed;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.wpg-lb-close:hover,
.wpg-lb-prev:hover,
.wpg-lb-next:hover {
    background: rgba(255,255,255,0.28);
}

.wpg-lb-close { top: 18px; right: 18px; font-size: 18px; }
.wpg-lb-prev  { left: 14px; top: 50%; transform: translateY(-50%); }
.wpg-lb-next  { right: 14px; top: 50%; transform: translateY(-50%); }

.wpg-lb-counter {
    position: fixed;
    bottom: 16px;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-family: sans-serif;
    letter-spacing: 1px;
}

/* Touch swipe hint */
@media (max-width: 600px) {
    .wpg-lb-prev,
    .wpg-lb-next { display: none; }
}
