/* Tarjetas y modal de Novedades (usado en el inicio y en novedades/index.html). */

.nv-list {
    --nv-ink: #15241b;
    --nv-muted: #5d6d64;
    --nv-line: #e2e9e4;
    --nv-sindicato: #006633;
    --nv-obra-social: #0d83a0;
    --nv-mutual: #25579d;
    --nv-general: #36443c;
}

.nv-area-sindicato { --nv-c: var(--nv-sindicato, #006633); }
.nv-area-obra-social { --nv-c: var(--nv-obra-social, #0d83a0); }
.nv-area-mutual { --nv-c: var(--nv-mutual, #25579d); }
.nv-area-general { --nv-c: var(--nv-general, #36443c); }

/* ---------- Layouts ---------- */
.nv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 1.25rem;
    align-items: start;
}

.nv-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(280px, 340px);
    gap: 1.25rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--nv-rail-pad, 0px);
    padding: 0.25rem var(--nv-rail-pad, 0px) 1.25rem;
    margin-inline: calc(var(--nv-rail-pad, 0px) * -1);
    scrollbar-width: none;
    align-items: stretch;
}

.nv-rail::-webkit-scrollbar { display: none; }
.nv-rail > * { scroll-snap-align: start; }
.nv-rail.nv-is-empty { display: block; overflow: visible; }

/* ---------- Tarjeta ---------- */
.nv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--nv-line, #e2e9e4);
    border-radius: 20px;
    box-shadow: 0 1px 2px rgba(16, 40, 26, 0.04), 0 10px 30px -18px rgba(16, 40, 26, 0.25);
    color: var(--nv-ink, #15241b);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    min-width: 0;
}

.nv-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 1.25rem;
    width: 44px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--nv-c);
}

.nv-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--nv-c) 30%, #e2e9e4);
    box-shadow: 0 1px 2px rgba(16, 40, 26, 0.05), 0 22px 40px -20px rgba(16, 40, 26, 0.35);
}

.nv-head {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.nv-avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--nv-c, #dfe7e2);
    overflow: hidden;
}

.nv-avatar img {
    width: 74%;
    height: 74%;
    object-fit: contain;
}

.nv-head-copy {
    display: grid;
    line-height: 1.2;
    min-width: 0;
}

.nv-head-copy strong {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--nv-ink, #15241b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nv-head-copy time {
    font-size: 0.8rem;
    color: var(--nv-muted, #5d6d64);
}

.nv-new {
    margin-left: auto;
    flex: none;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--nv-c) 12%, #fff);
    color: var(--nv-c);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nv-media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: #e9efeb;
}

.nv-media img,
.nv-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    pointer-events: none;
}

.nv-card:hover .nv-media img,
.nv-card:hover .nv-media video {
    transform: scale(1.04);
}

.nv-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: rgba(10, 20, 14, 0.55);
    backdrop-filter: blur(4px);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18);
}

.nv-play::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 54%;
    transform: translate(-50%, -50%);
    border-style: solid;
    border-width: 11px 0 11px 18px;
    border-color: transparent transparent transparent #fff;
}

.nv-count {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    padding: 0.2rem 0.55rem;
    border-radius: 8px;
    background: rgba(10, 20, 14, 0.62);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
}

.nv-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: #2b3a31;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.nv-card .nv-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.nv-card-textonly .nv-text {
    -webkit-line-clamp: 11;
    line-clamp: 11;
    font-size: 1rem;
}

.nv-text strong { font-weight: 700; color: var(--nv-ink, #15241b); }
.nv-text a { color: var(--nv-c); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; position: relative; z-index: 1; }
.nv-text code { font-family: ui-monospace, Consolas, monospace; font-size: 0.88em; background: #f1f4f2; padding: 0.1em 0.3em; border-radius: 4px; }

.nv-open {
    margin-top: auto;
    align-self: flex-start;
    display: inline-flex;
    gap: 0.35rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--nv-c);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
}

.nv-open::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.nv-open:focus-visible { outline: none; }
.nv-card:has(.nv-open:focus-visible) { outline: 3px solid color-mix(in srgb, var(--nv-c) 45%, transparent); outline-offset: 3px; }
.nv-open span { transition: transform 0.2s ease; }
.nv-card:hover .nv-open span { transform: translateX(3px); }

.nv-empty {
    padding: 2rem 1.5rem;
    border: 1px dashed #cfdbd3;
    border-radius: 20px;
    text-align: center;
    color: var(--nv-muted, #5d6d64);
    background: rgba(255, 255, 255, 0.7);
}

/* ---------- Skeleton ---------- */
.nv-skeleton { cursor: default; pointer-events: none; }
.nv-skeleton::before { display: none; }
.nv-skeleton .nv-avatar,
.nv-skeleton .nv-media,
.nv-sk-line {
    background: linear-gradient(90deg, #edf1ee 0%, #f6f8f7 50%, #edf1ee 100%);
    background-size: 200% 100%;
    animation: nv-shimmer 1.3s linear infinite;
}
.nv-sk-line { display: block; height: 12px; border-radius: 6px; width: 100%; }
@keyframes nv-shimmer { to { background-position: -200% 0; } }

/* ---------- Modal ---------- */
.nv-lock { overflow: hidden; }

.nv-dialog {
    width: min(720px, 100% - 1.5rem);
    max-height: min(92vh, 100% - 1.5rem);
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #fff;
    color: #15241b;
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.nv-dialog::backdrop {
    background: rgba(8, 22, 14, 0.72);
    backdrop-filter: blur(4px);
}

/* Flex en columna: la barra queda fija y el cuerpo se desplaza dentro del alto máximo. */
.nv-dialog[open] {
    display: flex;
    flex-direction: column;
    animation: nv-pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
@keyframes nv-pop { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

.nv-dialog-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.nv-dialog-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.9rem 1.2rem;
    border-bottom: 1px solid #e8eee9;
}

.nv-dialog-bar .nv-head { flex: 1; }

.nv-close {
    flex: none;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: #f1f4f2;
    color: #15241b;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
}

.nv-close:hover { background: #e3e9e5; }

.nv-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.1rem 1.2rem 1.5rem;
    display: grid;
    gap: 1.1rem;
}

.nv-gallery {
    display: grid;
    gap: 0.6rem;
}

.nv-gallery.is-multi {
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    border-radius: 14px;
}

.nv-gallery figure {
    margin: 0;
    scroll-snap-align: center;
    border-radius: 14px;
    overflow: hidden;
    background: #0d1711;
    display: grid;
    place-items: center;
}

.nv-gallery img,
.nv-gallery video {
    display: block;
    max-width: 100%;
    max-height: 62vh;
    width: auto;
    height: auto;
}

.nv-gallery video { width: 100%; }

.nv-text-full {
    font-size: 1.02rem;
    line-height: 1.65;
}

@media (max-width: 640px) {
    .nv-rail { grid-auto-columns: 84%; gap: 0.9rem; }
    .nv-dialog { width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
    .nv-dialog-panel { height: 100%; }
    .nv-gallery img, .nv-gallery video { max-height: 70vh; }
}

@media (prefers-reduced-motion: reduce) {
    .nv-card, .nv-media img, .nv-media video, .nv-dialog[open] { transition: none; animation: none; }
}

/* ---------- Página novedades/index.html ---------- */
.nv-page-hero {
    margin-top: var(--nav-h, 86px);
    padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem);
    background:
        radial-gradient(900px 360px at 90% 0%, rgba(0, 154, 68, 0.1), transparent 70%),
        linear-gradient(180deg, #fff, #f5f8f6);
    border-bottom: 1px solid #e1e8e3;
}

.nv-page-hero h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.05;
}

.nv-page-hero p {
    margin-top: 0.7rem;
    max-width: 40rem;
    color: #5e6e65;
    font-size: 1.05rem;
}

.nv-back {
    display: flex;
    width: fit-content;
    gap: 0.4rem;
    margin-bottom: 1.4rem;
    color: #006633;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
}

.nv-back:hover { text-decoration: underline; text-underline-offset: 3px; }

.nv-page-list { background: #f5f8f6; }

.nv-more-wrap { display: flex; justify-content: center; margin-top: 2.25rem; }

.nv-more {
    min-height: 50px;
    padding: 0.8rem 1.6rem;
    border-radius: 999px;
    border: 1px solid #cfdbd3;
    background: #fff;
    color: #006633;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.nv-more:hover:not(:disabled) { background: #006633; border-color: #006633; color: #fff; }
.nv-more[hidden] { display: none; }
