/*
 * Estilos de Post Individual - VivaElMundial Theme
 * Página de detalle de un post
 */

/* === OVERRIDE NARROW CONTAINER === */
/* Astra sets --ast-narrow-container-width:750px which makes content too narrow */
.single-post {
    --ast-narrow-container-width: 920px !important;
}

/* === FEATURED IMAGE HERO === */
.blog-featured-hero {
    position: relative;
    width: 100%;
    max-height: 500px;
    overflow: hidden;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-xl);
}

.blog-featured-hero-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 500px;
}

.blog-featured-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(to top, rgba(10, 16, 31, 0.8) 0%, transparent 100%);
    pointer-events: none;
}

/* === HERO DEL POST === */
.single-post .entry-header {
    position: relative;
    padding: var(--spacing-lg) 0 var(--spacing-sm) !important;
    text-align: center;
    background: var(--color-dark-secondary);
    border-radius: var(--border-radius-md);
    margin-bottom: 0 !important;
    overflow: hidden;
}

/* Si tiene imagen destacada, usarla como fondo */
.single-post .ast-single-post-featured-section {
    position: relative;
    height: 60vh;
    min-height: 400px;
    margin-bottom: var(--spacing-3xl);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.single-post .ast-single-post-featured-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0 !important;
}

/* Overlay sobre la imagen */
.single-post .ast-single-post-featured-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(10, 16, 31, 0.9) 0%, rgba(10, 16, 31, 0.3) 100%);
}

/* === TÍTULO DEL POST === */
.single-post .entry-title {
    font-size: clamp(2rem, 5vw, var(--font-size-5xl)) !important;
    font-weight: var(--font-weight-black) !important;
    color: var(--color-text-white) !important;
    margin-bottom: var(--spacing-sm) !important;
    margin-top: 0 !important;
    line-height: 1.2;
}

/* === META INFORMACIÓN === */
.single-post .entry-meta,
.single-post .ast-single-post-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fca311 !important;
    font-size: var(--font-size-sm) !important;
}

/* Category & tag pills in meta */
.blog-meta-taxonomies {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.blog-meta-cat {
    display: inline-block;
    background: rgba(252, 163, 17, 0.15);
    color: #fca311;
    padding: 3px 12px;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(252, 163, 17, 0.25);
}

.blog-meta-cat:hover {
    background: #fca311;
    color: #0a101f;
}

.blog-meta-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 0.7rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-meta-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.single-post .entry-meta *,
.single-post .entry-meta .posted-on,
.single-post .entry-meta .posted-by,
.single-post .entry-meta .published {
    color: #fca311 !important;
}

.single-post .entry-meta a {
    color: #fca311 !important;
    text-decoration: none;
    transition: color var(--transition-base);
}

.single-post .entry-meta a:hover {
    color: var(--color-text-white) !important;
}

/* === CONTENIDO DEL POST === */
.single-post .entry-content {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto;
    padding: var(--spacing-2xl);
    line-height: 1.8;
    font-size: var(--font-size-lg);
}

/* Override Astra's blocks layout max-width constraint */
.single-post .entry-content[data-ast-blocks-layout]>* {
    max-width: 100% !important;
}

.single-post .entry-content>* {
    margin-bottom: var(--spacing-xl);
}

.single-post .entry-content p {
    color: var(--color-text-primary);
}

/* Primer párrafo más grande */
.single-post .entry-content>p:first-of-type {
    font-size: var(--font-size-xl);
    color: var(--color-text-primary);
    line-height: 1.7;
}

/* === HEADINGS EN CONTENIDO === */
.single-post .entry-content h2 {
    color: #fca311 !important;
    font-size: 1.6rem !important;
    font-weight: 700;
    margin-top: var(--spacing-3xl);
    margin-bottom: var(--spacing-lg);
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(252, 163, 17, 0.2);
}

.single-post .entry-content h3 {
    color: #fca311 !important;
    font-size: 1.3rem !important;
    font-weight: 600;
    margin-top: var(--spacing-2xl);
    margin-bottom: var(--spacing-md);
}

/* === IMÁGENES EN CONTENIDO === */
.single-post .entry-content img {
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 100%;
    height: auto;
}

.single-post .entry-content .wp-caption,
.single-post .entry-content figure {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    margin: var(--spacing-2xl) auto;
}

/* Ensure aligncenter figures are centered */
.single-post .entry-content .aligncenter {
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center;
}

.single-post .entry-content .wp-caption-text,
.single-post .entry-content figcaption,
.single-post .entry-content .wp-element-caption {
    color: #fca311;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-style: italic;
    text-align: center;
    margin-top: var(--spacing-sm);
    padding: 8px 16px;
    background: rgba(252, 163, 17, 0.08);
    border: 1px solid rgba(252, 163, 17, 0.2);
    border-radius: 8px;
}

/* === GALERÍA === */
.single-post .entry-content .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-2xl) 0;
}

.single-post .entry-content .gallery-item {
    margin: 0;
}

/* === TAGS === */
.single-post .ast-single-post-bottom {
    max-width: 800px;
    margin: var(--spacing-3xl) auto 0;
    padding-top: var(--spacing-xl);
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.single-post .tags-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.single-post .tags-links span {
    color: var(--color-text-secondary);
    font-weight: var(--font-weight-semibold);
}

.single-post .tags-links a {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary) !important;
    padding: 6px 14px;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--transition-base);
    text-decoration: none;
}

.single-post .tags-links a:hover {
    background: var(--color-accent-gold);
    color: var(--color-dark-primary) !important;
    border-color: var(--color-accent-gold);
    transform: translateY(-2px);
}

/* === NAVEGACIÓN ENTRE POSTS === */
.single-post .ast-single-post-navigation {
    max-width: 800px;
    margin: var(--spacing-3xl) auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
}

.single-post .ast-single-post-navigation a {
    background: var(--color-dark-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-decoration: none;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.single-post .ast-single-post-navigation a:hover {
    border-color: var(--color-accent-gold);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.single-post .ast-single-post-navigation .nav-previous {
    text-align: left;
}

.single-post .ast-single-post-navigation .nav-next {
    text-align: right;
}

.single-post .ast-single-post-navigation .nav-subtitle {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.single-post .ast-single-post-navigation .nav-title {
    font-size: var(--font-size-lg);
    color: var(--color-text-white);
    font-weight: var(--font-weight-semibold);
}

/* === AUTOR === */
.single-post .ast-author-box {
    max-width: 800px;
    margin: var(--spacing-3xl) auto;
    background: var(--color-dark-secondary);
    padding: var(--spacing-2xl);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: var(--spacing-xl);
    align-items: center;
}

.single-post .ast-author-box .avatar {
    border-radius: 50%;
    border: 3px solid var(--color-accent-gold);
}

.single-post .ast-author-box .ast-author-bio {
    flex-grow: 1;
}

.single-post .ast-author-box .ast-author-name {
    font-size: var(--font-size-2xl);
    color: var(--color-text-white);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-sm);
}

.single-post .ast-author-box .ast-author-bio-text {
    color: var(--color-text-primary);
    line-height: 1.6;
}

/* === COMENTARIOS === */
.single-post .comments-area {
    max-width: 100% !important;
    width: 100% !important;
    margin: var(--spacing-3xl) auto;
    background: var(--color-dark-secondary);
    padding: var(--spacing-2xl);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.single-post .comments-title {
    color: var(--color-text-white);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--color-accent-gold);
}

.single-post .comment-list {
    list-style: none;
    padding: 0;
}

.single-post .comment-list .comment {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.single-post .comment-list .comment-author {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.single-post .comment-list .comment-author .avatar {
    border-radius: 50%;
}

.single-post .comment-list .comment-author .fn {
    color: var(--color-text-white);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-lg);
}

.single-post .comment-list .comment-metadata {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
}

.single-post .comment-list .comment-content {
    color: var(--color-text-primary);
    line-height: 1.7;
}

.single-post .comment-list .reply {
    margin-top: var(--spacing-md);
}

.single-post .comment-list .reply a {
    color: var(--color-accent-gold) !important;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

/* Comentarios anidados */
.single-post .comment-list .children {
    list-style: none;
    margin-left: var(--spacing-2xl);
    margin-top: var(--spacing-lg);
}

/* === FORMULARIO DE COMENTARIOS === */
.single-post .comment-respond {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-2xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.single-post .comment-reply-title {
    color: var(--color-text-white);
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin-bottom: var(--spacing-lg);
}

.single-post .comment-form {
    display: grid;
    gap: var(--spacing-lg);
}

.single-post .comment-form label {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-xs);
    display: block;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .single-post .ast-single-post-featured-section {
        height: 40vh;
        min-height: 300px;
    }

    .single-post .entry-content {
        padding: var(--spacing-lg);
        font-size: var(--font-size-base);
    }

    .single-post .entry-content>p:first-of-type {
        font-size: var(--font-size-lg);
    }

    .single-post .ast-single-post-navigation {
        grid-template-columns: 1fr;
    }

    .single-post .ast-author-box {
        flex-direction: column;
        text-align: center;
    }

    .single-post .comment-list .children {
        margin-left: var(--spacing-lg);
    }
}

/* ============================================
   READING PROGRESS BAR
   ============================================ */
.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 9999;
    pointer-events: none;
}

.reading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #fca311, #ff6b6b);
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
}

/* ============================================
   FLOATING TABLE OF CONTENTS
   ============================================ */
.blog-toc {
    position: fixed;
    top: 50%;
    left: max(20px, calc((100vw - 1200px) / 2 - 240px));
    transform: translateY(-50%);
    width: 200px;
    max-height: 60vh;
    overflow-y: auto;
    background: #121a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 20px;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(252, 163, 17, 0.3) transparent;
}

.blog-toc-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #fca311;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.blog-toc-item {
    margin-bottom: 4px;
}

.blog-toc-item-sub {
    padding-left: 14px;
}

.blog-toc-link {
    display: block;
    color: #888;
    text-decoration: none;
    font-size: 0.78rem;
    line-height: 1.4;
    padding: 5px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: all 0.25s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.blog-toc-link:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.03);
}

.blog-toc-link.active {
    color: #fca311;
    border-left-color: #fca311;
    background: rgba(252, 163, 17, 0.06);
    font-weight: 600;
}

/* ============================================
   HEADER ACTION BAR (Share + Listen)
   ============================================ */
.blog-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-header-actions-left,
.blog-header-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.blog-header-share-label {
    color: #888;
    font-size: 0.85rem;
    font-weight: 600;
}

.blog-listen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(252, 163, 17, 0.1);
    border: 1px solid rgba(252, 163, 17, 0.3);
    color: #fca311;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.blog-listen-btn:hover {
    background: rgba(252, 163, 17, 0.2);
    border-color: #fca311;
}

.blog-listen-btn.listening {
    background: #fca311;
    color: #0a101f;
    border-color: #fca311;
    animation: pulse-listen 2s infinite;
}

@keyframes pulse-listen {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(252, 163, 17, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(252, 163, 17, 0);
    }
}

/* Hide TOC on screens where it would overlap content */
@media (max-width: 1500px) {
    .blog-toc {
        display: none;
    }
}

/* Back-to-top: Using Astra's built-in #ast-scroll-top instead */

/* ============================================
   RELATED POSTS SECTION
   ============================================ */
.blog-related-posts {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-related-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.blog-related-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: #fca311;
    border-radius: 2px;
}

.blog-related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.blog-related-card {
    background: #0a101f;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.blog-related-card:hover {
    transform: translateY(-4px);
    border-color: rgba(252, 163, 17, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.blog-related-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #121a2e;
}

.blog-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.blog-related-card:hover .blog-related-thumb img {
    transform: scale(1.05);
}

.blog-related-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.blog-related-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fca311;
}

.blog-related-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-related-date {
    font-size: 0.75rem;
    color: #666;
    margin-top: auto;
}

/* Related posts + header actions responsive */
@media (max-width: 768px) {
    .blog-related-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .blog-related-card {
        flex-direction: row;
        height: 100px;
    }

    .blog-related-thumb {
        width: 120px;
        min-width: 120px;
        aspect-ratio: auto;
        height: 100%;
    }

    .blog-related-info {
        padding: 12px;
    }

    .blog-related-card-title {
        font-size: 0.9rem;
    }

    .blog-header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .blog-header-actions-right {
        width: 100%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .blog-related-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   IMAGE LIGHTBOX MODAL
   ============================================ */

/* Cursor hint on lightbox-enabled images */
.single-post .entry-content a[href$=".jpg"] img,
.single-post .entry-content a[href$=".jpeg"] img,
.single-post .entry-content a[href$=".png"] img,
.single-post .entry-content a[href$=".webp"] img,
.single-post .entry-content a[href$=".gif"] img {
    cursor: zoom-in;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.single-post .entry-content a[href$=".jpg"]:hover img,
.single-post .entry-content a[href$=".jpeg"]:hover img,
.single-post .entry-content a[href$=".png"]:hover img,
.single-post .entry-content a[href$=".webp"]:hover img,
.single-post .entry-content a[href$=".gif"]:hover img {
    transform: scale(1.02);
    box-shadow: 0 8px 30px rgba(252, 163, 17, 0.15);
}

/* Modal overlay */
.blog-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 16, 31, 0.95);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
}

.blog-lightbox-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

/* Modal image */
.blog-lightbox-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: default;
}

.blog-lightbox-overlay.is-active img {
    transform: scale(1);
}

/* Close button */
.blog-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.blog-lightbox-close:hover {
    background: #fca311;
    color: #0a101f;
    border-color: #fca311;
    transform: rotate(90deg);
}

/* Caption under modal image */
.blog-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #a0a0a0;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    max-width: 80%;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .blog-lightbox-overlay img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .blog-lightbox-close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 1.3rem;
    }
}