/* =========================================================
   FINANTRES MÉXICO — EDITORIAL UI v1.0.0
   Alcance limitado a body.fmx-editorial-ui
   ========================================================= */

.fmx-editorial-ui {
    --fmx-ink: #0E2A1E;
    --fmx-text: #3F5148;
    --fmx-muted: #66786E;
    --fmx-link: #0E7C57;
    --fmx-link-hover: #0A6547;
    --fmx-accent: #16A07A;
    --fmx-violet: #6D4AFF;
    --fmx-soft: #EEF7F1;
    --fmx-soft-2: #F7FBF8;
    --fmx-violet-soft: #EFEAFF;
    --fmx-surface: #FFFFFF;
    --fmx-border: #DCEAE1;
    --fmx-border-strong: #CBDDD2;
    --fmx-radius-sm: 10px;
    --fmx-radius: 14px;
    --fmx-radius-lg: 16px;
    --fmx-shadow-soft: 0 8px 30px rgba(14, 42, 30, .05);
}

/* =========================================================
   CONTENIDO EDITORIAL
   ========================================================= */

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) {
    color: var(--fmx-text);
    font-size: 18px;
    line-height: 1.78;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) p {
    margin: 0 0 1.35em !important;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h2 {
    margin: 2.15em 0 .72em !important;
    color: var(--fmx-ink);
    font-size: clamp(27px, 2.1vw, 32px);
    line-height: 1.22;
    letter-spacing: -.025em;
    font-weight: 700;
    text-wrap: wrap;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h3 {
    margin: 1.75em 0 .65em !important;
    color: var(--fmx-ink);
    font-size: clamp(21px, 1.7vw, 24px);
    line-height: 1.3;
    letter-spacing: -.018em;
    font-weight: 700;
    text-wrap: wrap;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h4 {
    margin: 1.55em 0 .55em !important;
    color: var(--fmx-ink);
    font-size: 19px;
    line-height: 1.35;
    font-weight: 700;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) strong {
    color: #183429;
    font-weight: 700;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:not(.elementor-button):not(.wp-block-button__link) {
    color: var(--fmx-link);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(14, 124, 87, .28);
    text-underline-offset: 3px;
    transition: color .18s ease, text-decoration-color .18s ease;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:not(.elementor-button):not(.wp-block-button__link):hover {
    color: var(--fmx-link-hover);
    text-decoration-color: currentColor;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:focus-visible {
    outline: 3px solid rgba(109, 74, 255, .20);
    outline-offset: 3px;
    border-radius: 3px;
}

/* =========================================================
   INTRODUCCIÓN ACF
   ========================================================= */

.fmx-editorial-ui .fmx-entry-intro-widget,
.fmx-editorial-ui .fmx-entry-intro-widget .elementor-widget-container,
.fmx-editorial-ui .fmx-entry-intro-widget .elementor-text-editor,
.fmx-editorial-ui .fmx-entry-intro-widget p,
.fmx-editorial-ui .fmx-entry-intro-widget li {
    color: var(--fmx-text) !important;
    font-size: 18px !important;
    line-height: 1.78 !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.fmx-editorial-ui .fmx-entry-intro-widget p {
    margin: 0 0 1.35em !important;
}

.fmx-editorial-ui .fmx-entry-intro-widget p:last-child {
    margin-bottom: 0 !important;
}

.fmx-editorial-ui .fmx-entry-intro-widget strong {
    color: #183429;
    font-weight: 700;
}

.fmx-editorial-ui .fmx-entry-intro-widget a:not(.elementor-button) {
    color: var(--fmx-link);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(14, 124, 87, .28);
    text-underline-offset: 3px;
    transition: color .18s ease, text-decoration-color .18s ease;
}

.fmx-editorial-ui .fmx-entry-intro-widget a:not(.elementor-button):hover {
    color: var(--fmx-link-hover);
    text-decoration-color: currentColor;
}

.fmx-editorial-ui .fmx-entry-intro-widget a:focus-visible {
    outline: 3px solid rgba(109, 74, 255, .20);
    outline-offset: 3px;
    border-radius: 3px;
}

.fmx-editorial-ui .fmx-entry-intro-widget :is(ul, ol) {
    margin: .25em 0 1.45em !important;
    padding-left: 1.35em !important;
}

.fmx-editorial-ui .fmx-entry-intro-widget li {
    margin-bottom: .58em !important;
    padding-left: .15em;
}

.fmx-editorial-ui .fmx-entry-intro-widget li::marker {
    color: var(--fmx-accent);
    font-weight: 700;
}

/* =========================================================
   LISTAS
   ========================================================= */

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) :is(ul, ol) {
    margin: .25em 0 1.45em !important;
    padding-left: 1.35em !important;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) li {
    margin-bottom: .58em !important;
    padding-left: .15em;
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) li::marker {
    color: var(--fmx-accent);
    font-weight: 700;
}

/* =========================================================
   BLOCKQUOTES Y DESTACADOS
   ========================================================= */

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) blockquote,
.fmx-editorial-ui .fmx-callout,
.fmx-editorial-ui .mce-indent,
.fmx-editorial-ui p[style*="padding-left"] {
    position: relative;
    margin: 28px 0 !important;
    padding: 20px 24px !important;
    color: var(--fmx-text);
    background: linear-gradient(135deg, var(--fmx-soft-2) 0%, var(--fmx-soft) 72%, rgba(239, 234, 255, .72) 100%) !important;
    border: 1px solid var(--fmx-border) !important;
    border-left: 4px solid var(--fmx-violet) !important;
    border-radius: var(--fmx-radius);
    box-shadow: 0 8px 26px rgba(14, 42, 30, .045);
}

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) blockquote > :last-child,
.fmx-editorial-ui .mce-indent p,
.fmx-editorial-ui p.mce-indent,
.fmx-editorial-ui .fmx-callout > :last-child {
    margin-bottom: 0 !important;
}

.fmx-editorial-ui .mce-indent p,
.fmx-editorial-ui p.mce-indent {
    line-height: 1.8;
}

.fmx-editorial-ui .mce-indent strong,
.fmx-editorial-ui p[style*="padding-left"] strong,
.fmx-editorial-ui .fmx-callout strong {
    color: var(--fmx-ink);
}

/* =========================================================
   SEPARADORES
   ========================================================= */

.fmx-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) :is(
    hr,
    .wp-block-separator,
    .elementor-divider-separator,
    .separator,
    .hr
) {
    margin: 40px 0 !important;
    border: 0 !important;
    height: 1px !important;
    background: linear-gradient(
        90deg,
        rgba(14, 124, 87, 0),
        rgba(14, 124, 87, .28) 20%,
        rgba(22, 160, 122, .36) 50%,
        rgba(14, 124, 87, .28) 80%,
        rgba(14, 124, 87, 0)
    ) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

/* =========================================================
   TABLAS
   ========================================================= */

.fmx-editorial-ui .table-container,
.fmx-editorial-ui .fmx-table-container {
    width: 100%;
    margin: 1rem 0 2rem;
}

.fmx-editorial-ui .table-toolbar,
.fmx-editorial-ui .fmx-table-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.fmx-editorial-ui .table-copy-btn,
.fmx-editorial-ui .fmx-table-copy-btn {
    appearance: none;
    background: #FFFFFF;
    color: var(--fmx-link);
    border: 1px solid var(--fmx-border-strong);
    padding: 7px 13px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(14, 42, 30, .035);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.fmx-editorial-ui .table-copy-btn:hover,
.fmx-editorial-ui .fmx-table-copy-btn:hover {
    background: var(--fmx-soft);
    border-color: #BFD8C9;
    color: var(--fmx-link-hover);
}

.fmx-editorial-ui .table-copy-btn:active,
.fmx-editorial-ui .fmx-table-copy-btn:active {
    transform: translateY(1px);
}

.fmx-editorial-ui .table-copy-btn:focus-visible,
.fmx-editorial-ui .fmx-table-copy-btn:focus-visible {
    outline: 3px solid rgba(109, 74, 255, .18);
    outline-offset: 2px;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--fmx-surface);
    border: 1px solid var(--fmx-border);
    border-radius: var(--fmx-radius-lg);
    box-shadow: var(--fmx-shadow-soft);
    scrollbar-width: thin;
    scrollbar-color: #C5D8CC transparent;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
)::-webkit-scrollbar {
    height: 9px;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
)::-webkit-scrollbar-track {
    background: transparent;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
)::-webkit-scrollbar-thumb {
    background: #C5D8CC;
    border: 2px solid #FFFFFF;
    border-radius: 999px;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
)::-webkit-scrollbar-thumb:hover {
    background: #9EB9A9;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) table {
    width: 100% !important;
    min-width: 100%;
    margin: 0 !important;
    border: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: auto;
    color: var(--fmx-text);
    background: #FFFFFF !important;
    font-size: 15px;
    line-height: 1.55;
}

.fmx-editorial-ui :is(.table-wrapper, .fmx-table-scroll, figure.wp-block-table):has(tr > :nth-child(6)) table {
    min-width: 980px !important;
}

.fmx-editorial-ui :is(.table-wrapper, .fmx-table-scroll, figure.wp-block-table):has(tr > :nth-child(3)):not(:has(tr > :nth-child(6))) table {
    min-width: 720px !important;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) :is(th, td) {
    min-width: 138px;
    padding: 15px 17px !important;
    vertical-align: top;
    text-align: left !important;
    white-space: normal;
    word-break: normal !important;
    overflow-wrap: normal !important;
    hyphens: none;
    border-top: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--fmx-border) !important;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) td a {
    overflow-wrap: anywhere;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) thead th,
.fmx-editorial-ui figure.wp-block-table tbody > tr:first-child > th {
    color: var(--fmx-ink) !important;
    background: #F0F8F3 !important;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
    vertical-align: middle;
    border-bottom: 1px solid var(--fmx-border-strong) !important;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) :is(th, td):first-child {
    min-width: 155px;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) tbody td:first-child {
    color: var(--fmx-ink);
    font-weight: 700;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) tbody td {
    background: #FFFFFF !important;
    transition: background .15s ease;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) tbody tr:nth-child(even) td {
    background: #FAFDFC !important;
}

@media (hover: hover) {
    .fmx-editorial-ui :is(
        .table-wrapper,
        .fmx-table-scroll,
        figure.wp-block-table
    ) tbody tr:hover td {
        background: #F0F8F3 !important;
    }
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) tbody tr:last-child td {
    border-bottom: 0 !important;
}

.fmx-editorial-ui :is(
    .table-wrapper,
    .fmx-table-scroll,
    figure.wp-block-table
) caption {
    caption-side: bottom;
    padding: 12px 4px 2px;
    color: var(--fmx-muted);
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}

.fmx-editorial-ui figure.wp-block-table {
    margin: 1rem 0 2rem !important;
}

.fmx-editorial-ui figure.wp-block-table figcaption {
    margin: 0 !important;
    padding: 12px 14px;
    color: var(--fmx-muted);
    background: #FFFFFF;
    font-size: 13px;
    line-height: 1.5;
    border-top: 1px solid var(--fmx-border);
}

/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 768px) {
    .fmx-editorial-ui .fmx-entry-intro-widget,
    .fmx-editorial-ui .fmx-entry-intro-widget .elementor-widget-container,
    .fmx-editorial-ui .fmx-entry-intro-widget .elementor-text-editor,
    .fmx-editorial-ui .fmx-entry-intro-widget p,
    .fmx-editorial-ui .fmx-entry-intro-widget li {
        font-size: 17px !important;
        line-height: 1.74 !important;
    }

    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) {
        font-size: 17px;
        line-height: 1.74;
    }

    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) h2 {
        margin-top: 1.9em !important;
        font-size: 26px;
        line-height: 1.23;
    }

    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) h3 {
        font-size: 21px;
    }

    .fmx-editorial-ui :is(
        .table-wrapper,
        .fmx-table-scroll,
        figure.wp-block-table
    ) {
        border-radius: 12px;
    }

    .fmx-editorial-ui :is(
        .table-wrapper,
        .fmx-table-scroll,
        figure.wp-block-table
    ) table {
        font-size: 14px;
    }

    .fmx-editorial-ui :is(
        .table-wrapper,
        .fmx-table-scroll,
        figure.wp-block-table
    ) :is(th, td) {
        min-width: 140px;
        padding: 13px 14px !important;
    }

    .fmx-editorial-ui :is(
        .table-wrapper,
        .fmx-table-scroll,
        figure.wp-block-table
    ) :is(th, td):first-child {
        min-width: 140px;
    }

    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) :is(
        .fmx-callout,
        .mce-indent,
        p[style*="padding-left"]
    ) {
        padding: 18px !important;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) h2 {
        font-size: 24px;
    }

    .fmx-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) h3 {
        font-size: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fmx-editorial-ui *,
    .fmx-editorial-ui *::before,
    .fmx-editorial-ui *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}
