/* ═══════════════════════════════════════════════════
   Photo Grid Widget  –  grid.css
   Responsive columns są generowane inline per instancja.
   ═══════════════════════════════════════════════════ */

/* ─── Siatka ───────────────────────────────────────── */
.pgw-wrap {
    display: grid;
    grid-template-columns: var(--pgw-cols, repeat(3,1fr));
    gap: var(--pgw-gap, 16px);
    width: 100%;
}

/* ─── Item ─────────────────────────────────────────── */
.pgw-item {
    overflow: hidden;
    border-radius: var(--pgw-br, 8px);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pgw-item:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ─── Hover zoom ───────────────────────────────────── */
.pgw-item.pgw-hover-zoom .pgw-img-wrap img {
    transition: transform 0.35s ease;
}
.pgw-item.pgw-hover-zoom:hover .pgw-img-wrap img {
    transform: scale(1.06);
}

/* ─── Obraz ────────────────────────────────────────── */
.pgw-img-wrap {
    overflow: hidden;
    border-radius: var(--pgw-br, 8px) var(--pgw-br, 8px) 0 0;
    position: relative;
    line-height: 0;
}

.pgw-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: var(--pgw-aspect, 1/1);
}

/* ─── Metro: span 2×2 dla co 3. elementu ──────────── */
.pgw-layout-metro .pgw-item:nth-child(3n+1) {
    grid-column: span 2;
    grid-row: span 2;
}
/* Na mobile metro wyłączane przez inline CSS per instancja */

/* ─── Styl: plain ──────────────────────────────────── */
.pgw-style-plain .pgw-img-wrap {
    border-radius: var(--pgw-br, 8px);
}
.pgw-style-plain .pgw-caption {
    padding: 10px 4px;
}

/* ─── Styl: card ───────────────────────────────────── */
.pgw-style-card.pgw-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--pgw-br, 8px);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.pgw-style-card.pgw-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    transform: translateY(-2px);
}
.pgw-style-card .pgw-img-wrap {
    border-radius: 0;
}
.pgw-style-card .pgw-caption {
    padding: 12px;
}

/* ─── Styl: overlay ────────────────────────────────── */
.pgw-style-overlay.pgw-item {
    position: relative;
}
.pgw-style-overlay .pgw-img-wrap {
    border-radius: var(--pgw-br, 8px);
    position: relative;
    overflow: hidden;
}
.pgw-style-overlay .pgw-overlay-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 14px 12px;
    background: linear-gradient(to top, rgba(0,0,0,.72) 0%, transparent 100%);
    border-radius: 0 0 var(--pgw-br, 8px) var(--pgw-br, 8px);
}
.pgw-style-overlay .pgw-title {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.pgw-style-overlay .pgw-desc {
    color: rgba(255,255,255,.82) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,.4);
    margin-top: 3px;
}

/* ─── Typografia (fallback, nadpisywana przez inline CSS) ─ */
.pgw-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.35;
    margin: 0;
}
.pgw-desc {
    font-size: 13px;
    color: #666;
    line-height: 1.55;
    margin: 5px 0 0;
}

/* ═══════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════ */
.pgw-lb-overlay {
    position: fixed;
    inset: 0;
    background: var(--pgw-lb-bg, rgba(0,0,0,0.92));
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.pgw-lb-overlay.pgw-lb-active {
    opacity: 1;
    visibility: visible;
}

.pgw-lb-box {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 92vh;
}

.pgw-lb-img-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 75vh;
}
.pgw-lb-img-wrap img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    display: block;
}

.pgw-lb-caption {
    margin-top: 16px;
    text-align: center;
    max-width: 640px;
    padding: 0 16px;
}
.pgw-lb-title {
    color: var(--pgw-lb-title, #fff);
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}
.pgw-lb-desc {
    color: rgba(255,255,255,.7);
    font-size: 14px;
    margin-top: 6px;
    line-height: 1.5;
}

.pgw-lb-close {
    position: absolute;
    top: -44px;
    right: -8px;
    background: none;
    border: none;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    opacity: .85;
    transition: opacity .15s;
}
.pgw-lb-close:hover { opacity: 1; }

.pgw-lb-nav {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}
.pgw-lb-nav button {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    font-size: 13px;
    padding: 8px 22px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s;
}
.pgw-lb-nav button:hover { background: rgba(255,255,255,.28); }

.pgw-lb-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    font-size: 26px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    z-index: 1000000;
}
.pgw-lb-arrow:hover { background: rgba(255,255,255,.25); }
.pgw-lb-arrow-prev { left: 20px; }
.pgw-lb-arrow-next { right: 20px; }

/* Na małych ekranach strzałki mniejsze */
@media (max-width: 767px) {
    .pgw-lb-arrow {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
    .pgw-lb-arrow-prev { left: 8px; }
    .pgw-lb-arrow-next { right: 8px; }
    .pgw-lb-title { font-size: 15px; }
    .pgw-lb-desc  { font-size: 13px; }
    .pgw-lb-nav   { display: none; } /* tylko strzałki boczne i swipe */
}

.pgw-lb-counter {
    position: absolute;
    top: -44px;
    left: 0;
    color: rgba(255,255,255,.6);
    font-size: 13px;
}

.pgw-lb-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pgw-spin .7s linear infinite;
    margin: 40px auto;
}
@keyframes pgw-spin { to { transform: rotate(360deg); } }
