/* BeatLatin Home — Nuevos Remix destacados (grid Apple Music) */

.bl-home-featured {
    position: relative;
    overflow: visible;
}

.bl-home-featured__title-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* Apple --title-2-emphasized 700 17px */
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2941;
    letter-spacing: -0.01em;
    color: var(--bl-system-primary, var(--bl-heading, #fff));
    text-decoration: none;
}

.bl-home-featured__title-link:hover {
    color: var(--bl-system-primary, var(--bl-heading, #fff));
    opacity: 0.92;
}

.bl-home-featured__title-link .fa-chevron-right {
    font-size: 0.72em;
    opacity: 0.75;
}

/* Título con chevron decorativo (sin enlace) — Lo más descargado */
.bl-home-featured__title-static {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2941;
    letter-spacing: -0.01em;
    color: inherit;
    cursor: default;
}

.bl-home-featured__title-static .fa-chevron-right {
    font-size: 0.72em;
    opacity: 0.75;
}

.bl-home-featured__title {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2941;
    color: var(--bl-system-primary, var(--bl-heading, #fff));
}

/* Shelf — carrusel estilo Apple Music (flecha pill glass en hover) */
.bl-home-featured__shelf {
    position: relative;
    overflow: visible;
}

.bl-home-featured__shelf-arrow {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 52px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 1000px;
    cursor: pointer;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    color: var(--bl-muted-soft, rgba(245, 245, 247, 0.55));
    background-color: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(24px) saturate(185%);
    -webkit-backdrop-filter: blur(24px) saturate(185%);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.14),
        0 4px 14px rgba(0, 0, 0, 0.22);
    transition:
        background-color 0.25s linear,
        color 0.25s linear,
        opacity 0.25s linear;
    -webkit-appearance: none;
    appearance: none;
}

/*
 * El atributo HTML "hidden" (estado inicial servidor: flecha izquierda
 * oculta por defecto) tiene la MISMA especificidad que la regla de
 * arriba (display:flex) — al cargar después en el cascade, la gana y
 * anula el "hidden" hasta que el JS agrega "is-at-start" (mountShelf).
 * Con [hidden] subimos la especificidad para que gane siempre, desde
 * el primer paint, sin depender de que el JS ya haya corrido.
 */
.bl-home-featured__shelf-arrow[hidden] {
    display: none !important;
}

.bl-home-featured__shelf-arrow svg,
.bl-home-featured__shelf-arrow-icon {
    width: 8.5px;
    height: 30.5px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Path Apple apunta < ; derecha = espejo → > */
.bl-home-featured__shelf-arrow-icon--right {
    transform: scaleX(-1);
}

/*
 * Flechas: borde de la última columna ENTERA (no del peek).
 * Apple “canciones nuevas”: 3 cols + peek → right = gap + peek.
 * La pill sobresale 10px del borde sin perder su anclaje.
 */
.bl-home-featured__shelf-arrow--left {
    left: 0;
    right: auto;
    translate: -10px -50%;
}

.bl-home-featured__shelf-arrow--right {
    /* 3.04 slots: peek 0.04 (igual Novedades) + 1 gap (28px) tras la 3ª col */
    right: calc(28px + (100% - 84px) / 3.04 * 0.04);
    left: auto;
    translate: 10px -50%;
}

.bl-home-featured__shelf-arrow:hover {
    color: var(--bl-heading, #fff);
    background-color: rgba(255, 255, 255, 0.16);
}

.bl-home-featured__shelf-arrow:focus-visible {
    opacity: 1;
    pointer-events: auto;
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 2px;
}

[data-theme="light"] .bl-home-featured__shelf-arrow:focus-visible {
    outline-color: rgba(0, 0, 0, 0.28);
}

/* Hover en el shelf → flechas visibles (sin necesidad de reproducir) */
.bl-home-featured.is-shelf-hover .bl-home-featured__shelf-arrow:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
}

.bl-home-featured.is-at-start .bl-home-featured__shelf-arrow--left {
    display: none !important;
}

.bl-home-featured.is-at-end .bl-home-featured__shelf-arrow--right {
    display: none !important;
}

[data-theme="light"] .bl-home-featured__shelf-arrow {
    color: rgba(29, 29, 31, 0.48);
    background-color: rgba(255, 255, 255, 0.78);
    box-shadow:
        inset 0 0 0 0.5px rgba(0, 0, 0, 0.07),
        0 4px 14px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .bl-home-featured__shelf-arrow:hover {
    color: rgba(29, 29, 31, 0.92);
    background-color: rgba(255, 255, 255, 0.92);
}

.bl-home-featured__viewport {
    overflow: hidden;
    width: 100%;
}

/*
 * Bleed Apple Music (desktop): el viewport se extiende hasta los bordes
 * del navegador. CRÍTICO con border-box: hay que COMPENSAR el padding
 * en el width; si no, las columnas se calculan sobre un área más estrecha
 * y queda un hueco muerto a la derecha (bug 1920×1080).
 */
@media (min-width: 1025px) {
    .bl-home-featured__viewport {
        box-sizing: border-box;
        width: calc(100% + var(--bl-bleed-left, 256px) + var(--bl-bleed-right, 12px));
        max-width: none;
        margin-left: calc(-1 * var(--bl-bleed-left, 256px));
        margin-right: calc(-1 * var(--bl-bleed-right, 12px));
        padding-left: var(--bl-bleed-left, 256px);
        padding-right: var(--bl-bleed-right, 12px);
    }
}

.bl-home-featured__track {
    display: flex;
    flex-wrap: nowrap;
    gap: 28px;
    transition: transform 0.38s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}

/*
 * Peek sin calc(var + var): WP Rocket minify elimina espacios
 * alrededor de +/− y el calc queda inválido.
 * Desktop: 3 columnas + peek corto (~4%, igual Novedades) → / 3.04
 * 3 gaps × 28 = 84
 */
.bl-home-featured__col {
    flex: 0 0 calc((100% - 84px) / var(--bl-shelf-slots-featured, 3.04));
    width: calc((100% - 84px) / var(--bl-shelf-slots-featured, 3.04));
    max-width: calc((100% - 84px) / var(--bl-shelf-slots-featured, 3.04));
    min-width: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

@media (min-width: 2560px) {
    :root {
        --bl-shelf-slots-featured: 4.04;
    }

    .bl-home-featured__col {
        flex: 0 0 calc((100% - 112px) / var(--bl-shelf-slots-featured, 4.04));
        width: calc((100% - 112px) / var(--bl-shelf-slots-featured, 4.04));
        max-width: calc((100% - 112px) / var(--bl-shelf-slots-featured, 4.04));
    }

    .bl-home-featured__shelf-arrow--right {
        right: calc(28px + (100% - 112px) / 4.04 * 0.04);
    }
}

/* Fila estilo Apple Music track-lockup */
.bl-home-featured-item {
    /* Igual que mixes: 40px, radio 6px */
    --bl-art-size: 40px;
    --bl-art-radius: 6px;
    /* Foto de perfil DJ (transparente) → fondo gris suave */
    --bl-featured-photo-bg: #3a3a3c;
    display: grid;
    grid-template-columns: var(--bl-art-size) minmax(0, 1fr) 36px;
    align-items: center;
    gap: 12px;
    min-height: var(--bl-art-size);
    padding: 8px 0;
    /* Línea fina desde arriba (también sobre la 1ª fila), como Apple */
    border-top: 0.5px solid var(--bl-border, rgba(255, 255, 255, 0.12));
    border-bottom: none;
    border-radius: 0;
    background: transparent;
}

.bl-home-featured-item:hover,
.bl-home-featured-item.now-playing {
    background: transparent !important;
}

/* Play / artwork — mismo patrón mixes (shade + barras + glyphs) */
.bl-home-featured-item__play {
    position: relative !important;
    flex: 0 0 var(--bl-art-size) !important;
    width: var(--bl-art-size) !important;
    height: var(--bl-art-size) !important;
    min-width: var(--bl-art-size) !important;
    min-height: var(--bl-art-size) !important;
    max-width: var(--bl-art-size) !important;
    max-height: var(--bl-art-size) !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-radius: var(--bl-art-radius, 6px) !important;
    overflow: hidden !important;
    cursor: pointer;
    background: var(--bl-featured-photo-bg, #3a3a3c) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: #fff !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.bl-home-featured-item__play:disabled {
    cursor: default;
    opacity: 0.7;
}

.bl-home-featured-item__play:hover,
.bl-home-featured-item__play:focus,
.bl-home-featured-item__play:focus-visible,
.bl-home-featured-item.now-playing .bl-home-featured-item__play {
    border: none !important;
    border-color: transparent !important;
    color: #fff !important;
    outline: none !important;
    box-shadow: none !important;
}

.bl-home-featured-item__art {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    border: none !important;
    border-radius: var(--bl-art-radius, 6px) !important;
    box-shadow: none !important;
    background: var(--bl-featured-photo-bg, #3a3a3c) !important;
}

.bl-home-featured-item__art--placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--bl-system-secondary, hsla(0, 0%, 100%, 0.55));
    font-size: 14px;
    background: var(--bl-featured-photo-bg, #3a3a3c);
}

.bl-home-featured-item__shade {
    position: absolute;
    inset: 0;
    border-radius: var(--bl-art-radius, 6px);
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 1;
}

.bl-home-featured-item:hover .bl-home-featured-item__shade,
.bl-home-featured-item.now-playing .bl-home-featured-item__shade,
.bl-home-featured-item__play:focus-visible .bl-home-featured-item__shade {
    opacity: 1;
}

/* Barras / glyphs — reutiliza clases mixes (CSS local por si mixes no está encolado) */
.bl-home-featured-item .bl-mixes-playback-bars {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    color: #fff;
}

.bl-home-featured-item .bl-mixes-playback-bars__svg {
    position: absolute;
    width: 15px;
    height: 15px;
    opacity: 0;
}

.bl-home-featured-item .bl-mixes-glyph {
    position: absolute;
    width: 16px;
    height: 16px;
    opacity: 0;
    color: #fff;
}

.bl-home-featured-item.now-playing:not(.paused) .bl-mixes-playback-bars__svg {
    opacity: 1;
}

.bl-home-featured-item.now-playing:not(.paused) .bl-mixes-glyph--play {
    opacity: 0;
}

/* Pausado → play inmediato */
.bl-home-featured-item.now-playing.paused .bl-mixes-glyph--play {
    opacity: 1;
}

.bl-home-featured-item.now-playing.paused .bl-mixes-glyph--pause,
.bl-home-featured-item.now-playing.paused .bl-mixes-playback-bars__svg {
    opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
    .bl-home-featured-item.has-preview:hover:not(.now-playing) .bl-mixes-glyph--play {
        opacity: 1;
    }

    .bl-home-featured-item.now-playing:not(.paused):hover .bl-mixes-playback-bars__svg {
        opacity: 0;
    }

    .bl-home-featured-item.now-playing:not(.paused):hover .bl-mixes-glyph--play {
        opacity: 0;
    }

    .bl-home-featured-item.now-playing:not(.paused):hover .bl-mixes-glyph--pause {
        opacity: 1;
    }
}

.bl-home-featured-item .bl-mixes-playback-bars__bar {
    fill: currentColor;
    transform: translateY(9px);
    animation-name: none;
    animation-duration: 0.4s;
    animation-timing-function: ease-in;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    animation-delay: var(--delay, 0s);
}

.bl-home-featured-item.now-playing:not(.paused) .bl-mixes-playback-bars__bar {
    animation-name: bl-home-featured-playback-bar;
}

.bl-home-featured-item .bl-mixes-playback-bars__bar--1 {
    --max-height-offset: 6px;
    --delay: 0.25s;
    animation-duration: 0.6s;
}

.bl-home-featured-item .bl-mixes-playback-bars__bar--2 {
    --max-height-offset: 2px;
    --delay: 615ms;
}

.bl-home-featured-item .bl-mixes-playback-bars__bar--3 {
    --max-height-offset: 4px;
    --delay: 475ms;
}

.bl-home-featured-item .bl-mixes-playback-bars__bar--4 {
    --max-height-offset: 2px;
    --delay: 25ms;
}

@keyframes bl-home-featured-playback-bar {
    0% {
        transform: translateY(9px);
    }
    to {
        transform: translateY(var(--max-height-offset));
    }
}

.bl-home-featured-item__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    cursor: default;
}

.bl-home-featured-item__meta:hover {
    opacity: 1;
}

.bl-home-featured-item__title {
    font-family: var(--bl-font) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-style: normal !important;
    color: var(--bl-system-primary, hsla(0, 0%, 100%, 0.92)) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 18px !important;
}

.bl-home-featured-item__artist {
    font-family: var(--bl-font) !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    font-style: normal !important;
    color: var(--bl-system-secondary, hsla(0, 0%, 100%, 0.55)) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 16px !important;
}

.bl-home-featured-item__options {
    justify-self: end;
}

/* Menú flotante home — fuera del carrusel */
.bl-home-featured .bl-search-result__menu.bl-context-menu-portal,
.bl-home-featured .bl-search-result__share-menu.bl-context-menu-portal {
    pointer-events: auto;
}

/* Móvil: 1 columna + peek (como Apple), swipe, sin flechas */
@media (max-width: 767px) {
    .bl-home-featured__shelf-arrow {
        display: none !important;
    }

    .bl-home-featured__viewport {
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }

    .bl-home-featured__track {
        gap: 12px;
    }

    .bl-home-featured__col {
        flex: 0 0 calc((100% - 12px) / 1.18);
        width: calc((100% - 12px) / 1.18);
        max-width: calc((100% - 12px) / 1.18);
    }

    .bl-home-featured-item {
        grid-template-columns: 40px minmax(0, 1fr) 32px;
        gap: 12px;
        min-height: 40px;
    }

    .bl-home-featured-item__play {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }

    .bl-home-featured-item__title {
        font-size: 13px !important;
        font-weight: 400 !important;
        line-height: 18px !important;
    }

    .bl-home-featured-item__artist {
        font-size: 13px !important;
        font-weight: 400 !important;
        line-height: 16px !important;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .bl-home-featured__track {
        gap: 16px;
    }

    .bl-home-featured__col {
        flex: 0 0 calc((100% - 32px) / 2.08);
        width: calc((100% - 32px) / 2.08);
        max-width: calc((100% - 32px) / 2.08);
    }

    .bl-home-featured__shelf-arrow--right {
        right: calc(16px + (100% - 32px) / 2.08 * 0.08);
    }
}

[data-theme="light"] .bl-home-featured-item {
    border-top-color: rgba(0, 0, 0, 0.08);
}

/* Shield final — overrides globales no vuelven a poner borde/sombra en play */
.bl-home-featured .bl-home-featured-item__play,
.bl-home-featured .bl-home-featured-item__play:hover,
.bl-home-featured .bl-home-featured-item__play:focus,
.bl-home-featured .bl-home-featured-item__play:focus-visible,
[data-theme="light"] .bl-home-featured .bl-home-featured-item__play {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
