/* ==========================================================================
   NOVEDADES — carrusel (inicio y /novedades)
   Sistema "Figma" de DESIGN.md con la paleta del sitio (negro, tarjetas #161616, verde esmeralda): titular ultraligero a la izquierda, tarjeta flotante con
   la gran sombra sobre una imagen a sangre, radios 8/16/50, un solo CTA saturado por vista. Lienzo negro,
   superficies gris translúcidas, acentos verdes y amarillo para lo importante. Sin índigo.

   Movimiento: una diapositiva por vez; el carril se desplaza con un resorte (linear() de un resorte amortiguado);
   la imagen hace un zoom lento y el texto entra escalonado; el riel de miniaturas lleva una barra de progreso que
   además marca el avance automático.
   ========================================================================== */

.ns {
    /* Paleta del sitio (la de los módulos anteriores): negro #0f0f0f, tarjetas #161616, bordes #262626, verde esmeralda */
    --bg: #0f0f0f;
    --card: #161616;
    --card-deep: #141414;
    --mist: #ffffff;
    --silver: #d1d5db;
    --muted: #9ca3af;
    --teal: #4ade80;          /* verde de acento (antes teal) */
    --teal-deep: #059669;     /* esmeralda de los botones */
    --lavender: #facc15;      /* "Importante": amarillo */
    --mineral: rgba(255, 255, 255, 0.04);
    --mineral-hi: rgba(255, 255, 255, 0.07);
    --hairline: #262626;

    /* Resorte amortiguado (m=1, k=170, c=17): llega en ~40 % del tiempo y se asienta con un rebote suave */
    --spring: linear(0, 0.0706 2.5%, 0.2234 5%, 0.4073 7.5%, 0.5878 10%, 0.7448 12.5%, 0.8691 15%, 0.959 17.5%, 1.0176 20%, 1.0506 22.5%, 1.0642 25%, 1.0648 27.5%, 1.0574 30%, 1.0461 32.5%, 1.0339 35%, 1.0225 37.5%, 1.0131 40%, 1.0059 42.5%, 1.0008 45%, 0.9977 47.5%, 0.9962 50%, 0.9959 55%, 0.9973 60%, 0.9988 65%, 0.9998 70%, 1.0002 75%, 1);
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --move: 0.95s;
    --duracion: 7s;   /* lo que dura cada diapositiva con avance automático */

    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    font-family: 'Matter', 'Inter', 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--mist);
}

/* ---------- Página /novedades ---------- */
body.ns-page {
    background: #0f0f0f;
    min-height: 100vh;
}

.ns-page-main { padding: 28px 0 120px; }
.ns-home { padding: 72px 24px 24px; }

/* ---------- Encabezado ---------- */
.ns-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.ns-title { margin: 0; font-size: clamp(2.5rem, 5vw, 3.5rem); font-weight: 300; line-height: 1.1; letter-spacing: -0.015em; color: var(--mist); }
.ns-controls { display: flex; align-items: center; gap: 18px; flex-shrink: 0; padding-bottom: 8px; }
.ns-all { font-size: 14px; font-weight: 500; color: var(--teal); text-decoration: none; white-space: nowrap; }
.ns-all i { margin-left: 4px; transition: transform 0.5s var(--spring); }
.ns-all:hover i { transform: translateX(4px); }
.ns-all:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; border-radius: 4px; }
.ns-count { font-size: 16px; font-weight: 500; letter-spacing: 0.04em; color: var(--teal); font-variant-numeric: tabular-nums; }

/* ---------- Escenario ---------- */
.ns-stage {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--hairline);
    background: var(--card-deep);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 24px 70px 0 rgba(0, 0, 0, 0.45);
    touch-action: pan-y;
    cursor: grab;
}
.ns-stage.is-dragging { cursor: grabbing; }
.ns-track { display: flex; transition: transform var(--move) var(--spring); will-change: transform; }
.ns-track.is-dragging { transition: none; }

.ns-slide {
    position: relative;
    flex: 0 0 100%;
    min-width: 0;
    height: clamp(440px, 46vw, 540px);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.ns-slide__link { position: absolute; inset: 0; z-index: 1; }

/* Imagen a sangre con zoom lento al activarse y un leve paralaje con el cursor */
.ns-slide__bg { position: absolute; inset: 0; background: var(--card-deep); }
.ns-slide__bg img { width: 100%; height: 100%; object-fit: cover; display: block; scale: 1.14; translate: calc(var(--mx, 0) * -14px) calc(var(--my, 0) * -10px); transition: scale 2.2s var(--ease-out); }
.ns-slide.is-active .ns-slide__bg img { scale: 1.04; }
.ns-slide__orb {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(40% 60% at 72% 38%, rgba(74, 222, 128, 0.36), transparent 70%),
        radial-gradient(35% 50% at 90% 85%, rgba(250, 204, 21, 0.13), transparent 70%),
        var(--card-deep);
}
.ns-slide__icon { position: absolute; right: 14%; top: 50%; translate: calc(var(--mx, 0) * -14px) calc(-50% + var(--my, 0) * -10px); font-size: clamp(90px, 14vw, 170px); color: var(--teal); opacity: 0.9; filter: drop-shadow(0 0 34px rgba(74, 222, 128, 0.5)); }
/* Velo para que el texto siempre se lea sobre cualquier foto */
.ns-slide__shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(15, 15, 15, 0.82) 0%, rgba(15, 15, 15, 0.35) 45%, transparent 75%), linear-gradient(0deg, rgba(15, 15, 15, 0.5), transparent 40%); }

/* ---------- Tarjeta flotante (hero floating card) ---------- */
.ns-panel {
    position: absolute;
    z-index: 2;
    left: 40px;
    bottom: 40px;
    width: min(480px, calc(100% - 80px));
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    border-radius: 16px;
    background: rgba(15, 15, 15, 0.72);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--hairline);
    box-shadow: 0 24px 70px 0 rgba(0, 0, 0, 0.5);
}
.ns-slide.is-importante .ns-panel { border-color: rgba(250, 204, 21, 0.3); }
.ns-slide.is-importante .ns-panel::before { content: ''; position: absolute; left: 24px; right: 24px; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--teal), var(--lavender), transparent); }

/* El texto entra escalonado cuando la diapositiva se activa */
.ns-panel > * { opacity: 0; transform: translateY(18px); transition: opacity 0.4s var(--ease-out), transform 0.7s var(--spring); }
.ns-slide.is-active .ns-panel > * { opacity: 1; transform: none; }
.ns-slide.is-active .ns-panel > :nth-child(1) { transition-delay: 0.18s; }
.ns-slide.is-active .ns-panel > :nth-child(2) { transition-delay: 0.26s; }
.ns-slide.is-active .ns-panel > :nth-child(3) { transition-delay: 0.34s; }
.ns-slide.is-active .ns-panel > :nth-child(4) { transition-delay: 0.42s; }

.ns-panel__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--silver); }
.ns-avatar { flex: none; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(74, 222, 128, 0.16); color: var(--teal); font-size: 11px; }
.ns-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 50px; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; }
.ns-pill--star { background: var(--lavender); color: #422006; }

.ns-panel__title { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2.25rem); font-weight: 300; line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.ns-panel__title a { position: relative; z-index: 2; color: var(--mist); text-decoration: none; }
.ns-panel__text { margin: 0; font-size: 16px; line-height: 1.5; color: var(--silver); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* El único CTA saturado de la vista */
.ns-cta {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 10px 20px;
    border-radius: 50px;
    background: var(--teal-deep);
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: scale 0.6s var(--spring), background-color 0.25s var(--ease-out);
}
.ns-cta i { transition: translate 0.5s var(--spring); }
.ns-cta:hover { scale: 1.05; background: #047857; }
.ns-cta:hover i { translate: 3px 0; }
.ns-cta:active { scale: 0.97; transition-duration: 0.12s; }
.ns-cta:focus-visible, .ns-panel__title a:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 4px; }

/* ---------- Flechas (botones fantasma, 8px) ---------- */
.ns-arrow {
    position: absolute;
    z-index: 4;
    top: 50%;
    width: 48px;
    height: 48px;
    margin-top: -24px;
    border: 1px solid rgba(74, 222, 128, 0.45);
    border-radius: 8px;
    background: rgba(15, 15, 15, 0.55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--teal);
    font-size: 15px;
    cursor: pointer;
    transition: scale 0.6s var(--spring), background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out), opacity 0.3s var(--ease-out);
}
.ns-arrow--prev { left: 16px; }
.ns-arrow--next { right: 16px; }
.ns-arrow:hover:not(:disabled) { scale: 1.1; background: rgba(74, 222, 128, 0.18); border-color: var(--teal); }
.ns-arrow:active:not(:disabled) { scale: 0.92; transition-duration: 0.12s; }
.ns-arrow:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.ns-arrow:disabled { opacity: 0; pointer-events: none; }

/* ---------- Riel de miniaturas con progreso ---------- */
.ns-thumbs { list-style: none; margin: 16px 0 0; padding: 4px 2px 8px; display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.ns-thumbs::-webkit-scrollbar { display: none; }
.ns-thumbs li { flex: 0 0 auto; scroll-snap-align: start; }
.ns-thumb {
    position: relative;
    width: 250px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 12px 10px;
    text-align: left;
    color: var(--mist);
    font-family: inherit;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    background: var(--mineral);
    overflow: hidden;
    cursor: pointer;
    transition: scale 0.6s var(--spring), background-color 0.25s var(--ease-out), border-color 0.25s var(--ease-out);
}
@media (hover: hover) { .ns-thumb:hover { scale: 1.03; background: var(--mineral-hi); } }
.ns-thumb:active { scale: 0.98; transition-duration: 0.12s; }
.ns-thumb:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.ns-thumb.is-active { border-color: rgba(74, 222, 128, 0.55); background: rgba(74, 222, 128, 0.08); }
.ns-thumb__img { flex: none; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--card-deep); color: var(--teal); font-size: 20px; }
.ns-thumb__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ns-thumb__txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ns-thumb__txt strong { font-size: 14px; font-weight: 500; line-height: 1.25; color: var(--mist); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ns-thumb__txt small { font-size: 12px; color: var(--muted); }
.ns-thumb:not(.is-active) .ns-thumb__txt strong { color: var(--silver); }

/* Barra de progreso: llena en la activa; con avance automático corre durante --duracion */
.ns-thumb__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.ns-thumb__bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--teal-deep), var(--teal)); transform-origin: left center; transform: scaleX(0); }
.ns-thumb.is-active .ns-thumb__bar::after { transform: scaleX(1); }
.ns.is-autoplay .ns-thumb.is-active .ns-thumb__bar::after { animation: ns-progreso var(--duracion) linear forwards; }
@keyframes ns-progreso { from { transform: scaleX(0); } to { transform: scaleX(1); } }
/* pausa mientras se interactúa */
.ns:hover .ns-thumb.is-active .ns-thumb__bar::after,
.ns:focus-within .ns-thumb.is-active .ns-thumb__bar::after,
.ns.is-paused .ns-thumb.is-active .ns-thumb__bar::after { animation-play-state: paused; }

/* ---------- Sin novedades ---------- */
.ns-empty { padding: 72px 24px; text-align: center; border-radius: 16px; border: 1px dashed var(--hairline); background: var(--mineral); color: var(--silver); }
.ns-empty > i { font-size: 38px; color: var(--teal); }
.ns-empty p { margin: 16px auto 0; max-width: 46ch; font-size: 16px; line-height: 1.5; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 720px) {
    .ns, .ns-home { padding-left: 16px; padding-right: 16px; }
    .ns-page-main { padding-top: 40px; }
    .ns-head { margin-bottom: 20px; }
    .ns-slide { height: 520px; }
    .ns-slide__shade { background: linear-gradient(0deg, rgba(15, 15, 15, 0.9) 0%, rgba(15, 15, 15, 0.15) 60%, transparent 100%); }
    .ns-slide__icon { right: 50%; top: 28%; translate: 50% -50%; font-size: 96px; }
    .ns-panel { left: 12px; right: 12px; bottom: 12px; width: auto; padding: 20px; gap: 12px; }
    .ns-panel__title { font-size: 1.5rem; }
    .ns-arrow { top: 28%; width: 40px; height: 40px; margin-top: -20px; }
    .ns-arrow--prev { left: 10px; }
    .ns-arrow--next { right: 10px; }
    .ns-thumb { width: 220px; }
}

/* ---------- Reducir movimiento ---------- */
@media (prefers-reduced-motion: reduce) {
    .ns-track, .ns-slide__bg img, .ns-panel > *, .ns-arrow, .ns-thumb, .ns-cta, .ns-cta i, .ns-all i { transition-duration: 0.01ms; transition-delay: 0s; }
    .ns-panel > * { opacity: 1; transform: none; }
    .ns-slide__bg img { scale: 1.04; translate: none; }
    .ns-thumb__bar::after { animation: none !important; }
}
