/* ================================================
   BEFORE/AFTER COMPARISON SLIDER
   ================================================ */

.wd-comparison {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.wd-comparison-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
}

.wd-img-before,
.wd-img-after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    user-select: none;
    pointer-events: none;
}

.wd-img-after {
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}

.wd-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
}

.wd-slider-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: #fcb900;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(252, 185, 0, 0.6);
}

.wd-slider-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: #fcb900;
    border: 3px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #000;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    user-select: none;
}

/* Mobile toggle: Przed / Po */
.wd-ba-toggle {
    display: none;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.wd-ba-toggle__btn {
    appearance: none;
    border: 0;
    margin: 0;
    padding: 8px 18px;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}

.wd-ba-toggle__btn.is-active {
    background: #fcb900;
    color: #000;
}

.wd-ba-toggle__btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.wd-comparison--toggle .wd-ba-toggle {
    display: inline-flex;
}

.wd-comparison--toggle .wd-slider {
    pointer-events: none;
}

.wd-comparison--toggle .wd-slider-knob {
    display: none;
}

.wd-comparison--toggle .wd-slider-line {
    width: 3px;
    background: #fcb900;
    box-shadow: 0 0 12px rgba(252, 185, 0, 0.75);
}

@media (prefers-reduced-motion: reduce) {
    .wd-ba-toggle__btn {
        transition: none;
    }
}

/* ================================================
   POST THUMBNAIL (MATCHING COMPARISON STYLE)
   ================================================ */

.post-thumb {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    overflow: hidden;
    border-radius: 8px; /* Match .wd-comparison */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); /* Match .wd-comparison */
}

/* Force standard WordPress featured image to behave like the comparison wrapper */
.post-thumb img {
    display: block;
    width: 100%;
    height: auto;
    /* Simulate the 16:9 aspect ratio wrapper if desired, or just let height be auto but constrained */
    /* .wd-comparison-wrapper has padding-bottom: 56.25%; which is 16:9 */
    /* To ensure EXACT match in size, we might need to object-fit cover it inside a ratio box */
}

/* If the user wants exact 16:9 ratio match: */
.post-thumb {
    aspect-ratio: 16/9;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================================================
   GALLERY RESPONSIVE
   ================================================ */

.wd-gallery,
.wp-block-gallery {
    display: grid !important; /* Force grid over WP flex */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px !important;
    margin: 40px auto;
    padding: 20px;
    max-width: 1200px;
}

.wd-gallery img,
.wp-block-gallery .wp-block-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 6px;
    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wp-block-gallery .wp-block-image {
    margin: 0 !important; /* Reset default WP margins */
    width: 100% !important; /* Reset default WP widths */
}

/* Reset figure in block gallery to behave nicely */
.wp-block-gallery figure.wp-block-image {
    display: block;
}

.wd-gallery img:hover,
.wp-block-gallery .wp-block-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(252, 185, 0, 0.4);
}

/* ================================================
   LIGHTBOX STYLES
   ================================================ */

.wd-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.wd-lightbox.wd-active {
    display: flex;
}

.wd-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.wd-lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    z-index: 10000;
    transition: color 0.3s ease;
    user-select: none;
}

.wd-lightbox-close:hover {
    color: #fcb900;
}

.wd-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 50px;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    padding: 20px;
    user-select: none;
    transition: color 0.3s ease;
    z-index: 10000;
}

.wd-lightbox-nav:hover {
    color: #fcb900;
}

.wd-lightbox-prev {
    left: 20px;
}

.wd-lightbox-next {
    right: 20px;
}

/* ================================================
   RESPONSIVE BREAKPOINTS
   ================================================ */

@media screen and (max-width: 979px) {
    .wd-comparison {
        margin: 20px auto;
    }

    .wd-gallery,
    .wp-block-gallery {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 12px !important;
        padding: 15px;
    }

    .wd-gallery img,
    .wp-block-gallery .wp-block-image img {
        height: 200px;
    }

    .wd-slider-knob {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .wd-lightbox-close {
        font-size: 35px;
        top: 15px;
        right: 20px;
    }

    .wd-lightbox-nav {
        font-size: 40px;
        padding: 15px;
    }

    .wd-lightbox-prev {
        left: 10px;
    }

    .wd-lightbox-next {
        right: 10px;
    }
}

@media screen and (max-width: 767px) {
    .wd-comparison {
        margin: 15px auto;
        border-radius: 6px;
    }

    .wd-comparison-wrapper {
        padding-bottom: 75%;
    }

    .wd-gallery,
    .wp-block-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px !important;
        padding: 10px;
    }

    .wd-gallery img,
    .wp-block-gallery .wp-block-image img {
        height: 150px;
        border-radius: 4px;
    }

    .wd-slider-knob {
        width: 35px;
        height: 35px;
        font-size: 14px;
        border-width: 2px;
    }

    .wd-lightbox-close {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }

    .wd-lightbox-nav {
        font-size: 35px;
        padding: 10px;
    }
}

@media screen and (max-width: 479px) {
    .wd-comparison {
        margin: 10px 0;
        border-radius: 4px;
    }

    .wd-comparison-wrapper {
        padding-bottom: 100%;
    }

    .wd-gallery,
    .wp-block-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px !important;
        padding: 8px;
    }

    .wd-gallery img,
    .wp-block-gallery .wp-block-image img {
        height: 120px;
    }

    .wd-slider-knob {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .wd-slider {
        width: 6px;
    }

    .wd-lightbox-close {
        font-size: 28px;
        top: 10px;
        right: 10px;
    }

    .wd-lightbox-nav {
        font-size: 30px;
        padding: 8px;
    }

    .wd-lightbox img {
        max-width: 95%;
        max-height: 95%;
    }
}

/* ================================================
   END BEFORE/AFTER & GALLERY STYLES
   ================================================ */
