/* ============================================================
   1. RESETEO Y NORMALIZACIÓN GLOBAL
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #fafafa;
    color: #222;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Control estricto para evitar que las imágenes se desborden o se vean gigantes */
img, video {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ============================================================
   2. HEADER Y MENÚ PRINCIPAL (Visible en todas las páginas/noticias)
   ============================================================ */

.top-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: #ffffff;
    border-bottom: 1px solid #e5e5e5;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo img {
    height: 55px;
    max-height: 55px;
    width: auto;
    object-fit: contain;
}

/* MENÚ ESCRITORIO (PC) */
.menu {
    display: flex !important; /* Garantiza visibilidad por defecto en pantallas grandes */
    gap: 25px;
    align-items: center;
}

.menu a {
    font-size: 18px;
    font-weight: bold;
    color: #222222;
    transition: color 0.2s ease;
}

.menu a:hover,
.menu a:focus-visible {
    color: #0077ff;
}

/* MENÚ MÓVIL (Oculto en PC por defecto) */
.menu-toggle {
    display: none;
    font-size: 32px;
    cursor: pointer;
    user-select: none;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: #ffffff;
    border-bottom: 1px solid #dddddd;
    padding: 10px 20px;
}

.mobile-menu a {
    padding: 12px 0;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    font-weight: bold;
}

.mobile-menu a:last-child {
    border-bottom: none;
}

/* Clase dinámica para abrir el menú móvil con JS */
.mobile-menu.active {
    display: flex !important;
}

.hidden {
    display: none !important;
}

/* ============================================================
   3. HOME / INICI (.home-hero)
   ============================================================ */

.home-hero {
    position: relative;
    max-width: 1400px;
    margin: 40px auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,0.15);
}

.home-hero-img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    filter: brightness(75%);
}

.home-hero-text {
    position: absolute;
    bottom: 30px;
    left: 40px;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(0,0,0,0.6);
}

.home-hero-text h1 {
    font-size: 42px;
    margin: 0 0 10px 0;
}

.home-hero-text p {
    font-size: 20px;
    max-width: 600px;
    line-height: 1.5;
}

/* ============================================================
   4. BLOG Y LISTADO DE CATEGORÍAS/NOTICIAS
   ============================================================ */

.blog-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.sidebar {
    width: 280px;
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    height: fit-content;
    box-shadow: 0 0 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 90px;
}

.sidebar h3 {
    margin-bottom: 15px;
    font-size: 20px;
}

.sidebar a {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
    color: #222;
}

.sidebar a:hover {
    color: #0077ff;
}

/* GRID DE ARTÍCULOS EN 3 COLUMNAS */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.blog-card {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    height: 380px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.blog-thumb {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.blog-info {
    padding: 15px;
}

.blog-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.blog-date {
    font-size: 14px;
    color: #777;
}

/* ============================================================
   5. NOTICIA INDIVIDUAL / POST
   ============================================================ */

.post-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
}

.post-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 25px;
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.post-image:hover {
    transform: scale(1.01);
}

.titol1 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.post-date {
    font-size: 16px;
    color: #777777;
    margin-bottom: 25px;
}

.post-content {
    font-size: 20px;
    line-height: 1.8;
    margin-bottom: 40px;
}

/* GALERÍA DENTRO DE LA NOTICIA */
.post-gallery {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.post-thumb {
    width: 100%;
    height: 180px;
    border-radius: 8px;
    object-fit: cover;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: zoom-in;
}

.post-thumb:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(0,0,0,0.25);
}

/* ============================================================
   6. BOTONES DE NAVEGACIÓN ENTRE NOTICIAS (.nav-posts)
   ============================================================ */

.nav-posts {
    width: 100%;
    max-width: 900px;
    margin: 40px auto 20px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.nav-posts a {
    background-color: #ffffff;
    border: 2px solid #0077ff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: #0077ff;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    min-width: 160px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.nav-posts a:hover,
.nav-posts a:focus-visible {
    background-color: #0077ff;
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 119, 255, 0.3);
    outline: none;
}

.btn-prev { margin-right: auto; }
.btn-next { margin-left: auto; }

.btn-prev::before {
    content: "←";
    font-size: 1.2em;
    margin-right: 8px;
    line-height: 1;
}

.btn-next::after {
    content: "→";
    font-size: 1.2em;
    margin-left: 8px;
    line-height: 1;
}

/* ============================================================
   7. CONTACTO
   ============================================================ */

.contact-container {
    max-width: 700px;
    margin: 50px auto;
    padding: 20px;
}

.contact-title {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.contact-subtitle {
    font-size: 18px;
    text-align: center;
    margin-bottom: 30px;
    color: #555555;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-form label {
    font-weight: bold;
    font-size: 16px;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
    background: #ffffff;
}

.contact-form textarea {
    height: 150px;
    resize: vertical;
}

.contact-btn {
    padding: 14px;
    background: #0077ff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s ease;
}

.contact-btn:hover {
    background: #005fcc;
}

/* ============================================================
   8. FOOTER
   ============================================================ */

.footer {
    background: #111111;
    color: #eeeeee;
    padding: 40px 20px;
    margin-top: 60px;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-logo img {
    height: 45px;
    max-height: 45px;
    margin: 0 auto 15px auto;
}

.footer-links {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 25px;
}

.footer-links a {
    color: #eeeeee;
    font-size: 16px;
    font-weight: bold;
}

.footer-links a:hover {
    color: #4da3ff;
}

.footer-copy {
    font-size: 14px;
    opacity: 0.7;
}

/* ============================================================
   9. MODAL DE FOTOS Y VÍDEOS (ZOOM Y NAVEGACIÓN)
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.92);
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    cursor: grab;
    transition: transform 0.15s ease;
    user-select: none;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    font-size: 40px;
    color: #ffffff;
    cursor: pointer;
    font-weight: bold;
    z-index: 999999;
}

.modal-nav {
    position: absolute;
    top: 50%;
    font-size: 55px;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
    padding: 10px;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
}

.modal-prev { left: 30px; }
.modal-next { right: 30px; }

.modal-nav:hover {
    opacity: 0.6;
}

/* ============================================================
   10. ADAPTACIÓN RESPONSIVE (MÓVILES Y TABLETS)
   ============================================================ */

@media (max-width: 900px) {
    /* Menú móvil */
    .menu { display: none !important; }
    .menu-toggle { display: block !important; }

    /* Estructura del blog */
    .sidebar { display: none; }

    .blog-wrapper {
        display: block;
        padding: 10px;
    }

    .blog-grid {
        grid-template-columns: repeat(1, 1fr);
    }

    /* Ajuste visual general */
    .home-hero-img {
        height: 300px;
    }

    .home-hero-text h1 {
        font-size: 30px;
    }

    .home-hero-text p {
        font-size: 16px;
    }

    /* Botones de navegación de noticias en móviles */
    .nav-posts {
        padding: 0 10px;
    }

    .nav-posts a {
        font-size: 0.9rem;
        padding: 10px 14px;
        min-width: 120px;
    }
}

@media (min-width: 901px) {
    /* Forzado estricto para mantener el menú visible siempre en PC */
    .menu { display: flex !important; }
    .menu-toggle { display: none !important; }
    .mobile-menu { display: none !important; }
}