/*
 * YT Live & VOD per Eventi: blocco "Live Streaming" della pagina evento.
 * Solo valori del tema padelfip, verificati sulla pagina evento il 27/10/2026:
 * - colori: --blue-fip, --blue-header, --azure-fip, --red-youtube; testo #404040 (body, style.min.css); bordi #e6e6e6
 *   (.category__slide, .item__news); le trasparenze sono questi stessi colori, nessuna tinta nuova
 * - intestazioni come .overview__mainTitle (Bebas Neue 40px maiuscolo #17253f) e .overview__title (24px)
 * - titoli delle schede nel font del body (stack di sistema di style.css), scelta dell'utente: come le dirette
 * Dirette su fascia scura, programmate e replay su chiaro, come la pagina.
 */
.bw-yt {
    --bw-ink: var(--blue-fip, #1d3056);
    --bw-night: var(--blue-header, #17253f);
    --bw-azure: var(--azure-fip, #29aae1);
    --bw-red: var(--red-youtube, #b30000);
    --bw-muted: #404040;
    --bw-line: #e6e6e6;
    --bw-gap: 16px;
    --bw-ease: cubic-bezier(.16, 1, .3, 1);
    display: grid;
    gap: 48px;
    max-width: 1140px;
    margin: 0 auto;
    color: var(--bw-ink);
}

.bw-yt ::selection { background: var(--bw-azure); color: #fff; }

/* ---------- gruppi ---------- */
.bw-yt-group { min-width: 0; }

.bw-yt-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 20px;
    font-family: "Bebas Neue", sans-serif; /* come .overview__mainTitle; "Bebas Neue Pro" non è caricato sulla pagina */
    font-size: 40px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    color: var(--bw-night);
}
.bw-yt-group--live .bw-yt-heading { color: #fff; }

/* le cifre del Bebas stanno fuori centro nel cerchio: il numero usa il font del body (style.css) */
.bw-yt-count {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: 999px;
    background: var(--bw-ink);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}
.bw-yt-next__title .bw-yt-count { min-width: 24px; height: 24px; padding: 0 7px; font-size: 12px; }

/* dirette: una fascia scura sola, non schede scure isolate */
.bw-yt-group--live {
    padding: 28px 28px 32px;
    background: var(--bw-night);
    color: #fff;
}
.bw-yt-group--live .bw-yt-count { background: var(--bw-red); }

.bw-yt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
    gap: var(--bw-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}
.bw-yt-group--live .bw-yt-grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }

.bw-yt .bw-yt-item { margin: 0; padding: 0; min-width: 0; }
.bw-yt .bw-yt-item::before, .bw-yt .bw-yt-item::marker { content: none; }

.bw-yt-day + .bw-yt-day { margin-top: 32px; }
.bw-yt-day__title {
    margin: 0 0 12px;
    font-family: "Bebas Neue", sans-serif; /* come .overview__title */
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    color: var(--bw-night);
}

/* ---------- scheda ---------- */
.bw-yt-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--bw-line);
    color: inherit;
    font-family: inherit;
    font-weight: inherit;
    text-decoration: none;
    transition: border-color .25s var(--bw-ease), box-shadow .35s var(--bw-ease), transform .35s var(--bw-ease);
}
.bw-yt-card:hover {
    border-color: var(--bw-azure);
    box-shadow: 0 14px 28px -18px rgba(23, 37, 63, .55);
    transform: translateY(-2px);
    color: inherit;
}
.bw-yt-card:focus { outline: none; }
.bw-yt-card:focus-visible { outline: 3px solid var(--bw-azure); outline-offset: 3px; }
.bw-yt-card[aria-current="true"] { border-color: var(--bw-azure); box-shadow: inset 0 0 0 1px var(--bw-azure); }

.bw-yt-group--live .bw-yt-card {
    background: rgba(255, 255, 255, .04);
    border-color: rgba(255, 255, 255, .14);
}
.bw-yt-group--live .bw-yt-card:hover { border-color: var(--bw-azure); box-shadow: 0 14px 28px -16px rgba(0, 0, 0, .7); }

.bw-yt-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bw-night);
}
.bw-yt-thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .6s var(--bw-ease);
}
.bw-yt-card:hover .bw-yt-thumb { transform: scale(1.04); }

.bw-yt-play {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(23, 37, 63, .82);
    color: #fff;
    transition: background-color .25s var(--bw-ease), transform .35s var(--bw-ease);
}
.bw-yt-play svg { width: 18px; height: 18px; fill: currentColor; margin-left: 2px; }
.bw-yt-card:hover .bw-yt-play { background: var(--bw-red); transform: scale(1.08); }

.bw-yt-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.bw-yt-badge--live { background: var(--bw-red); color: #fff; }

.bw-yt-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px 14px;
}
.bw-yt-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-wrap: balance;
}
.bw-yt-title img.emoji { margin: 0 .15em !important; vertical-align: -.12em !important; }

.bw-yt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--bw-muted);
}
.bw-yt-group--live .bw-yt-tags { color: rgba(255, 255, 255, .74); }
.bw-yt-sep { opacity: .6; }

/* ---------- palinsesto delle programmate, dentro la fascia scura ---------- */
.bw-yt-next {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .14);
}
.bw-yt-heading + .bw-yt-next { margin-top: 0; padding-top: 0; border-top: 0; } /* nessuna diretta: la fascia è solo palinsesto */
.bw-yt-next__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-family: "Bebas Neue", sans-serif; /* come .overview__title */
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
    text-transform: uppercase;
    color: #fff;
}
.bw-yt-next__title .bw-yt-count,
.bw-yt-group--soon .bw-yt-heading .bw-yt-count { background: #fff; color: var(--bw-night); } /* rosso solo per ciò che è in onda */

.bw-yt-schedule {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
    gap: 8px var(--bw-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}
.bw-yt .bw-yt-slot {
    display: grid;
    grid-template-columns: 7.5em minmax(0, 1fr) auto;
    grid-template-areas: "when name go" "when tags go";
    align-items: center;
    column-gap: 14px;
    row-gap: 3px;
    padding: 10px 12px;
}
.bw-yt-slot__when {
    grid-area: when;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, .14);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.bw-yt-slot__when [data-part="day"] { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: rgba(255, 255, 255, .74); }
.bw-yt-slot__when [data-part="hour"] { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }
.bw-yt-slot__when [data-part="tz"] { font-size: 11px; font-weight: 600; color: rgba(255, 255, 255, .74); }
.bw-yt-slot__name {
    grid-area: name;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}
.bw-yt-slot .bw-yt-tags { grid-area: tags; }
.bw-yt-slot__go {
    grid-area: go;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    color: #fff;
    transition: background-color .25s var(--bw-ease), border-color .25s var(--bw-ease);
}
.bw-yt-slot__go svg { width: 14px; height: 14px; fill: currentColor; margin-left: 2px; }
.bw-yt-slot:hover .bw-yt-slot__go { background: var(--bw-red); border-color: var(--bw-red); }

/* pallino delle dirette: il pulse del tema, in rosso nell'intestazione e in bianco nel badge */
.bw-yt-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: bw-yt-pulse 1.8s var(--bw-ease) infinite;
}
.bw-yt-heading .bw-yt-dot { width: 12px; height: 12px; color: var(--bw-red); background: var(--bw-red); }
@keyframes bw-yt-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 70%, transparent); }
    100% { box-shadow: 0 0 0 9px transparent; }
}

/* ---------- player (creato dal JS) ---------- */
.bw-yt-player {
    margin: 0 0 24px;
    scroll-margin-top: 170px; /* header del sito (90) + barra dei tab (60), entrambi sticky */
    animation: bw-yt-reveal .45s var(--bw-ease) both;
}
.bw-yt-player:focus { outline: none; }
.bw-yt-player__frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.bw-yt-player__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bw-yt-player__bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 12px 0 0;
}
.bw-yt-player__title { flex: 1 1 260px; min-width: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.bw-yt-player__link,
.bw-yt-player__close,
.bw-yt-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .06em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .2s var(--bw-ease), color .2s var(--bw-ease), border-color .2s var(--bw-ease);
}
.bw-yt-player__link:hover, .bw-yt-player__close:hover, .bw-yt-more:hover { background: var(--bw-ink); border-color: var(--bw-ink); color: #fff; }
.bw-yt-group--live .bw-yt-player__link:hover, .bw-yt-group--live .bw-yt-player__close:hover { background: #fff; border-color: #fff; color: var(--bw-night); }
.bw-yt-player__link:focus-visible, .bw-yt-player__close:focus-visible, .bw-yt-more:focus-visible { outline: 3px solid var(--bw-azure); outline-offset: 3px; }
@keyframes bw-yt-reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.bw-yt-more { margin-top: 24px; color: var(--bw-ink); }
.bw-yt-more[hidden], .bw-yt [hidden] { display: none !important; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
    .bw-yt { gap: 36px; }
    .bw-yt-group--live { padding: 20px 16px 24px; margin-inline: -16px; }
    .bw-yt-heading { margin-bottom: 14px; }

    /* dirette: una riga che scorre, la prossima scheda si intravede; il palinsesto resta una lista */
    .bw-yt-group--live .bw-yt-grid {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 78%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: 16px;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }
    .bw-yt-group--live .bw-yt-grid .bw-yt-item { scroll-snap-align: start; }
    .bw-yt .bw-yt-slot { grid-template-columns: 6.5em minmax(0, 1fr) auto; column-gap: 10px; padding: 10px; }
    .bw-yt-slot__when { padding-right: 10px; }

    /* replay: due colonne compatte */
    .bw-yt-group--replays .bw-yt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .bw-yt-group--replays .bw-yt-body { padding: 10px 10px 12px; }
    .bw-yt-group--replays .bw-yt-title { font-size: 14px; -webkit-line-clamp: 3; }
    .bw-yt-group--replays .bw-yt-tags { font-size: 11px; letter-spacing: .04em; }
    .bw-yt-group--replays .bw-yt-play { width: 32px; height: 32px; right: 8px; bottom: 8px; }
    .bw-yt-player__title { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    .bw-yt-dot, .bw-yt-player { animation: none; }
    .bw-yt-card, .bw-yt-thumb, .bw-yt-play { transition: none; }
    .bw-yt-card:hover, .bw-yt-card:hover .bw-yt-thumb, .bw-yt-card:hover .bw-yt-play { transform: none; }
}
