/**
 * Archivo: assets/css/archive-articulo-new.css
 * Descripción: Estilos para el rediseño del Home de Artículos (Pillars Strategy)
 */

/* =========================================
   VARIABLES & GLOBAL
   ========================================= */
:root {
    --color-navy: #001344;
    --color-blue: #0033ff;
    --color-dark-blue: #050588;
    --color-white: #ffffff;
    --color-gray-bg: #F0F2F5;
    --color-text: #333333;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Montserrat', sans-serif;
    --transition: all 0.3s ease;
}

body {
    background-color: var(--color-gray-bg);
}

.site-main {
    background-color: var(--color-gray-bg);
    overflow-x: clip;
    /* Prevent horizontal scroll from negative margins */
}

/* FIX: Remove top padding from #content if present globally */
#content {
    padding-top: 0 !important;
}

/* =========================================
   1. HERO SECTION
   ========================================= */
.articles-hero {
    position: relative;
    /* Navy background with blueprint image overlay */
    background-color: var(--color-navy);
    background-image:
        linear-gradient(rgba(0, 19, 68, 0.5), rgba(0, 19, 68, 0.7));
    background-size: cover;
    background-position: center;
    background-blend-mode: normal;
    /* Less aggressive blending for clarity */

    /* Matches reference: large padding bot for overlap, no hard border radius on bottom yet (or simplified) */
    padding: 2vh 20px 120px;
    text-align: center;
    color: var(--color-white);
}

.hero-content-wrapper {
    position: relative;
    z-index: 2;
    max-width: 900px;
    margin: 0 auto;
}

.articles-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    /* Better readability on lighter bg */
}

.articles-hero .tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
}

/* Search Bar - Matches Ref: Dark input, Bright Button */
.hero-search-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.hero-search-form {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    /* Lighter/Glassier */
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px;
    padding: 6px;
    transition: var(--transition);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hero-search-form:focus-within {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

.hero-search-form input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 25px;
    color: var(--color-white);
    font-size: 0.95rem;
    outline: none;
}

.hero-search-form input::placeholder {
    color: rgba(255, 255, 255, 0.8);
    font-style: normal;
}

.hero-search-form button {
    background-color: var(--color-blue);
    color: var(--color-white);
    border: none;
    border-radius: 40px;
    padding: 0 40px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    text-transform: capitalize;
    box-shadow: 0 4px 15px rgba(0, 51, 255, 0.3);
}

.hero-search-form button:hover {
    background-color: #1a45ff;
    box-shadow: 0 6px 20px rgba(0, 51, 255, 0.5);
    transform: translateY(-2px);
}

/* =========================================
   PILLARS GRID (UPDATED)
   ========================================= */

.pillars-container {
    max-width: 1300px;
    /* Slightly wider */
    margin: -100px auto 20px;
    /* Deep negative margin for "floating" effect */
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.pillars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.pillar-card {
    position: relative;
    height: 200px;
    border-radius: 12px;
    overflow: hidden; /* Crucial para que el drawer no se salga */
    background-color: #000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.pillar-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Enlace principal que actúa como fondo */
.pillar-main-link {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    text-decoration: none;
}

.pillar-bg {
    position: absolute;
    inset: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
    opacity: 0.85;
    transition: transform 0.8s ease, opacity 0.5s ease;
}

.pillar-card:hover .pillar-bg {
    transform: scale(1.1);
    opacity: 0.6;
}

.pillar-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0) 20%, rgba(0,0,0,0.8) 80%);
    z-index: 1;
}

.pillar-content {
    position: absolute;
    top: 20%;
    left: 0;
    width: 100%;
    padding: 0 24px;
    z-index: 2;
    text-align: center;
    transition: top 0.4s ease;
}

/* Cuando el drawer está abierto, subimos el título */
.pillar-card.is-open .pillar-content {
    top: 25%; 
}

.pillar-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-white);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

/* Nuevo estilo para el contador */
.pillar-count-badge {
    display: inline-block;
    font-size: 0.85rem;
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 5px 14px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.2);
    letter-spacing: 0.5px;
}

/* --- DRAWER (Zona Inferior) --- */
.pillar-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 10; /* Por encima del enlace principal */
    background: rgba(0, 19, 68, 0.9); /* Azul Navy semitransparente */
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.2);
    transition: max-height 0.5s ease, background-color 0.3s;
    max-height: 50px; /* Altura inicial (solo botón) */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Estado Abierto */
.pillar-card.is-open .pillar-drawer {
    max-height: 80%; /* Altura máxima al abrir */
    background: rgba(0, 19, 68, 0.95);
}

.drawer-trigger {
    width: 100%;
    height: 50px; /* Altura fija del botón */
    background: transparent;
    border: none;
    color: var(--color-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    flex-shrink: 0; /* No encoger */
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); 
}

.drawer-trigger:hover {
    background: rgba(255,255,255,0.1);
}

.trigger-icon {
    transition: transform 0.4s;
}

/* Rotar icono al abrir */
.pillar-card.is-open .trigger-icon {
    transform: rotate(180deg);
}

/* Lista de especialidades (Scrollable) */
.drawer-list-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 10px 20px 20px;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.drawer-list-wrapper::-webkit-scrollbar {
    width: 4px;
}
.drawer-list-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

@media (max-width: 768px) {
    
    /* Forzar fondo sólido en móvil para evitar el 'glitch' del blur y mejorar lectura */
    .pillar-drawer {
        background: #001344; /* Color Navy sólido (tu variable --color-navy) */
        backdrop-filter: none !important; /* Desactivar blur forzosamente */
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    
    /* Asegurar que la lista también tenga fondo sólido al abrirse */
    .pillar-card.is-open .pillar-drawer {
        background: #001344; 
    }

    /* Aumentar un poco el tamaño de fuente del disparador en móvil para mejor tacto/lectura */
    .drawer-trigger {
        font-size: 0.95rem; 
        background: rgba(0,0,0,0.2); /* Un poco de oscuridad extra en el botón */
    }
}

.specialties-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.specialties-list li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.specialties-list li:last-child {
    border-bottom: none;
}

.specialties-list a {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 12px 0;
    font-size: 0.9rem;
    text-transform: capitalize;
    transition: color 0.2s, padding-left 0.2s;
}

.specialties-list a:hover {
    color: #fff;
    padding-left: 5px;
}

.empty-msg {
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    padding: 10px 0;
}

/* =========================================
   3. EXPLORE BY TOPIC
   ========================================= */
.explore-section {
    padding: 20px 0 80px;
    /* Top padding accounts for floating overlap area */
    text-align: center;
}

.section-title-wrapper {
    margin-bottom: 50px;
    text-align: center;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--color-navy);
    margin-bottom: 10px;
}

.section-subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: left;
}

.explore-col h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explore-col h3 i {
    color: var(--color-blue);
    font-style: normal;
}

.topic-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.topic-btn {
    display: block;
    padding: 12px 16px;
    background: var(--color-white);
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    color: #4B5563;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: capitalize;
    text-decoration: none;
    transition: var(--transition);
}

.topic-btn:hover {
    border-color: var(--color-blue);
    color: var(--color-blue);
    background: #F3F6FF;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 51, 255, 0.05);
}

/* =========================================
   4. LATEST PUBLICATIONS
   ========================================= */
.latest-section {
    padding: 30px 20px;
    max-width: 1240px;
    margin: 20px auto;
}

.latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.latest-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-navy);
    margin: 0;
    text-transform: uppercase;
}

.latest-tabs {
    display: flex;
    gap: 25px;
}

/* Resetear estilos de botón para que parezcan links/tabs */
.latest-tabs button.tab-link {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-body); /* Asegura que herede la fuente */
    padding: 0 0 6px 0; /* Mismo padding que tenías */
    margin-right: 25px; /* Espaciado entre tabs */
    /* Heredar estilos del link original */
    color: #000;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.3s;
}

.latest-tabs button.tab-link:hover, 
.latest-tabs button.tab-link.active {
    color: var(--color-blue);
}

.latest-tabs button.tab-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--color-blue);
}

/* Wrapper para controles (Tabs + Search) */
.latest-controls-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 30px;
}

/* Ajuste de Tabs para que no ocupen todo el ancho si hay buscador */
.latest-tabs {
    border-bottom: none; /* Quitamos borde individual */
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Buscador Secundario */
.secondary-search {
    flex-shrink: 0;
}

.sec-search-form {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 4px 10px;
    transition: all 0.3s ease;
}

.sec-search-form:focus-within {
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(0, 51, 255, 0.1);
}

.sec-search-form input {
    border: none;
    outline: none;
    font-size: 0.9rem;
    padding: 6px 8px;
    width: 200px; /* Ancho fijo desktop */
    color: #333;
}

.sec-search-form button {
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.sec-search-form button:hover {
    color: var(--color-blue);
}

/* Mensaje de vacío */
.grid-empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    background: #fff;
    border-radius: 12px;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .latest-controls-wrapper {
        flex-direction: column;
        align-items: flex-start;
        border-bottom: none;
    }
    
    .latest-tabs {
        width: 100%;
        overflow-x: auto;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }

    .secondary-search {
        width: 100%;
        margin-top: 10px;
    }

    .sec-search-form {
        width: 100%;
    }

    .sec-search-form input {
        width: 100%;
    }
}

/* Grid */
.latest-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.article-card-new {
    background: var(--color-white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.article-card-new:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.ac-thumb-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.ac-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.article-card-new:hover .ac-thumb {
    transform: scale(1.05);
}

.ac-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ac-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--color-white);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
    align-self: flex-start;
}

/* Dynamic Pill Colors */
.ac-pill.energia {
    background-color: #0033ff;
}

.ac-pill.integridad {
    background-color: #8A2BE2;
}

.ac-pill.industria {
    background-color: #10B981;
}

.ac-pill.gestion {
    background-color: #F59E0B;
}

/* Default */
.ac-pill {
    background-color: var(--color-blue);
}

.ac-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-navy);
    line-height: 1.4;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-new:hover .ac-title {
    color: var(--color-blue);
}

.ac-excerpt {
    font-size: 0.9rem;
    color: #6B7280;
    line-height: 1.5;
    margin-bottom: 20px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Ajustes para el footer de la tarjeta (Autor + Fecha) */
.ac-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    border-top: 1px solid #f0f0f0; /* Opcional: una línea sutil separadora */
    padding-top: 15px; /* Espacio extra si pones borde */
}

.ac-meta-info {
    display: flex;
    flex-direction: column; /* Apilamos Autor arriba, Fecha abajo para limpieza */
    gap: 2px;
    font-size: 0.8rem;
    line-height: 1.3;
}

.ac-author {
    font-weight: 700;
    color: var(--color-navy); /* O el color principal de texto */
    text-transform: capitalize;
}

.ac-date {
    color: #444953;
    font-size: 0.75rem;
}

.ac-sep {
    display: none; /* Ocultamos el punto si usamos flex-column */
}

/* OPCIONAL: Si prefieres Autor y Fecha en una sola línea (Autor • Fecha) */
/* Descomenta esto si prefieres una sola línea:
.ac-meta-info {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}
.ac-sep {
    display: inline-block;
    color: #ccc;
}
*/

.ac-arrow {
    color: var(--color-blue);
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.article-card-new:hover .ac-arrow {
    transform: translateX(5px);
}

/* =========================================
   5. TRENDING SECTION
   ========================================= */
.trending-section {
    max-width: 1240px;
    margin: 0 auto 60px;
    padding: 0 20px;
}

.trending-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-navy);
    margin-bottom: 25px;
    text-transform: uppercase;
}

.trending-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.trending-card {
    background-color: var(--color-navy);
    border-radius: 12px;
    padding: 24px;
    color: var(--color-white);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trending-card:hover {
    background-color: #002266;
    transform: translateY(-4px);
}

.tc-cat {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.tc-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 15px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tc-date {
    margin-top: auto;
    font-size: 0.75rem;
    opacity: 0.5;
}

/* =========================================
   Responsive Adjustments
   ========================================= */

/* Tablet */
@media (max-width: 1024px) {
    .pillars-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

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

    .articles-hero {
        padding-bottom: 160px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .articles-hero {
        padding: 60px 20px 140px;
        /* Still need overlap padding */
        border-radius: 0 0 30px 30px;
    }

    .articles-hero h1 {
        font-size: 2.2rem;
    }

    .hero-search-form {
        flex-direction: column;
        padding: 10px;
        background: rgba(30, 41, 89, 0.9);
        border-radius: 20px;
    }

    .hero-search-form button {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        padding: 12px;
    }

    /* Pillars Carousel on Mobile */
    .pillars-container {
        margin-top: -100px;
        padding: 0;
    }

    .pillars-grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding: 20px 20px 40px;
        /* Space for shadow */
        gap: 15px;
    }

    .pillar-card {
        min-width: 280px;
        scroll-snap-align: center;
        height: 400px;
    }

    /* Grids to single column */
    .explore-grid {
        grid-template-columns: 1fr;
    }

    .latest-grid {
        grid-template-columns: 1fr;
    }

    .trending-grid {
        grid-template-columns: 1fr;
    }

    .latest-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Scrollable Tabs */
    .latest-tabs {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .tab-link {
        white-space: nowrap;
        margin-right: 15px;
    }
}