/* ──────────────────────────────────────
   Alanews Shorts — Homepage Carousel
   Stile ispirato a CNN Shorts
   ────────────────────────────────────── */

.ans-shorts-carousel {
    /* --ans-card-width and --ans-gap are injected by ANS_Carousel_Config::render_inline_css() */
    --ans-card-ratio: 9 / 16;
    --ans-radius: 16px;

    margin: 24px 0;
    position: relative;
}

/* Header */
.ans-shorts-carousel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.ans-shorts-carousel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    text-transform: none;
}

.ans-shorts-carousel__title svg {
    flex-shrink: 0;
    color: #e53e3e;
}

.ans-shorts-carousel__more {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
    white-space: nowrap;
}

.ans-shorts-carousel__more:hover {
    text-decoration: underline;
}

/* Viewport — wrapper per track + frecce */
.ans-shorts-carousel__viewport {
    position: relative;
    overflow: hidden;
}

/* Arrow buttons */
.ans-shorts-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-60%);
    z-index: 10;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
    opacity: 1;
}

.ans-shorts-carousel__arrow:hover {
    background: rgba(0, 0, 0, 1);
    transform: translateY(-60%) scale(1.08);
}

.ans-shorts-carousel__arrow.is-hidden {
    opacity: 0;
    pointer-events: none;
}

.ans-shorts-carousel__arrow--left {
    left: 8px;
}

.ans-shorts-carousel__arrow--right {
    right: 8px;
}

/* Track — scroll orizzontale con snap */
.ans-shorts-carousel__track {
    display: flex;
    gap: var(--ans-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 4px 8px;
}

.ans-shorts-carousel__track::-webkit-scrollbar {
    display: none;
}

/* Card — stile CNN: solo poster, titolo sovrapposto */
.ans-shorts-card {
    flex: 0 0 var(--ans-card-width);
    scroll-snap-align: start;
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: var(--ans-radius);
    overflow: hidden;
    background: #000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.ans-shorts-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Play icon overlay on hover */
.ans-shorts-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    width: 56px;
    height: 56px;
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    /* Play triangle via clip-path + inner pseudo won't work, use background SVG */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpolygon points='9.5 7 9.5 17 17 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 28px 28px;
    pointer-events: none;
}

.ans-shorts-card:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Poster — occupa tutta la card */
.ans-shorts-card__poster {
    position: relative;
    aspect-ratio: var(--ans-card-ratio);
    overflow: hidden;
    background: #111;
}

.ans-shorts-card__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Gradient overlay per leggibilità testo */
.ans-shorts-card__poster::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    pointer-events: none;
}

/* Duration badge con icona orologio — sopra il gradient */
.ans-shorts-card__duration {
    position: absolute;
    bottom: 10px;
    left: 16px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Icona orologio via CSS (inline SVG nel PHP, fallback cerchio) */
.ans-shorts-card__duration svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.9;
}

/* Section badge */
.ans-shorts-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e53e3e;
    color: #fff;
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    line-height: 1;
    white-space: nowrap;
}

/* Titolo sovrapposto al poster (stile CNN) */
.ans-shorts-card__meta {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 0 10px;
}

.ans-shorts-card__title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.7);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Theme font alignment ─── */

.ans-shorts-card__duration,
.ans-shorts-card__badge {
    font-family: 'Source Sans 3', system-ui, sans-serif;
}

/* ─── Responsive ─── */

@media (max-width: 480px) {
    .ans-shorts-carousel {
        --ans-radius: 12px;
        margin: 16px 0;
    }

    .ans-shorts-carousel__title {
        font-size: 15px;
    }

    .ans-shorts-card__title {
        font-size: 12px;
    }

    .ans-shorts-card__duration {
        font-size: 11px;
    }

    /* Nascondi frecce su mobile — si usa swipe */
    .ans-shorts-carousel__arrow {
        display: none !important;
    }
}

/* card-width e gap ora iniettati inline da ANS_Carousel_Config */

/* large desktop card-width ora gestito da config inline */
