/* BeatLatin Home — Novedades (carrusel Apple Music + peek)
 *
 * IMPORTANTE: no usar calc(var(a) + var(b)) — WP Rocket minify
 * elimina espacios alrededor de +/− y el calc queda inválido
 * (flex cae a 0 1 auto → cards ~120px). Anchos fijos por breakpoint.
 */

.bl-home-novedades {
    position: relative;
    overflow: visible;
    margin-bottom: 36px;
}

.bl-home-novedades__title {
    margin: 0 0 18px;
    /* Apple --header-emphasized */
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1765;
    letter-spacing: -0.02em;
    color: var(--bl-system-primary, var(--bl-heading, #fff));
}

@media (max-width: 767px) {
    .bl-home-novedades__title {
        font-size: 28px;
        margin-bottom: 14px;
    }
}

.bl-home-novedades__title-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.bl-home-novedades__title-link:hover {
    opacity: 0.92;
}

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

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

.bl-home-novedades__shelf-arrow {
    position: absolute;
    /* Apple shelf-grid-nav: --offset 38px → centro del artwork */
    top: calc(var(--bl-shelf-arrow-offset, 38px) + (100% - var(--bl-shelf-arrow-offset, 38px)) / 2);
    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;
}

.bl-home-novedades__shelf-arrow[hidden] {
    display: none !important;
}

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

.bl-home-novedades__shelf-arrow-icon--right {
    transform: scaleX(-1);
}

/*
 * Flechas: borde exterior de la pill = borde de la última card ENTERA.
 * left: 0 → borde izq de card 1.
 * right: gap + peek → borde der de card 2 (NO el borde del viewport/peek).
 * La pill sobresale 10px del borde sin perder su anclaje.
 */
.bl-home-novedades__shelf-arrow--left {
    left: 0;
    right: auto;
    translate: -10px -50%;
}

.bl-home-novedades__shelf-arrow--right {
    /* peek 0.04 + 1 gap (20px) tras la 2ª card */
    right: calc(20px + (100% - 40px) / 2.04 * 0.04);
    left: auto;
    translate: 10px -50%;
}

.bl-home-novedades__shelf-arrow:hover,
.bl-home-novedades__shelf-arrow:focus,
.bl-home-novedades__shelf-arrow:focus-visible,
.bl-home-novedades__shelf-arrow:active {
    color: var(--bl-heading, #fff);
    background-color: rgba(255, 255, 255, 0.16);
    /* Sin rojo Hello/Elementor al click */
    outline: none;
}

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

.bl-home-novedades.is-shelf-hover .bl-home-novedades__shelf-arrow:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
}

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

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

[data-theme="light"] .bl-home-novedades__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-novedades__shelf-arrow:hover {
    color: rgba(29, 29, 31, 0.92);
    background-color: rgba(255, 255, 255, 0.92);
}

.bl-home-novedades__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 cards se calculan sobre un área más estrecha
 * y queda un hueco muerto a la derecha (bug 1920×1080).
 * width = 100% del padre + bleeds → el área útil de las cards = 100% del padre.
 */
@media (min-width: 1025px) {
    .bl-home-novedades__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-novedades__track {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--bl-shelf-gap-editorial, 20px);
    transition: transform 0.38s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
}

/*
 * Ancho de card = (100% - gaps) / slots.
 * Apple 1920 editorial: 2 enteras + peek CORTO → / 2.04
 * Rocket minify: no calc(var + var) — gaps fijos por breakpoint.
 */
.bl-home-novedades-card {
    flex: 0 0 calc((100% - 40px) / var(--bl-shelf-slots-novedades, 2.04));
    width: calc((100% - 40px) / var(--bl-shelf-slots-novedades, 2.04));
    max-width: calc((100% - 40px) / var(--bl-shelf-slots-novedades, 2.04));
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .bl-home-novedades__track {
        gap: 14px;
    }

    /* 1 + peek 0.18 → / 1.18 */
    .bl-home-novedades-card {
        flex: 0 0 calc((100% - 14px) / 1.18);
        width: calc((100% - 14px) / 1.18);
        max-width: calc((100% - 14px) / 1.18);
    }

    .bl-home-novedades__shelf-arrow--right {
        right: calc(14px + (100% - 14px) / 1.18 * 0.18);
    }
}

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

    .bl-home-novedades__track {
        gap: 24px;
    }

    /* Ultrawide: 3 enteras + peek corto ; 2 gaps × 24 = 48 */
    .bl-home-novedades-card {
        flex: 0 0 calc((100% - 48px) / var(--bl-shelf-slots-novedades, 3.04));
        width: calc((100% - 48px) / var(--bl-shelf-slots-novedades, 3.04));
        max-width: calc((100% - 48px) / var(--bl-shelf-slots-novedades, 3.04));
    }

    .bl-home-novedades__shelf-arrow--right {
        right: calc(24px + (100% - 48px) / 3.04 * 0.04);
    }
}

@media (max-width: 767px) {
    .bl-home-novedades {
        margin-bottom: 28px;
    }

    .bl-home-novedades__shelf-arrow {
        display: none !important;
    }

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

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

    /* 1 + peek 0.22 → / 1.22 */
    .bl-home-novedades-card {
        flex: 0 0 calc((100% - 12px) / 1.22);
        width: calc((100% - 12px) / 1.22);
        max-width: calc((100% - 12px) / 1.22);
    }
}

.bl-home-novedades-card__meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    margin-bottom: 2px;
    text-decoration: none;
    color: inherit;
}

.bl-home-novedades-card__meta:hover {
    opacity: 0.92;
}

.bl-home-novedades-card__meta--nolink {
    cursor: default;
}

.bl-home-novedades-card__meta--nolink:hover {
    opacity: 1;
}

.bl-home-novedades-card__media-link--nolink {
    cursor: default;
}

/* Apple --subhead-emphasized 600 11px / secondary */
.bl-home-novedades-card__eyebrow {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2727;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--bl-system-secondary, var(--bl-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Apple --title-2 400 17px / primary */
.bl-home-novedades-card__title {
    font-size: 17px;
    font-weight: 400;
    line-height: 1.2941;
    letter-spacing: -0.01em;
    color: var(--bl-system-primary, var(--bl-heading));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Apple --title-2 400 17px / secondary */
.bl-home-novedades-card__artist {
    font-size: 17px;
    font-weight: 400;
    line-height: 1.2941;
    letter-spacing: -0.01em;
    color: var(--bl-system-secondary, var(--bl-muted));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bl-home-novedades-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bl-art-bg, rgba(255, 255, 255, 0.06));
    isolation: isolate;
}

.bl-home-novedades-card__media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.bl-home-novedades-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.35s ease, filter 0.25s ease;
}

.bl-home-novedades-card__img--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bl-muted-soft);
    font-size: 28px;
    background: var(--bl-art-bg, rgba(255, 255, 255, 0.06));
}

.bl-home-novedades-card__shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.42) 0%,
        rgba(0, 0, 0, 0.08) 42%,
        rgba(0, 0, 0, 0) 70%
    );
    pointer-events: none;
    transition: background 0.25s ease;
    z-index: 1;
}

/* Apple --callout 400 12px — 1 línea + ellipsis (PC y móvil) */
.bl-home-novedades-card__desc {
    position: absolute;
    left: 14px;
    right: 56px;
    bottom: 14px;
    z-index: 2;
    margin: 0;
    padding: 0;
    max-width: calc(100% - 70px);
    font-family: var(--bl-font);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.25;
    color: #fff;
    display: block;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    word-break: normal;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* Apple play-button--platter ~30px, systemQuaternary glass */
.bl-home-novedades-card__play {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    padding: 0 !important;
    margin: 0;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
    color: #fff !important;
    background: rgba(255, 255, 255, 0.22) !important;
    background-color: rgba(255, 255, 255, 0.22) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.22),
        0 2px 8px rgba(0, 0, 0, 0.22);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease,
        background-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.bl-home-novedades-card__play:hover,
.bl-home-novedades-card__play:focus,
.bl-home-novedades-card__play:focus-visible,
.bl-home-novedades-card__play:active,
.bl-home-novedades-card.now-playing .bl-home-novedades-card__play,
.bl-home-novedades-card.now-playing:not(.paused) .bl-home-novedades-card__play {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.34) !important;
    background-color: rgba(255, 255, 255, 0.34) !important;
    border-color: transparent !important;
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.28),
        0 2px 10px rgba(0, 0, 0, 0.28);
}

.bl-home-novedades-card__play .play-icon,
.bl-home-novedades-card__play .pause-icon,
.bl-home-novedades-card__play i,
.bl-home-novedades-card__play .fas {
    font-size: 11px !important;
    line-height: 1 !important;
    color: inherit !important;
}

.bl-home-novedades-card__play .play-icon {
    margin-left: 1px;
}

.bl-home-novedades-card__play .pause-icon {
    display: none;
}

.bl-home-novedades-card.has-preview:hover .bl-home-novedades-card__shade,
.bl-home-novedades-card.has-preview:focus-within .bl-home-novedades-card__shade,
.bl-home-novedades-card.now-playing .bl-home-novedades-card__shade {
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.52) 0%,
        rgba(0, 0, 0, 0.18) 45%,
        rgba(0, 0, 0, 0.06) 100%
    );
}

.bl-home-novedades-card.has-preview:hover .bl-home-novedades-card__play,
.bl-home-novedades-card.has-preview:focus-within .bl-home-novedades-card__play,
.bl-home-novedades-card.now-playing .bl-home-novedades-card__play {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.bl-home-novedades-card.now-playing:not(.paused) .play-icon {
    display: none;
}

.bl-home-novedades-card.now-playing:not(.paused) .pause-icon {
    display: inline-block;
}

.bl-home-novedades-card.now-playing.paused .play-icon {
    display: inline-block;
}

.bl-home-novedades-card.now-playing.paused .pause-icon {
    display: none;
}

[data-theme="light"] .bl-home-novedades-card__eyebrow,
[data-theme="light"] .bl-home-novedades-card__artist {
    color: var(--bl-system-secondary, rgba(0, 0, 0, 0.56));
}

[data-theme="light"] .bl-home-novedades-card__title {
    color: var(--bl-system-primary, rgba(0, 0, 0, 0.88));
}

[data-theme="light"] .bl-home-novedades-card__desc {
    color: #fff;
}

[data-theme="light"] .bl-home-novedades-card__play {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.28) !important;
    background-color: rgba(0, 0, 0, 0.28) !important;
    box-shadow:
        inset 0 0 0 0.5px rgba(255, 255, 255, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .bl-home-novedades-card__play:hover,
[data-theme="light"] .bl-home-novedades-card__play:focus,
[data-theme="light"] .bl-home-novedades-card__play:active,
[data-theme="light"] .bl-home-novedades-card.now-playing .bl-home-novedades-card__play {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.42) !important;
    background-color: rgba(0, 0, 0, 0.42) !important;
}

[data-theme="light"] .bl-home-novedades-card.has-preview:hover .bl-home-novedades-card__shade,
[data-theme="light"] .bl-home-novedades-card.has-preview:focus-within .bl-home-novedades-card__shade,
[data-theme="light"] .bl-home-novedades-card.now-playing .bl-home-novedades-card__shade {
    background: rgba(0, 0, 0, 0.28);
}

@media (max-width: 767px) {
    .bl-home-novedades-card__media {
        border-radius: 10px;
    }

    .bl-home-novedades-card__play {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        right: 10px;
        bottom: 10px;
        opacity: 0.92;
        transform: scale(1);
        pointer-events: auto;
    }

    /* Móvil: 2 líneas como Apple Music, sin ellipsis (…) */
    .bl-home-novedades-card__desc {
        left: 12px;
        right: 48px;
        bottom: 12px;
        max-width: calc(100% - 58px);
        white-space: normal !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        display: block !important;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        max-height: calc(12px * 1.25 * 2); /* 2 líneas (font 12px × lh 1.25) */
    }

    .bl-home-novedades-card.has-preview .bl-home-novedades-card__shade {
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.45) 0%,
            rgba(0, 0, 0, 0.12) 50%,
            rgba(0, 0, 0, 0) 100%
        );
    }
}
