/* ================================
   MASONRY GALLERY BLOCK STYLES
   ================================ */

.bb-masonry-gallery {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    background: #1a1721;
    color: white;
}

/* Wrapper i Content Structure */
.masonry-wrapper {
    overflow: hidden;
    position: fixed;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.masonry-content {
    overflow: visible;
    width: 100%;
    position: relative;
    min-height: 150vh;
}

/* Logo Styles - Centralne pozycjonowanie */
.masonry-logo {
    position: fixed;
    top: 50vh;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    pointer-events: none;
}

.logo-image {
    max-width: 300px;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.6));
    opacity: 0.95;
    transition: all 0.6s ease;
}

.logo-text {
    font-family: var(--wp--preset--font-family--heading);
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 8rem);
    text-align: center;
    width: 100%;
    margin: 0;
    transform: translateY(-50%);
    z-index: 2;
    color: white;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: white;
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

.outline-text {
    color: transparent;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: rgba(255, 255, 255, 0.8);
    z-index: 3;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.filter-text {
    mix-blend-mode: screen;
    color: var(--wp--preset--color--gold-accent, #d9c07e);
    z-index: 4;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

/* Masonry Images Layout */
.masonry-images {
    padding-top: 80vh;
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 200vh;
    display: grid;
    grid-template-columns: repeat(20, 5%);
    grid-template-rows: repeat(40, 2.5%);
    justify-content: center;
    justify-items: center;
    align-items: center;
    z-index: 1;
    gap: 0.5rem;
}

.masonry-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.9;
    transform-origin: center;
    backface-visibility: hidden;
    will-change: transform;
}

.masonry-images img:hover {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    z-index: 2;
}

/* Dynamicke pozycjonowanie obrazów - podobne do CodePen ale bardziej subtelne */
.masonry-images img:nth-child(1) {
    grid-area: 1/1/8/9;
}

.masonry-images img:nth-child(2) {
    grid-area: 3/12/10/20;
}

.masonry-images img:nth-child(3) {
    grid-area: 10/4/16/13;
}

.masonry-images img:nth-child(4) {
    grid-area: 17/1/24/8;
}

.masonry-images img:nth-child(5) {
    grid-area: 18/13/25/20;
}

.masonry-images img:nth-child(6) {
    grid-area: 26/2/33/10;
}

.masonry-images img:nth-child(7) {
    grid-area: 28/12/33/19;
}

.masonry-images img:nth-child(8) {
    grid-area: 35/5/40/15;
}

/* Dla dodatkowych obrazów - cykliczne pozycjonowanie */
.masonry-images img:nth-child(9) {
    grid-area: 2/15/7/20;
}

.masonry-images img:nth-child(10) {
    grid-area: 12/1/17/6;
}

.masonry-images img:nth-child(11) {
    grid-area: 20/8/26/16;
}

.masonry-images img:nth-child(12) {
    grid-area: 30/1/36/7;
}

/* Editor Styles */
.bb-masonry-gallery-editor {
    border: 2px solid rgba(217, 192, 126, 0.3);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.bb-masonry-gallery-editor h3 {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .masonry-images {
        grid-template-columns: repeat(16, 6.25%);
        grid-template-rows: repeat(35, 3%);
        max-width: 1000px;
    }

    .logo-text {
        font-size: clamp(2.5rem, 7vw, 6rem);
    }

    .logo-image {
        max-width: 250px;
        max-height: 120px;
    }
}

@media (max-width: 768px) {
    .masonry-images {
        grid-template-columns: repeat(12, 8.33%);
        grid-template-rows: repeat(30, 3.5%);
        padding-top: 70vh;
        gap: 0.25rem;
    }

    .logo-text {
        font-size: clamp(2rem, 6vw, 4rem);
        -webkit-text-stroke-width: 0.5px;
    }

    .logo-image {
        max-width: 200px;
        max-height: 100px;
    }

    /* Mobilne pozycjonowanie obrazów */
    .masonry-images img:nth-child(1) {
        grid-area: 1/1/6/7;
    }

    .masonry-images img:nth-child(2) {
        grid-area: 2/7/7/12;
    }

    .masonry-images img:nth-child(3) {
        grid-area: 8/2/13/9;
    }

    .masonry-images img:nth-child(4) {
        grid-area: 9/9/14/12;
    }

    .masonry-images img:nth-child(5) {
        grid-area: 15/1/20/6;
    }

    .masonry-images img:nth-child(6) {
        grid-area: 16/7/21/12;
    }

    .masonry-images img:nth-child(7) {
        grid-area: 22/3/27/10;
    }

    .masonry-images img:nth-child(8) {
        grid-area: 25/1/30/5;
    }
}

@media (max-width: 480px) {
    .masonry-images {
        grid-template-columns: repeat(8, 12.5%);
        grid-template-rows: repeat(25, 4%);
        padding-top: 60vh;
    }

    .logo-text {
        font-size: clamp(1.5rem, 5vw, 3rem);
    }

    .logo-image {
        max-width: 150px;
        max-height: 75px;
    }

    /* Bardzo małe ekrany - pojedyncza kolumna obrazów */
    .masonry-images img:nth-child(odd) {
        grid-column: 1/5;
    }

    .masonry-images img:nth-child(even) {
        grid-column: 5/8;
    }
}

/* Performance Optimizations */
.masonry-images img {
    /* GPU acceleration */
    transform: translateZ(0);
    /* Better text rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Accessibility - Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .masonry-images img {
        transition: none !important;
    }

    .logo-image,
    .logo-text {
        transition: none !important;
    }

    /* Wyłącz wszystkie GSAP animacje */
    .bb-masonry-gallery * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .bb-masonry-gallery {
        position: static !important;
        height: auto !important;
        background: white !important;
        color: black !important;
    }

    .masonry-wrapper {
        position: static !important;
        height: auto !important;
    }

    .masonry-content {
        min-height: auto !important;
    }

    .masonry-logo {
        position: static !important;
        transform: none !important;
        margin-bottom: 2rem !important;
    }

    .masonry-images {
        display: block !important;
        padding-top: 0 !important;
        min-height: auto !important;
    }

    .masonry-images img {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 1rem !important;
        break-inside: avoid !important;
    }
}