/**
 * Event Carousel Component
 *
 * Migrated from: timelapse-carrossel-de-eventos-swiper v2.5 code snippet.
 * Swiper-based horizontal carousel with header and responsive breakpoints.
 *
 * @package Timelapse
 * @since 1.0.0
 */

/* ── Wrapper ── */
.tl-carousel {
    font-family: var(--tl-font-primary);
    margin-bottom: 30px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.tl-carousel.tl-is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Header ── */
.tl-carousel__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: var(--tl-space-lg);
    padding: 0 var(--tl-space-xs);
}

.tl-carousel__heading {
    margin: 0;
    padding: 0;
    line-height: 1;
}

.tl-carousel__title {
    font-family: var(--tl-font-primary);
    font-size: 2rem;
    font-weight: var(--tl-weight-extrabold);
    color: var(--tl-white);
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
    letter-spacing: var(--tl-tracking-tight);
    transition: color var(--tl-duration-normal) ease;
}

.tl-carousel__title:hover {
    color: var(--tl-gray-400);
}

/* ── "Ver Todos" Link ── */
.tl-carousel__link-all {
    font-family: var(--tl-font-primary);
    font-size: var(--tl-text-xs);
    font-weight: var(--tl-weight-medium);
    color: var(--tl-white);
    text-transform: uppercase;
    text-decoration: none;
    transition: opacity var(--tl-duration-normal) ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tl-carousel__link-all:hover {
    opacity: 0.7;
}

/* ── Animated Arrow ── */
.tl-carousel__arrow-anim {
    display: inline-flex;
    align-items: center;
    height: auto;
    line-height: 1;
}

.tl-carousel__arrow-anim span {
    display: inline-block;
    opacity: 0;
    font-family: var(--tl-font-primary);
    font-weight: var(--tl-weight-medium);
    font-size: 1.6em;
    position: relative;
    margin-left: 2px;
    transform: translateY(-2px);
    animation: tl-carousel-chevron 1.5s infinite;
}

.tl-carousel__arrow-anim span:nth-child(1) { animation-delay: 0s; }
.tl-carousel__arrow-anim span:nth-child(2) { animation-delay: 0.15s; }
.tl-carousel__arrow-anim span:nth-child(3) { animation-delay: 0.3s; }

@keyframes tl-carousel-chevron {
    0%  { opacity: 0; }
    30% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Skeleton Loader ── */
.tl-carousel__loader {
    display: flex;
    gap: var(--tl-space-md);
    width: 100%;
    overflow: hidden;
}

.tl-carousel__skeleton {
    min-width: 30%;
    height: 0;
    padding-top: 40%;
    background: linear-gradient(90deg, var(--tl-gray-900) 25%, var(--tl-surface) 50%, var(--tl-gray-900) 75%);
    background-size: 200% 100%;
    animation: tl-carousel-loading 1.5s infinite;
    border-radius: var(--tl-radius-lg);
}

@keyframes tl-carousel-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Swiper Container ── */
.tl-carousel__swiper {
    width: 100%;
    padding-bottom: 40px;
    overflow: visible;
}

.tl-carousel__swiper--hidden {
    opacity: 0;
}

.tl-carousel__swiper--visible {
    animation: tl-carousel-fadein 0.5s forwards;
}

@keyframes tl-carousel-fadein {
    to { opacity: 1; }
}

/* ── Swiper Nav / Pagination ── */
.tl-carousel__swiper .swiper-button-next,
.tl-carousel__swiper .swiper-button-prev {
    color: var(--tl-white);
    width: 44px;
    height: 44px;
    background: var(--tl-hover-bg-strong);
    border: 1px solid var(--tl-glass-border);
    border-radius: var(--tl-radius-circle);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: var(--tl-transition-default);
}

.tl-carousel__swiper .swiper-button-next:hover,
.tl-carousel__swiper .swiper-button-prev:hover {
    background: var(--tl-white);
    color: var(--tl-black);
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    border-color: var(--tl-white);
}

.tl-carousel__swiper .swiper-button-next::after,
.tl-carousel__swiper .swiper-button-prev::after {
    font-size: 18px;
    font-weight: bold;
}

.tl-carousel__swiper .swiper-pagination-bullet {
    background: var(--tl-white);
    opacity: 0.3;
    width: 6px;
    height: 6px;
    transition: var(--tl-transition-default);
}

.tl-carousel__swiper .swiper-pagination-bullet-active {
    background: var(--tl-white);
    opacity: 1;
    width: 20px;
    border-radius: 10px;
}

/* Ensure card fills slide */
.tl-carousel__swiper .swiper-slide .tl-evt-card {
    max-width: 100%;
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .tl-carousel {
        margin-bottom: 25px;
    }

    .tl-carousel__header {
        margin-bottom: 10px;
        align-items: center;
    }

    .tl-carousel__title {
        font-size: 1.1rem;
        letter-spacing: var(--tl-tracking-wide);
    }

    .tl-carousel__link-all {
        font-size: 0.7rem;
    }

    .tl-carousel__swiper .swiper-button-next,
    .tl-carousel__swiper .swiper-button-prev {
        display: none;
    }

    .tl-carousel__skeleton {
        min-width: 30%;
        padding-top: 40%;
    }

    .tl-carousel__skeleton--desktop {
        display: block;
    }

    .tl-carousel__swiper {
        padding-bottom: 30px;
    }
}
