/**
 * Instagram-style side-scrolling row of clickable images. Design language
 * (peek sizing, scroll-snap, Reels/TikTok-style 9:16 card ratio on mobile
 * easing to a bigger near-square 4:5 + autoplay/arrows on desktop, didora
 * brand colors) mirrors the video-carousel plugin's frontend, but this
 * file is an independent copy — no shared file or class name between the
 * two plugins.
 */
.ic-carousel-wrapper {
    width: 100%;
    overflow: hidden;
}

.ic-carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 4px 16px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.ic-carousel-track::-webkit-scrollbar {
    height: 6px;
}

.ic-carousel-track::-webkit-scrollbar-thumb {
    background-color: var(--primary-color, #a0704a);
    border-radius: 3px;
    opacity: 0.5;
}

/* Card width is a % of the track's own width at every breakpoint, tuned
   (same values validated for video-carousel) so the *next* card always
   peeks in at the right edge. */
.ic-card {
    position: relative;
    display: block;
    flex: 0 0 auto;
    width: clamp(230px, 80%, 320px);
    scroll-snap-align: start;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
}

/* ~2 cards + a peek of the 3rd (large phones / small tablets). */
@media (min-width: 576px) {
    .ic-card {
        width: clamp(220px, 46%, 320px);
    }
}

/* Desktop (>768px): bigger cards, ~3-4 fit on screen + a peek of the next
   one. This breakpoint is also where autoplay + arrows (see
   image-carousel.js) engage — kept at exactly 769px so CSS and JS agree
   on what "desktop" means here. */
@media (min-width: 769px) {
    .ic-card {
        width: clamp(230px, 25%, 320px);
    }
}

.ic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.ic-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #1a1a1a;
    overflow: hidden;
}

/* Full 9/16 at desktop card widths reads as too narrow/tall a shelf — ease
   to a near-square 4/5 (+ a hard cap) so no single card dominates the
   viewport, and the row reads like Amerce's category block instead of a
   Reels strip. Placed after the base .ic-thumb-wrap rule above (same
   specificity — source order decides the winner, media query or not) so
   it actually overrides it at this breakpoint instead of silently losing
   the cascade tie. */
@media (min-width: 769px) {
    .ic-thumb-wrap {
        aspect-ratio: 4 / 5;
        max-height: 480px;
    }
}

/* Desktop-only: relative positioning anchor for the prev/next arrows
   below — scoped to this same breakpoint so mobile's wrapper is
   completely untouched (no positioning context change there at all). */
@media (min-width: 769px) {
    .ic-carousel-wrapper {
        position: relative;
    }
}

/* Prev/next arrows — hidden by default (mobile/tablet, ≤768px): this
   carousel stays swipe-only there, exactly as before. JS
   (image-carousel.js) only ever wires these up when the same >768px
   media query matches, so this display:none is belt-and-braces, not the
   only thing preventing them from doing anything on mobile. */
.ic-carousel-arrow {
    display: none;
}

@media (min-width: 769px) {
    .ic-carousel-arrow {
        display: flex;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
        cursor: pointer;
        padding: 0;
        transition: background 0.15s ease, transform 0.15s ease;
    }

    .ic-carousel-arrow:hover {
        background: #fff;
        transform: translateY(-50%) scale(1.06);
    }

    .ic-carousel-arrow svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: var(--primary-color, #a0704a);
        stroke-width: 2.4;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .ic-carousel-arrow-prev {
        left: 8px;
    }

    .ic-carousel-arrow-next {
        right: 8px;
    }
}

.ic-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ic-eye-btn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: opacity 0.25s ease, transform 0.15s ease, background 0.15s ease;
    pointer-events: none;
}

.ic-eye-btn svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary-color, #a0704a);
    fill: none;
}

.ic-card:hover .ic-eye-btn {
    transform: scale(1.08);
    background: #fff;
}

/* Real-hover devices (desktop/trackpad): eye icon hidden until the card is
   hovered, fading in smoothly — touch devices (no hover) are untouched by
   this query, so the icon stays always-visible there (hard to "discover"
   hover state by touch). */
@media (hover: hover) {
    .ic-eye-btn {
        opacity: 0;
    }

    .ic-card:hover .ic-eye-btn {
        opacity: 1;
    }
}

.ic-card-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px 10px 8px;
    font-size: 0.75rem;
    line-height: 1.25;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

/* ── "Image not available" fallback (missing/deleted upload, or broken
   at runtime — e.g. media library entry removed after the card was
   built). Didora brand gradient instead of a plain grey box, so a
   missing image still reads as intentional rather than "broken site". ── */
.ic-broken-state {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    background: linear-gradient(160deg, var(--primary-color, #a0704a) 0%, var(--secondary-color, #c9a96e) 100%);
}

.ic-card-broken {
    cursor: default;
}

.ic-card-broken .ic-eye-btn {
    display: none;
}
