body { font-family: 'Lexend', sans-serif; margin: 0; background-color: #f9f9f9; color: #333; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Header y Logo (Escritorio) --- */
.fixed-logo { position: fixed; top: 30px; left: 40px; z-index: 1001; }
.fixed-logo img { height: 40px; width: auto; }
.main-header { position: fixed; top: 20px; right: 20px; left: 20px; z-index: 1000; display: flex; justify-content: flex-end; align-items: center; padding: 10px 20px; transition: top 0.4s ease-in-out; }
.main-header.nav-hidden { top: -100px; }
.nav-wrapper { background-color: rgba(255, 255, 255, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 10px; padding: 10px 20px; display: flex; align-items: center; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.main-nav { display: flex; }
.main-nav a { color: #333; text-decoration: none; margin: 0 20px; font-weight: 500; position: relative; padding: 5px 0; }
.main-nav a.active { font-weight: 700; }
.main-nav a.active::after, .main-nav a:hover::after { content: ''; position: absolute; bottom: -2px; left: 0; width: 100%; height: 2px; background-color: #c5a47e; }
.cta-button { background-color: #b39169; color: #fff; padding: 12px 25px; border-radius: 5px; text-decoration: none; font-weight: 600; margin-left: 20px; transition: background-color 0.3s ease, transform 0.2s ease; }
.cta-button:hover { background-color: #3c4a6b; transform: scale(1.05);  }
.mobile-nav-toggle { display: none; }

/* --- Hero de Página --- */
.page-hero { position: relative; height: 50vh; min-height: 350px; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; text-align: center; }
.hero-bg { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-size: cover; background-position: center; animation: kenburns 20s ease-out infinite; z-index: 1; }
.hero-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(to top, rgba(0,0,0,0.5), rgba(26, 42, 74, 0.6)); z-index: 2; }
.hero-content { position: relative; z-index: 3; }
.hero-content h1 { font-size: 4rem; text-shadow: 2px 2px 8px rgba(0,0,0,0.5); }
@keyframes kenburns { 0% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* --- Cuadrícula de Publicaciones --- */
.page-container { max-width: 1200px; margin: 0 auto; padding: 80px 40px; }
.publications-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 40px; }
.publication-card { background-color: #fff; border-radius: 10px; box-shadow: 0 5px 25px rgba(0,0,0,0.07); display: flex; flex-direction: column; overflow: hidden; }
.card-image { width: 100%; height: 200px; object-fit: cover; }
.card-content { padding: 25px; display: flex; flex-direction: column; flex-grow: 1; }
.card-category { background-color: #1a2a4a; color: #fff; padding: 5px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; align-self: flex-start; margin-bottom: 15px; }
.card-title { font-size: 1.4rem; color: #1a2a4a; margin: 0 0 10px 0; line-height: 1.4; }
.card-summary { color: #555; line-height: 1.6; flex-grow: 1; margin-bottom: 20px; }
.read-more-btn { background-color: #c5a47e; color: #fff; border: none; padding: 12px 25px; border-radius: 5px; font-weight: 600; cursor: pointer; transition: background-color 0.3s; align-self: flex-start; }
.read-more-btn:hover { background-color: #b39169; }

/* --- Estilos del Modal --- */
#modal-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease; }
#modal-container.is-visible { opacity: 1; visibility: visible; }
.modal-content { background-color: #fff; padding: 40px; border-radius: 10px; max-width: 700px; width: 90%; max-height: 85vh; overflow-y: auto; position: relative; transform: scale(0.95); transition: transform 0.4s ease; }
#modal-container.is-visible .modal-content { transform: scale(1); }
.modal-close-btn { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 2.5rem; color: #aaa; cursor: pointer; line-height: 1; }
#modal-title { font-size: 2.2rem; color: #1a2a4a; margin: 0 0 20px 0; }
#modal-body p { font-size: 1.1rem; line-height: 1.8; color: #555; }

/* --- Pre-Footer y Footer --- */
.pre-footer { background:#f5f6f7; padding:80px 20px; text-align:center; }
.pre-footer-content { max-width:900px; margin: 0 auto; }
.pre-footer h2 { font-size:2.2rem; color:#1a2a4a; margin:0 0 12px; }
.pre-footer p { color:#465161; margin:0 0 26px; line-height: 1.7;}
.cta-button-footer { display:inline-block; background:#c5a47e; color:#fff; text-decoration:none; font-weight:700; padding:14px 28px; border-radius:8px; transition: transform .1s, background .2s; }
.cta-button-footer:hover { background:#b39169; transform: translateY(-1px); }
.main-footer-container { background-color: #1a2a4a; color: #e0e0e0; padding: 60px 40px 20px; }
.footer-content { display: flex; flex-wrap: wrap; justify-content: space-between; max-width: 1200px; margin: 0 auto; gap: 40px; }
.footer-column { flex: 1; min-width: 220px; }
.footer-brand { max-width: 180px; height: auto; display: block; filter: brightness(0) invert(1); }
.footer-tagline { font-style: italic; color: #c5a47e; }
.footer-column h4 { font-size: 1.2rem; color: #fff; margin-bottom: 20px; font-weight: 600; position: relative; padding-bottom: 10px; }
.footer-column h4::after { content: ''; position: absolute; bottom: 0; left: 0; width: 40px; height: 2px; background-color: #c5a47e; }
.footer-column a, .footer-column p { color: #e0e0e0; text-decoration: none; display: block; margin-bottom: 10px; line-height: 1.7; }
.footer-column a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { text-align: center; border-top: 1px solid #3c4a6b; padding-top: 20px; margin-top: 40px; font-size: 0.9rem; color: #a0a0a0; }

/* --- Clases de Animación --- */
.hidden-item { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.hidden-item.is-visible { opacity: 1; transform: translateY(0); }
.hidden-hero-text { opacity: 0; transform: translateY(20px); transition: opacity 1s ease-out 0.5s, transform 1s ease-out 0.5s; }
.hidden-hero-text.is-visible { opacity: 1; transform: translateY(0); }

/* ============================ */
/* === RESPONSIVE UNIFICADO === */
/* ============================ */
@media (max-width: 992px) {
    .page-hero h1 { font-size: 3.2rem; }
    .page-container { padding: 60px 30px; }
    .publications-grid { gap: 30px; }
}

@media (max-width: 768px) {
    /* --- Menú Hamburguesa --- */
    .mobile-nav-toggle {
        display: block; position: relative; z-index: 1001;
        width: 28px; height: 20px;
        background: transparent; border: 0; padding: 0; cursor: pointer;
    }
    .mobile-nav-toggle::before, .mobile-nav-toggle::after {
        content: ''; position: absolute; left: 0;
        width: 100%; height: 3px; background: #fff;
        border-radius: 2px; transition: transform .3s, top .3s, bottom .3s;
    }
    .mobile-nav-toggle::before { top: 0; }
    .mobile-nav-toggle::after { bottom: 0; }
    .nav-open .mobile-nav-toggle::before { top: 8.5px; transform: rotate(45deg); }
    .nav-open .mobile-nav-toggle::after { bottom: 8.5px; transform: rotate(-45deg); }
    body.nav-open { overflow: hidden; }

    .fixed-logo { top: 20px; left: 20px; }
    .fixed-logo img { height: 35px; }
    .main-header { padding: 15px 20px; }
    .nav-wrapper { background: none; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border: none; padding: 0; }
    .main-nav {
        display: none; position: fixed; z-index: 1000;
        inset: 0 0 0 30%;
        flex-direction: column; justify-content: center; align-items: center; gap: 3rem;
        padding: min(20vh, 10rem) 2em;
        background: rgba(26, 42, 74, 0.95);
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        transform: translateX(100%); transition: transform 0.4s ease-out;
    }
    .nav-open .main-nav { display: flex; transform: translateX(0%); }
    .main-nav a { color: white; margin: 0; font-size: 1.1rem; }
    .main-nav a.active::after, .main-nav a:hover::after { display: none; }
    .main-nav .cta-button { border: 2px solid #c5a47e; background-color: transparent; padding: 12px 30px; border-radius: 50px; }

    /* --- Otros Ajustes --- */
    .page-hero { height: 40vh; min-height: 280px; }
    .hero-content h1 { font-size: 2.5rem; }
    .page-container { padding: 50px 20px; }
    .publications-grid { gap: 25px; }
    .card-title { font-size: 1.2rem; }
    .modal-content { padding: 30px; }
    #modal-title { font-size: 1.8rem; }
    #modal-body p { font-size: 1rem; line-height: 1.7; }
    .pre-footer { padding: 60px 20px; }
    .pre-footer h2 { font-size: 1.8rem; }
    .footer-content { flex-direction: column; text-align: center; }
    .footer-column h4::after { left: 50%; transform: translateX(-50%); }
    .footer-brand { margin: 0 auto 15px; }
}

@media (max-width: 480px) {
    .hero-content h1 { font-size: 2rem; }
    .publications-grid { grid-template-columns: 1fr; }
    .card-content { padding: 20px; }
    .modal-content { width: 95%; padding: 25px; }
    .modal-close-btn { top: 10px; right: 15px; font-size: 2rem; }
    .footer-content { grid-template-columns: 1fr; }
}

#modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; /* Oculto por defecto */
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 15px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}