/*
Theme Name:   Ascenso Financiero Child
Theme URI:    https://ascensofinanciero.com
Description:  Child theme of GeneratePress con diseño personalizado para Ascenso Financiero + FARO.
Author:       Miguel Scarabaggio
Template:     generatepress
Version:      1.0.0
Text Domain:  ascenso-child
*/

/* ========================================================
   1. IMPORTAR ESTILOS DEL PADRE
   ======================================================== */
@import url("../generatepress/style.css");

/* ========================================================
   2. FUENTES Y VARIABLES GLOBALES
   ======================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Oswald:wght@500;700&display=swap');

:root {
    --brand-red:    #ef4444;
    --brand-dark:   #0f172a;
    --brand-black:  #020617;
    --brand-accent: #f59e0b;
    --brand-faro:   #2563eb;
    --slate-900:    #0f172a;
    --slate-800:    #1e293b;
    --slate-700:    #334155;
    --text-muted:   #94a3b8;
}

/* ========================================================
   3. RESET PARA OVERRIDE DE GENERATEPRESS
   ======================================================== */
html {
    margin-top: 0 !important; /* WP admin bar handled by body padding */
}

body {
    background-color: var(--brand-black);
    color: #cbd5e1; /* slate-300 */
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* Ocultar elementos nativos de GeneratePress que sobreescribimos */
.site-header,
.main-navigation,
.site-footer,
.generated-sidebar,
#site-navigation {
    display: none !important;
}

/* Ocultar footer duplicado embebido en el contenido de páginas/posts.
   El footer canónico lo renderiza footer.php del child theme (fuera de #page). */
.entry-content > footer,
.entry-content footer.bg-black,
#page footer {
    display: none !important;
}

/* Aseguramos que el contenido no tenga margen superior innecesario */
.site-content,
.content-area,
#primary {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* ========================================================
   4. ESTILOS GLOBALES DEL ARTÍCULO
   ======================================================== */

/* Grid de fondo (patrón radial) */
.bg-grid-pattern {
    background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* Efectos de texto glow */
.text-glow     { text-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
.text-glow-blue{ text-shadow: 0 0 20px rgba(37, 99, 235, 0.5);  }

/* ========================================================
   5. TIPOGRAFÍA DEL ARTÍCULO
   ======================================================== */
.af-article-body {
    color: #cbd5e1;
    font-size: 1.0625rem;
    line-height: 1.8;
    max-width: 780px;
    margin: 0 auto;
}

.af-article-body h1,
.af-article-body h2,
.af-article-body h3,
.af-article-body h4 {
    font-family: 'Oswald', sans-serif;
    color: #ffffff;
    line-height: 1.2;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.af-article-body h1 { font-size: 2.25rem; }
.af-article-body h2 {
    font-size: 1.75rem;
    border-bottom: 2px solid var(--brand-red);
    padding-bottom: 0.4rem;
}
.af-article-body h3 { font-size: 1.375rem; color: #e2e8f0; }

.af-article-body p  { margin-bottom: 1.25rem; }

.af-article-body a {
    color: var(--brand-red);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}
.af-article-body a:hover { color: #ffffff; }

.af-article-body strong { color: #ffffff; }
.af-article-body em     { color: var(--brand-accent); font-style: normal; }

/* Listas */
.af-article-body ul,
.af-article-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}
.af-article-body li { margin-bottom: 0.5rem; }

/* Citas / blockquote destacada */
.af-article-body blockquote {
    border-left: 4px solid var(--brand-red);
    background: rgba(239,68,68,0.07);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 0.75rem 0.75rem 0;
    color: #e2e8f0;
    font-size: 1.1rem;
}

/* Tablas */
.af-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}
.af-article-body th {
    background: var(--slate-800);
    color: #fff;
    font-family: 'Oswald', sans-serif;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid var(--slate-700);
}
.af-article-body td {
    padding: 0.65rem 1rem;
    border: 1px solid var(--slate-700);
    color: #cbd5e1;
}
.af-article-body tr:nth-child(even) td { background: rgba(255,255,255,0.03); }

/* Código inline */
.af-article-body code {
    background: var(--slate-800);
    color: var(--brand-accent);
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: 'JetBrains Mono', monospace;
}

/* ========================================================
   6. CAJAS DE ALERTA / INFO (shortcodes o HTML dentro del editor)
   ======================================================== */
.af-box-warning,
.af-box-tip,
.af-box-faro {
    padding: 1rem 1.5rem;
    border-radius: 0.75rem;
    margin: 1.5rem 0;
}
.af-box-warning {
    background: rgba(239,68,68,0.08);
    border-left: 4px solid var(--brand-red);
    color: #fca5a5;
}
.af-box-tip {
    background: rgba(245,158,11,0.08);
    border-left: 4px solid var(--brand-accent);
    color: #fcd34d;
}

/* ========================================================
   7. BLOQUE CTA DE FARO (dentro de artículos)
   ======================================================== */
.af-faro-cta {
    background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(99,102,241,0.10));
    border: 1px solid rgba(37,99,235,0.35);
    border-radius: 1rem;
    padding: 2rem;
    margin: 2.5rem 0;
    text-align: center;
}
.af-faro-cta .cta-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #60a5fa;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: block;
}
.af-faro-cta h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    color: #ffffff;
    margin: 0 0 0.5rem;
    padding: 0;
    border: none;
}
.af-faro-cta p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin: 0 0 1.25rem;
}
.af-faro-cta .cta-btn {
    display: inline-block;
    background: var(--brand-faro);
    color: #fff !important;
    font-weight: 700;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.875rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none !important;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 0 20px rgba(37,99,235,0.4);
}
.af-faro-cta .cta-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 0 30px rgba(37,99,235,0.7);
    color: #fff !important;
}
.af-faro-cta .cta-note {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
}

/* ========================================================
   8. MIGAS DE PAN (Breadcrumbs)
   ======================================================== */
.af-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
    padding: 1rem 0;
    flex-wrap: wrap;
}
.af-breadcrumb a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}
.af-breadcrumb a:hover { color: var(--brand-red); }
.af-breadcrumb .sep { color: #334155; }
.af-breadcrumb .current { color: #94a3b8; }

/* ========================================================
   9. HEADER DEL ARTÍCULO
   ======================================================== */
.af-post-header {
    padding-top: 7rem; /* compensa el nav fijo (80px) */
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 3rem;
    background: var(--brand-black);
    position: relative;
}
.af-post-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}
.af-post-header .inner { position: relative; }

.af-post-category {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--brand-red);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(239,68,68,0.4);
    padding-bottom: 2px;
}
.af-post-title {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    margin: 0 0 1.25rem;
}
.af-post-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: #64748b;
    flex-wrap: wrap;
}
.af-post-meta span { display: flex; align-items: center; gap: 0.3rem; }

/* ========================================================
   10. SIDEBAR STICKY (TOC)
   ======================================================== */
.af-toc {
    background: var(--slate-900);
    border: 1px solid var(--slate-700);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 100px;
}
.af-toc h5 {
    font-family: 'Oswald', sans-serif;
    color: #fff;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 1rem;
    padding: 0;
    border: none;
}
.af-toc ol { padding-left: 1.25rem; margin: 0; }
.af-toc li { margin-bottom: 0.4rem; }
.af-toc a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s;
}
.af-toc a:hover { color: var(--brand-red); }

/* ========================================================
   11. ARTÍCULOS RELACIONADOS
   ======================================================== */
.af-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.af-related-card {
    background: var(--slate-900);
    border: 1px solid var(--slate-800);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: border-color 0.25s;
    text-decoration: none !important;
    display: block;
}
.af-related-card:hover { border-color: var(--brand-red); }
.af-related-card .tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--brand-red);
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.af-related-card h6 {
    color: #fff;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    margin: 0;
    line-height: 1.3;
}

/* ========================================================
   12. BARRA STICKY MÓVIL (Bottom CTA)
   ======================================================== */
.af-sticky-mobile-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--brand-faro);
    color: white;
    text-align: center;
    padding: 0.875rem 1rem;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-decoration: none;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}
.af-sticky-mobile-cta:hover { background: #1d4ed8; }
@media(min-width: 768px) { .af-sticky-mobile-cta { display: none; } }

/* ========================================================
   13. UTILIDADES RESPONSIVAS
   ======================================================== */
.af-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
@media(min-width: 1024px) { .af-container { padding: 0 2rem; } }

.af-layout-article {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    padding: 0 0 5rem;
}
@media(min-width: 1024px) {
    .af-layout-article {
        grid-template-columns: 1fr 260px;
        align-items: stretch; /* aside debe estirarse = misma altura que article */
    }
}

/* ========================================================
   14. ANIMACIONES
   ======================================================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.af-fade-in { animation: fadeInUp 0.5s ease both; }

/* ========================================================
   15. FIX: IMÁGENES CON FONDO BLANCO EN DARK MODE
   Reduce el deslumbramiento de gráficos/charts con fondo blanco.
   ======================================================== */
.af-article-body img,
.entry-content img,
.post-content img,
article img {
    border-radius: 0.75rem;
    border: 1px solid var(--slate-700);
    filter: brightness(0.88) contrast(1.08);
    transition: filter 0.3s;
    max-width: 100%;
    height: auto;
}
/* Al hacer hover, muestra la imagen al brillo original */
.af-article-body img:hover,
.entry-content img:hover,
.post-content img:hover,
article img:hover {
    filter: brightness(1) contrast(1);
}

/* ========================================================
   16. FIX: CONTRASTE DE ENLACES DEL TOC (RankMath / WP)
   Los enlaces del índice de contenido eran rojo oscuro
   sobre fondo negro. Ahora son gris claro con hover rojo.
   ======================================================== */

/* RankMath TOC Block */
.wp-block-rank-math-toc-block a,
.rank-math-toc-list a,
.wp-block-rank-math-toc-block li a {
    color: #94a3b8 !important;
    text-decoration: none !important;
    transition: color 0.2s;
}
.wp-block-rank-math-toc-block a:hover,
.rank-math-toc-list a:hover {
    color: var(--brand-red) !important;
}

/* RankMath TOC heading */
.wp-block-rank-math-toc-block h2,
.wp-block-rank-math-toc-block h3,
.wp-block-rank-math-toc-block nav > h2 {
    color: #ffffff !important;
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
}

/* TOC container styling (matches our dark theme) */
.wp-block-rank-math-toc-block,
.wp-block-rank-math-toc-block nav {
    background: var(--slate-900) !important;
    border: 1px solid var(--slate-700) !important;
    border-radius: 0.75rem !important;
    padding: 1.25rem 1.5rem !important;
}

/* Generic WordPress TOC plugins (LuckyWP, Easy TOC, etc.) */
#ez-toc-container a,
.lwptoc_item a,
.toc_list a {
    color: #94a3b8 !important;
    text-decoration: none !important;
}
#ez-toc-container a:hover,
.lwptoc_item a:hover,
.toc_list a:hover {
    color: var(--brand-red) !important;
}

/* ========================================================
   17. FIX: BLOCKQUOTES Y CITAS DE WORDPRESS
   Asegura que las citas tengan fondo oscuro, no blanco.
   ======================================================== */
.entry-content blockquote,
.post-content blockquote,
article blockquote,
.wp-block-quote {
    border-left: 4px solid var(--brand-red) !important;
    background: rgba(239,68,68,0.07) !important;
    padding: 1rem 1.5rem !important;
    margin: 1.5rem 0 !important;
    border-radius: 0 0.75rem 0.75rem 0 !important;
    color: #e2e8f0 !important;
}
.entry-content blockquote p,
.post-content blockquote p,
.wp-block-quote p {
    color: #e2e8f0 !important;
}
.wp-block-quote cite,
blockquote cite {
    color: #64748b !important;
    font-style: italic;
}

/* ========================================================
   18. FIX: ENLACES GENERALES DEL CONTENIDO WP
   Asegura que todos los links dentro del post tengan
   contraste suficiente sobre fondo oscuro.
   ======================================================== */
.entry-content a,
.post-content a {
    color: var(--brand-red);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}
.entry-content a:hover,
.post-content a:hover {
    color: #ffffff;
}

/* ========================================================
   19. FIX: SIDEBAR NATIVO (GeneratePress) STICKY
   ======================================================== */

/* A) Overflow visible en todos los contenedores GeneratePress
   (Esencial para que funcione position: sticky) */
.site-content,
#content,
.content-area,
#primary,
.site-main,
.widget-area,
.sidebar,
#secondary,
.inside-right-sidebar,
.inside-site-container,
.grid-container,
.generate-columns-container {
    overflow: visible !important;
}

/* B) Hacemos que la barra lateral derecha nativa sea sticky */
@media (min-width: 1024px) {
    #right-sidebar {
        position: -webkit-sticky !important; /* Soporte Safari */
        position: sticky !important;
        top: 100px !important;
        align-self: flex-start !important; 
        height: fit-content;
    }
    
    /* Pequeño margen estético a los widgets de la barra */
    .inside-right-sidebar {
        padding-left: 20px;
    }
}


/* Sidebar Natiro Wrapper */
.af-sidebar-sticky {
    position: sticky;
    top: 100px;
    height: max-content;
}

