/* Variables de diseño profesional con colores oscuros */
:root {
    --primary: #1a2332;
    --primary-dark: #0f1419;
    --primary-light: #2d3f5f;
    --secondary: #c9884b;
    --accent: #d4a574;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.10);
    --shadow-xl: 0 20px 35px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: all 0.25s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-size: 16px;
    overflow-x: hidden;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header compacto y profesional */
.header {
    background: var(--primary);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 20px;
    max-height: 56px;
}

.nav-brand a {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: -0.3px;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-brand a:hover {
    color: var(--accent);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: rgba(255,255,255,0.1);
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-toggle:hover {
    background: rgba(255,255,255,0.2);
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background-color: white;
    margin: 2.5px 0;
    transition: var(--transition);
    border-radius: 2px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.nav-menu a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.nav-menu a:hover {
    background: var(--primary-light);
    color: var(--accent);
}

/* Hero section profesional */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 4rem 0 4.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255,255,255,0.02) 10px,
        rgba(255,255,255,0.02) 20px
    );
    opacity: 0.5;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    text-shadow: 0 2px 15px rgba(0,0,0,0.3);
    letter-spacing: -0.8px;
}

.hero-text {
    max-width: 880px;
    margin: 0 auto;
}

.hero-text p {
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
    opacity: 0.92;
    font-weight: 400;
}

/* Sección de categorías */
.silos-selector {
    padding: 4.5rem 0;
    background: var(--bg-primary);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.silos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.75rem;
    margin-top: 2.5rem;
}

.silo-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.silo-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--secondary);
}

.silo-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    position: relative;
    overflow: hidden;
}

.silo-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.silo-card:hover .silo-image img {
    transform: scale(1.06);
}

.silo-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    padding: 1.35rem 1.35rem 0.6rem;
    color: var(--primary);
    line-height: 1.3;
}

.silo-card .silo-pain {
    font-size: 0.95rem;
    color: var(--text-secondary);
    padding: 0 1.35rem 1.35rem;
    line-height: 1.55;
}

/* Sección de contenido */
.content-section {
    padding: 4.5rem 0;
    background: var(--bg-secondary);
}

.content-block {
    background: white;
    padding: 2.75rem;
    margin-bottom: 2.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.content-block h2 {
    font-size: 1.85rem;
    font-weight: 700;
    margin-bottom: 1.35rem;
    color: var(--primary);
    line-height: 1.3;
}

.content-text {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.content-text p {
    margin-bottom: 1.35rem;
}

.content-text strong {
    color: var(--primary);
    font-weight: 600;
}

.content-image {
    width: 100%;
    max-width: 580px;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1.75rem 0;
    box-shadow: var(--shadow-md);
}

/* Página de artículo */
.article-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 3rem 0;
    color: white;
    text-align: center;
}

.article-header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.5px;
    max-width: 950px;
    margin-left: auto;
    margin-right: auto;
}

.breadcrumb {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-top: 0.85rem;
}

.breadcrumb a {
    color: white;
    text-decoration: underline;
}

.breadcrumb span {
    opacity: 0.75;
}

.article-content {
    max-width: 880px;
    margin: -2.5rem auto 4rem;
    background: white;
    padding: 3.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 10;
}

.article-featured-image {
    width: calc(100% + 6.5rem);
    margin: -3.25rem -3.25rem 2.75rem;
    height: 420px;
    object-fit: cover;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.article-intro {
    font-size: 1.15rem;
    line-height: 1.8;
    color: var(--text-secondary);
    padding: 1.75rem;
    background: var(--bg-tertiary);
    border-left: 4px solid var(--secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 2.75rem;
}

.article-content h2 {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--primary);
    margin: 2.75rem 0 1.35rem;
    padding-bottom: 0.65rem;
    border-bottom: 2px solid var(--border);
}

.article-content h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2.25rem 0 0.95rem;
}

.article-content h4 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.75rem 0 0.75rem;
}

.article-content p {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 1.35rem;
}

.article-content ul, .article-content ol {
    margin: 1.35rem 0 1.75rem 1.75rem;
    line-height: 1.8;
}

.article-content li {
    margin-bottom: 0.65rem;
    color: var(--text-secondary);
    font-size: 1.02rem;
}

.article-content strong {
    color: var(--primary);
    font-weight: 600;
}

/* Cajas de información */
.info-box, .warning-box, .success-box, .tip-box {
    padding: 1.6rem;
    border-radius: var(--radius-md);
    margin: 1.75rem 0;
    border-left: 4px solid;
}

.info-box {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1e40af;
}

.warning-box {
    background: #fef3c7;
    border-color: var(--warning);
    color: #92400e;
}

.success-box {
    background: #d1fae5;
    border-color: var(--success);
    color: #065f46;
}

.tip-box {
    background: #fef3e8;
    border-color: var(--secondary);
    color: #78350f;
}

.info-box strong, .warning-box strong, .success-box strong, .tip-box strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
}

/* Enlaces relacionados */
.related-links {
    background: var(--bg-tertiary);
    padding: 1.75rem;
    border-radius: var(--radius-md);
    margin: 2.5rem 0;
}

.related-links h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.related-links ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.related-links li {
    margin-bottom: 0.65rem;
}

.related-links a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.related-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* FAQ */
.faq-section {
    margin: 2.5rem 0;
}

.faq-item {
    background: var(--bg-tertiary);
    padding: 1.35rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--secondary);
}

.faq-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 0.75rem 0;
}

.faq-item p {
    margin: 0;
    font-size: 1rem;
}

/* Footer profesional */
.footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.75);
    padding: 3.5rem 0 1.75rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-section h4 {
    color: white;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 0.65rem;
}

.footer-section a {
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.92rem;
}

.footer-section a:hover {
    color: var(--accent);
    padding-left: 4px;
}

.footer-section p {
    font-size: 0.92rem;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.875rem;
    color: rgba(255,255,255,0.55);
}

/* Responsive */
@media (max-width: 768px) {
    .nav {
        padding: 0.6rem 16px;
    }

    .nav-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 100%;
        flex-direction: column;
        background: var(--primary);
        padding: 1.5rem;
        gap: 0.75rem;
        transition: var(--transition);
        box-shadow: var(--shadow-lg);
        align-items: stretch;
    }
    
    .nav-menu a {
        text-align: center;
        padding: 0.75rem;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-text p {
        font-size: 1.05rem;
    }
    
    .section-title {
        font-size: 1.85rem;
    }
    
    .silos-grid {
        grid-template-columns: 1fr;
    }
    
    .article-header h1 {
        font-size: 1.85rem;
    }
    
    .article-content {
        padding: 2.25rem;
        margin: -2rem 1rem 3rem;
    }
    
    .article-featured-image {
        width: calc(100% + 4.5rem);
        margin: -2.25rem -2.25rem 2.25rem;
        height: 260px;
    }
    
    .content-block {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero {
        padding: 3rem 0 3.5rem;
    }
    
    .hero h1 {
        font-size: 1.65rem;
    }

    .article-content {
        padding: 1.75rem;
    }

    .article-featured-image {
        width: calc(100% + 3.5rem);
        margin: -1.75rem -1.75rem 1.75rem;
    }
}
/* ============================================
   ÍNDICE NAVEGABLE (TABLE OF CONTENTS)
   ============================================ */

.table-of-contents {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    margin: 2.5rem 0;
    padding: 0;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
}

.table-of-contents:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.toc-header:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

.toc-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.toc-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.toc-toggle.collapsed {
    transform: rotate(-90deg);
}

.toc-toggle.collapsed:hover {
    transform: rotate(-90deg) scale(1.1);
}

.toc-content {
    max-height: 600px;
    overflow-y: auto;
    padding: 1.5rem;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
}

.toc-content.collapsed {
    max-height: 0;
    padding: 0 1.5rem;
    overflow: hidden;
}

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

.toc-item {
    margin: 0;
    transition: var(--transition);
}

.toc-item a {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
    position: relative;
    padding-left: 2rem;
}

.toc-item a::before {
    content: '▸';
    position: absolute;
    left: 0.75rem;
    color: var(--secondary);
    transition: var(--transition);
    font-size: 0.9rem;
}

.toc-item a:hover {
    background: var(--bg-tertiary);
    color: var(--primary);
    padding-left: 2.25rem;
}

.toc-item a:hover::before {
    color: var(--primary);
    transform: translateX(3px);
}

.toc-h2 {
    margin-top: 0.75rem;
}

.toc-h2:first-child {
    margin-top: 0;
}

.toc-h2 a {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
}

.toc-h3 a {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 3rem;
    font-weight: 400;
}

.toc-h3 a::before {
    content: '•';
    left: 2rem;
    font-size: 1.2rem;
}

.toc-h3 a:hover {
    padding-left: 3.25rem;
}

/* Scrollbar personalizado para el índice */
.toc-content::-webkit-scrollbar {
    width: 8px;
}

.toc-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.toc-content::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 4px;
}

.toc-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .toc-header h3 {
        font-size: 1rem;
    }
    
    .toc-item a {
        font-size: 0.9rem;
        padding: 0.55rem 0.75rem;
        padding-left: 1.75rem;
    }
    
    .toc-h3 a {
        font-size: 0.85rem;
        padding-left: 2.5rem;
    }
    
    .toc-h3 a::before {
        left: 1.5rem;
    }
}

/* Smooth scroll para navegación */
html {
    scroll-behavior: smooth;
}

/* Destacar sección activa */
:target {
    scroll-margin-top: 100px;
    animation: highlight-section 2s ease-in-out;
}

@keyframes highlight-section {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(201, 136, 75, 0.1);
    }
}


/* ============================================
   IMÁGENES RESPONSIVE EN ARTÍCULOS
   ============================================ */

/* Prevenir que las imágenes desborden el contenedor */
.article-content img,
.responsive-img,
img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    object-fit: contain;
}

/* Imágenes dentro del contenido del artículo */
.article-content img {
    max-width: 100% !important;
    height: auto !important;
}

/* Resetear cualquier ancho fijo inline */
.article-content img[style*="width"],
.responsive-img[style*="width"] {
    width: auto !important;
}

/* Pie de imagen */
.image-caption {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Asegurar que las imágenes no desborden en tablets */
@media (max-width: 1024px) {
    .article-content img,
    .responsive-img {
        max-width: 100% !important;
        width: auto !important;
        margin: 1.75rem auto;
    }
}

/* Optimización para móviles medianos */
@media (max-width: 768px) {
    .article-content img,
    .responsive-img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        margin: 1.5rem auto;
        border-radius: 6px;
    }
    
    .image-caption {
        font-size: 0.85rem;
        padding: 0 1rem;
    }
}

/* Optimización para móviles pequeños */
@media (max-width: 480px) {
    .article-content img,
    .responsive-img {
        max-width: 100% !important;
        width: 100% !important;
        margin: 1rem auto;
        border-radius: 5px;
    }
    
    .image-caption {
        font-size: 0.8rem;
        padding: 0 0.5rem;
    }
}

/* Prevenir overflow horizontal en todo el sitio */
body, html {
    overflow-x: hidden;
    max-width: 100%;
}

/* Asegurar que todos los contenedores respeten el ancho */
* {
    max-width: 100%;
}

/* Excepciones para elementos que necesitan ancho completo */
.header, .footer, .hero {
    max-width: none;
}



/* Responsive Images - Auto-generated/Updated */
img {
    max-width: 100%;
    height: auto;
}

.responsive-img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 2rem auto;
    border-radius: 8px;
}

.article-image {
    max-width: 100%;
    margin: 2rem 0;
    text-align: center;
}

.article-image img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.image-caption {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    padding: 0 1rem;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .article-image {
        margin: 1.5rem 0;
    }
    
    .responsive-img {
        margin: 1.5rem auto;
        border-radius: 4px;
    }
    
    .image-caption {
        font-size: 0.85rem;
    }
}
