/**
 * SISTEMA DE TRANSICIONES — El Heraldo del Cambio
 */

/* ===== BASE ===== */
html {
    scrollbar-gutter: stable;
    overflow-y: scroll;
}

/* ===== VIEW TRANSITIONS API (Chrome/Edge/Brave 126+, Safari 18.2+) ===== */
@view-transition {
    navigation: auto;
}

/* El header tiene el mismo aspecto en todas las páginas → animation:none = 100% estático */
header {
    view-transition-name: cabecera-heraldo;
}
::view-transition-old(cabecera-heraldo),
::view-transition-new(cabecera-heraldo) {
    animation: none;
    mix-blend-mode: normal;
}

/* El nav cambia el link activo entre páginas → crossfade rápido en vez de snap */
nav {
    view-transition-name: nav-heraldo;
}
/* El nav se mantiene 100% estático al igual que la cabecera */
::view-transition-old(nav-heraldo),
::view-transition-new(nav-heraldo) {
    animation: none;
    mix-blend-mode: normal;
}

/* El contenido hace fade + slide */
#page-content-area {
    view-transition-name: contenido-heraldo;
}
::view-transition-old(contenido-heraldo) {
    animation: 0.2s ease-out both vt-fade-out;
}
::view-transition-new(contenido-heraldo) {
    animation: 0.28s ease-out both vt-fade-in;
}

@keyframes vt-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0);   }
}
@keyframes vt-fade-out {
    from { opacity: 1; transform: translateY(0);    }
    to   { opacity: 0; transform: translateY(-4px); }
}

/* ===================================================================
   FALLBACK CSS — solo activo cuando View Transitions NO está soportado
   (Firefox). Con VT, el #page-content-area NO debe tener pca-fade-in
   porque entra en conflicto con ::view-transition-new.
   =================================================================== */
@supports not (view-transition-name: none) {
    /* Firefox: animación de entrada manual */
    #page-content-area {
        animation: pca-fade-in 0.28s ease-out both;
    }
    #page-content-area.pca-exiting {
        opacity: 0 !important;
        transform: translateY(-3px) !important;
        transition: opacity 0.18s ease-out, transform 0.18s ease-out !important;
        animation: none !important;
        pointer-events: none;
    }
    @keyframes pca-fade-in {
        from { opacity: 0; transform: translateY(4px); }
        to   { opacity: 1; transform: translateY(0);   }
    }
}

/* ===== GALERÍA: transiciones internas ===== */
.seccion-fade {
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.seccion-oculta {
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
}

/* ===== MICRO-INTERACCIONES ===== */
a {
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out,
                opacity 0.2s ease-in-out;
}
button, .btn {
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
                border-color 0.2s ease-in-out !important;
}

/* ===== LIGHTBOX ===== */
#lightbox {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
#lightbox.open { opacity: 1; }
#lightbox-img  { transition: opacity 0.2s ease-in-out; }

/* ===== SKELETON LOADERS ===== */
@keyframes skeleton-pulse {
    0%   { background-color: #f0f0f0; }
    50%  { background-color: #e0e0e0; }
    100% { background-color: #f0f0f0; }
}
.skeleton-box {
    animation: skeleton-pulse 1.5s infinite ease-in-out;
    border-radius: 4px;
    display: block;
    width: 100%;
    color: transparent !important;
}
.skeleton-text {
    height: 1em;
    margin-bottom: 0.6em;
    border-radius: 4px;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}
.skeleton-text.short  { width: 60%; }
.skeleton-text.medium { width: 85%; }
.skeleton-img {
    width: 100%;
    aspect-ratio: 4/3;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

/* ===== RETRY BUTTON ===== */
.retry-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 18px;
    background: transparent;
    border: 1px solid var(--negro, #111);
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    cursor: pointer;
    color: var(--negro, #111);
}
.retry-btn:hover { background: var(--negro, #111); color: white; }

/* ===== ZERO CLS ===== */
.ad-banner-slot {
    min-height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ad-sidebar-slot {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ===== FOOTER MÓVIL ===== */
@media (max-width: 600px) {
    .footer-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 25px 20px;
    }
    .footer-section:nth-child(1) { grid-column: 1; grid-row: 1; }
    .footer-section:nth-child(2) { grid-column: 2; grid-row: 1 / 3; }
    .footer-section:nth-child(3) { grid-column: 1; grid-row: 2; }
    .footer-section:last-child   { grid-column: 1 / 3; grid-row: 3; }
}

/* ===== HAMBURGER NAV (móvil) ===== */
.hamburger-bar { display: none; }

@media (max-width: 600px) {
    .hamburger-bar {
        display: flex;
        justify-content: center;
        padding: 12px 0;
        border-top: 1px solid var(--negro);
        border-bottom: 1px solid var(--negro);
    }
    #hamburger-btn {
        background: transparent;
        border: none;
        font-family: 'Source Sans 3', sans-serif;
        font-weight: 700;
        font-size: 0.75rem;
        letter-spacing: 0.15em;
        text-transform: uppercase;
        cursor: pointer;
        color: var(--negro);
        display: flex;
        align-items: center;
        gap: 8px;
    }
    #main-nav-inner {
        display: none !important;
        flex-direction: column !important;
        border-top: none !important;
        background: white;
    }
    #main-nav-inner.nav-open { display: flex !important; }
    #main-nav-inner a {
        border-bottom: 1px solid var(--gris-borde);
        border-radius: 0 !important;
        padding: 14px 20px !important;
        text-align: center;
    }
}
