/* ============================================
   YI CAROUSEL — Frontend Styles
   ============================================ */

/* ── Section container ───────────────────────────────── */
.yi-carousel-section {
    position: relative;
    width: 100%;
    height: 62vh;
    min-height: 340px;
    max-height: 740px;
    overflow: hidden;
    background: #111;
    outline: none;
    /* Prevent text selection on swipe */
    user-select: none;
    -webkit-user-select: none;
}

/* ── Track wrapper ───────────────────────────────────── */
.yi-carousel-track-wrapper {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* ── Track (flex row for slide effect) ──────────────── */
.yi-carousel-track {
    display: flex;
    height: 100%;
    will-change: transform;
    transition: transform 0.65s cubic-bezier(0.77, 0, 0.175, 1);
}

/* ── Individual slide ────────────────────────────────── */
.yi-slide {
    min-width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* ── Slide inner (isolates overflow for zoom) ────────── */
.yi-slide-inner {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

/* ── Image with zoom-on-hover ────────────────────────── */
.yi-slide-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.75s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Zoom effect — active slide only, so we don't zoom hidden slides */
.yi-slide.is-active .yi-slide-inner:hover .yi-slide-image {
    transform: scale(1.07);
}

/* Subtle dark overlay on hover for dramatic effect */
.yi-slide-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background 0.5s ease;
    pointer-events: none;
    z-index: 1;
}

.yi-slide.is-active .yi-slide-inner:hover::after {
    background: rgba(0, 0, 0, 0.08);
}

/* ── Caption ─────────────────────────────────────────── */
.yi-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.75rem 2.5rem 3.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.58));
    color: #fff;
    font-family: var(--font-heading, 'Bodoni Moda', serif);
    font-size: clamp(1rem, 2.5vw, 1.6rem);
    font-weight: 500;
    letter-spacing: 0.03em;
    line-height: 1.3;
    z-index: 2;
    transition: opacity 0.35s ease;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ══════════════════════════════════════════
   FADE EFFECT OVERRIDES
   ══════════════════════════════════════════ */
.yi-carousel-section[data-effect="fade"] .yi-carousel-track {
    display: block;
    width: 100%;
    height: 100%;
    position: relative;
    transform: none !important;
    transition: none;
}

.yi-carousel-section[data-effect="fade"] .yi-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-width: auto;
    opacity: 0;
    transition: opacity 0.85s ease;
    z-index: 1;
    pointer-events: none;
}

.yi-carousel-section[data-effect="fade"] .yi-slide.is-active {
    opacity: 1;
    z-index: 2;
    pointer-events: auto;
}

/* ══════════════════════════════════════════
   NAVIGATION ARROWS
   ══════════════════════════════════════════ */
.yi-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.25s ease,
        transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.25s ease;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.yi-carousel-arrow:hover {
    background: rgba(140, 60, 33, 0.8);
    border-color: rgba(140, 60, 33, 0.6);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 24px rgba(140, 60, 33, 0.4);
}

.yi-carousel-arrow:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.65);
}

.yi-carousel-arrow:active {
    transform: translateY(-50%) scale(0.96);
}

.yi-carousel-arrow svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
    flex-shrink: 0;
}

.yi-carousel-prev { left: 1.5rem; }
.yi-carousel-next { right: 1.5rem; }

/* ══════════════════════════════════════════
   DOT INDICATORS
   ══════════════════════════════════════════ */
.yi-carousel-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.yi-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition:
        width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.25s ease,
        border-color 0.25s ease,
        border-radius 0.35s ease;
    outline: none;
}

.yi-dot:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.9);
}

.yi-dot.is-active {
    width: 26px;
    border-radius: 4px;
    background: #fff;
    border-color: #fff;
}

.yi-dot:focus-visible {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6);
}

/* ══════════════════════════════════════════
   PROGRESS BAR (autoplay)
   ══════════════════════════════════════════ */
.yi-carousel-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.18);
    z-index: 11;
    overflow: hidden;
}

.yi-carousel-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--orange-gris-pastel, #8C3C21);
    transition: none;
}

/* ══════════════════════════════════════════
   ADMIN NOTICE (logged-in editors only)
   ══════════════════════════════════════════ */
.yi-carousel-notice {
    padding: 1.5rem 2rem;
    background: #fdf8f6;
    border-left: 4px solid #8C3C21;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.yi-carousel-notice p {
    margin: 0;
    font-size: 0.95rem;
    color: #555;
}

.yi-carousel-notice a {
    color: #8C3C21;
    font-weight: 600;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 1024px) {
    .yi-carousel-section {
        height: 55vw;
        min-height: 280px;
        max-height: 520px;
    }
}

@media (max-width: 768px) {
    .yi-carousel-section {
        height: 56vw;
        min-height: 240px;
        max-height: 400px;
    }

    .yi-carousel-arrow {
        width: 40px;
        height: 40px;
    }

    .yi-carousel-arrow svg {
        width: 18px;
        height: 18px;
    }

    .yi-carousel-prev { left: 0.75rem; }
    .yi-carousel-next { right: 0.75rem; }

    .yi-slide-caption {
        padding: 1rem 1.25rem 3rem;
    }
}

@media (max-width: 480px) {
    .yi-carousel-section {
        height: 60vw;
        min-height: 200px;
    }

    /* Hide arrows on very small screens — swipe only */
    .yi-carousel-arrow {
        display: none;
    }

    .yi-carousel-dots {
        bottom: 1rem;
    }
}

/* ══════════════════════════════════════════
   DARK MODE COMPATIBILITY
   ══════════════════════════════════════════ */
[data-theme="dark"] .yi-carousel-section {
    background: #0a0a0a;
}

[data-theme="dark"] .yi-carousel-progress-bar {
    background: var(--orange-gris-pastel, #CC9A89);
}
