:root {
    --ns-primary: #1a365d;
    --ns-primary-dark: #0f2744;
    --ns-secondary: #2d6a4f;
    --ns-secondary-light: #40916c;
    --ns-light: #f4f7f5;
    --ns-muted: #6c757d;
    --ns-shadow: 0 12px 40px rgba(26, 54, 93, 0.12);
}

html {
    scroll-behavior: smooth;
}

body.ns-public {
    font-family: "Public Sans", system-ui, sans-serif;
    color: #1e293b;
    background: #fff;
}

.ns-public-navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(26, 54, 93, 0.08);
    transition: box-shadow 0.25s ease;
}

.ns-public-navbar.is-scrolled {
    box-shadow: var(--ns-shadow);
}

.ns-public-navbar .navbar-brand img {
    height: 44px;
    width: auto;
}

.ns-public-navbar .nav-link {
    color: var(--ns-primary);
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
}

.ns-public-navbar .nav-link:hover,
.ns-public-navbar .nav-link.active {
    color: var(--ns-secondary);
}

.ns-btn-primary {
    background: var(--ns-secondary);
    border-color: var(--ns-secondary);
    color: #fff;
}

.ns-btn-primary:hover {
    background: var(--ns-secondary-light);
    border-color: var(--ns-secondary-light);
    color: #fff;
}

.ns-btn-outline-primary {
    color: var(--ns-primary);
    border-color: var(--ns-primary);
}

.ns-btn-outline-primary:hover {
    background: var(--ns-primary);
    color: #fff;
}

.ns-hero {
    position: relative;
    min-height: 88vh;
    display: flex;
    align-items: center;
    color: #fff;
    overflow: hidden;
}

.ns-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    transform: scale(1.02);
    transition: transform 8s ease;
}

.ns-hero:hover .ns-hero__bg {
    transform: scale(1.06);
}

.ns-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, rgba(15, 39, 68, 0.92) 0%, rgba(45, 106, 79, 0.78) 55%, rgba(26, 54, 93, 0.65) 100%);
}

.ns-hero__content {
    position: relative;
    z-index: 2;
    padding: 6rem 0 4rem;
}

.ns-hero__logo {
    max-height: 110px;
    width: auto;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

.ns-hero .lead {
    max-width: 42rem;
    opacity: 0.95;
}

.ns-animate {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.ns-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ns-section {
    padding: 5rem 0;
}

.ns-section--alt {
    background: var(--ns-light);
}

.ns-section__title {
    color: var(--ns-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.ns-section__subtitle {
    color: var(--ns-muted);
    max-width: 40rem;
    margin-bottom: 2.5rem;
}

.ns-value-card,
.ns-product-card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(26, 54, 93, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    height: 100%;
}

.ns-value-card:hover,
.ns-product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ns-shadow);
}

.ns-product-card__img {
    height: 200px;
    object-fit: cover;
    width: 100%;
    background: var(--ns-light);
}

.ns-product-card__placeholder {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--ns-light), #e8f0eb);
    color: var(--ns-secondary);
    font-size: 2.5rem;
}

.ns-presentation-badge {
    font-size: 0.8rem;
    background: rgba(45, 106, 79, 0.12);
    color: var(--ns-secondary);
    border: 1px solid rgba(45, 106, 79, 0.2);
}

.ns-gallery-carousel {
    position: relative;
    width: 100%;
    min-height: 280px;
    height: min(420px, 55vw);
    background: linear-gradient(135deg, var(--ns-light), #e8f0eb);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ns-gallery-carousel__track {
    position: relative;
    width: 100%;
    height: 100%;
}

.ns-gallery-carousel__slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.9s ease-in-out, visibility 0.9s ease-in-out;
    z-index: 0;
}

.ns-gallery-carousel__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

.ns-gallery-carousel__slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
    border-radius: 0.5rem;
}

.ns-gallery-carousel__dots {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 2;
}

.ns-gallery-carousel__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(26, 54, 93, 0.25);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
}

.ns-gallery-carousel__dot.is-active,
.ns-gallery-carousel__dot:hover {
    background: var(--ns-secondary);
    transform: scale(1.15);
}

.ns-gallery-carousel__dot:focus-visible {
    outline: 2px solid var(--ns-primary);
    outline-offset: 2px;
}

.ns-publicaciones-row {
    --ns-pub-panel-h: 480px;
}

.ns-publicaciones-panel {
    width: 100%;
    height: var(--ns-pub-panel-h);
    min-height: var(--ns-pub-panel-h);
    max-height: var(--ns-pub-panel-h);
    border-radius: 1rem;
    box-shadow: var(--ns-shadow);
    overflow: hidden;
}

.ns-fb-wrap {
    background: #fff;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
}

/*
 * El plugin de Facebook inyecta spans/iframes con ancho fijo (p. ej. clase _2p3a).
 * Esas clases cambian con el SDK; forzamos ancho desde nuestro contenedor.
 */
.ns-fb-wrap .fb-page,
.ns-fb-wrap .fb-page > span,
.ns-fb-wrap span,
.ns-fb-wrap iframe {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

.ns-fb-wrap iframe {
    display: block;
    margin: 0 auto;
}

.ns-social-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--ns-light), #e8f0eb);
}

.ns-social-panel__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(var(--ns-pub-panel-h) - 2.5rem);
    object-fit: contain;
    object-position: center;
}

@media (max-width: 991.98px) {
    .ns-publicaciones-row {
        --ns-pub-panel-h: 420px;
    }
}

@media (max-width: 575.98px) {
    .ns-publicaciones-row {
        --ns-pub-panel-h: 380px;
    }

    .ns-social-panel__img {
        max-height: calc(var(--ns-pub-panel-h) - 2rem);
    }
}

.ns-contact-card {
    border-radius: 1rem;
    border: none;
    box-shadow: var(--ns-shadow);
}

.ns-contact-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(45, 106, 79, 0.12);
    color: var(--ns-secondary);
}

.ns-map {
    border: 0;
    width: 100%;
    min-height: 280px;
    border-radius: 1rem;
}

.ns-footer {
    background: var(--ns-primary-dark);
    color: rgba(255, 255, 255, 0.88);
    padding: 3rem 0 1.5rem;
}

.ns-footer a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
}

.ns-footer a:hover {
    color: #fff;
}

.ns-catalog-empty {
    padding: 3rem;
    text-align: center;
    color: var(--ns-muted);
}

@media (max-width: 991.98px) {
    .ns-hero {
        min-height: auto;
    }

    .ns-hero__content {
        padding: 5rem 0 3rem;
    }
}

/* Visor de videos institucionales */
.ns-video-viewer {
    max-width: 960px;
    margin: 0 auto;
}

.ns-video-viewer__main {
    background: #fff;
    border-radius: 1rem;
    box-shadow: var(--ns-shadow);
    overflow: hidden;
}

.ns-video-viewer__player-wrap {
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
}

.ns-video-viewer__player {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.ns-video-viewer__nav {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    padding: 0 0.5rem;
}

.ns-video-viewer__nav-btn {
    pointer-events: auto;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ns-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.15s ease, background 0.15s ease;
}

.ns-video-viewer__nav-btn:hover {
    transform: scale(1.05);
    background: #fff;
}

.ns-video-viewer__meta {
    padding: 1.25rem 1.5rem;
}

.ns-video-viewer__thumbs {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.ns-video-thumb {
    flex: 0 0 160px;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    background: #fff;
    padding: 0.35rem;
    text-align: left;
    box-shadow: var(--ns-shadow);
    scroll-snap-align: start;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.ns-video-thumb.is-active,
.ns-video-thumb:hover {
    border-color: var(--ns-secondary);
    transform: translateY(-2px);
}

.ns-video-thumb img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0.5rem;
    background: #e9ecef;
}

.ns-video-thumb__label {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.35rem;
    color: var(--ns-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .ns-video-viewer__meta {
        padding: 1rem;
    }

    .ns-video-thumb {
        flex-basis: 130px;
    }

    .ns-video-viewer__nav-btn {
        width: 2.25rem;
        height: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .ns-animate {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .ns-hero__bg {
        transition: none;
    }

    .ns-gallery-carousel__slide {
        transition: none;
    }
}
