/* =========================
   1. RESETEO BÁSICO
   ========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

/* =========================
   2. BASE GENERAL
   ========================= */
:root {
    --color-primary: #0b3c78;
    --color-primary-dark: #082d59;
    --color-secondary: #1d4f91;
    --color-accent: #ffd54f;
    --color-text: #333333;
    --color-text-soft: #4b5563;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-border: #d9e1ea;

    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 22px rgba(0, 0, 0, 0.12);

    --container-width: 1100px;
    --transition: 0.25s ease;
    --font-base: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-base);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--color-primary);
}

.container {
    width: min(90%, var(--container-width));
    margin: 0 auto;
}

main {
    padding: 3rem 0;
    min-height: 60vh;
}

/* =========================
   3. TIPOGRAFÍA GENERAL
   ========================= */
h1,
h2,
h3 {
    color: var(--color-primary);
    line-height: 1.25;
}

h1 {
    margin-bottom: 1rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--color-primary);
}

h2 {
    margin-bottom: 0.9rem;
}

h3 {
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

.page-section > p:first-of-type,
.contact-intro {
    max-width: 75ch;
}

/* Utilidad de accesibilidad:
   Oculta visualmente un elemento,
   pero lo mantiene accesible para lectores de pantalla. */
.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;
}

/* =========================
   4. TARJETAS Y BLOQUES
   ========================= */
.card {
    background: var(--color-surface);
    padding: 30px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.page-section {
    display: block;
}

ul.list {
    margin-left: 20px;
    margin-top: 10px;
}

ul.list li {
    margin-bottom: 10px;
}

/* =========================
   5. ENCABEZADO
   ========================= */
.site-header {
    background-color: var(--color-primary);
    color: white;
    padding: 1.25rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.site-tagline {
    font-size: 0.95rem;
    color: #c8d8f0;
    margin: 0;
}

.main-nav {
    display: block;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding-bottom: 4px;
    transition: color var(--transition), border-color var(--transition);
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* Compatibilidad temporal con estructura anterior.
   Eliminar cuando todo el proyecto use:
   .site-header, .main-nav y .nav-menu */
header {
    background-color: var(--color-primary);
    color: white;
    padding: 1.25rem 0;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

nav a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition), border-color var(--transition);
    border-bottom: 2px solid transparent;
}

nav a:hover,
nav a.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

/* =========================
   6. PIE DE PÁGINA
   ========================= */
.site-footer {
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

.site-footer p {
    font-size: 0.95rem;
    margin: 6px 0;
}

.footer-institution {
    opacity: 0.9;
}

/* Compatibilidad temporal con footer antiguo.
   Eliminar cuando todo use .site-footer */
footer {
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: auto;
}

footer p {
    font-size: 0.9rem;
    margin-bottom: 5px;
}

/* =========================
   7. SECCIÓN HERO / INICIO
   ========================= */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    flex-wrap: nowrap;
}

.hero-text {
    flex: 1 1 65%;
}

.hero-text h1 {
    font-size: 2.4rem;
    color: var(--color-primary);
    margin-bottom: 20px;
    border-bottom: 3px solid var(--color-primary);
    display: inline-block;
    padding-bottom: 8px;
}

.hero-text p {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--color-text);
    margin-bottom: 18px;
}

.hero-image {
    flex: 0 0 300px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hero-image img {
    width: 100%;
    max-width: 300px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 4px solid #ffffff;
}

/* =========================
   8. VISTAS PREVIAS / HOME
   ========================= */
.preview-section {
    margin-top: 30px;
}

.preview-grid,
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.preview-card,
.content-card,
.article-item,
.book-card,
.profile-card,
.software-card {
    background: var(--color-surface);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e8edf3;
    padding: 18px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.preview-card:hover,
.content-card:hover,
.article-item:hover,
.book-card:hover,
.profile-card:hover,
.software-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.preview-card img,
.content-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 12px;
}

.preview-card h3,
.content-body h2,
.content-body h3,
.article-item h2,
.article-item h3 {
    color: #1f2d3d;
    margin-bottom: 10px;
}

.preview-card p,
.content-body p,
.article-item p {
    color: #444;
    line-height: 1.7;
}

.section-action {
    margin-top: 20px;
    text-align: center;
}

/* =========================
   9. BOTONES Y ENLACES
   ========================= */
.btn-link,
.btn-more {
    display: inline-block;
    margin-top: 12px;
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 700;
    transition: color var(--transition);
}

.btn-link:hover,
.btn-more:hover {
    color: var(--color-primary-dark);
}

.btn-submit {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 14px 22px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition), transform 0.2s ease;
}

.btn-submit:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

/* =========================
   10. CONTACTO
   ========================= */
.contact-section {
    background: #f2f2f2;
}

.contact-intro {
    font-size: 1.05rem;
    color: var(--color-text);
    line-height: 1.7;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-secondary);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
}

.contact-info h2,
.contact-info h3 {
    color: var(--color-primary);
    margin-bottom: 15px;
}

.contact-info p {
    margin-bottom: 18px;
    font-size: 1rem;
    line-height: 1.6;
}

.contact-info a {
    color: var(--color-secondary);
    text-decoration: none;
}

.contact-info a:hover {
    text-decoration: underline;
}

.contact-note {
    background: #f7f9fc;
    padding: 14px;
    border-left: 4px solid var(--color-secondary);
    border-radius: 8px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #1c1c1c;
}

.form-group input,
.form-group textarea,
.search-box input {
    padding: 14px 16px;
    border: 1px solid #cfcfcf;
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.search-box input:focus {
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(29, 79, 145, 0.12);
}

/* =========================
   11. PUBLICACIONES
   ========================= */
.publicaciones-section h2 {
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--color-primary);
}

.books-grid,
.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 20px;
}

.book-card img {
    width: 100%;
    max-width: 180px;
    height: auto;
    margin: 0 auto 15px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.book-card h3,
.profile-card h3,
.software-card h3 {
    color: var(--color-primary);
    margin-bottom: 10px;
}

.book-card a,
.profile-card a,
.software-card a {
    display: inline-block;
    margin-top: 10px;
    text-decoration: none;
    font-weight: 600;
}

.book-card a:hover,
.profile-card a:hover,
.software-card a:hover {
    text-decoration: underline;
}

.profile-card {
    text-align: center;
}

.icon {
    width: 50px;
    margin: 0 auto 10px;
}

.profile-card a {
    padding: 8px 12px;
    background: #1a73e8;
    color: white;
    border-radius: 6px;
    text-decoration: none;
}

.profile-card a:hover {
    text-decoration: none;
    background: #155fbe;
}

.software-card p {
    font-size: 0.95rem;
    color: var(--color-text-soft);
    margin: 6px 0;
    line-height: 1.5;
}

.software-card p strong {
    color: #111827;
}

.software-card a {
    margin-right: 8px;
    padding: 8px 14px;
    font-size: 0.9rem;
    border-radius: 6px;
    color: #fff;
    background: #0b8043;
    transition: background var(--transition);
}

.software-card a:hover {
    background: #086c36;
    text-decoration: none;
}

.icon-indecopi {
    width: 140px;
    height: auto;
    margin-top: 6px;
    vertical-align: middle;
}

/* =========================
   12. SISTEMA EDITORIAL
   Videos / Artículos / Filtros
   ========================= */

/* Barra superior de filtros y búsqueda */
.posts-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 24px 0;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: #f7f9fc;
}

/* Grupo de botones de filtro */
.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Botones del sistema de filtrado */
.filter-btn {
    border: 1px solid var(--color-secondary);
    background: white;
    color: var(--color-secondary);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--color-secondary);
    color: white;
}

/* Campo de búsqueda del sistema editorial */
.search-box input {
    min-width: 280px;
}

/* Etiquetas de tipo de contenido */
.content-tag {
    display: inline-block;
    background: #e8f0fb;
    color: var(--color-primary);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Metadatos de videos y artículos */
.content-meta,
.article-meta {
    font-size: 0.92rem;
    color: #5b6570;
    margin-bottom: 10px;
}

/* Lista vertical de artículos */
.articles-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 20px;
}

/* =========================
   13. RESPONSIVE
   Ajustes para tablets y móviles
   ========================= */
@media (max-width: 768px) {
    main {
        padding: 2rem 0;
    }

    .card {
        padding: 22px;
    }

    /* Header responsive */
    .site-header,
    header {
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .logo {
        width: 100%;
    }

    .site-title {
        font-size: 1.2rem;
    }

    .site-tagline {
        font-size: 0.92rem;
        line-height: 1.45;
        max-width: 34ch;
    }

    .main-nav {
        width: 100%;
    }

    .nav-menu,
    nav ul {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px 16px;
        justify-content: flex-start;
    }

    .nav-menu a,
    nav a {
        display: inline-block;
        font-size: 1rem;
    }

    /* Hero en móvil */
    .hero-section {
        flex-direction: column-reverse;
        align-items: flex-start;
    }

    .hero-text,
    .hero-image {
        width: 100%;
        flex: 1 1 100%;
    }

    .hero-image {
        justify-content: center;
    }

    .hero-image img {
        max-width: 260px;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    /* Contacto */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    /* Toolbar editorial */
    .posts-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        justify-content: flex-start;
    }

    .search-box input {
        min-width: 100%;
        width: 100%;
    }
}

.preview-card {
    background: var(--color-surface);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e8edf3;
    padding: 18px;
}

/* Enlace envolvente de tarjeta */
.preview-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.preview-card-link:hover,
.preview-card-link:focus {
    text-decoration: none;
}

/* =========================
   LOGOTIPO + TEXTO
   ========================= */
.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.25);
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.site-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin: 0;
    line-height: 1.1;
}

.site-tagline {
    margin: 4px 0 0 0;
    color: #dbe7ff;
    font-size: 1rem;
}