/*
Theme Name: Intrade Theme
Theme URI: https://intrade.com
Author: Intrade Development Team
Author URI: https://intrade.com
Description: Tema corporativo a la medida para Intrade, optimizado para rendimiento, diseño editorial y Core Web Vitals.
Version: 1.1.0
Text Domain: intrade
*/

/* ==========================================================================
   1. CSS Variables & Design Tokens
   ========================================================================== */
:root {
    /* Colores Principales */
    --color-primary: #005b9f;
    --color-secondary: #0b132b;
    --color-accent: #00b4d8;
    
    /* Neutros */
    --color-text-main: #333333;
    --color-text-muted: #666666;
    --color-bg-light: #f8f9fa;
    --color-bg-white: #ffffff;
    --color-border: #e2e8f0;

    /* Tipografía */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-secondary: 'Merriweather', Georgia, serif;
    
    /* Espaciados */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;

    /* Bordes y Sombras */
    --border-radius: 8px;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   2. Reset & Base Elements
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    color: var(--color-text-main);
    background-color: var(--color-bg-white);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    width: 100%;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   3. Layout & Containers
   ========================================================================== */
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    width: 100%;
}

.section-padding {
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

.bg-light { background-color: var(--color-bg-light); }
.bg-dark { background-color: var(--color-secondary); color: #fff; }

/* ==========================================================================
   4. Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-secondary);
    line-height: 1.25;
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); }
h3 { font-size: clamp(1.4rem, 2.5vw, 1.8rem); }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
}

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

a:hover {
    color: var(--color-secondary);
}

/* ==========================================================================
   5. Buttons & Controls
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: #004477;
    color: #fff;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid #fff;
    color: #fff;
}
.btn-outline:hover {
    background-color: #fff;
    color: var(--color-secondary);
}

/* ==========================================================================
   6. Header & Navigation
   ========================================================================== */
.site-header {
    background-color: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.logo-link img {
    display: block;
    height: auto;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    margin: 0;
    padding: 0;
}

.main-navigation a {
    color: var(--color-text-main);
    font-weight: 600;
    font-size: 0.95rem;
}

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

/* Utilidades para ocultar/mostrar elementos de menú en WP Admin */
.solo-mobile,
.mobile-only,
.mobile-only-cta {
    display: none !important;
}

.solo-desktop,
.desktop-only {
    display: block !important;
}

.site-footer {
    margin-top: 0;
    background-color: var(--color-bg-light);
    border-top: 1px solid var(--color-border);
    padding-top: 4.5rem;
    padding-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

.footer-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
    line-height: 2;
}

.footer-menu-list a {
    color: #666;
    transition: color 0.2s ease;
}

.footer-menu-list a:hover {
    color: var(--color-primary);
}

.footer-legal-menu {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    margin: 0;
    padding: 0;
}

.footer-legal-menu a {
    color: #999;
    transition: color 0.2s ease;
}

.footer-legal-menu a:hover {
    color: var(--color-primary);
}

/* Paginación Global */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 3.5rem 0 1.5rem 0;
    flex-wrap: wrap;
    clear: both;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.85rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: var(--color-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination .page-numbers:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: #f0f7ff;
}

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

.pagination .page-numbers.dots {
    border: none;
    background: transparent;
    color: #94a3b8;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--color-primary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* ==========================================================================
   7. Form Controls Global
   ========================================================================== */
input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    color: #333;
    box-sizing: border-box;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 91, 159, 0.12);
}

/* ==========================================================================
   8. Specific Components
   ========================================================================== */
/* Tarjetas Globales */
.curso-card, .articulo-secundario {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    background: var(--color-bg-white);
}

.curso-card:hover, .articulo-secundario:hover {
    transform: translateY(-4px);
    box-shadow: var(--box-shadow);
}

/* Modal de Video */
.intrade-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.intrade-modal.active {
    display: flex;
}
.intrade-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 19, 43, 0.9);
}
.intrade-modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: #000;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}
.intrade-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
}

/* Ticker Animation */
.ticker-track {
    will-change: transform;
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS (Tablet & Mobile)
   ========================================================================== */

/* --- TABLET & LAPTOPS (< 1024px) --- */
@media (max-width: 1024px) {
    .menu-toggle {
        display: block;
    }

    .main-navigation {
        display: none;
        width: 100%;
        margin-top: 1rem;
        border-top: 1px solid var(--color-border);
        padding-top: 1rem;
    }

    .main-navigation.active {
        display: block;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0;
    }

    .main-navigation ul li {
        width: 100%;
        border-bottom: 1px solid #f1f5f9;
    }

    .main-navigation ul li a {
        display: block;
        padding: 0.85rem 0;
    }

    .header-inner {
        flex-wrap: wrap;
    }

    .header-cta {
        display: none !important;
    }

    .solo-mobile,
    .mobile-only,
    .mobile-only-cta {
        display: block !important;
        margin-top: 0.5rem;
    }

    .solo-desktop,
    .desktop-only {
        display: none !important;
    }

    /* Grillas a 2 columnas en Tablet */
    .hero-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr !important;
        gap: 2.5rem !important;
    }

    /* Grilla Editorial a 1 columna */
    .intrade-grilla-editorial {
        grid-template-columns: 1fr !important;
    }

    /* Artículo Destacado Revista */
    .premium-article {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
    .premium-article > div:first-child {
        min-height: 280px !important;
    }
    .premium-article > div:last-child {
        padding: 2rem 1.5rem !important;
    }
}

/* --- MOBILE (< 768px) --- */
@media (max-width: 768px) {
    /* Tipografía móvil */
    h1 { font-size: 2.2rem !important; }
    h2 { font-size: 1.75rem !important; }
    h3 { font-size: 1.4rem !important; }

    /* Contenedores con acolchado adaptable */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .section-padding {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }

    /* Hero Section */
    .hero-section {
        padding: 6rem 1rem 4.5rem 1rem !important;
    }

    .hero-cards {
        grid-template-columns: 1fr !important;
        margin-top: 1.5rem !important;
        gap: 1.25rem !important;
    }

    /* Forzar todas las grillas inline a 1 columna en teléfonos */
    div[style*="grid-template-columns"],
    section[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Reducción de padding excesivo en mobile (Fila 2 Nosotros, Form Contacto, etc.) */
    div[style*="padding:3.5rem"],
    div[style*="padding: 3.5rem"],
    div[style*="padding:3rem"],
    div[style*="padding: 3rem"] {
        padding: 1.25rem !important;
    }

    div[style*="padding:2.5rem"],
    div[style*="padding: 2.5rem"],
    div[style*="padding:2rem"],
    div[style*="padding: 2rem"] {
        padding: 1.25rem 1rem !important;
    }

    div[style*="grid-template-columns"] > div {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .entry-content div[style*="margin-bottom:5rem"],
    .entry-content div[style*="margin-bottom: 5rem"] {
        margin-bottom: 2.5rem !important;
    }

    .entry-content figure img {
        height: 260px !important;
    }

    /* Ejes 50/50 y bloques flex */
    section[style*="display:flex; flex-wrap:wrap;"] > div,
    section[style*="display: flex; flex-wrap: wrap;"] > div {
        flex: 1 1 100% !important;
        min-width: 100% !important;
        padding: 3.5rem 1.5rem !important;
    }

    /* Pestañas de categorías con scroll horizontal suave (estilo App) */
    div[style*="border-bottom:1px solid #e2e8f0;"] {
        overflow-x: auto !important;
        white-space: nowrap !important;
        display: flex !important;
        gap: 1.2rem !important;
        padding-bottom: 0.5rem !important;
        -webkit-overflow-scrolling: touch;
    }
    div[style*="border-bottom:1px solid #e2e8f0;"]::-webkit-scrollbar {
        display: none;
    }

    /* Cifras / Stats en mobile */
    .hero-cards + div {
        padding: 2.5rem 1.5rem !important;
    }

    /* Botones de Compartir en artículos */
    div[style*="border-top: 1px solid #e2e8f0; display:flex;"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    /* Formularios */
    .intrade-form input,
    .intrade-form select,
    .intrade-form textarea {
        font-size: 16px !important; /* Previene el zoom automático molesto en iPhones */
    }

    /* Footer a 1 columna completa */
    .footer-inner {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    /* INTrade TV Adaptativo en Móvil */
    .intrade-tv-grid {
        grid-template-columns: 1fr !important;
        gap: 1.75rem !important;
    }
    .intrade-tv-sidebar {
        max-height: 300px !important;
        overflow-y: auto !important;
    }
}

/* Efecto y alineación de Tarjetas de Área */
.area-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.area-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -6px rgba(0,0,0,0.18) !important;
}
