/*
Theme Name: AI Publisher Theme
Theme URI: 
Author: AI Publisher Team
Author URI: 
Description: Tema WordPress profesional, ultraligero y enfocado en contenido, SEO, velocidad y monetización.
Version: 1.0.1
Text Domain: ai-publisher-theme
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPLv2 or later
*/

/* ==========================================================================
   CSS Variables & Base Reset
   ========================================================================== */
:root {
    /* Colors (Fallback si wp_add_inline_style falla) */
    --primary-color: #0073aa;
    --secondary-color: #1e293b;
    --accent-color: #ff5722;
    --heading-color: #0f172a;
    --text-color: #334155;
    --text-light: #666666;
    --bg-body: #f4f6f8;
    --bg-content: #ffffff;
    --header-bg: #ffffff;
    --header-text: #1e293b;
    --header-hover: #0073aa;
    --footer-bg: #0f172a;
    --footer-text: #94a3b8;
    --footer-link: #ffffff;
    --category-color: #8a2be2;
    --border-color: #eaeaea;
    --link-hover: #005177;

    /* Typography */
    --font-primary: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;

    /* Layout */
    --container-max: 95%;
    --sidebar-width: 300px;
    --gap: 30px;
    --radius: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    color: var(--text-color);
    background-color: var(--bg-body);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
figure,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover,
a:focus {
    color: var(--link-hover);
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.3;
    font-weight: 700;
    color: var(--heading-color, #0f172a);
}

h1 {
    font-size: 2.5rem;
    margin-top: 0;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-top: 0;
    margin-bottom: 1.5em;
}

/* ==========================================================================
   Layout (Mobile First)
   ========================================================================== */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Site header styling is handled dynamically via Tailwind CSS in header.php */

/* ==========================================================================
   3-Column Master Layout Grid System (Responsive Desktop, Tablet, Mobile)
   ========================================================================== */
.site-main-container {
    width: 100%;
    box-sizing: border-box;
}

/* Columna Izquierda (Anuncios AdSense / Sidebar Izquierdo) */
.site-sidebar-left {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

/* .site-content styles are handled dynamically via Tailwind CSS in PHP templates */

/* Columna Derecha (Widgets de WordPress / Sidebar Derecho) */
.site-sidebar-right {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.site-sidebar {
    background: var(--bg-content);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}



/* Legacy footer styling rules removed. Handled via Tailwind CSS in footer.php. */

/* ==========================================================================
   Components: Post Cards
   ========================================================================== */
/* Legacy Post Card components styles removed. Handled via Tailwind CSS. */

/* ==========================================================================
   Category Carousels (Sleek Borderless Controls, Expanded Cards, Fully Responsive)
   ========================================================================== */
/* .ai-home-h1-title styles are handled dynamically via Tailwind CSS in front-page.php */

.ai-carousel-section {
    margin-bottom: 35px;
}

.ai-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.ai-section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--heading-color, #0f172a);
    margin: 0;
}

.ai-view-all-link {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary-color, #0073aa);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.ai-view-all-link:hover {
    opacity: 0.8;
}

/* Container & Track */
.ai-carousel-container {
    position: relative;
    width: 100%;
    padding: 0 20px;
    /* Reducido para mayor área de contenido */
    box-sizing: border-box;
}

.ai-carousel-track-wrapper {
    overflow: hidden;
    width: 100%;
    padding: 6px 0;
}

.ai-carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.ai-carousel-slide {
    flex: 0 0 100%;
    /* Móvil */
    box-sizing: border-box;
    padding: 0 6px;
    /* Ajustado para eliminar márgenes excesivos */
}

@media (min-width: 768px) {
    .ai-carousel-slide {
        flex: 0 0 50%;
        /* Tablet */
    }
}

@media (min-width: 1024px) {
    .ai-carousel-slide {
        flex: 0 0 33.333%;
        /* Escritorio */
    }
}

/* Navigation Arrow Buttons: Clean, Vertically Centered & 100% Stationary */
.ai-carousel-prev,
.ai-carousel-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    color: var(--text-color, #1e293b) !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none !important;
    transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ai-carousel-prev {
    left: -8px !important;
}

.ai-carousel-next {
    right: -8px !important;
}

.ai-carousel-prev:hover:not(:disabled),
.ai-carousel-next:hover:not(:disabled) {
    background: transparent !important;
    color: var(--primary-color, #0073aa) !important;
    border: none !important;
    transform: translateY(-50%) scale(1.25) !important;
    /* Crece la flecha levemente */
}

.ai-carousel-prev:disabled,
.ai-carousel-next:disabled {
    opacity: 0.15;
    cursor: not-allowed;
    background: transparent !important;
    color: #cbd5e1 !important;
    transform: translateY(-50%) !important;
}

.ai-carousel-prev svg,
.ai-carousel-next svg {
    width: 22px;
    height: 22px;
}

/* Post Cards inside Carousel: Expanded, Roomy & Clean */
.ai-carousel-slide .ai-post-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-content, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    padding: 0;
    overflow: hidden;
    box-shadow: none;
}

.ai-carousel-slide .ai-post-card:hover {
    transform: none;
    box-shadow: none;
}

.ai-carousel-slide .ai-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: left;
}

.ai-carousel-slide .entry-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 8px 0 12px 0;
    text-align: left;
}

.ai-carousel-slide .entry-title a {
    color: var(--heading-color, #0f172a);
    text-decoration: none;
}

.ai-carousel-slide .entry-title a:hover {
    color: var(--primary-color, #0073aa);
}

.ai-carousel-slide .ai-card-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ==========================================================================
   Hero Featured CTAs Section (Dynamic Magazine Layout)
   ========================================================================== */
/* Legacy popular grid section styles removed. Styled using Tailwind utility classes in front-page.php. */

/* Featured Post */
.ai-featured-post {
    background: var(--bg-content);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.ai-featured-thumbnail img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.ai-featured-content {
    padding: 30px;
}

.ai-featured-post .entry-title {
    font-size: 2rem;
    margin-top: 10px;
}

.ai-featured-post .entry-summary {
    font-size: 1.1rem;
}

/* ==========================================================================
   Components: Single Post
   ========================================================================== */
.single .ai-single-main-content>.entry-header {
    text-align: left;
    margin-bottom: 24px;
}

.single .ai-single-main-content>.entry-header>.entry-title {
    text-align: left;
    font-size: clamp(1.5rem, 3vw, 2.1rem) !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    color: var(--heading-color, #0f172a);
    margin: 10px 0 14px 0;
}

.single .entry-meta {
    text-align: left;
    color: var(--text-light, #64748b);
    font-size: 0.88rem;
    margin-top: 8px;
}

/* Restablecer Títulos de Tarjetas (Artículos Relacionados, Carruseles, Grilla) */
.ai-post-card .entry-title,
.ai-related-grid .ai-post-card .entry-title,
.ai-carousel-slide .ai-post-card .entry-title {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
    font-weight: 700 !important;
    margin: 8px 0 10px 0 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
}

/* Legacy related posts and post cards styles removed. Handled via Tailwind CSS. */

/* Author Box */
.ai-author-box {
    display: flex;
    align-items: center;
    background: var(--bg-body);
    padding: 20px;
    border-radius: var(--radius);
    margin: 40px 0;
    gap: 20px;
}

.ai-author-avatar img {
    border-radius: 50%;
}

.ai-author-title {
    margin: 0 0 5px 0;
}

.ai-author-bio {
    margin: 0 0 10px 0;
    font-size: 0.95rem;
}

/* Share Buttons */
.ai-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 30px 0;
}

.ai-share-title {
    font-weight: 700;
    margin-right: 10px;
}

.ai-share-buttons a {
    padding: 6px 12px;
    background: var(--bg-body);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Legacy forms, breadcrumbs, and related posts styles removed. Handled via Tailwind CSS. */

/* ==========================================================================
   Magazine Redesign (Panamericana Style)
   ========================================================================== */

/* Header Top / Bottom */
.site-header {
    padding: 0;
}

.header-top {
    background: #ffffff;
    padding: 15px var(--gap);
}

.header-bottom {
    background: var(--primary-color);
    color: #ffffff;
}

/* Dynamic menu styles are handled via Tailwind and options in header.php */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu-toggle {
    background: transparent;
    border: none;
    color: #333;
    display: inline-flex !important;
}

/* Legacy single post layout styles removed. Handled via Tailwind CSS. */

/* ==========================================================================
   Media Queries
   ========================================================================== */

/* Tablet (2 columns) */
@media (min-width: 768px) {
    /* Las reglas de visualización (display) de .menu-toggle y .main-navigation se controlan de forma dinámica en critical-css.php */

    .main-navigation {
        width: auto;
        margin: 0;
        padding: 0;
        border: none;
    }

    .main-navigation ul {
        display: flex;
        gap: 20px;
    }

    .main-navigation li {
        margin: 0;
    }

    .ai-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop (Grid Layout Control via Body Classes ideally, but we simulate it here) */
@media (min-width: 1024px) {

    /* Grid columns are fully managed dynamically by critical-css.php */
}

.site-sidebar-left {
    padding: 20px 10px;
    /* Menos padding horizontal para optimizar espacio del banner */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Single post layout */
.ai-single-layout.has-share-sidebar {
    grid-template-columns: 50px 1fr;
}

.ai-single-layout.no-share-sidebar {
    grid-template-columns: 1fr;
}

.ai-single-layout.has-share-sidebar .ai-single-main-content {
    grid-column: 2;
}

.ai-single-layout.has-share-sidebar .ai-share-buttons-container {
    grid-column: 1;
}

.ai-share-buttons {
    flex-direction: column;
}

.ai-single-share-bar {
    display: block;
}


.ai-related-grid {
    grid-template-columns: repeat(3, 1fr);
}


/* Utils */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* ==========================================================================
   Homepage Redesign: Popular Grid & Category Carousels
   ========================================================================== */

/* Legacy popular grid section styles removed. Handled via Tailwind CSS. */

/* ==========================================================================
   Modern Header: Sticky Scrolled Header & Slide-out Drawer
   ========================================================================== */

/* Cabecera general */
.site-header {
    background: transparent;
    transition: all 0.3s ease;
    width: 100%;
    z-index: 1000;
}

/* Header Top (Superior: Logo & Idiomas) */
.header-top {
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-top-bg, #ffffff);
    color: var(--header-top-text, #1e293b);
    transition: padding 0.3s ease;
}

.header-top .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0;
}

/* Branding */
.site-branding {
    text-align: center;
}

.site-branding img {
    max-height: 60px;
    width: auto;
    transition: max-height 0.3s ease;
}

.site-title {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 800;
}

.site-title a {
    color: var(--header-top-text, #1e293b);
}

.site-description {
    font-size: 0.75rem;
    color: var(--header-top-text, #1e293b);
    opacity: 0.8;
    margin: 4px 0 0 0;
}

.header-extra-area,
.header-extra-area a {
    color: var(--header-top-text, #1e293b);
}

/* Header Bottom (Inferior: Barra de Menú de Navegación) */
.header-bottom {
    background: var(--header-bottom-bg, #ffffff);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.header-bottom .header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 10px 0;
    display: flex;
    justify-content: center;
}

/* Legacy drawer and navigation styles removed. Styled using Tailwind utility classes. */

/* Evitar scroll del body cuando el menú está abierto */
body.drawer-open {
    overflow: hidden;
}

/* Grilla del Blog (2 columnas para las tarjetas de artículos) */
.ai-blog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

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

.ai-grid-ad-wrapper {
    grid-column: 1 / -1;
    width: 100%;
}

/* Paginación Elegante y Sutil */
.pagination {
    margin: 40px 0 20px;
    text-align: center;
    width: 100%;
}

.pagination .nav-links {
    display: inline-flex;
    gap: 6px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    color: #475569;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s ease;
    background: #ffffff;
    line-height: 1;
}

.pagination .page-numbers.current {
    background: var(--primary-color, #0073aa);
    color: #ffffff;
    border-color: var(--primary-color, #0073aa);
    font-weight: 600;
}

.pagination .page-numbers:hover:not(.current):not(.dots) {
    background: #f8fafc;
    color: var(--primary-color, #0073aa);
    border-color: var(--primary-color, #0073aa);
}

.pagination .page-numbers.prev,
.pagination .page-numbers.next {
    padding: 0 14px;
    font-weight: 500;
    border-radius: 6px;
}

.pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
    color: #94a3b8;
    min-width: auto;
    padding: 0 4px;
}