/*
 * Cuerpo de una entrada del blog: el HTML de WordPress (Gutenberg) ya limpio con wpContentHtml(), dentro de
 * .post-content. Es el único archivo que da estilo a clases que no son nuestras (wp-block-*, has-background,
 * wp-embed-aspect-*): son las que pone WordPress y no se pueden cambiar sin editar cada entrada (excepción de
 * rule-frontend, regla 7). Por eso todo va dentro de .post-content y nada sale de ahí.
 *
 * Medidas del diseño de Main Avena/Blog Articulo (revisado el 2026-11-09): texto de 18 px, el primer párrafo de 21 px,
 * 24 px entre bloques, viñetas azules, tablas con borde redondeado y recuadros grises sin borde.
 *
 * Para Safari 14.0: los videos usan una caja con padding-top en lugar de aspect-ratio.
 */
.post-content {
    font-size: 18px;
    line-height: 1.75;
    color: var(--fg);
    overflow-wrap: break-word;
}

.post-content > :first-child {
    margin-top: 0;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content figure,
.post-content pre,
.post-content hr {
    margin: 0 0 24px;
}

/* Párrafos vacíos que deja el editor */
.post-content p:empty {
    display: none;
}

/* El primer párrafo abre el artículo, más grande */
.post-content > p:first-of-type {
    font-size: 21px;
    line-height: 1.6;
    letter-spacing: -0.02em;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin: 40px 0 24px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.03em;
}

/* Al saltar desde el índice el título no queda debajo del nav fijo */
.post-content h2 {
    scroll-margin-top: calc(var(--site-chrome-h, 77px) + 24px);
    margin-top: 64px;
    font-size: clamp(26px, 2.6vw, 32px);
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.post-content h3 {
    font-size: 22px;
}

.post-content h4 {
    font-size: 19px;
}

.post-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    color: var(--primary-hover);
}

/* Un enlace del texto a otra página del sitio (components/page-loading.js pone data-loading al tocarlo): el aro va
   junto al texto, del color del enlace */
@keyframes post-content-spin {
    to {
        transform: rotate(360deg);
    }
}

.post-content a[data-loading] {
    pointer-events: none;
}

.post-content a[data-loading]::after {
    content: '';
    display: inline-block;
    width: 0.7em;
    height: 0.7em;
    box-sizing: border-box;
    margin-left: 6px;
    border: 2px solid currentcolor;
    border-right-color: transparent;
    border-radius: var(--radius-pill);
    vertical-align: -0.05em;
    animation: post-content-spin 700ms linear infinite;
}

.post-content ul,
.post-content ol {
    padding-left: 28px;
}

.post-content li {
    line-height: 1.65;
}

.post-content li + li {
    margin-top: 12px;
}

/* Viñetas: un punto azul de 6 px */
.post-content ul {
    padding-left: 0;
    list-style: none;
}

.post-content ul > li {
    position: relative;
    padding-left: 32px;
}

.post-content ul > li::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 7px;
    width: 6px;
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--primary);
}

.post-content strong,
.post-content b {
    font-weight: 700;
}

.post-content mark {
    padding: 0 4px;
    border-radius: 4px;
    background: var(--primary-soft);
    color: inherit;
}

.post-content hr {
    height: 1px;
    border: 0;
    background: var(--border);
}

/* Cita grande, sin borde; quien la dice va en cite o figcaption, en gris */
.post-content blockquote {
    margin: 16px 0 40px;
    padding: 0;
    font-size: clamp(22px, 2.2vw, 26px);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -0.03em;
}

.post-content blockquote cite {
    display: block;
    margin-top: 16px;
    font-size: 15px;
    font-style: normal;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--fg-muted);
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content code,
.post-content pre {
    border-radius: var(--radius-control);
    background: var(--bg-subtle);
    font-size: 15px;
}

.post-content code {
    padding: 2px 6px;
}

.post-content pre {
    padding: 16px;
    overflow-x: auto;
}

/* Bloques plegables del cuerpo (details y summary, desde WP_CONTENT_VERSION 8): el expediente de avena-news pliega ahí lo
   técnico, como la búsqueda exacta en PubMed */
.post-content details {
    margin: 0 0 24px;
}

.post-content summary {
    min-height: 44px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

.post-content details[open] > summary {
    margin-bottom: 8px;
}

/* Recuadros de color: WordPress los pintaba con style= (se quita al limpiar); aquí son los recuadros grises del
   diseño */
.post-content .has-background {
    padding: 24px 28px;
    border-radius: 20px;
    background: var(--bg-canvas);
    font-size: 17px;
    line-height: 1.65;
}

/* Imágenes y figuras */
.post-content img,
.post-content video {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 20px;
}

.post-content .aligncenter,
.post-content .aligncenter img {
    margin-right: auto;
    margin-left: auto;
}

.post-content figcaption {
    margin-top: 12px;
    font-size: 15px;
    text-align: center;
    color: var(--fg-muted);
}

/* Tablas (94 entradas): se deslizan de lado en el teléfono en lugar de salirse de la pantalla. wpContentHtml() pone
   cada tabla en .post-content__scroll, también las que llegan sin la figure de Gutenberg */
.post-content .wp-block-table {
    overflow-x: auto;
}

.post-content__scroll {
    margin: 0 0 24px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.post-content .wp-block-table .post-content__scroll {
    margin-bottom: 0;
}

.post-content table {
    width: 100%;
    min-width: 420px;
    margin: 0;
    border-collapse: collapse;
    font-size: 16px;
    line-height: 1.55;
}

.post-content th,
.post-content td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.post-content th {
    background: var(--bg-canvas);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--fg-muted);
}

.post-content tr:last-child td {
    border-bottom: 0;
}

/* Videos de YouTube: caja con la proporción que marca WordPress (16:9 por defecto) */
.post-content .wp-block-embed__wrapper {
    position: relative;
    padding-top: 56.25%;
}

.post-content .wp-embed-aspect-4-3 .wp-block-embed__wrapper {
    padding-top: 75%;
}

.post-content .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: var(--radius-panel);
}

/* Botones de Gutenberg */
.post-content .wp-block-button__link {
    display: inline-block;
    padding: 12px 20px;
    border-radius: var(--radius-pill);
    background: var(--primary);
    font-weight: 600;
    text-decoration: none;
    color: var(--on-primary);
}

.post-content .wp-block-button__link:hover {
    background: var(--primary-hover);
    color: var(--on-primary);
}

/*
 * Recuadros, respuesta corta, fuentes y preguntas de avena-news. El título nombra el tipo (En resumen,
 * Precaución, Nota, Consejo, Cuidado, Respuesta corta): el color del borde y del fondo solo lo refuerza.
 * WordPress no usa estas clases, así que una entrada vieja se ve igual.
 */
.post-content .post-alert,
.post-content .post-answer {
    margin: 8px 0 32px;
    padding: 24px 28px;
    border: 0;
    border-left: 4px solid transparent;
    border-radius: 20px;
    background: var(--bg-canvas);
    font-size: 17px;
    line-height: 1.65;
    color: var(--fg);
}

.post-content .post-answer {
    margin-bottom: var(--space-post-section);
    border-left-color: var(--primary);
    background: var(--primary-soft);
}

.post-content .post-alert--importante {
    border-left-color: var(--primary);
    background: var(--primary-soft);
}

.post-content .post-alert--precaucion {
    border-left-color: var(--border-post-alert-caution);
    background: var(--bg-post-alert-caution);
}

.post-content .post-alert--nota {
    border-left-color: var(--fg-muted);
    background: var(--bg-subtle);
}

.post-content .post-alert--consejo {
    border-left-color: var(--success);
    background: var(--bg-post-alert-tip);
}

.post-content .post-alert--cuidado {
    border-left-color: var(--danger);
    background: var(--bg-post-alert-care);
}

.post-content .post-alert__title,
.post-content .post-answer__title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: var(--letter-spacing);
}

.post-content .post-answer__title,
.post-content .post-alert--importante .post-alert__title {
    color: var(--primary);
}

.post-content .post-alert > :last-child,
.post-content .post-answer > :last-child {
    margin-bottom: 0;
}

.post-content .post-ref,
.blog-post__faq .post-ref {
    font-size: var(--font-size);
    line-height: var(--line-height);
    vertical-align: super;
}

/* Fuentes: al final, en letra chica y gris, como en el diseño */
.post-content .post-sources {
    margin-top: var(--space-post-section);
    font-size: 14px;
    line-height: 1.6;
    color: var(--fg-muted);
}

.post-content .post-sources h2 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.post-content .post-sources ol,
.post-content .post-sources ul {
    margin-bottom: 0;
    padding-left: 20px;
}

.post-content .post-sources li {
    line-height: 1.6;
}

.post-content .post-sources li + li {
    margin-top: 6px;
}

.post-content .post-sources__back {
    margin-left: var(--space-post-tight);
    white-space: nowrap;
}

/* El FAQ lo pinta la vista, fuera de .post-content: <details> no pasa la lista blanca. Como en el diseño: una lista
   con líneas entre preguntas, la pregunta en un h3 y una flecha en un círculo que gira al abrir. */
.blog-post .blog-post__faqs {
    margin-top: 40px;
}

.blog-post .blog-post__faqs > h2 {
    scroll-margin-top: calc(var(--site-chrome-h, 77px) + 24px);
    margin: 0 0 24px;
    font-size: clamp(26px, 2.6vw, 32px);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.035em;
}

.blog-post__faq-list {
    border-top: 1px solid var(--border);
}

.blog-post__faq {
    border-bottom: 1px solid var(--border);
}

.blog-post__faq-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 0;
    list-style: none;
    cursor: pointer;
}

.blog-post__faq-summary::-webkit-details-marker {
    display: none;
}

.blog-post__faq-summary h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: -0.025em;
    transition: color 0.15s var(--ease);
}

.blog-post__faq-summary:hover h3 {
    color: var(--primary);
}

.blog-post__faq-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: var(--size-post-faq-icon);
    height: var(--size-post-faq-icon);
    margin-left: 20px;
    border-radius: var(--radius-pill);
    background: var(--bg-subtle);
    color: var(--fg);
    transition: transform 0.18s var(--ease);
}

.blog-post__faq[open] .blog-post__faq-icon {
    transform: rotate(180deg);
}

.blog-post__faq-answer {
    padding: 0 52px 24px 0;
    font-size: 17px;
    line-height: 1.7;
    color: var(--fg-muted);
}

.blog-post__faq-answer > * {
    margin: 0;
}

.blog-post__faq-answer > * + * {
    margin-top: 12px;
}

.blog-post .blog-post__faq a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-post .blog-post__faq a:hover {
    color: var(--primary-hover);
}

@media (prefers-reduced-motion: reduce) {
    .blog-post__faq-icon {
        transition: none;
    }

    .post-content a[data-loading]::after {
        animation: none;
    }
}
