/* Before/After Slider Block */
.wp-block-tillman-before-after {
    position: relative;
    width: 100%;
    /* No fixed aspect-ratio, height defined by content (Room Image) */
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    margin-bottom: 2rem;
    background-color: transparent;
    /* Let container be transparent */
    cursor: ew-resize;

    /* CSS Variables */
    --slider-pos: 95%;
    /* Default to right */

    /* Foreground Positioning Defaults (overridden by inline styles) */
    --fg-width: 50%;
    --fg-top: 50%;
    --fg-left: 50%;
}

/* Layer 1: Background Image (Bottom - The Room) */
.tml-slider-background-img {
    position: relative !important;
    display: block;
    width: 100%;
    height: auto !important;
    max-height: 85vh;
    object-fit: contain;
    z-index: 10;
    pointer-events: none;
}

/* Layer 2: Dark Overlay */
.tml-slider-dark-overlay {
    position: absolute;
    inset: 0;
    background-color: #121212;
    z-index: 20;
    clip-path: polygon(0 0, var(--slider-pos) 0, var(--slider-pos) 100%, 0 100%);
    pointer-events: none;
}

/* Layer 3: Masterpiece (Foreground Object) */
.tml-slider-foreground-img {
    position: absolute;
    width: var(--fg-width);
    top: var(--fg-top);
    left: var(--fg-left);
    transform: translate(-50%, -50%);
    /* Center pivot */
    object-fit: contain;
    /* Maintain aspect ratio of object */
    z-index: 30;
    pointer-events: none;
    transition: all 0.3s ease;
    /* Smooth transition when swapping items */
}

/* Labels */
.tml-label {
    position: absolute;
    top: 2rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #121212;
    pointer-events: none;
    z-index: 40;
}

.tml-label-before {
    left: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    z-index: 40;
}

.tml-label-after {
    right: 2rem;
    background: rgba(255, 255, 255, 0.8);
    color: #000;
    z-index: 15;
}

/* Handle */
.tml-slider-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--slider-pos);
    width: 2px;
    background: #fff;
    cursor: ew-resize;
    z-index: 50;
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.tml-slider-handle-button {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3rem;
    height: 3rem;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    color: #000;
}

.tml-slider-handle-button::after {
    content: '↔';
    font-size: 1.2rem;
}

/* 
   THUMBNAILS (New)
*/
.tml-slider-thumbnails {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.tml-slider-thumb {
    width: 5rem;
    height: 5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

.tml-slider-thumb:hover,
.tml-slider-thumb.is-active {
    opacity: 1;
    border-color: #fff;
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

.tml-slider-thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}