/* =============================================================
   SEKCJA: REALIZACJE (masonry przez CSS columns)
============================================================= */
.jgm-realizacje {
    padding: clamp(60px, 10vw, 100px) 0;
    background: var(--bg-white);
}

/* =============================================================
   GRID – prawdziwy masonry na CSS columns
   Obrazki zachowują naturalne proporcje, brak pustych miejsc.
============================================================= */
.jgm-realizacje-grid {
    column-count: 3;
    column-gap: 1.25rem;
}

/* --- ITEM --- */
.jgm-realizacja-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    display: block;
    text-decoration: none !important;
    transition: transform var(--transition), box-shadow var(--transition);

    /* KLUCZOWE dla columns layoutu */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 1.25rem;
    width: 100%;
}

.jgm-realizacja-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

/* --- OBRAZEK – naturalne proporcje --- */
.jgm-realizacja-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform .6s ease;
    vertical-align: bottom;
}

.jgm-realizacja-item:hover img {
    transform: scale(1.04);
}

/* --- OVERLAY --- */
.jgm-realizacja-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(27, 42, 74, .92) 0%,
        rgba(27, 42, 74, .3) 55%,
        transparent 100%
    );
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem;
    opacity: 0;
    transition: opacity var(--transition);
}

.jgm-realizacja-item:hover .jgm-realizacja-overlay {
    opacity: 1;
}

.jgm-realizacja-overlay h4 {
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    margin: 0 0 .25rem 0;
    line-height: 1.3;
    transform: translateY(10px);
    transition: transform .4s ease .05s;
}

.jgm-realizacja-overlay span {
    color: var(--accent);
    font-size: .78rem;
    font-weight: 500;
    transform: translateY(10px);
    transition: transform .4s ease .1s;
}

.jgm-realizacja-item:hover .jgm-realizacja-overlay h4,
.jgm-realizacja-item:hover .jgm-realizacja-overlay span {
    transform: translateY(0);
}

/* --- ICON ZOOM --- */
.jgm-realizacja-zoom {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: rgba(212, 168, 67, .95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform .35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

.jgm-realizacja-item:hover .jgm-realizacja-zoom {
    transform: scale(1);
}

.jgm-realizacja-zoom svg {
    width: 18px;
    height: 18px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =============================================================
   STAN PUSTY (brak zdjęć)
============================================================= */
.jgm-realizacje-empty {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    border: 2px dashed rgba(0, 0, 0, .1);
}

.jgm-realizacje-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-mid);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    margin: 0 auto 1rem;
    opacity: .4;
}

.jgm-realizacje-empty p {
    color: var(--text-mid);
    font-size: 1rem;
    margin: 0 0 .5rem 0;
    font-weight: 500;
}

.jgm-realizacje-empty small {
    color: var(--text-mid);
    font-size: .82rem;
    opacity: .7;
}

.jgm-realizacje-empty code {
    background: rgba(0, 0, 0, .06);
    padding: .15rem .5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: .8rem;
}

/* =============================================================
   RESPONSIVE
============================================================= */
@media (max-width: 1100px) {
    .jgm-realizacje-grid {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .jgm-realizacje-grid {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .jgm-realizacje-grid {
        column-count: 1;
        column-gap: 1rem;
    }

    .jgm-realizacja-item {
        margin-bottom: 1rem;
    }

    /* Na mobile – overlay zawsze widoczny */
    .jgm-realizacja-overlay {
        opacity: 1;
        background: linear-gradient(
            to top,
            rgba(27, 42, 74, .85) 0%,
            transparent 60%
        );
    }

    .jgm-realizacja-overlay h4,
    .jgm-realizacja-overlay span {
        transform: translateY(0);
    }

    .jgm-realizacja-zoom {
        display: none;
    }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .jgm-realizacja-item,
    .jgm-realizacja-item img,
    .jgm-realizacja-overlay,
    .jgm-realizacja-overlay h4,
    .jgm-realizacja-overlay span,
    .jgm-realizacja-zoom {
        transition: none !important;
    }
}

/* =============================================================
   LIGHTBOX
============================================================= */
.jgm-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity .3s ease;
}

.jgm-lightbox.open {
    display: flex;
    opacity: 1;
    animation: jgm-fadeInUp .3s ease;
}

.jgm-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.jgm-lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.jgm-lightbox-caption {
    color: #fff;
    font-size: .95rem;
    text-align: center;
    max-width: 600px;
}

.jgm-lightbox button {
    position: absolute;
    background: rgba(255, 255, 255, .1);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.jgm-lightbox button:hover {
    background: var(--accent);
    color: var(--primary);
    transform: scale(1.1);
}

.jgm-lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
}

.jgm-lightbox-prev {
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.jgm-lightbox-next {
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.jgm-lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.jgm-lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

@media (max-width: 600px) {
    .jgm-lightbox-prev,
    .jgm-lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .jgm-lightbox-close {
        top: 1rem;
        right: 1rem;
    }
}