.compare-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 600px;
    /* optional, for demo */
    height: 400px;
    /* 👈 set an explicit height or match image ratio */
}

.compare-img {
    width: 100%;
    height: 100%;
    /* 👈 fill container */
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.compare-before {
    z-index: 1;
}

.compare-after {
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

.compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: #fff;
    border: 2px solid #000;
    cursor: ew-resize;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-handle::before {
    content: "⇆";
    font-size: 20px;
    color: #000;
    background: #fff;
    border-radius: 50%;
    padding: 6px;
}