/*
Theme Name: Mercagi Blog
Theme URI: https://mercagi.com
Author: Mercagi
Author URI: https://mercagi.com
Description: Tema minimalista y limpio para el blog de Mercagi. Diseño estilo SaaS: portada con chips de categorías, búsqueda y carga AJAX; artículos con TOC sticky, minutos de lectura y CTA. Sin dependencias de plugins.
Version: 1.0.17
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mercagi-blog
*/

/*=====================================
  1. VARIABLES GLOBALES
=====================================*/
:root {
    --mg-primary: #ff4747;
    --mg-primary-hover: #e63a3a;
    --mg-text: #2d3238;
    --mg-text-soft: #757575;
    --mg-border: #e9e9e9;
    --mg-bg: #ffffff;
    --mg-bg-soft: #f7f7f7;
    --mg-radius: 10px;
    --mg-max-width: 720px;
    --mg-dark: #2a2c31;
    --mg-font: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

/*=====================================
  2. RESET Y BASE
=====================================*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    font-family: var(--mg-font);
    color: var(--mg-text);
    background: var(--mg-bg);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--mg-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--mg-primary-hover);
}

ul,
ol {
    padding-left: 24px;
}

/*=====================================
  3. CONTENEDORES
=====================================*/
.mg-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
}

.mg-content-width {
    max-width: var(--mg-max-width);
    margin: 0 auto;
}

/*=====================================
  4. HEADER DEL SITIO
=====================================*/
.mg-header {
    border-bottom: 1px solid var(--mg-border);
    background: var(--mg-bg);
}

.mg-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.mg-header__logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mg-header__logo img {
    height: 34px;
    width: auto;
    border-radius: 8px;
}

.mg-header__wordmark {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--mg-text);
}

.mg-header__wordmark em {
    font-style: normal;
    font-weight: 500;
    color: var(--mg-text-soft);
    margin-left: 2px;
}

.mg-header__nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mg-header__nav>a:not(.mg-header__cta) {
    color: var(--mg-text-soft);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 999px;
    transition: color 0.2s ease, background 0.2s ease;
}

.mg-header__nav>a:not(.mg-header__cta):hover {
    color: var(--mg-text);
    background: var(--mg-bg-soft);
}

.mg-header__nav>a:not(.mg-header__cta).mg-is-active {
    color: var(--mg-text);
    font-weight: 600;
}

.mg-header__cta {
    background: var(--mg-primary);
    color: #fff;
    padding: 9px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 10px;
    box-shadow: 0 2px 8px rgba(255, 71, 71, 0.35);
    transition: background 0.2s ease;
}

.mg-header__cta:hover {
    background: var(--mg-primary-hover);
    color: #fff;
}

/* Barra de progreso de lectura */
.mg-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--mg-primary);
    z-index: 9999;
    pointer-events: none;
}

/*=====================================
  5. HERO DEL BLOG (PORTADA)
=====================================*/
.mg-hero {
    padding: 72px 0 40px;
    text-align: center;
}

.mg-hero__title {
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.mg-hero__tagline {
    color: var(--mg-text-soft);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto;
}

/*=====================================
  6. BÚSQUEDA + CHIPS
=====================================*/
.mg-filters {
    padding: 8px 0 32px;
}

.mg-search {
    position: relative;
    max-width: 440px;
    margin: 0 auto 28px;
}

.mg-search input {
    width: 100%;
    height: 48px;
    border: 1px solid var(--mg-border);
    border-radius: 10px;
    padding: 0 48px 0 20px;
    font-family: var(--mg-font);
    font-size: 0.95rem;
    color: var(--mg-text);
    background: var(--mg-bg-soft);
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.mg-search input:focus {
    border-color: var(--mg-primary);
    background: var(--mg-bg);
}

.mg-search__icon {
    position: absolute;
    right: 14px;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    color: var(--mg-text-soft);
    pointer-events: none;
}

.mg-search__icon svg {
    width: 20px;
    height: 20px;
}

.mg-chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
    padding: 0;
}

.mg-chip {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 10px;
    border: 1px solid var(--mg-border);
    color: var(--mg-text-soft);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mg-chip:hover {
    border-color: var(--mg-primary);
    color: var(--mg-primary);
}

.mg-chip.mg-is-active {
    background: var(--mg-primary);
    border-color: var(--mg-primary);
    color: #fff;
}

/*=====================================
  7. GRID DE ARTÍCULOS
=====================================*/
.mg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    padding-bottom: 48px;
}

.mg-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px;
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius);
    background: var(--mg-bg);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.mg-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
    transform: translateY(-2px);
}

.mg-card__thumb {
    display: block;
    margin: -20px -20px 8px;
    border-radius: var(--mg-radius) var(--mg-radius) 0 0;
    overflow: hidden;
}

.mg-card__thumb img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mg-card:hover .mg-card__thumb img {
    transform: scale(1.03);
}

.mg-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--mg-text-soft);
}

.mg-card__dot {
    opacity: 0.4;
}

.mg-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--mg-text);
}

.mg-card__title a {
    color: inherit;
}

.mg-card__title a:hover {
    color: var(--mg-primary);
}

.mg-card__excerpt {
    color: var(--mg-text-soft);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/*=====================================
  8. BOTÓN CARGAR MÁS
=====================================*/
.mg-loadmore-wrap {
    text-align: center;
    padding-bottom: 72px;
}

.mg-btn {
    display: inline-block;
    border: 1px solid var(--mg-primary);
    background: transparent;
    color: var(--mg-primary);
    padding: 12px 32px;
    border-radius: 10px;
    font-family: var(--mg-font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mg-btn:hover {
    background: var(--mg-primary);
    color: #fff;
}

.mg-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/*=====================================
  9. SINGLE: HERO DEL ARTÍCULO
=====================================*/
.mg-single-hero {
    padding: 40px 0 32px;
}

.mg-breadcrumb {
    font-size: 0.85rem;
    color: var(--mg-text-soft);
    margin-bottom: 24px;
}

.mg-breadcrumb p {
    margin: 0;
}

.mg-breadcrumb a {
    color: var(--mg-text-soft);
}

.mg-breadcrumb a:hover {
    color: var(--mg-primary);
}

.mg-breadcrumb__sep,
.mg-breadcrumb .separator {
    margin: 0 8px;
    opacity: 0.5;
}

.mg-breadcrumb .last {
    color: var(--mg-text);
    font-weight: 500;
}

.mg-single-hero__title {
    font-size: 2.2rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.5px;
    margin-bottom: 20px;
    max-width: 780px;
}

.mg-single-hero__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--mg-text-soft);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.mg-single-hero__author-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mg-single-hero__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mg-single-hero__meta img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.mg-single-hero__author {
    color: var(--mg-text);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Check de verificación en el meta del hero — mismo tamaño que el texto (1em) */
.mg-single-hero__verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d9bf0;
}

.mg-single-hero__verified svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
}

/* Separadores del meta: barras verticales finitas (estilo minimalista) */
.mg-single-hero__meta .mg-dot {
    display: inline-block;
    width: 1px;
    height: 14px;
    background: var(--mg-text-soft);
    opacity: 0.35;
}

.mg-single-hero__thumb {
    margin: 32px 0;
    border-radius: var(--mg-radius);
    overflow: hidden;
}

.mg-single-hero__thumb img {
    width: 100%;
    object-fit: cover;
}

/*=====================================
  10. LAYOUT SINGLE + TOC
=====================================*/
/* Contenedor del artículo — ancho de página (como mx-auto max-w-[1060px]) */
.mg-single-article {
    padding-top: 40px;
}

/* Breadcrumb + header + imagen: ancho completo del article, FUERA del grid */
.mg-single-header {
    max-width: 860px;
}

/* Grid SOLO para [contenido | TOC] — como Shoperly (xl:grid-cols-[720px_240px]) */
.mg-single-grid {
    padding-bottom: 40px;
    /* Línea de separación inferior a ANCHO COMPLETO (contenido+TOC).
       En el bloque de autor quedaría cortada a 720px en PC */
    border-bottom: 1px solid var(--mg-border);
}

@media (min-width: 1280px) {
    .mg-single-grid {
        display: grid;
        grid-template-columns: minmax(0, 720px) 240px;
        justify-content: space-between;
        gap: 48px;
    }
}

/* Columna de contenido */
.mg-single-grid .mg-entry {
    min-width: 0;
}

/* CTA + autor + relacionados a ancho completo (contenido + TOC) */
/* .mg-single-wide es full-bleed del article; el .mg-container interno reaplica el ancho */
.mg-single-wide {
    padding: 0 0 64px;
}

.mg-single-wide .mg-related {
    padding-bottom: 0;
}

/* CTA banda estilo admin: fondo negro #2a2c31, ancho completo contenido+TOC (1080px) */
/* Especificidad 0,2,0 (.mg-cta.mg-cta--band) para vencer la regla base .mg-cta (roja) */
.mg-cta.mg-cta--band {
    margin-top: 40px;
    margin-bottom: 40px;
    background: var(--mg-dark, #2a2c31);
    color: #fff;
    border-radius: 14px;
    padding: 40px 32px;
    text-align: left;
}

.mg-cta.mg-cta--band>.mg-container {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 32px;
    padding: 0;
    /* el padding ya lo da la banda */
    max-width: none;
    /* hereda el ancho completo del article */
}

.mg-cta.mg-cta--band .mg-cta__title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.mg-cta.mg-cta--band .mg-cta__text {
    color: rgba(255, 255, 255, 0.7);
    opacity: 1;
    max-width: 672px;
    margin-bottom: 0;
}

.mg-cta.mg-cta--band .mg-cta__btn {
    padding: 14px 28px;
    border-radius: 10px;
    color: #fff;
}

.mg-cta.mg-cta--band .mg-cta__btn:hover {
    background: #fff;
    color: var(--mg-dark, #2a2c31);
}

/* Móvil: una sola columna, botón centrado abajo */
@media (max-width: 640px) {
    .mg-cta.mg-cta--band {
        padding: 32px 24px;
        text-align: center;
    }

    .mg-cta.mg-cta--band>.mg-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .mg-cta.mg-cta--band .mg-cta__btn {
        justify-self: center;
        padding: 14px 32px;
    }
}

/* TOC lateral — SOLO visible en pantallas ≥1280px */
.mg-toc {
    position: sticky;
    top: 90px;
    align-self: start;
}

@media (max-width: 1279px) {
    .mg-toc {
        display: none;
    }
}

.mg-toc__title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--mg-text-soft);
    margin-bottom: 14px;
}

.mg-toc__list {
    list-style: none;
    padding: 0;
    border: none;
}

.mg-toc__list a {
    display: block;
    padding: 7px 0;
    font-size: 0.86rem;
    color: var(--mg-text-soft);
    line-height: 1.5;
}

.mg-toc__list a:hover {
    color: var(--mg-text);
}

.mg-toc__list a.mg-is-active {
    color: var(--mg-text);
    font-weight: 600;
}

/* TOC colapsable — SOLO visible en pantallas <1280px (móvil y tablet) */
.mg-toc-mobile {
    border-top: 1px solid var(--mg-border);
    border-bottom: 1px solid var(--mg-border);
    padding: 14px 0;
    margin: 32px 0;
}

.mg-toc-mobile summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--mg-text);
    list-style: none;
    position: relative;
    padding-right: 24px;
}

.mg-toc-mobile summary::-webkit-details-marker {
    display: none;
}

/* Flecha indicadora */
.mg-toc-mobile summary::after {
    content: '›';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
    transition: transform 0.2s ease;
    color: var(--mg-text-soft);
}

.mg-toc-mobile[open] summary::after {
    transform: translateY(-50%) rotate(-90deg);
}

.mg-toc-mobile[open] summary {
    margin-bottom: 10px;
}

.mg-toc-mobile .mg-toc__list a {
    padding: 6px 0;
}

@media (min-width: 1280px) {
    .mg-toc-mobile {
        display: none;
    }
}

/*=====================================
  11. CONTENIDO DEL ARTÍCULO
=====================================*/
.mg-entry {
    font-size: 1.125rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
}

.mg-entry h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 64px 0 20px;
    line-height: 1.3;
}

/* Ancla de los H2: enlace invisible, # visible al hover */
.mg-entry h2 .mg-anchor {
    color: inherit;
    text-decoration: none;
    position: relative;
}

.mg-entry h2 .mg-anchor:hover {
    color: inherit;
}

.mg-entry h2 .mg-anchor::after {
    content: '#';
    color: var(--mg-primary);
    opacity: 0;
    margin-left: 8px;
    font-weight: 400;
    transition: opacity 0.2s ease;
}

.mg-entry h2 .mg-anchor:hover::after {
    opacity: 1;
}

@media (min-width: 768px) {
    .mg-entry h2 {
        font-size: 1.875rem;
    }
}

.mg-entry h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 40px 0 16px;
}

.mg-entry p {
    margin-bottom: 20px;
    color: rgba(15, 17, 19, 0.85);
    /* negro base al 85% — equivalente al text-foreground/85 de Shoperly */
}

/* Resaltados (strong/b) al 100% de opacidad, como Shoperly (text-foreground) */
.mg-entry p strong,
.mg-entry p b,
.mg-entry li strong,
.mg-entry li b {
    color: var(--mg-text);
    font-weight: 600;
}

/* Links del contenido estilo Shoperly: semibold, subrayado rojo 2px, offset 4px */
.mg-entry a {
    color: var(--mg-text);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--mg-primary);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

.mg-entry a:hover {
    text-decoration-color: var(--mg-text);
}

/* Los links del TOC acordeón (móvil) no heredan el estilo de links del contenido.
   Especificidad 0,3,1 para vencer a .mg-entry a (0,1,1) sin importar el orden del archivo */
.mg-entry .mg-toc-mobile .mg-toc__list a {
    color: var(--mg-text-soft);
    font-weight: 400;
    text-decoration: none;
    text-decoration-color: transparent;
    text-decoration-thickness: 0;
}

.mg-entry .mg-toc-mobile .mg-toc__list a:hover,
.mg-entry .mg-toc-mobile .mg-toc__list a.mg-is-active {
    text-decoration: none;
    color: var(--mg-text);
}

/* Botones Gutenberg dentro del contenido: estilo landing mercagi */
.mg-entry .wp-block-button__link {
    color: var(--mg-text);
    font-weight: 600;
    font-family: var(--mg-font);
    text-decoration: none;
    background: var(--mg-bg);
    border: 2px solid var(--mg-border);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mg-entry .wp-block-button__link:hover {
    border-color: var(--mg-primary);
    color: var(--mg-primary);
    box-shadow: 0 2px 8px rgba(255, 71, 71, 0.15);
}

.mg-entry .wp-block-button.is-style-outline>.wp-block-button__link {
    border: 2px solid var(--mg-border);
    padding: 12px 24px;
}

.mg-entry .wp-block-buttons {
    gap: 12px;
}

.mg-entry ul,
.mg-entry ol {
    margin-bottom: 20px;
}

.mg-entry li {
    margin-bottom: 8px;
}

/* Separador Gutenberg: fino y con aire arriba/abajo */
.mg-entry hr.wp-block-separator {
    border: none;
    border-top: 1px solid var(--mg-border);
    margin: 40px 0;
    opacity: 1;
}

.mg-entry hr.wp-block-separator.has-alpha-channel-opacity {
    opacity: 0.55;
}

/* Imágenes del contenido: separación + borde redondeado con remarcado negro */
.mg-entry figure {
    margin: 20px 0;
}

.mg-entry img {
    border-radius: 10px;
    border: 2px solid var(--mg-dark);
}

/* El avatar del autor queda excluido del remarcado */
.mg-author__avatar img,
.mg-single-hero__meta img {
    border: none;
    border-radius: 50%;
}

.mg-entry blockquote {
    border-left: 3px solid var(--mg-primary);
    padding: 8px 0 8px 20px;
    margin: 28px 0;
    color: var(--mg-text-soft);
    font-style: italic;
}

.mg-entry table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius);
    overflow: hidden;
    margin: 28px 0;
    font-size: 0.95rem;
}

.mg-entry th {
    text-align: left;
    padding: 12px 14px;
    background: var(--mg-bg-soft);
    border-bottom: 2px solid var(--mg-border);
    font-weight: 600;
}

.mg-entry th:first-child {
    border-top-left-radius: var(--mg-radius);
}

.mg-entry th:last-child {
    border-top-right-radius: var(--mg-radius);
}

.mg-entry td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--mg-border);
}

.mg-entry tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--mg-radius);
}

.mg-entry tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--mg-radius);
}

/* Anular los bordes oscuros del core de WP (wp-block-table) */
.mg-entry .wp-block-table th {
    border-left: none;
    border-right: none;
    border-top: none;
}

.mg-entry .wp-block-table td {
    border: none;
    border-bottom: 1px solid var(--mg-border);
}

.mg-entry .wp-block-table thead {
    border-bottom: 2px solid var(--mg-border);
}

.mg-entry .wp-block-table tfoot {
    border-top: 2px solid var(--mg-border);
}

/* Scroll horizontal si la tabla excede el ancho (móvil) */
.mg-entry .wp-block-table {
    overflow-x: auto;
}

/* Zebra striping en tablas */
.mg-entry tbody tr:nth-child(even) {
    background: var(--mg-bg-soft);
}

/* Tabla "Respuesta rápida" del pattern */
.mg-entry .mg-quick-answer table {
    border: 1px solid var(--mg-border);
    border-radius: var(--mg-radius);
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
}

.mg-entry .mg-quick-answer th {
    background: var(--mg-dark);
    color: #fff;
    border-bottom: none;
}

.mg-entry .mg-quick-answer th:first-child {
    border-top-left-radius: var(--mg-radius);
}

.mg-entry .mg-quick-answer th:last-child {
    border-top-right-radius: var(--mg-radius);
}

.mg-entry .mg-quick-answer td:first-child {
    font-weight: 600;
}

/* Box "En resumen" del pattern */
.mg-entry .mg-summary {
    background: var(--mg-bg-soft);
    border: none;
    border-radius: var(--mg-radius);
    padding: 22px 26px;
    margin: 32px 0;
}

.mg-entry .mg-summary .mg-summary__title,
.mg-entry .mg-summary h2 {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    margin: 0 0 12px !important;
}

.mg-entry .mg-summary ul,
.mg-entry .mg-summary ol {
    margin-bottom: 0;
}

/*=====================================
  12. CTA + AUTOR + RELACIONADOS
=====================================*/
.mg-cta {
    background: var(--mg-primary);
    border-radius: 14px;
    padding: 40px 32px;
    text-align: center;
    color: #fff;
    margin: 48px 0;
}

.mg-cta__title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.mg-cta__text {
    opacity: 0.9;
    margin-bottom: 20px;
    font-size: 0.98rem;
}

.mg-cta__btn {
    display: inline-block;
    background: var(--mg-primary);
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.mg-cta__btn:hover {
    background: var(--mg-primary-hover);
    color: #fff;
}

/* Párrafos de la tarjeta de autor — scope propio para vencer .mg-entry p (especificidad) */
.mg-author p {
    margin-bottom: 0;
}

.mg-author__name {
    margin-bottom: 2px;
}

.mg-author__role {
    margin-bottom: 8px;
}

.mg-author__bio {
    margin-bottom: 0;
}

/* Autor en 2 filas: arriba avatar+nombre+rol, abajo bio a ancho completo (como Shoperly) */
.mg-author {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 30px;
    border-top: 1px solid var(--mg-border);
    margin-top: 40px;
}

.mg-author__top {
    display: flex;
    gap: 16px;
    align-items: center;
}

.mg-author__avatar img {
    border-radius: 50%;
}

.mg-author__name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mg-author__role {
    color: var(--mg-text-soft);
    font-size: 0.9375rem;
    font-weight: 400;
    margin-bottom: 8px;
}

/* La identidad (nombre + rol) ocupa el espacio flexible central */
.mg-author__identity {
    flex: 1;
    min-width: 0;
}

/* Check de verificación pegado al nombre (estilo X/Instagram) */
.mg-author__verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d9bf0;
}

.mg-author__verified svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* LinkedIn: CTA discreto debajo de la bio (ícono + texto).
   Especificidad 0,2,0 para vencer a .mg-entry a (0,1,1) que pinta subrayado rojo */
.mg-author .mg-author__linkedin {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--mg-text);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mg-author__linkedin svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.mg-author .mg-author__linkedin:hover {
    color: var(--mg-primary);
}

.mg-author__bio {
    color: var(--mg-text-soft);
    font-size: 0.9375rem;
    line-height: 1.6;
}

/* Nombre del autor enlazado a su página.
   Especificidad 0,2,0 para vencer a .mg-entry a (0,1,1) que pinta subrayado rojo */
.mg-author .mg-author__link {
    color: inherit;
    text-decoration: none;
    text-decoration-color: transparent;
    text-decoration-thickness: 0;
}

.mg-author .mg-author__link:hover {
    color: var(--mg-primary);
}

/* Compartir en redes */
.mg-share {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 40px 0 0;
    padding-top: 24px;
    border-top: 1px solid var(--mg-border);
}

.mg-share__label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--mg-text-soft);
}

.mg-share__buttons {
    display: flex;
    gap: 8px;
}

.mg-share__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--mg-border);
    color: var(--mg-text-soft);
    transition: all 0.2s ease;
}

.mg-share__btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.mg-share__btn:hover {
    color: #fff;
    border-color: transparent;
}

.mg-share__btn--whatsapp:hover {
    background: #25d366;
}

.mg-share__btn--facebook:hover {
    background: #1877f2;
}

.mg-share__btn--x:hover {
    background: #000;
}

.mg-share__btn--linkedin:hover {
    background: #0a66c2;
}

/* Página de autor — sin padding horizontal (lo da .mg-container) */
.mg-author-page {
    padding-top: 48px;
    padding-bottom: 32px;
}

.mg-author-page__posts {
    padding-bottom: 64px;
}

.mg-author-page__top {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mg-author-page__top img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: none;
}

.mg-author-page__name {
    font-size: 1.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mg-author-page__role {
    color: var(--mg-text-soft);
    font-size: 1rem;
}

.mg-author-page__bio {
    color: var(--mg-text-soft);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 720px;
    margin: 20px 0 16px;
}

@media (max-width: 480px) {
    .mg-author-page {
        padding-top: 32px;
        padding-bottom: 24px;
    }

    .mg-author-page__top {
        flex-direction: column;
        text-align: center;
    }

    .mg-author-page__name {
        font-size: 1.4rem;
        justify-content: center;
    }
}

.mg-related {
    padding-bottom: 64px;
}

.mg-related__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.mg-related__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.mg-related__all {
    text-align: center;
    margin-top: 32px;
}

.mg-related__all a {
    font-weight: 600;
    font-size: 0.95rem;
}

/*=====================================
  13. BÚSQUEDA / ARCHIVO
=====================================*/
.mg-page-title {
    padding: 56px 0 8px;
    text-align: center;
}

.mg-page-title h1 {
    font-size: 1.9rem;
    font-weight: 600;
}

.mg-page-title p {
    color: var(--mg-text-soft);
    margin-top: 8px;
}

/* Paginación de archivos (categorías) */
.mg-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 0 0;
}

.mg-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--mg-border);
    border-radius: 10px;
    color: var(--mg-text-soft);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mg-pagination .page-numbers:hover {
    border-color: var(--mg-primary);
    color: var(--mg-primary);
}

.mg-pagination .page-numbers.current {
    background: var(--mg-primary);
    border-color: var(--mg-primary);
    color: #fff;
}

.mg-pagination .page-numbers.dots {
    border: none;
    min-width: 24px;
    padding: 0;
}

/*=====================================
  14. FOOTER
=====================================*/
.mg-footer {
    background: var(--mg-dark);
    color: #fff;
    padding: 48px 0 32px;
}

.mg-footer__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mg-footer__brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 480px;
}

.mg-footer__logo {
    width: 200px;
    height: auto;
}

.mg-footer__logo-link {
    display: inline-block;
    transition: opacity 0.2s ease;
}

.mg-footer__logo-link:hover {
    opacity: 0.85;
}

.mg-footer__tagline {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.9rem;
}

.mg-footer__social {
    display: flex;
    gap: 12px;
}

.mg-footer__social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transition: background 0.2s ease, color 0.2s ease;
}

.mg-footer__social-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.mg-footer__social-link:hover {
    background: var(--mg-primary);
    color: #fff;
}

.mg-footer__links {
    display: flex;
    gap: 22px;
    flex-wrap: wrap;
    padding: 24px 0;
}

.mg-footer__links a {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.88rem;
    font-weight: 500;
}

.mg-footer__links a:hover {
    color: #fff;
}

.mg-footer__bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 20px;
}

.mg-footer__bottom p {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.82rem;
}

/*=====================================
  15. RESPONSIVE
=====================================*/
@media (max-width: 768px) {
    .mg-hero {
        padding: 48px 0 32px;
    }

    .mg-hero__title {
        font-size: 2rem;
    }

    .mg-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .mg-related__grid {
        grid-template-columns: 1fr;
    }

    .mg-single-hero__meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .mg-single-hero__title {
        font-size: 1.95rem;
    }

    /* Bloque de autor en móvil: texto un poco más grande (sin llegar al del contenido) */
    .mg-author__name {
        font-size: 1.0625rem;
    }

    .mg-author__role {
        font-size: 1rem;
    }

    .mg-author__bio {
        font-size: 1rem;
        line-height: 1.7;
        letter-spacing: 0.01em;
    }

    .mg-author .mg-author__linkedin {
        font-size: 0.9375rem;
    }

    /* Tablas: ancho de desktop (720px) + columnas IGUALES + scroll horizontal */
    .mg-entry .wp-block-table {
        margin: 28px 0;
    }

    .mg-entry .wp-block-table table {
        margin: 0;
        min-width: 720px;
        table-layout: fixed;
    }
}

@media (max-width: 480px) {
    .mg-hero__title {
        font-size: 1.7rem;
    }

    .mg-single-hero__title {
        font-size: 1.6rem;
    }

    .mg-header__inner {
        height: 58px;
    }
}

/*=====================================
  16. MENÚ MÓVIL (drawer animado)
=====================================*/
.mg-menu-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
    color: var(--mg-text);
    line-height: 0;
    border-radius: 8px;
}

.mg-menu-toggle svg {
    width: 26px;
    height: 26px;
}

.mg-menu-toggle .mg-icon-close {
    display: none;
}

body.mg-menu-open .mg-menu-toggle .mg-icon-open {
    display: none;
}

body.mg-menu-open .mg-menu-toggle .mg-icon-close {
    display: block;
}

.mg-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 998;
}

body.mg-menu-open .mg-menu-overlay {
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 768px) {
    .mg-menu-toggle {
        display: inline-flex;
    }

    /* La nav desktop se convierte en drawer lateral */
    .mg-header__nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 85vw);
        background: var(--mg-dark);
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 80px 24px 32px;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 999;
        overflow-y: auto;
    }

    body.mg-menu-open .mg-header__nav {
        transform: translateX(0);
    }

    .mg-header__nav>a:not(.mg-header__cta) {
        color: rgba(255, 255, 255, 0.75);
        font-size: 1.05rem;
        padding: 12px 8px;
        width: 100%;
        border-radius: 8px;
        opacity: 0;
        transform: translateX(24px);
        transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
    }

    body.mg-menu-open .mg-header__nav>a:not(.mg-header__cta) {
        opacity: 1;
        transform: translateX(0);
    }

    /* Stagger: cada enlace entra con un pequeño retraso */
    body.mg-menu-open .mg-header__nav>a:nth-child(1) {
        transition-delay: 0.08s;
    }

    body.mg-menu-open .mg-header__nav>a:nth-child(2) {
        transition-delay: 0.14s;
    }

    body.mg-menu-open .mg-header__nav>a:nth-child(3) {
        transition-delay: 0.2s;
    }

    body.mg-menu-open .mg-header__nav>a:nth-child(4) {
        transition-delay: 0.26s;
    }

    .mg-header__nav>a:not(.mg-header__cta):hover,
    .mg-header__nav>a:not(.mg-header__cta).mg-is-active {
        background: rgba(255, 255, 255, 0.08);
        color: #fff;
    }

    .mg-header__cta {
        margin: 16px 0 0;
        width: 100%;
        text-align: center;
        opacity: 0;
        transform: translateX(16px);
        transition: opacity 0.3s ease 0.32s, transform 0.3s ease 0.32s, background 0.2s ease;
    }

    body.mg-menu-open .mg-header__cta {
        opacity: 1;
        transform: translateX(0);
    }
}

/*=====================================
  17. FUENTES (Poppins self-hosted)
=====================================*/
@font-face {
    font-family: 'Poppins';
    src: url('assets/fonts/poppins-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('assets/fonts/poppins-500.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('assets/fonts/poppins-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Poppins';
    src: url('assets/fonts/poppins-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}