/* ==========================================================================
   Layout Base
   ========================================================================== */
.aav-layout {
    display: grid;
    grid-template-columns: var(--aav-sidebar-width) var(--aav-content-width);
    gap: var(--aav-gap);
    width: 100%;
    max-width: calc(var(--aav-sidebar-width) + var(--aav-gap) + var(--aav-content-width));
    margin: 0 auto;
}

/* Sidebar */
.aav-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Contenido principal - RESPONSIVE FIX */
.aav-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 2.5rem;
    min-width: 0;
    width: 100%;
    max-width: var(--aav-content-width);
    box-sizing: border-box;
}

/* ==========================================================================
   Responsive Layout - CRÍTICO
   ========================================================================== */
@media (max-width: 1024px) {
    /* Prevenir desbordamiento horizontal global */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
    }
    
    /* Reset box-sizing global */
    *, *::before, *::after {
        box-sizing: border-box;
    }
    
    .aav-single-post .aav-layout,
    .aav-tools-page .aav-layout,
    .aav-layout {
        display: flex;
        flex-direction: column;
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 1rem;
        margin: 0 !important;
        box-sizing: border-box;
    }
    
    .aav-single-post .aav-sidebar,
    .aav-tools-page .aav-sidebar,
    .aav-sidebar {
        position: static !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: none !important;
        margin-bottom: 1.5rem;
        order: -1;
        padding: 0 !important;
    }
    
    .aav-single-post .aav-content,
    .aav-tools-page .aav-content,
    .aav-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.5rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Forzar que las listas del TOC no tengan números */
    .aav-toc ol,
    .aav-toc-list,
    .aav-toc-list ol {
        counter-reset: none !important;
        list-style: none !important;
        list-style-type: none !important;
    }
    
    .aav-toc-list li::before,
    .aav-toc-list > li > ol li::before {
        counter-increment: none !important;
    }
}

@media (max-width: 768px) {
    .aav-layout {
        padding: 0 1rem;
    }
    
    .aav-content {
        padding: 1.25rem;
        box-shadow: none;
        border: 1px solid var(--aav-border);
    }
}

@media (max-width: 480px) {
    .aav-layout {
        padding: 0 0.75rem;
    }
    
    .aav-content {
        padding: 1rem;
        border-radius: 6px;
    }
}

/* ==========================================================================
   Contenido del post
   ========================================================================== */
.aav-post-content {
    font-size: var(--aav-font-size) !important;
    line-height: var(--aav-line-height) !important;
    color: var(--aav-text) !important;
}

/* Imagen destacada */
.aav-featured-image {
    margin-bottom: 2rem;
    border-radius: 8px;
    overflow: hidden;
}

.aav-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Placeholder cuando no hay imagen */
.aav-featured-image-placeholder {
    width: 100%;
    height: 400px;
    background-color: #f0f0f0;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 0.9rem;
}

.aav-post-content p,
.aav-post-content li,
.aav-post-content td,
.aav-post-content dd {
    font-size: inherit !important;
    line-height: inherit !important;
    color: var(--aav-text) !important;
}

.aav-post-content h1,
.aav-single-post .aav-content h1 {
    font-size: var(--aav-h1-size) !important;
    line-height: var(--aav-h1-height) !important;
    color: var(--aav-heading) !important;
    margin-top: 0;
    margin-bottom: 1.25rem;
}

.aav-post-content h2,
.aav-single-post .aav-content h2 {
    font-size: var(--aav-h2-size) !important;
    line-height: var(--aav-h2-height) !important;
    color: var(--aav-heading) !important;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
}

.aav-post-content h3,
.aav-single-post .aav-content h3 {
    font-size: var(--aav-h3-size) !important;
    line-height: var(--aav-h3-height) !important;
    color: var(--aav-heading) !important;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.aav-post-content h4,
.aav-single-post .aav-content h4 {
    font-size: var(--aav-font-size) !important;
    line-height: var(--aav-line-height) !important;
    color: var(--aav-heading) !important;
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.aav-post-content p {
    margin-bottom: 1.25rem;
}

.aav-post-content ul,
.aav-post-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
    list-style: none;
}

.aav-post-content li,
.aav-single-post .entry-content ul li,
.aav-single-post .entry-content ol li {
    margin-bottom: 0.5rem;
    margin-left: 0 !important;
    position: relative;
    padding-left: 0;
}

/* Bullets personalizados para listas */
.aav-post-content ul > li::before,
.aav-single-post .entry-content ul > li::before {
    content: "–";
    position: absolute;
    left: -1.5rem;
    color: var(--aav-gray);
}

/* Números para listas ordenadas - EXCLUYENDO TOC y sus sublistas */
.aav-post-content ol:not(.aav-toc-list):not(.aav-toc ol),
.aav-single-post .entry-content ol:not(.aav-toc-list):not(.aav-toc ol) {
    counter-reset: ol-counter;
}

.aav-post-content ol:not(.aav-toc-list):not(.aav-toc ol) > li,
.aav-single-post .entry-content ol:not(.aav-toc-list):not(.aav-toc ol) > li {
    counter-increment: ol-counter;
}

.aav-post-content ol:not(.aav-toc-list):not(.aav-toc ol) > li::before,
.aav-single-post .entry-content ol:not(.aav-toc-list):not(.aav-toc ol) > li::before {
    content: counter(ol-counter) ".";
    position: absolute;
    left: -1.5rem;
    color: var(--aav-gray);
    font-weight: 500;
}

/* Responsive para contenido */
@media (max-width: 768px) {
    .aav-featured-image-placeholder {
        height: 250px;
    }
    
    .aav-post-content h1,
    .aav-single-post .aav-content h1 {
        font-size: 1.75rem !important;
        line-height: 2.25rem !important;
    }
    
    .aav-post-content h2,
    .aav-single-post .aav-content h2 {
        font-size: 1.35rem !important;
        line-height: 1.75rem !important;
        margin-top: 2rem;
    }
    
    .aav-post-content h3,
    .aav-single-post .aav-content h3 {
        font-size: 1.15rem !important;
        line-height: 1.5rem !important;
        margin-top: 1.5rem;
    }
}

@media (max-width: 480px) {
    .aav-featured-image-placeholder {
        height: 180px;
    }
    
    .aav-post-content h1,
    .aav-single-post .aav-content h1 {
        font-size: 1.5rem !important;
        line-height: 2rem !important;
    }
}