/* ==========================================================================
   POST - REVISADO Y CORREGIDO
   ========================================================================== */

.post-single-container {
    margin-top: 2rem;
    margin-bottom: 5rem;
}

.post-single-article {
    max-width: 1200px;
    margin: 0 auto;
}

/* Títulos y texto */
.post-single-title {
    font-size: 3rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .post-single-title {
       font-size: 2.75rem;
    }
}


.post-single-meta {
    font-size: 1rem; 
    line-height: 1.8; 
    margin-bottom: 1.5rem;
}

.post-single-content h2 { font-size: 2.25rem; margin: 1.75rem 0 1.25rem; font-weight: 700; }
.post-single-content h3 { font-size: 1.75rem; margin: 1.75rem 0 1.25rem; font-weight: 700; }
.post-single-content h4 { font-size: 1.35rem; margin: 1.75rem 0 1.25rem; font-weight: 700; }
.post-single-content p { font-size: 1.125rem; line-height: 1.8; margin-bottom: 1.75rem; }

/* Media general */
.post-single-content img,
.post-single-content .wp-block-image img,
.post-single-content figure {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 2rem !important;
    border-radius: 8px;
}

img.wp-smiley,
img.emoji {
    display: inline !important;
    border: none !important;
    box-shadow: none !important;
    height: 1em !important;
    width: 1em !important;
    margin: 0 .07em !important;
    vertical-align: -0.1em !important;
    background: none !important;
    padding: 0 !important;
}

/* --- SECCIÓN DE EMBEDS (EL CORAZÓN DEL PROBLEMA) --- */

/* 1. Reset general para todos los contenedores de video */
.post-single-content .wp-block-embed {
    margin: 2.5rem 0;
    display: flex;
    justify-content: center;
}

/* 2. Estilo específico para YouTube/Vimeo (16:9) 
      USAMOS :not() para que TikTok no herede el height 0 */
.post-single-content .wp-block-embed:not(.wp-block-embed-tiktok) .wp-block-embed__wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    width: 100%;
    overflow: hidden;
}

.post-single-content .wp-block-embed:not(.wp-block-embed-tiktok) .wp-block-embed__wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: 0;
}

/* 3. Estilo específico para TikTok (Vertical / Dinámico) */
/* Atacamos el contenedor de Gutenberg y el del script de TikTok simultáneamente */
.post-single-content .wp-block-embed-tiktok,
.post-single-content .wp-block-embed-tiktok .wp-block-embed__wrapper,
.post-single-content blockquote.tiktok-embed {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
    min-width: 325px !important; /* Evita que se estire a 1200px */
    margin-left: auto !important;
    margin-right: auto !important;
    padding: 0 !important;
}

/* El script de TikTok crea un div con clase 'tiktok-embed', lo limpiamos */
div.tiktok-embed {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Forzar que el iframe no herede fondos */
.post-single-content .wp-block-embed-tiktok iframe {
    width: 100% !important;
    min-width: 100% !important;
    height: 750px !important; /* Altura sugerida para que no se corte el video vertical */
    border: none !important;
}

/* Si TikTok inyecta una sección de 'loading' o container blanco */
.tiktok-embed-container, 
.tiktok-embed-wrapper {
    background: transparent !important;
    box-shadow: none !important;
}

/* Ajuste para que en móviles vuelva a su tamaño normal */
@media (max-width: 768px) {
    .post-single-content .wp-block-embed-tiktok,
    .post-single-content blockquote.tiktok-embed {
        width: 325px !important;
        border-radius: 0px; !important
    }
}

/* ==========================================================================
   SOLUCIÓN UNIFICADA CON ESPACIADO INFERIOR
   ========================================================================== */

/* Atacamos todos los tipos de embed de Facebook */
iframe[src*="facebook.com/plugins/post.php"],
iframe[src*="facebook.com/plugins/video.php"],
.fb-post, 
.fb-video,
.fb-post span,
.fb-video span,
.fb-post iframe,
.fb-video iframe {
    /* 1. Obligamos a que el ancho sea elástico */
    width: 100% !important;
    max-width: 100% !important; /* No permite que supere el contenedor padre */
    min-width: 0 !important;    /* ROMPE el ancho mínimo de Facebook */
    
    /* 2. Centrado */
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    
    /* 3. Evitar fugas visuales */
    box-sizing: border-box !important;
}

/* 4. Espaciado inferior que querías */
iframe[src*="facebook.com/plugins/post.php"],
iframe[src*="facebook.com/plugins/video.php"] {
    margin: 1rem auto 0 !important;
}

/* Ajuste específico para Desktop para que no se vean gigantes */
@media (min-width: 768px) {
    iframe[src*="facebook.com/plugins/post.php"] {
        max-width: 500px !important;
    }
    iframe[src*="facebook.com/plugins/video.php"] {
        max-width: 380px !important;
    }
}

/* ==========================================================================
   PAGE CONTENT (GUTENBERG / PÁGINAS)
   ========================================================================== */

.page-content {
  max-width: 1200px;
  margin: 4rem auto;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-foreground);
}

/* Headings */

.page-content h1,
.page-content h2,
.page-content h3,
.page-content h4,
.page-content h5,
.page-content h6 {
  font-family: var(--font-display);
  margin-top: 3rem;
  margin-bottom: 1.25rem;
  line-height: 1.2;
}

.page-content h1 { font-size: 3rem; }
.page-content h2 { font-size: 2.25rem; }
.page-content h3 { font-size: 1.75rem; }
.page-content h4 { font-size: 1.35rem; }

/* Párrafos */

.page-content p {
  margin-bottom: 1.75rem;
}

/* Links */

.page-content a {
  color: var(--color-primary);
  text-decoration: underline;
}

.page-content a:hover {
  color: var(--color-primary-hover);
}

/* Listas */

/* List markers para contenido Gutenberg */

.page-content ul {
  list-style: disc;
  padding-left: 1.75rem;
}

.page-content ol {
  list-style: decimal;
  padding-left: 1.75rem;
}

.page-content li::marker {
  color: var(--color-primary);
  font-weight: 700;
}

/* Imágenes y media */

.page-content img,
.page-content figure,
.page-content .wp-block-image img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2.5rem auto;
  border-radius: var(--radius-md);
}

/* Citas */

.page-content blockquote {
  border-left: 4px solid var(--color-primary);
  margin: 3rem 0;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--color-muted-foreground);
}

/* Tablas */

.page-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 3rem 0;
}

.page-content th,
.page-content td {
  border: 1px solid var(--color-border);
  padding: .75rem;
  text-align: left;
}

/* Separador */

.page-content hr {
  margin: 4rem 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* Espaciado bloques Gutenberg */

.page-content .wp-block-group,
.page-content .wp-block-columns {
  margin: 3rem 0;
}

.news-page {
    background-color: #ffffff;
    min-height: 100vh;
}

.news-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.news-page__header {
    background-color: #f4f4f5;
    padding: 60px 0;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 40px;
}

.news-page__title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #09090b;
    margin: 0 0 10px 0;
    letter-spacing: -0.05em;
}

.news-page__count {
    color: #71717a;
    font-size: 1.1rem;
}

/* --- Grid Responsivo --- */
.news-grid {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 640px) {
    .news-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .news-grid { grid-template-columns: repeat(4, 1fr); }
}

/* --- Tarjeta --- */
.news-card {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

.news-card:hover {
    transform: translateY(-4px);
}

.news-card__media {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
}

.news-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-card__badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #e11d48;
    text-transform: uppercase;
}

.news-card__title {
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 4px 0 8px 0;
}

.news-card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #71717a;
}