/* =========================================================
   FINANMERCADO — EDITORIAL UI v1.0.0
   Alcance limitado a body.fm-editorial-ui
   ========================================================= */

.fm-editorial-ui {
    --fm-black: #111111;
    --fm-ink: #1C1917;
    --fm-text: #3A332B;
    --fm-muted: #6D6256;
    --fm-gold: #B47A1B;
    --fm-gold-dark: #946014;
    --fm-gold-hover: #7B4D0E;
    --fm-gold-light: #D7B36A;
    --fm-gold-soft: #F2E4C4;
    --fm-paper: #F7F1E4;
    --fm-paper-light: #FBF7EE;
    --fm-surface: #FFFDF9;
    --fm-border: #D8C8A8;
    --fm-border-strong: #C7AF80;
    --fm-radius: 14px;
    --fm-radius-lg: 16px;
    --fm-shadow-soft: 0 8px 28px rgba(58, 51, 43, .065);
}
/* =========================================================
   CONTENIDO EDITORIAL
   Los componentes propios .fw, si existen, conservan su UI.
   ========================================================= */

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

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

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h3:not(.fw):not(.fw *) {
    margin: 1.72em 0 .64em !important;
    color: var(--fm-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;
}

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) strong:not(.fw):not(.fw *) {
    color: #241F1A;
    font-weight: 700;
}

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:not(.fw):not(.fw *):not(.elementor-button):not(.wp-block-button__link) {
    color: var(--fm-gold);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(180, 122, 27, .30);
    text-underline-offset: 3px;
    transition: color .18s ease, text-decoration-color .18s ease;
}

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:not(.fw):not(.fw *):focus-visible {
    outline: 3px solid rgba(215, 179, 106, .34);
    outline-offset: 3px;
    border-radius: 3px;
}

/* =========================================================
   ACF: primer_texto_arriba + introduccion
   ========================================================= */

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

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

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

.fm-editorial-ui .fm-entry-intro-widget strong {
    color: #241F1A;
    font-weight: 700;
}

.fm-editorial-ui .fm-entry-intro-widget a:not(.elementor-button) {
    color: var(--fm-gold);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(180, 122, 27, .30);
    text-underline-offset: 3px;
}

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

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

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

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

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

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

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) li:not(.fw):not(.fw *)::marker {
    color: var(--fm-gold);
    font-weight: 700;
}

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) blockquote:not(.fw):not(.fw *) {
    margin: 30px 0 !important;
    padding: 20px 24px !important;
    color: var(--fm-text);
    background: linear-gradient(135deg, #FFFDF9 0%, var(--fm-paper-light) 58%, #F7EBCD 100%);
    border: 1px solid var(--fm-border) !important;
    border-left: 4px solid var(--fm-gold) !important;
    border-radius: var(--fm-radius);
    box-shadow: 0 8px 25px rgba(58, 51, 43, .055);
}

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) blockquote:not(.fw):not(.fw *) > :last-child {
    margin-bottom: 0 !important;
}

.fm-editorial-ui .fm-callout:not(.fw):not(.fw *),
.fm-editorial-ui .mce-indent:not(.fw):not(.fw *),
.fm-editorial-ui p[style*="padding-left"]:not(.fw):not(.fw *) {
    position: relative;
    margin: 28px 0 !important;
    padding: 20px 24px !important;
    color: var(--fm-text);
    background: linear-gradient(135deg, #FFFDF9 0%, #F8F1E3 100%) !important;
    border: 1px solid var(--fm-border) !important;
    border-left: 4px solid var(--fm-gold) !important;
    border-radius: var(--fm-radius);
    box-shadow: 0 7px 24px rgba(58, 51, 43, .055);
}

.fm-editorial-ui .mce-indent:not(.fw):not(.fw *) p,
.fm-editorial-ui p.mce-indent:not(.fw):not(.fw *),
.fm-editorial-ui .fm-callout:not(.fw):not(.fw *) > :last-child {
    margin-bottom: 0 !important;
}

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

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

.fm-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) :is(
    hr,
    .wp-block-separator,
    .elementor-divider-separator,
    .separator,
    .hr
):not(.fw):not(.fw *) {
    margin: 40px 0 !important;
    border: 0 !important;
    height: 1px !important;
    background: linear-gradient(
        90deg,
        rgba(180, 122, 27, 0),
        rgba(180, 122, 27, .34) 34%,
        rgba(215, 179, 106, .36) 66%,
        rgba(215, 179, 106, 0)
    ) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

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

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

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

.fm-editorial-ui .table-copy-btn,
.fm-editorial-ui .fm-table-copy-btn {
    appearance: none;
    background: #FFFFFF;
    color: var(--fm-gold-dark);
    border: 1px solid #D8C8A8;
    padding: 7px 13px;
    font-size: 12px;
    line-height: 1.2;
    font-weight: 650;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(58, 51, 43, .055);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.fm-editorial-ui .table-copy-btn:hover,
.fm-editorial-ui .fm-table-copy-btn:hover {
    background: var(--fm-paper);
    border-color: #C7AF80;
    color: var(--fm-gold-hover);
    box-shadow: 0 5px 14px rgba(58, 51, 43, .075);
}

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

.fm-editorial-ui .table-copy-btn:focus-visible,
.fm-editorial-ui .fm-table-copy-btn:focus-visible {
    outline: 3px solid rgba(215, 179, 106, .32);
    outline-offset: 2px;
}

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

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

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

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *)::-webkit-scrollbar-thumb {
    background: #D7B36A;
    border: 2px solid var(--fm-paper-light);
    border-radius: 999px;
}

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *)::-webkit-scrollbar-thumb:hover {
    background: var(--fm-gold);
}

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) 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(--fm-text);
    background: var(--fm-surface) !important;
    font-size: 15px;
    line-height: 1.55;
}

/* Nada de 1200px para todas las tablas. */
.fm-editorial-ui :is(.table-wrapper, .fm-table-scroll, figure.wp-block-table):not(.fw *):has(tr > :nth-child(6)) table {
    min-width: 980px !important;
}

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

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) :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(--fm-border) !important;
}

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

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) thead th,
.fm-editorial-ui figure.wp-block-table:not(.fw *) tbody > tr:first-child > th {
    color: var(--fm-black) !important;
    background: linear-gradient(180deg, #F8F0DF 0%, #F1E3C7 100%) !important;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
    vertical-align: middle;
    border-bottom: 1px solid var(--fm-border-strong) !important;
}

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

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) tbody td:first-child {
    color: var(--fm-black);
    font-weight: 700;
}

.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) tbody td {
    background: var(--fm-surface) !important;
    transition: background .15s ease;
}

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

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

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

.fm-editorial-ui figure.wp-block-table:not(.fw *) {
    margin: 1rem 0 2rem !important;
}

.fm-editorial-ui figure.wp-block-table:not(.fw *) figcaption,
.fm-editorial-ui :is(
    .table-wrapper,
    .fm-table-scroll,
    figure.wp-block-table
):not(.fw *) caption {
    margin: 0 !important;
    padding: 12px 14px;
    color: var(--fm-muted);
    background: var(--fm-paper-light);
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}

/* =========================================================
   COMPONENTES .fw
   Se preserva su UI y se evita que la capa editorial los invada.
   ========================================================= */

.fm-editorial-ui .elementor-widget-theme-post-content .fw {
    line-height: 1.5 !important;
    margin: 1.75rem auto !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw,
.fm-editorial-ui .elementor-widget-theme-post-content .fw * {
    box-sizing: border-box !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw :is(p, ul, ol, li, h1, h2, h3, h4, h5, h6) {
    line-height: inherit !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-title {
    margin: 0 0 6px !important;
    line-height: 1.3 !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-desc {
    margin: 0 0 14px !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-benefits {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 16px !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-benefits li {
    margin: 0 !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-foot {
    margin: 10px 0 0 !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw a,
.fm-editorial-ui .elementor-widget-theme-post-content .fw a:hover,
.fm-editorial-ui .elementor-widget-theme-post-content .fw a:focus,
.fm-editorial-ui .elementor-widget-theme-post-content .fw a:focus-visible {
    text-decoration: none !important;
    outline: none !important;
}

.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-cta,
.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-cta:focus,
.fm-editorial-ui .elementor-widget-theme-post-content .fw .fw-cv-cta:focus-visible {
    outline: none !important;
    box-shadow: 0 6px 16px -4px rgba(180, 122, 27, .34) !important;
}

/* =========================================================
   MOVIL
   ========================================================= */

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

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

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

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

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

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

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

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

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

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

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