/*
Theme Name: Siglo Informativo
Theme URI: http://sigloinformativo.com
Author: 01Digital
Description: Un tema de noticias moderno, limpio y 100% responsivo para Siglo Informativo.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sigloinformativo
*/

:root {
    --primary-color: #363737;
    --secondary-color: #64748B;
    --background-color: #F5F5F5;
    --text-color: #363737;
    --meta-color: #64748B;
    --border-color: #E2E8F0;
    --max-width: 1200px;
    --spacing: 1.5rem;
}

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

body {
    font-family: 'Lora', serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
}

/* Header & Navigation */
.site-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.site-header .container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-branding {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0;
}

.custom-logo-link {
    display: block;
}

.custom-logo {
    max-width: 300px;
    height: auto;
    display: block;
}

.site-title {
    font-family: 'Merriweather', serif;
    font-size: 2.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 1rem;
}

.main-navigation {
    text-align: center;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.main-navigation li a {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary-color);
}

.main-navigation li a:hover {
    color: var(--primary-color);
}

/* Mobile Navigation */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    position: relative;
    flex-shrink: 0;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease-in-out;
}

/* When the menu is open, the X stays in same position — no repositioning needed */

/* Transform to Close Icon */
.menu-toggle.is-active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 1023px) {
    .main-navigation {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: #FFFFFF;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 1000;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 80px 20px 20px;
        text-align: left;
    }

    .main-navigation.is-active {
        right: 0;
    }

    .main-navigation ul {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .main-navigation li a {
        font-size: 1.125rem;
        display: block;
        padding: 0.5rem 0;
        width: 100%;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (min-width: 1024px) {
    .site-header .container {
        display: block;
    }
    .site-branding {
        justify-content: center;
        margin-bottom: 2rem;
    }
    .site-title {
        text-align: center;
    }
    .menu-toggle {
        display: none;
    }
}

/* ── Submenu Chevron ── */
.submenu-chevron {
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    transition: transform 0.25s ease;
    color: var(--secondary-color);
}

/* Rotate chevron when submenu is visible */
.menu-item-has-children:hover > a .submenu-chevron,
.menu-item-has-children.submenu-open > a .submenu-chevron {
    transform: rotate(180deg);
}

/* ── Submenu dropdown (desktop) ── */
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    min-width: 180px;
    padding: 0.5rem 0;
    padding-top: 8px; /* bridges the invisible gap so hover doesn't break */
    margin-top: 0;
    z-index: 500;
    list-style: none;
}

.main-navigation .sub-menu li a {
    display: block;
    padding: 0.6rem 1.25rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--secondary-color);
    white-space: nowrap;
    border-bottom: none;
}

.main-navigation .sub-menu li a:hover {
    color: var(--primary-color);
    background: var(--background-color);
}

/* Show submenu on hover (desktop) */
@media (min-width: 1024px) {
    .main-navigation li {
        position: relative;
    }

    .main-navigation .menu-item-has-children:hover > .sub-menu {
        display: block;
        animation: submenu-in 0.18s ease;
    }
}

@keyframes submenu-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

/* ── Submenu on mobile ── */
@media (max-width: 1023px) {
    .main-navigation .sub-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border: none;
        border-left: 3px solid var(--border-color);
        border-radius: 0;
        min-width: unset;
        padding: 0.25rem 0 0.25rem 1rem;
        background: transparent;
        display: none;
    }

    .menu-item-has-children.submenu-open > .sub-menu {
        display: block;
    }

    .main-navigation .sub-menu li a {
        font-size: 0.9rem;
        padding: 0.4rem 0;
        border-bottom: none;
    }
}

/* Grid Layout */
.posts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Post Cards */
.post-card {
    display: flex;
    flex-direction: column;
}

.post-card__image {
    aspect-ratio: 16/9;
    background-color: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.post-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-card__category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.post-card__title {
    font-family: 'Merriweather', serif;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.post-card__meta {
    font-size: 0.875rem;
    color: var(--meta-color);
}

/* Single View */
.single-post {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.single-post__header {
    margin-bottom: 2rem;
    text-align: center;
}

.single-post__category {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    display: block;
}

.single-post__title {
    font-family: 'Merriweather', serif;
    font-size: 1.5rem;
    /* Reduced for mobile */
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

@media (min-width: 768px) {
    .single-post__title {
        font-size: 36px;
    }
}

.single-post__meta {
    color: var(--meta-color);
    margin-bottom: 2rem;
}

.single-post__image {
    margin-bottom: 2rem;
    border-radius: 6px;
    overflow: hidden;
}

.single-post__content {
    font-size: 15px;
    line-height: 24px;
    text-align: justify;
}

.single-post__content p {
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    .single-post__content {
        font-size: 16px;
        line-height: 24px;
    }
}

.single-post__content h1,
.single-post__content h2,
.single-post__content h3,
.single-post__content h4,
.single-post__content h5,
.single-post__content h6 {
    font-family: 'Merriweather', serif;
    margin: 2rem 0 1rem;
    line-height: 1.3;
    text-align: left;
}

.single-post__content h1 {
    font-size: 1.875rem;
}

.single-post__content h2 {
    font-size: 1.5rem;
}

.single-post__content h3 {
    font-size: 1.25rem;
}

@media (min-width: 768px) {
    .single-post__content h1 {
        font-size: 2.25rem;
    }

    .single-post__content h2 {
        font-size: 1.875rem;
    }

    .single-post__content h3 {
        font-size: 1.5rem;
    }
}

/* WordPress Gallery */
.wp-block-gallery,
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

@media (min-width: 768px) {

    .wp-block-gallery,
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

.wp-block-gallery .wp-block-image,
.gallery-item {
    margin: 0 !important;
}

.wp-block-gallery img,
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0 1rem;
    margin-top: 2rem;
    margin-bottom: 0;
    text-align: center;
    color: var(--meta-color);
    font-size: 0.875rem;
}

/* Loader */
.loader-container {
    display: flex;
    /* Always flex to occupy space */
    justify-content: center;
    padding: 2rem 0;
    min-height: 20px;
    visibility: hidden;
    /* Hide by default but keep in flow */
}

.loader-container.is-active {
    visibility: visible;
}

.loader-dots {
    display: flex;
    gap: 0.5rem;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    background-color: var(--meta-color);
    border-radius: 50%;
    animation: loader-dots 0.6s infinite alternate;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loader-dots {
    from {
        transform: scale(1);
        opacity: 0.4;
    }

    to {
        transform: scale(1.5);
        opacity: 1;
    }
}

/* Lightbox */
#siglo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

#siglo-lightbox.is-open {
    display: flex;
}

#siglo-lightbox-overlay {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#siglo-lightbox-img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: block;
    animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1);    }
}

#siglo-lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 1.75rem;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10000;
}

#siglo-lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}