/* ============================================================
   NOTICIAS FLOTANTES · tarjetas de últimas publicaciones
   ------------------------------------------------------------
   Todo se controla desde las variables CSS que el plugin escribe en el propio
   bloque (--nf-accent, --nf-w, --nf-dur…), así este archivo no hay que tocarlo
   nunca: los ajustes se cambian en Plugins → Noticias Flotantes.
   ============================================================ */

.nf {
    position: fixed;
    z-index: 9970;                 /* debajo del botón de WhatsApp (9999) */
    bottom: var(--nf-bottom, 24px);
    width: var(--nf-w, 320px);
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    background: var(--nf-bg, #fff);
    color: var(--nf-text, #1f2937);
    border: 1px solid rgba(2, 10, 20, .10);
    border-radius: 16px;
    box-shadow: 0 20px 45px rgba(2, 10, 20, .22), 0 2px 6px rgba(2, 10, 20, .10);
    overflow: hidden;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    animation: nf-in .5s cubic-bezier(.2, .8, .2, 1) both;
}

.nf[data-side="left"] { left: var(--nf-side, 24px); right: auto; }
.nf[data-side="right"] { right: var(--nf-side, 24px); left: auto; }

/* Cerrada por el visitante */
.nf.is-hidden { display: none !important; }

.nf *,
.nf *::before,
.nf *::after { box-sizing: border-box; }

/* --- Cabecera: rótulo + cerrar --- */
.nf-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 34px;
    padding: 9px 10px 7px 14px;
}

.nf-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--nf-accent, #c8102e);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Punto «en vivo» con su onda */
.nf-live {
    position: relative;
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}
.nf-live::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: currentColor;
    opacity: .28;
    animation: nf-pulse 2.1s ease-out infinite;
}

.nf-close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: rgba(2, 10, 20, .06);
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .16s ease, transform .16s ease;
}
.nf-close:hover { background: rgba(2, 10, 20, .13); }
.nf-close:active { transform: scale(.94); }
.nf-close:focus-visible { outline: 2px solid var(--nf-accent, #c8102e); outline-offset: 2px; }
.nf-close svg { width: 13px; height: 13px; }

/* --- Pila de tarjetas: todas ocupan la misma celda, se cruzan al cambiar --- */
.nf-stack {
    display: grid;
    grid-template-areas: "nf-stack";
}
.nf-stack > * { grid-area: nf-stack; }

.nf-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity .5s ease, transform .5s ease, visibility .5s;
}
.nf-card.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
}
.nf-card:focus-visible { outline: 2px solid var(--nf-accent, #c8102e); outline-offset: -3px; }

/* --- Imagen --- */
.nf-media {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(2, 10, 20, .07);
}
.nf-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .7s ease;
}
.nf-card:hover .nf-media img { transform: scale(1.035); }

/* Sin imagen: bloque con el color de acento y una trama suave */
.nf-media--empty {
    background:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .10) 0 10px, transparent 10px 20px),
        var(--nf-accent, #c8102e);
}

/* --- Texto --- */
.nf-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 11px 14px 13px;
}

.nf-cat {
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--nf-accent, #c8102e);
}

.nf-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -.005em;
}

.nf-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 2px;
    font-size: 11.5px;
    font-weight: 600;
    opacity: .68;
}
.nf-meta .nf-read {
    color: var(--nf-accent, #c8102e);
    opacity: 1;
    font-weight: 800;
    white-space: nowrap;
    margin-left: auto;   /* siempre a la derecha, aunque no haya fecha */
}
.nf-card:hover .nf-meta .nf-read { text-decoration: underline; text-underline-offset: 3px; }

/* --- Puntos de posición --- */
.nf-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px 11px;
}
.nf-dot {
    width: 6px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: currentColor;
    opacity: .2;
    cursor: pointer;
    transition: width .25s ease, opacity .25s ease, background-color .25s ease;
}
.nf-dot:hover { opacity: .45; }
.nf-dot.is-active {
    width: 18px;
    opacity: 1;
    background: var(--nf-accent, #c8102e);
}
.nf-dot:focus-visible { outline: 2px solid var(--nf-accent, #c8102e); outline-offset: 2px; }

/* --- Barra de progreso (los segundos de cada tarjeta) --- */
.nf-progress {
    position: relative;
    height: 3px;
    background: rgba(2, 10, 20, .07);
}
.nf-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--nf-accent, #c8102e);
}
.nf-progress span.is-run {
    animation: nf-progress var(--nf-dur, 20s) linear forwards;
}
.nf.is-paused .nf-progress span { animation-play-state: paused; }

/* ============================================================
   ANIMACIONES
   ============================================================ */
@keyframes nf-in {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes nf-pulse {
    0%   { transform: scale(.9); opacity: .30; }
    70%  { transform: scale(2.4); opacity: 0; }
    100% { transform: scale(2.4); opacity: 0; }
}
@keyframes nf-progress {
    from { width: 0; }
    to   { width: 100%; }
}

/* Quien pide menos movimiento no ve animaciones */
@media (prefers-reduced-motion: reduce) {
    .nf,
    .nf-live::after,
    .nf-progress span.is-run { animation: none !important; }
    .nf-card,
    .nf-media img,
    .nf-dot,
    .nf-close { transition: none !important; }
}

/* ============================================================
   MÓVIL
   ============================================================ */
@media (max-width: 640px) {
    .nf {
        width: calc(100vw - 24px);
        max-width: 420px;
        /* Por encima del botón flotante de WhatsApp (abajo a la derecha), que
           si no se comería la esquina de la tarjeta. `mobile_lift` lo ajusta. */
        bottom: calc(12px + var(--nf-lift, 0px));
        border-radius: 14px;
    }
    .nf[data-side="left"] { left: 12px; }
    .nf[data-side="right"] { right: 12px; }

    /* En el móvil la tarjeta se hace horizontal (foto a la izquierda) para que
       ocupe el mínimo alto posible y no tape media pantalla. */
    .nf-card { flex-direction: row; align-items: stretch; }
    .nf-media {
        flex: 0 0 38%;
        width: 38%;
        aspect-ratio: auto;
        min-height: 104px;
    }
    .nf-body {
        flex: 1 1 auto;
        min-width: 0;
        justify-content: center;
        padding: 10px 12px;
    }
    .nf-title {
        font-size: 13.5px;
        -webkit-line-clamp: 2;
    }
    .nf-cat { font-size: 9.5px; }
    .nf-meta { font-size: 10.5px; }
    .nf--nomobile { display: none !important; }
}
