/* ── Crispal Product Gallery ─────────────────────────────────────────────── */

.crispal-gallery {
    width: 100%;
    user-select: none;
}

/* ── Main slider ─────────────────────────────────────────────────────────── */

.crispal-main-slider {
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: #f5f5f5;
    margin-bottom: 10px;
}

.crispal-gallery.initialized.has-multiple .crispal-main-slider {
    cursor: grab;
}

.crispal-gallery.initialized.has-multiple .crispal-main-slider:active {
    cursor: grabbing;
}

/* 3:4 portrait ratio — defines the slider height from its width */
.crispal-main-slider::before {
    content: '';
    display: block;
    padding-top: 133.4%;
}

.crispal-slides-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: nowrap;
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Each slide fills exactly the slider width. The track is width:100%
   of the slider, slides are flex:0 0 100% (one slider-width each) and
   overflow horizontally. translateX in % is relative to the track width,
   so each 100% step = exactly one slide. No pixel measurement needed. */
.crispal-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    opacity: 1;
}

.crispal-slide img.crispal-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    position: absolute;
    inset: 0;
}

.crispal-lightbox-link {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

/* ── Video slide ─────────────────────────────────────────────────────────── */

.crispal-slide-video .crispal-video-wrap {
    position: absolute;
    inset: 0;
    background: #111;
}

.crispal-video-player {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Custom controls bar */
.crispal-video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.45) 0%, transparent 100%);
    z-index: 3;
}

/* Progress bar — not clickable, display only */
.crispal-video-progress {
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    pointer-events: none;
    cursor: default;
}

.crispal-video-progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* Replay button — same style as zoom button, slightly larger */
.crispal-video-replay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4;
}

.crispal-video-replay.visible {
    display: flex;
}

.crispal-video-replay button {
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

.crispal-video-replay button:hover {
    background: #fff;
    transform: scale(1.08);
}

.crispal-video-replay button svg {
    width: 26px;
    height: 26px;
    fill: #333;
}

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

.crispal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: rgba(255,255,255,0.85);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: background 0.2s, opacity 0.2s;
    padding: 0;
}

.crispal-arrow:hover { background: #fff; }
.crispal-arrow.disabled { opacity: 0.3; pointer-events: none; }

.crispal-prev { left: 10px; }
.crispal-next { right: 10px; }

.crispal-arrow svg {
    width: 18px;
    height: 18px;
    stroke: #333;
    stroke-width: 2.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Zoom button ─────────────────────────────────────────────────────────── */

.crispal-zoom-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(255,255,255,0.92);
    border: none;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.16);
    transition: background .15s, box-shadow .15s, transform .15s;
    padding: 0;
}

.crispal-zoom-btn:hover { background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.2); transform: translateY(-1px); }
.crispal-zoom-btn.hidden { display: none; }


.crispal-zoom-btn svg {
    width: 16px;
    height: 16px;
    stroke: #1a1a1a;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Thumbnails ──────────────────────────────────────────────────────────── */

.crispal-thumbs {
    overflow: hidden;
    padding-bottom: 2px;
    position: relative;
}

.crispal-thumbs-track {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.crispal-thumb {
    flex: 0 0 calc((100% - 32px) / 5);
    width: calc((100% - 32px) / 5);
    min-width: calc((100% - 32px) / 5);
    aspect-ratio: 3 / 4 !important;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, opacity 0.2s;
    position: relative;
    background: #f0f0f0;
}

.crispal-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.crispal-thumb.active {
    border-color: #333;
}

.crispal-thumb:hover:not(.active) {
    border-color: #999;
}

/* ── Video thumbnail ─────────────────────────────────────────────────────── */

.crispal-thumb-video img {
    opacity: 0.65;
}

.crispal-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 34px;
    height: 34px;
    pointer-events: none;
}

.crispal-play-icon svg {
    width: 100%;
    height: 100%;
}

/* ── Loading state ───────────────────────────────────────────────────────── */

.crispal-gallery.loading .crispal-main-slider::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    z-index: 20;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {

    /* Show 4 thumbs on mobile instead of 5 */
    .crispal-thumb {
        flex: 0 0 calc((100% - 24px) / 4);
        width: calc((100% - 24px) / 4);
    }
}
