/* =========================================================
   WP Page Widgets — 3D Coverflow
   Lightweight CSS-transform coverflow carousel.
   ========================================================= */

.wpw-coverflow {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--wpw-cf-bg, transparent);
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Viewport & Track ────────────────────────────────── */

.wpw-cf-viewport {
    perspective: 1200px;
    perspective-origin: 50% 50%;
    overflow: visible;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.wpw-cf-track {
    position: relative;
    width: var(--wpw-cf-w, 300px);
    height: var(--wpw-cf-h, 400px);
    transform-style: preserve-3d;
}

/* ── Slides ──────────────────────────────────────────── */

.wpw-cf-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--wpw-cf-w, 300px);
    height: var(--wpw-cf-h, 400px);
    transition: transform 0.5s cubic-bezier(0.25, 0.1, 0.25, 1),
        opacity 0.5s ease;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    pointer-events: none;
    opacity: 0;
}

/* Disable transition during silent normalization jumps */
.wpw-coverflow.wpw-cf-no-transition .wpw-cf-slide {
    transition: none !important;
}

.wpw-cf-slide.active,
.wpw-cf-slide.visible {
    pointer-events: auto;
}

.wpw-cf-slide.active {
    opacity: 1;
}

.wpw-cf-slide.visible {
    opacity: var(--wpw-cf-opacity, 0.6);
}

.wpw-cf-slide img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: var(--wpw-cf-fit, cover);
    border-radius: var(--wpw-cf-radius, 8px);
}

/* ── Shadow ──────────────────────────────────────────── */

.wpw-cf-shadow .wpw-cf-slide.active img {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.wpw-cf-shadow .wpw-cf-slide.visible img {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ── Reflection ──────────────────────────────────────── */

/*
 * Allow the reflection to overflow below without altering slide layout.
 * overflow-x stays hidden to clip side slides; overflow-y is visible
 * so the mirrored image can extend downward as pure decoration.
 */
.wpw-cf-reflection {
    overflow: clip visible;
}

/*
 * Real reflection via -webkit-box-reflect.
 * --wpw-cf-reflect-gap : space between image bottom and reflection top (px)
 * --wpw-cf-reflect-h   : how far the reflection extends before fully fading (%, px)
 *
 * The gradient mask starts opaque (visible) near the image and fades
 * to transparent towards the bottom based on --wpw-cf-reflect-h distance.
 * Note: due to flipped coordinate space in -webkit-box-reflect,
 * 100% is touching the image, and 0% is the far bottom of the reflection.
 */
.wpw-cf-reflection .wpw-cf-slide {
    -webkit-box-reflect: below var(--wpw-cf-reflect-gap, 0px) linear-gradient(to bottom,
            transparent 0%,
            transparent calc(100% - var(--wpw-cf-reflect-h, 50%)),
            rgba(0, 0, 0, 0.20) calc(100% - var(--wpw-cf-reflect-h, 50%) + 10%),
            rgba(0, 0, 0, 0.50) 100%);
}

/* ── 3D Thickness (Solid Tile) ──────────────────────── */

.wpw-cf-has-thickness .wpw-cf-slide {
    overflow: visible !important;
}

/* 3D card wrapper */
.wpw-cf-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

/* Front face */
.wpw-cf-front {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    backface-visibility: hidden;
    z-index: 1;
}

.wpw-cf-has-thickness .wpw-cf-front img {
    border-radius: 0;
}

/* Lighting overlay on front face */
.wpw-cf-light {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: background 0.5s ease;
    z-index: 2;
}

.wpw-cf-has-thickness .wpw-cf-slide.wpw-cf-tilt-right .wpw-cf-light {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.15) 0%, transparent 50%, rgba(255, 255, 255, 0.08) 100%);
}

.wpw-cf-has-thickness .wpw-cf-slide.wpw-cf-tilt-left .wpw-cf-light {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%, rgba(0, 0, 0, 0.15) 100%);
}

/* Extrusion layers (Layered Stack method) */
.wpw-cf-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--wpw-cf-radius, 8px);
    background: var(--wpw-cf-thick-color, #d3d3d3);
    transform: translateZ(calc(-1 * var(--l) / var(--wpw-cf-layers, 15) * var(--wpw-cf-thick-size, 20px)));
    backface-visibility: hidden;
    filter: brightness(calc(1 - 0.3 * var(--l) / var(--wpw-cf-layers, 15)));
}

/* Shadow: move to front face when thickness is active */
.wpw-cf-shadow.wpw-cf-has-thickness .wpw-cf-slide.active img,
.wpw-cf-shadow.wpw-cf-has-thickness .wpw-cf-slide.visible img {
    box-shadow: none;
}

.wpw-cf-shadow.wpw-cf-has-thickness .wpw-cf-slide.active .wpw-cf-front {
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.wpw-cf-shadow.wpw-cf-has-thickness .wpw-cf-slide.visible .wpw-cf-front {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* ── Arrows ──────────────────────────────────────────── */

.wpw-cf-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpw-cf-arrow:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.wpw-cf-arrow:disabled {
    opacity: 0.3;
    cursor: default;
    transform: translateY(-50%) scale(1);
}

.wpw-cf-prev {
    left: 12px;
}

.wpw-cf-next {
    right: 12px;
}

/* ── Dots ────────────────────────────────────────────── */

.wpw-cf-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 8px;
}

.wpw-cf-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.25);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background 0.3s, border-color 0.3s, transform 0.2s;
}

.wpw-cf-dot:hover {
    border-color: rgba(0, 0, 0, 0.5);
    transform: scale(1.2);
}

.wpw-cf-dot.active {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(0, 0, 0, 0.6);
}

/* ── Drag cursor ─────────────────────────────────────── */

.wpw-cf-draggable {
    cursor: grab;
}

.wpw-cf-draggable.is-dragging {
    cursor: grabbing;
}

.wpw-cf-draggable img {
    pointer-events: none;
}