/* ==========================================================================
   MEDIOS CMS - COMPONENT: SINGLE (Noticias y Páginas)
   Estilos del cuerpo de lectura, tipografía de artículo, modo lectura,
   barras de herramientas móviles, multimedia y avisos entre párrafos.
   ========================================================================== */

/* Redondeo de imágenes en el cuerpo del artículo */
.cms-single-body img {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 100% !important;
    height: auto !important;
    border-radius: var(--cms-radius, 16px) !important;
}

/* Excepción para tarjetas de servicios: Farmacias de guardia van de borde a borde */
.cms-single-body .svc-farmacia-col1 img {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    object-fit: cover !important;
    object-position: center !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Icono / Imagen cuadrada para signos del Horóscopo */
.cms-single-body .svc-horoscopo-img,
.cms-single-body .svc-card-col1 .svc-horoscopo-img {
    width: 80px !important;
    height: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;
    max-width: 80px !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    margin: 0 auto 6px auto !important;
    display: block !important;
}

.cms-single-body p:has(> img) {
    text-align: center !important;
}

/* Figuras dentro del cuerpo */
.cms-single-body figure {
    position: relative !important;
    margin-top: 2.5rem !important;
    margin-bottom: 2.5rem !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    border-radius: var(--cms-radius, 16px) !important;
    overflow: hidden;
}

.cms-single-body figure img {
    width: 100% !important;
    height: auto !important;
    border-radius: var(--cms-radius, 16px) !important;
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Epígrafes / Figcaptions Premium */
figure figcaption,
figure.group.relative figcaption,
.cms-single-body figure figcaption {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0.85rem 1.25rem !important;
    background: rgba(0, 0, 0, 0.75) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
    gap: 0.75rem !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 10 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

figure figcaption *,
figure.group.relative figcaption *,
.cms-single-body figure figcaption * {
    color: #ffffff !important;
    text-align: left !important;
    font-size: calc(1rem * var(--text-zoom, 1)) !important;
    line-height: 1.3 !important;
}

figure figcaption::before,
figure.group.relative figcaption::before,
.cms-single-body figure figcaption::before {
    content: 'photo_camera';
    font-family: 'Material Symbols Outlined' !important;
    font-size: 1.35rem !important;
    line-height: 1 !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

/* Espaciado superior en móviles (30px uniforme) */
@media (max-width: 767px) {
    .cms-single-top-spacing {
        padding-top: 1.875rem !important;
    }
}

/* Espaciado de Banner Top en Interior de Noticia (solo cuando existe anuncio activo) */
.cms-ad-zone-single-main-top {
    margin-top: -12px !important;
    margin-bottom: 30px !important;
}

/* Tipografía de Contenido Prose y Embeds */
.prose img,
.prose iframe,
.prose .instagram-media,
.prose .twitter-tweet,
.prose .wp-embedded-content { 
    margin-left: auto !important; 
    margin-right: auto !important;
    display: block !important; 
}

/* Embeds de Redes Sociales (Twitter / X, Instagram, Facebook, TikTok) */
.cms-embed-wrapper,
.cms-embed-twitter,
.cms-embed-instagram,
.cms-embed-facebook {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
}

/* Twitter / X Embeds: tanto blockquote original como iframe generado por widgets.js */
.prose .twitter-tweet,
.prose .twitter-tweet-rendered,
.cms-single-body .twitter-tweet,
.cms-single-body .twitter-tweet-rendered,
.cms-embed-wrapper .twitter-tweet,
.cms-embed-wrapper iframe,
.cms-embed-twitter .twitter-tweet,
.cms-embed-twitter iframe,
iframe.twitter-tweet,
iframe.twitter-tweet-rendered,
iframe[id^="twitter-widget-"] {
    width: 100% !important;
    max-width: 550px !important;
    min-width: 280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
}

.cms-embed-instagram .instagram-media {
    width: 100% !important;
    max-width: 540px !important;
    min-width: 280px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.cms-embed-facebook .fb-post,
.cms-embed-facebook .fb-video,
.cms-embed-facebook span,
.cms-embed-facebook iframe {
    max-width: 550px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.prose p,
.cms-single-body p { 
    margin-bottom: 1rem; 
}

/* ==========================================================================
   Jerarquía Tipográfica Editorial: Encabezados en el Cuerpo de Texto (H2-H4)
   Asegura que los ladillos/subtítulos no compitan ni superen al título H1.
   ========================================================================== */
.prose h1, .cms-single-body h1,
.prose h2, .cms-single-body h2 {
    font-weight: 600 !important;
    font-size: 1.55rem !important;
    line-height: 1.28 !important;
    letter-spacing: -0.015em !important;
    margin-top: 2.5rem !important;
    margin-bottom: 0.85rem !important;
    color: var(--titles-color, #1e293b) !important;
}

.prose h3, .cms-single-body h3 {
    font-weight: 600 !important;
    font-size: 1.3rem !important;
    line-height: 1.32 !important;
    letter-spacing: -0.01em !important;
    margin-top: 1rem !important;
    margin-bottom: 0.75rem !important;
    color: var(--titles-color, #1e293b) !important;
}

.prose h4, .cms-single-body h4,
.prose h5, .cms-single-body h5,
.prose h6, .cms-single-body h6 {
    font-weight: 600 !important;
    font-size: 1.15rem !important;
    line-height: 1.35 !important;
    letter-spacing: normal !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.5rem !important;
    color: var(--titles-color, #1e293b) !important;
}

/* Evitar que etiquetas <strong> internas inflen el grosor a ExtraBold/Black */
.prose h1 strong, .cms-single-body h1 strong,
.prose h2 strong, .cms-single-body h2 strong,
.prose h3 strong, .cms-single-body h3 strong,
.prose h4 strong, .cms-single-body h4 strong,
.prose h5 strong, .cms-single-body h5 strong,
.prose h6 strong, .cms-single-body h6 strong {
    font-weight: 600 !important;
    color: inherit !important;
}

/* Modo oscuro para encabezados */
.dark .prose h1, .dark .cms-single-body h1,
.dark .prose h2, .dark .cms-single-body h2,
.dark .prose h3, .dark .cms-single-body h3,
.dark .prose h4, .dark .cms-single-body h4,
.dark .prose h5, .dark .cms-single-body h5,
.dark .prose h6, .dark .cms-single-body h6 {
    color: #f1f5f9 !important;
}

@media (max-width: 768px) {
    .prose h1, .cms-single-body h1,
    .prose h2, .cms-single-body h2 {
        font-size: 1.35rem !important;
        margin-top: 2rem !important;
        margin-bottom: 0.75rem !important;
    }
    .prose h3, .cms-single-body h3 {
        font-size: 1.18rem !important;
        margin-top: 1rem !important;
        margin-bottom: 0.65rem !important;
    }
    .prose h4, .cms-single-body h4,
    .prose h5, .cms-single-body h5,
    .prose h6, .cms-single-body h6 {
        font-size: 1.05rem !important;
        margin-top: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
}

.prose blockquote { border-left: 4px solid var(--primary-color); padding-left: 1rem; font-style: italic; font-weight: 500; color: #6b7280; font-size: 1.25rem; }

/* Resaltado de Lectura por Voz */
.cms-reading-highlight { transition: all 0.3s ease; border-radius: 4px; border-bottom: 2px solid transparent; }
.cms-reading-active { background-color: rgba(var(--primary-rgb, 230,0,126), 0.15) !important; border-bottom-color: var(--primary-color) !important; box-shadow: 0 0 0 2px rgba(var(--primary-rgb, 230,0,126), 0.05); }

/* Corrección de espaciado compacto en títulos y subtítulos de servicios (Dólar, Mercados) */
.svc-dolar-col1 h3,
.svc-dolar-col1 [class*="typo-home_card_title"],
.cms-article-body article [class*="typo-home_card_title"] {
    margin-top: 0 !important;
    margin-bottom: 2px !important;
    line-height: 1.15 !important;
}

.svc-dolar-col1 [class*="typo-home_card_p"],
.cms-article-body article [class*="typo-home_card_p"] {
    margin-top: 0 !important;
    margin-bottom: 4px !important;
    line-height: 1.2 !important;
}

/* Modo Lectura Activo */
.reading-mode-active #cms-main-sidebar { display: none !important; }
.reading-mode-active #cms-main-article { grid-column: span 12 / span 12 !important; max-width: 800px !important; margin-left: auto !important; margin-right: auto !important; }

/* Ocultar botón de Modo Lectura en pantallas chicas (< 1024px) */
@media (max-width: 1023px) {
    #cms-reading-mode-trigger {
        display: none !important;
    }
}

/* Barra de Herramientas Responsive (< 600px) */
@media (max-width: 600px) {
    #cms-action-container {
        justify-content: space-around !important;
        gap: 15px !important;
        padding: 12px 6px !important;
    }
    #cms-action-container button,
    #cms-action-container .group {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0px !important;
        flex: none !important;
    }
    #cms-action-container button span:not(.material-symbols-outlined),
    #cms-action-container .cms-listen-trigger-text {
        display: none !important;
    }
    #cms-action-container #cms-voice-settings-trigger {
        margin-left: 6px !important;
        margin-top: 0px !important;
    }
}

/* Imagen / Video Destacado a Ancho Completo en Móvil (< 1024px) */
@media (max-width: 1023px) {
    .cms-single-featured-media {
        margin-left: -1.5rem !important;
        margin-right: -1.5rem !important;
        width: calc(100% + 3rem) !important;
        max-width: none !important;
        border-radius: 0 !important;
        -webkit-border-radius: 0 !important;
    }
    #cms-main-article .cms-single-featured-media,
    #cms-main-article .cms-single-featured-media *,
    html body .cms-single-featured-media,
    html body .cms-single-featured-media figure,
    html body .cms-single-featured-media figure.rounded-2xl,
    html body .cms-single-featured-media figure img,
    html body .cms-single-featured-media img,
    html body .cms-single-featured-media img:not(.rounded-full):not(.avatar),
    html body .cms-single-featured-media .aspect-video,
    html body .cms-single-featured-media iframe,
    html body .cms-single-featured-media figcaption {
        border-radius: 0 !important;
        -webkit-border-radius: 0 !important;
        border-top-left-radius: 0 !important;
        border-top-right-radius: 0 !important;
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
    }
    .cms-single-featured-media figure {
        box-shadow: none !important;
        aspect-ratio: 1 / 1 !important;
        width: 100% !important;
        position: relative !important;
        overflow: hidden !important;
    }
    .cms-single-featured-media figure img {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
    }
    .cms-single-featured-media figcaption {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    /* Avisos Entre Párrafos en Móvil (< 1024px) */
    .cms-single-body .cms-ad-v7,
    .cms-single-body [class*="cms-ad-zone-"],
    [class*="cms-ad-zone-single-content-p"] {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        align-items: center !important;
        width: 100% !important;
    }
    .cms-single-body .cms-ad-v7 .cms-ad-unit,
    .cms-single-body [class*="cms-ad-zone-"] .cms-ad-unit,
    [class*="cms-ad-zone-single-content-p"] .cms-ad-unit {
        width: 100% !important;
        max-width: 100% !important;
        text-align: center !important;
    }
    .cms-single-body .cms-ad-v7 .cms-ad-unit a,
    .cms-single-body [class*="cms-ad-zone-"] .cms-ad-unit a,
    [class*="cms-ad-zone-single-content-p"] .cms-ad-unit a {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
    .cms-single-body .cms-ad-v7 .cms-ad-unit img,
    .cms-single-body [class*="cms-ad-zone-"] .cms-ad-unit img,
    [class*="cms-ad-zone-single-content-p"] .cms-ad-unit img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto !important;
        display: block !important;
    }
}

/* Blindaje de componentes de servicios dentro del cuerpo de la noticia (.cms-single-body) */
.cms-single-body .cms-dolar-service-container span,
.cms-single-body .cms-dolar-service-container div {
    line-height: inherit;
}
.cms-single-body .cms-dolar-service-container [style*="border-radius: 4px"] {
    height: 18px !important;
    max-height: 18px !important;
    line-height: 18px !important;
    font-size: 9.5px !important;
    padding: 0 5px !important;
    box-sizing: border-box !important;
}

/* ============================================================
   BLINDAJE CLIMA: neutraliza typo-article_body para la vista de servicio
   La vista clima.php se renderiza dentro de .typo-article_body en post.php.
   Estas reglas anulan los !important de dynamic.css con mayor especificidad + !important.
   ============================================================ */

.typo-article_body .cms-service-clima-page span,
.typo-article_body .cms-service-clima-page div,
.typo-article_body .cms-service-clima-page p,
.typo-article_body .cms-service-clima-page small {
    font-size: unset !important;
    line-height: unset !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
}

/* Permitir que los inline styles de cada elemento surtan efecto */
.cms-service-clima-page [style*="font-size"] {
    font-size: revert-layer !important;
}

