/**
 * Wielka Wyspa - Moduł Porównań Fotografii "Dawniej i Dziś"
 * Ultra-lekki, responsywny Before/After Slider (Zero Dependency, GPU-accelerated)
 */

.ww-compare {
    position: relative;
    max-width: 650px;
    margin: 30px auto;
    font-family: inherit;
    box-sizing: border-box;
}

.ww-compare * {
    box-sizing: border-box;
}

.ww-compare__media {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    background-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
    line-height: 0;
}

/* Obraz główny (Dziś) - określa naturalną wysokość kontenera */
.ww-compare__img--after {
    position: relative;
    display: block;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
}

/* Warstwa wycinana dla zdjęcia "Dawniej" */
.ww-compare__clipped {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
    -webkit-clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

/* Obraz nakładany (Dawniej) - dopasowuje się do wymiarów kontenera */
.ww-compare__img--before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
}

/* Plakietki tekstowe (Etykiety) */
.ww-compare__badge {
    position: absolute;
    top: 14px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #ffffff;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    z-index: 4;
}

.ww-compare__badge--before {
    left: 14px;
    background: rgba(30, 30, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ww-compare__badge--after {
    right: 14px;
    background: rgba(35, 164, 85, 0.85); /* Akcent zielony Wielka Wyspa */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Wizualny uchwyt suwaka */
.ww-compare__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--pos, 50%);
    transform: translateX(-50%);
    width: 44px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    transition: filter 0.2s ease;
}

.ww-compare__line {
    width: 3px;
    flex-grow: 1;
    background: #ffffff;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

.ww-compare__knob {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    color: #1a202c;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    border: 3px solid #23A455;
    flex-shrink: 0;
    transition: transform 0.15s ease, background-color 0.2s ease;
}

.ww-compare:hover .ww-compare__knob,
.ww-compare:focus-within .ww-compare__knob {
    transform: scale(1.1);
    background: #f7fafc;
}

/* Natywny suwak dotykowy / myszkowy nałożony na całą powierzchnię */
.ww-compare__range {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: ew-resize;
    z-index: 10;
    touch-action: pan-y;
}

/* Dostępność i fokus klawiatury */
.ww-compare__range:focus-visible + .ww-compare__handle .ww-compare__knob {
    outline: 3px solid #1830f1;
    outline-offset: 3px;
}

/* Podpis edukacyjny i historyczny */
.ww-compare__caption {
    margin-top: 14px;
    padding: 14px 18px;
    background: #18191c;
    border-radius: 8px;
    border: 1px solid #2d3748;
    border-left: 4px solid #23A455;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    line-height: 1.4;
}

.ww-compare__title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
}

.ww-compare__desc {
    font-size: 14px;
    line-height: 1.5;
    color: #cbd5e1;
    margin: 0;
}

.ww-compare__hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* Responsywność mobilna */
@media (max-width: 600px) {
    .ww-compare__media {
        border-radius: 8px;
    }
    .ww-compare__badge {
        font-size: 11px;
        padding: 4px 10px;
        top: 10px;
    }
    .ww-compare__badge--before { left: 10px; }
    .ww-compare__badge--after { right: 10px; }
    .ww-compare__knob {
        width: 38px;
        height: 38px;
    }
    .ww-compare__caption {
        padding: 12px 14px;
    }
    .ww-compare__title {
        font-size: 15px;
    }
    .ww-compare__desc {
        font-size: 13px;
    }
}
