/*
 * FILE: assets/css/components/noticia-single.css
 * PAGE: /noticias/{slug}
 * TODO WP: enqueuear en is_single() && get_post_type() === 'pp_noticia'
 */

/* ============================================================
   TOPBAR — breadcrumb mínimo sobre fondo blanco/gris
   ============================================================ */
@keyframes ns-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.ns-topbar {
    background: #f6fbf7;
    border-bottom: 1px solid rgba(0,56,36,0.07);
    padding: 14px 0;
}

.ns-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
}

.ns-breadcrumb__item {
    color: rgba(0,56,36,0.45);
    text-decoration: none;
    transition: color 0.15s ease;
}
.ns-breadcrumb__item:hover { color: #003824; }
.ns-breadcrumb__item--current {
    color: rgba(0,56,36,0.65);
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ns-breadcrumb__sep { color: rgba(0,56,36,0.20); }

/* ============================================================
   IMAGEN EDITORIAL — cover al tope del artículo
   ============================================================ */
.ns-article__cover {
    margin: 0 0 clamp(1.5rem, 3vw, 2rem);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0,56,36,0.07);
    line-height: 0;
    animation: ns-fade-up 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ns-article__cover-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* ============================================================
   HEADER EDITORIAL — categoría, título, excerpt dentro del artículo
   ============================================================ */
.ns-article__header {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding-bottom: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
    border-bottom: 1px solid rgba(0,56,36,0.08);
    animation: ns-fade-up 0.55s 0.07s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ns-article__meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ns-article__meta-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(0,56,36,0.20);
    flex-shrink: 0;
}

.ns-article__date {
    font-size: 0.75rem;
    color: rgba(0,56,36,0.45);
    font-weight: 500;
}

.ns-article__title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: #003824;
    margin: 0;
}

.ns-article__excerpt {
    font-size: clamp(0.95rem, 1.3vw, 1.08rem);
    line-height: 1.72;
    color: rgba(0,56,36,0.60);
    margin: 0;
    font-weight: 400;
}

.ns-article__body { }

/* ============================================================
   CONTENIDO PRINCIPAL — layout sidebar
   ============================================================ */
.ns-content {
    background: #f6fbf7;
    padding: clamp(3rem, 6vw, 5rem) 0 clamp(5rem, 9vw, 8rem);
}

.ns-content__layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: clamp(3rem, 5vw, 5rem);
    align-items: start;
}

/* ── Artículo ─────────────────────────────────────────────── */
.ns-article {
    background: #fff;
    border: 1px solid rgba(0,56,36,0.07);
    border-radius: 20px;
    padding: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.84;
    color: rgba(0,56,36,0.80);
    font-size: clamp(0.92rem, 1.2vw, 1rem);
}

.ns-article p { margin: 0 0 1.5em; }
.ns-article p:last-child { margin-bottom: 0; }

.ns-article ul,
.ns-article ol {
    margin: 0 0 1.5em 1.25rem;
    padding: 0;
}

.ns-article li {
    margin-bottom: 0.45em;
}

.ns-article h2,
.ns-article h3 {
    font-family: var(--font-display);
    color: #003824;
    letter-spacing: -0.025em;
    margin: 2em 0 0.6em;
}

.ns-article a {
    color: #45A85A;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.ns-article a:hover { color: #205F3E; }

/* Contact box */
.ns-article__contact-box {
    margin-top: 2rem;
    padding: 1.5rem 2rem;
    background: rgba(0,56,36,0.04);
    border: 1px solid rgba(0,56,36,0.10);
    border-radius: 12px;
    font-size: 0.90rem;
}

.ns-article__contact-box p { margin: 0 0 0.6em; font-weight: 600; color: #003824; }
.ns-article__contact-box ul { margin: 0; padding-left: 1.2em; }
.ns-article__contact-box li { margin-bottom: 0.35em; }

/* Optional content blocks */
.ns-block {
    margin-top: 2rem;
    padding: 1.4rem 1.6rem;
    border-radius: 14px;
}

.ns-block h2 {
    margin: 0 0 0.7rem;
    font-size: 1rem;
}

.ns-block p:last-child,
.ns-block ul:last-child {
    margin-bottom: 0;
}

.ns-block--notice {
    background: rgba(236,226,73,0.16);
    border: 1px solid rgba(190,160,0,0.22);
    color: rgba(70,54,0,0.88);
}

.ns-block--links {
    background: rgba(23,88,160,0.06);
    border: 1px solid rgba(23,88,160,0.14);
}

.ns-block--links ul {
    margin: 0;
    padding-left: 1.1rem;
}

.ns-block--links li {
    margin-bottom: 0.45rem;
}

.ns-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.ns-gallery--single {
    grid-template-columns: 1fr;
}

.ns-gallery__item {
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0,56,36,0.08);
    background: #f6fbf7;
}

.ns-gallery__btn {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    overflow: hidden;
}

.ns-gallery__btn img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ns-gallery--single .ns-gallery__btn img {
    aspect-ratio: 16 / 9;
}

.ns-gallery__btn:hover img {
    transform: scale(1.04);
}

.ns-gallery__btn:focus-visible {
    outline: 2px solid #45A85A;
    outline-offset: 2px;
}

.ns-gallery__item figcaption {
    padding: 0.45rem 0.7rem;
    font-size: 0.75rem;
    color: rgba(0,56,36,0.55);
}

/* ── Lightbox ─────────────────────────────────────────────── */
.ns-lightbox {
    /* Centrado real en viewport */
    position: fixed;
    inset: 0;
    margin: auto;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border: none;
    padding: 0;
    background: transparent;
    overflow: hidden;
}

.ns-lightbox::backdrop {
    background: rgba(0, 8, 4, 0.92);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Inner — ocupa toda la pantalla, centra la imagen */
.ns-lightbox__inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Botón cerrar */
.ns-lightbox__close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 10;
}
.ns-lightbox__close:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.08);
}

/* Flechas de navegación */
.ns-lightbox__prev,
.ns-lightbox__next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.2s ease;
    z-index: 10;
    user-select: none;
}
.ns-lightbox__prev { left: 16px; }
.ns-lightbox__next { right: 16px; }

.ns-lightbox__prev:hover,
.ns-lightbox__next:hover {
    background: rgba(255,255,255,0.25);
}
.ns-lightbox__prev:hover { transform: translateY(-50%) translateX(-2px); }
.ns-lightbox__next:hover { transform: translateY(-50%) translateX(2px); }

/* Ocultar flechas cuando hay una sola imagen */
.ns-lightbox--single .ns-lightbox__prev,
.ns-lightbox--single .ns-lightbox__next { display: none; }

/* Figura contenedora */
.ns-lightbox__figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 70px;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

/* Imagen */
.ns-lightbox__img {
    display: block;
    max-width: min(90vw, 1200px);
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
    transition: opacity 0.18s ease;
}

.ns-lightbox__img.is-loading {
    opacity: 0;
}

/* Caption + contador */
.ns-lightbox__footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ns-lightbox__caption {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.60);
    text-align: center;
}
.ns-lightbox__caption:empty { display: none; }

.ns-lightbox__counter {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.35);
    letter-spacing: 0.05em;
}

@media (max-width: 600px) {
    .ns-lightbox__prev { left: 6px; }
    .ns-lightbox__next { right: 6px; }
    .ns-lightbox__figure { padding: 56px 52px; }
}

.ns-map {
    height: 320px;
    border-radius: 12px;
    border: 1px solid rgba(0,56,36,0.10);
    overflow: hidden;
    background: #e8f4ea;
}

/* .ns-video-frame ya no se renderiza en el HTML — se mantiene la clase por si se usa en otro contexto */
.ns-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #021f14;
}

.ns-video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── Tarjeta de video (thumbnail + label) ─────────────────── */
.ns-video-thumb {
    position: relative;
    display: block;
    border-radius: 14px;
    overflow: hidden;
    text-decoration: none;
    background: #021f14;
    border: 1px solid rgba(0,56,36,0.10);
}

.ns-video-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.ns-video-thumb:hover img {
    transform: scale(1.03);
    opacity: 0.85;
}

/* Play circle sobre la imagen */
.ns-video-thumb__label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.22);
    transition: background 0.2s ease;
}

.ns-video-thumb:hover .ns-video-thumb__label {
    background: rgba(0,0,0,0.38);
}

.ns-video-thumb__play {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    color: #1758A0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding-left: 3px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.30);
    transition: transform 0.2s ease, background 0.2s ease;
}

.ns-video-thumb:hover .ns-video-thumb__play {
    transform: scale(1.10);
    background: #fff;
}

/* Cuando no hay thumbnail disponible */
.ns-video-thumb__no-img {
    display: none;
}

.ns-video-link {
    display: inline-flex;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: rgba(23,88,160,0.08);
    color: #1758A0;
    font-weight: 700;
    text-decoration: none;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.ns-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.ns-sidebar__card {
    background: #fff;
    border: 1px solid rgba(0,56,36,0.08);
    border-radius: 16px;
    padding: var(--space-6);
}

.ns-sidebar__card--contact {
    background: #003824;
    border-color: transparent;
    color: rgba(255,255,255,0.80);
}

.ns-sidebar__title {
    font-family: var(--font-display);
    font-size: 0.80rem;
    font-weight: 800;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: inherit;
    margin: 0 0 var(--space-5);
}

.ns-sidebar__card:not(.ns-sidebar__card--contact) .ns-sidebar__title {
    color: rgba(0,56,36,0.45);
}

/* Definition list */
.ns-sidebar__dl {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.ns-sidebar__dl dt {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: rgba(0,56,36,0.38);
    margin-bottom: 4px;
}

.ns-sidebar__dl dd {
    margin: 0;
    font-size: 0.84rem;
    color: rgba(0,56,36,0.75);
    font-weight: 500;
}

/* Contact list */
.ns-sidebar__contact {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.ns-sidebar__contact li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
}

.ns-sidebar__contact svg { flex-shrink: 0; margin-top: 3px; opacity: 0.50; }

.ns-sidebar__contact a {
    color: rgba(255,255,255,0.80);
    text-decoration: none;
    word-break: break-all;
}
.ns-sidebar__contact a:hover { color: #fff; text-decoration: underline; }

/* Socials */
.ns-sidebar__socials {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid rgba(255,255,255,0.10);
}

.ns-sidebar__social-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.80rem;
    font-weight: 600;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: color 0.15s ease;
}
.ns-sidebar__social-link:hover { color: #fff; }

/* Volver */
.ns-sidebar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.80rem;
    font-weight: 700;
    color: #45A85A;
    text-decoration: none;
    padding: var(--space-4) 0;
    transition: color 0.15s ease, gap 0.15s ease;
}
.ns-sidebar__back:hover { color: #205F3E; gap: 10px; }

/* ============================================================
   RELACIONADAS
   ============================================================ */
.ns-relacionadas {
    background: #fff;
    padding: clamp(4rem, 7vw, 6rem) 0;
    border-top: 1px solid rgba(0,56,36,0.06);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .ns-content__layout {
        grid-template-columns: 1fr 280px;
    }
}

@media (max-width: 768px) {
    .ns-content__layout {
        grid-template-columns: 1fr;
    }
    .ns-sidebar {
        position: static;
    }
    .ns-article__title {
        font-size: clamp(1.5rem, 6vw, 2rem);
    }
}

@media (max-width: 480px) {
    .ns-breadcrumb__item--current { max-width: 140px; }
}
