/* Feed Carousel — progressive enhancement of the core ShowFiles mosaic.
 *
 * Core styles the mosaic with high-specificity rules (including
 * `body.device-mobile #wallStream .post-files img`), so the overrides that
 * fight those need !important. Everything else stays plain.
 */

/* Core turns .post-files into a horizontal strip on mobile; the carousel does
 * its own scrolling, so neutralise the wrapper. */
.post-files.fc-has-carousel {
    display: block !important;
    overflow: visible !important;
}

.fc-carousel {
    position: relative;
    margin: 10px 0;
    --fc-ratio: 1 / 1;
}

.fc-carousel__viewport {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    aspect-ratio: var(--fc-ratio);
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    border-radius: 8px;
    background-color: #000;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.fc-carousel__viewport::-webkit-scrollbar {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .fc-carousel__viewport {
        scroll-behavior: auto;
    }
}

.fc-carousel__slide {
    position: relative;
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    overflow: hidden;
    padding: 0 !important;
}

.fc-carousel__backdrop {
    position: absolute;
    inset: 0;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(24px) brightness(0.55);
    transform: scale(1.2);
}

.fc-carousel__slide > a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Beats `.post-files img` and the device-mobile wallStream rules. */
.fc-carousel__slide img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    border-radius: 0 !important;
}

/* Navigation */
.fc-carousel__nav {
    position: absolute;
    top: calc(50% - 18px);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #262626;
    background-color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;
}

.fc-carousel__nav--prev {
    left: 8px;
}

.fc-carousel__nav--next {
    right: 8px;
}

.fc-carousel__nav[disabled] {
    display: none;
}

/* Touch devices swipe instead; arrows only make sense for a mouse. */
@media (hover: hover) and (pointer: fine) {
    .fc-carousel:hover .fc-carousel__nav,
    .fc-carousel__nav:focus-visible {
        opacity: 1;
    }
}

.fc-carousel__counter {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: none;
}

.fc-carousel__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}

.fc-carousel__dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--bs-secondary, #a8a8a8);
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.fc-carousel__dot.is-active {
    background-color: var(--bs-accent, #0d6efd);
    opacity: 1;
}
