/* =============================================================
   Lilya Product Gallery — Frontend Styles
   ============================================================= */

/* ── Reset / Container ───────────────────────────────────────── */
.lilya-gallery {
    --lilya-accent:    #c0a48a;
    --lilya-arrow-bg:  rgba(255,255,255,0.92);
    --lilya-arrow-sz:  44px;
    --lilya-thumb-w:   88px;
    --lilya-thumb-h:   88px;
    --lilya-gap:       8px;
    --lilya-radius:    6px;

    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    font-family: inherit;
    direction: ltr;
}

/* ── Slider Wrap ─────────────────────────────────────────────── */
.lilya-slider-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: var(--lilya-radius);
    background: #f5f3f0;
    /* No fixed aspect-ratio — height driven by active image */
}

/* ── Slides Container ────────────────────────────────────────── */
.lilya-slides-container {
    display: flex;
    width: 100%;
    transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    align-items: flex-start;
}

/* ── Single Slide ────────────────────────────────────────────── */
.lilya-slide {
    min-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ── Main Image ──────────────────────────────────────────────── */
.lilya-zoom-link {
    display: block;
    width: 100%;
    line-height: 0;
}

.lilya-main-image {
    width: 100%;
    height: auto;           /* natural height — no cropping */
    display: block;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.lilya-main-image:hover {
    transform: scale(1.02);
}

/* ── Video Wrap ──────────────────────────────────────────────── */
.lilya-video-wrap {
    width: 100%;
    background: #000;
    line-height: 0;
}

.lilya-video-wrap video {
    width: 100%;
    height: auto;
    display: block;
    min-height: 280px;
}

.lilya-iframe-wrap {
    position: relative;
    padding-top: 56.25%; /* 16:9 for YouTube/Vimeo */
}

.lilya-iframe-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ── Arrows ──────────────────────────────────────────────────── */
.lilya-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: var(--lilya-arrow-sz);
    height: var(--lilya-arrow-sz);
    border-radius: 50%;
    border: none;
    background: var(--lilya-arrow-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
    padding: 0;
    opacity: 0.85;
}

.lilya-arrow:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.22);
    opacity: 1;
}

.lilya-arrow:disabled {
    opacity: 0.3;
    cursor: default;
}

.lilya-arrow svg {
    width: 20px;
    height: 20px;
    stroke: #333;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

.lilya-arrow-prev { left: 12px; }
.lilya-arrow-next { right: 12px; }

/* ── Counter ─────────────────────────────────────────────────── */
.lilya-counter {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.45);
    color: #fff;
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Thumbnails Wrap ─────────────────────────────────────────── */
.lilya-thumbs-wrap {
    margin-top: var(--lilya-gap);
    width: 100%;
    overflow: hidden;
}

.lilya-thumbs {
    display: flex;
    gap: var(--lilya-gap);
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
}

.lilya-thumbs::-webkit-scrollbar { display: none; }

/* ── Single Thumb ────────────────────────────────────────────── */
.lilya-thumb {
    flex: 0 0 var(--lilya-thumb-w);
    width: var(--lilya-thumb-w);
    height: var(--lilya-thumb-h);
    border-radius: calc( var(--lilya-radius) - 2px );
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.15s;
    background: #f0eeeb;
}

.lilya-thumb:hover {
    transform: translateY(-2px);
    border-color: var(--lilya-accent);
}

.lilya-thumb.is-active {
    border-color: var(--lilya-accent);
    box-shadow: 0 0 0 1px var(--lilya-accent);
}

.lilya-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.lilya-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: #e8e5e0;
}

/* ── Video Play Overlay on Thumb ─────────────────────────────── */
.lilya-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.32);
    transition: background 0.2s;
}

.lilya-thumb:hover .lilya-thumb-play {
    background: rgba(0,0,0,0.48);
}

.lilya-thumb-play svg {
    width: 22px;
    height: 22px;
    fill: #fff;
    stroke: none;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

/* =============================================================
   Responsive
   ============================================================= */

@media (max-width: 1024px) {
    .lilya-gallery {
        --lilya-thumb-w: 76px;
        --lilya-thumb-h: 76px;
    }
}

@media (max-width: 768px) {
    .lilya-gallery {
        --lilya-thumb-w: 62px;
        --lilya-thumb-h: 62px;
        --lilya-arrow-sz: 36px;
        --lilya-gap: 6px;
        max-width: 100%;
    }

    .lilya-slider-wrap {
        border-radius: 0;
        /* Full width on mobile, height follows image naturally */
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
    }

    .lilya-thumbs-wrap {
        padding: 0 0px;
    }

    .lilya-arrow svg {
        width: 16px;
        height: 16px;
    }

    .lilya-arrow-prev { left: 8px; }
    .lilya-arrow-next { right: 8px; }
}

@media (max-width: 480px) {
    .lilya-gallery {
        --lilya-thumb-w: 56px;
        --lilya-thumb-h: 56px;
    }

    .lilya-slider-wrap {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
    }
}
