/*
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.0
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;
    --text-color: #333333;
    --text-light: #666666;
    --bg-body: #f4f6f8;
    --bg-content: #ffffff;
    --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: 1200px;
    --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: #111;
}

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 {
    background: var(--bg-content);
    border-bottom: 1px solid var(--border-color);
    padding: 15px var(--gap);
    position: relative;
    z-index: 100;
}

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

.site-branding {
    flex: 1;
}

.site-title {
    font-size: 1.5rem;
    margin: 0;
}

.site-title a {
    color: #111;
}

.site-description {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

.header-extra-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Navigation Base */
.main-navigation {
    display: none; /* Hide by default on mobile, toggle with JS */
    width: 100%;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.main-navigation.toggled {
    display: block;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.main-navigation li {
    margin-bottom: 10px;
}
.main-navigation a {
    display: block;
    color: var(--text-color);
    font-weight: 500;
}

/* Mobile Toggle Button */
.menu-toggle {
    display: block;
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
}

.site-main-container {
    flex: 1;
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--gap);
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
}

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

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

.site-footer {
    background: #111;
    color: #fff;
    padding: 40px var(--gap);
    text-align: center;
    margin-top: auto;
}
.site-footer a {
    color: #ccc;
}
.site-footer a:hover {
    color: #fff;
}

/* ==========================================================================
   Components: Post Cards
   ========================================================================== */
.ai-post-card {
    background: var(--bg-content);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    margin-bottom: var(--gap);
}

.ai-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

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

.ai-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ai-card-meta {
    font-size: 0.85rem;
    margin-bottom: 10px;
    color: var(--text-light);
}

.ai-cat-label {
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.ai-post-card .entry-title {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
}

.ai-post-card .entry-title a {
    color: #111;
}

.ai-post-card .entry-summary {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: auto;
}

.ai-card-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-light);
}

/* 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 .entry-header {
    text-align: center;
    margin-bottom: 30px;
}

.single .entry-meta {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 10px;
}

.post-thumbnail {
    margin: 30px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.entry-content {
    font-size: 1.1rem; /* Slightly larger text for reading */
}

/* 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;
}

/* Breadcrumbs */
.ai-breadcrumbs {
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.ai-breadcrumbs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.ai-breadcrumbs-list .separator {
    color: var(--text-light);
    margin: 0 5px;
}

/* Related Posts */
.ai-related-posts {
    margin: 50px 0;
}

.ai-related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* Forms & Comments */
input[type="text"], input[type="email"], input[type="url"], textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
}

input[type="submit"], button, .button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

input[type="submit"]:hover, button:hover, .button:hover {
    background: var(--link-hover);
}

/* ==========================================================================
   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;
}
.header-bottom .main-navigation a {
    color: #ffffff;
    padding: 12px 15px;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.3s;
}
.header-bottom .main-navigation a:hover {
    background: rgba(0,0,0,0.1);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.menu-toggle {
    background: transparent;
    border: none;
    color: #333;
}

/* Single Post Layout */
.ai-single-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 20px;
}

.ai-single-share-bar {
    display: none; /* Hide on mobile by default, show flex row maybe? */
}

.ai-single-main-content {
    flex: 1;
}

.ai-author-name {
    font-weight: 600;
    color: #111;
}

/* Share Icons Sticky */
.ai-share-buttons-container {
    position: sticky;
    top: 20px;
}
.ai-share-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ai-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: #fff;
    transition: transform 0.2s;
}
.ai-share-btn:hover {
    transform: scale(1.1);
    color: #fff;
}
.share-wa { background: #25D366; }
.share-fb { background: #1877F2; }
.share-x { background: #000000; }
.share-mail { background: #D44638; }

/* Tags Pills */
.ai-tags-links {
    margin: 30px 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.ai-tags-links span {
    font-weight: bold;
}
.ai-tags-links a {
    border: 1px solid var(--border-color);
    padding: 5px 15px;
    border-radius: 20px;
    color: #111;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}
.ai-tags-links a:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.ai-related-title {
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

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

/* Tablet (2 columns) */
@media (min-width: 768px) {
    .menu-toggle {
        display: none;
    }
    
    .main-navigation {
        display: block;
        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) {
    .site-main-container {
        /* Default 3 cols if active */
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
    }
    
    /* Layout Overrides based on admin settings (simplified via classes or direct child logic) */
    body.layout-2c-right .site-main-container {
        grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
    }
    body.layout-2c-left .site-main-container {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }
    
    /* Single post layout */
    .ai-single-layout {
        grid-template-columns: 50px 1fr;
    }
    .ai-single-share-bar {
        display: block;
    }
    body.layout-1c .site-main-container {
        grid-template-columns: minmax(0, 1fr);
        max-width: 900px; /* Narrower for readability */
    }

    .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;
}
