/* =========================================================
   FINANTRES EDITORIAL UI v1.3.2
   Carga solo en contenidos compatibles mediante body.ft-editorial-ui
   ========================================================= */

.ft-editorial-ui {
    --ft-font-body: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
    --ft-font-heading: "IBM Plex Sans", "Source Sans 3", Arial, sans-serif;
    --ft-accent: #E9B949;
    --ft-ink: #191C20;
    --ft-text: #25282D;
    --ft-muted: #62676F;
    --ft-link: #8A6517;
    --ft-link-hover: #6F5112;
    --ft-blue-soft: #FFF5D6;
    --ft-blue-soft-2: #FFFCF3;
    --ft-blue-line: #F1D99A;
    --ft-surface: #ffffff;
    --ft-surface-soft: #F7F7F5;
    --ft-border: #E5E5E1;
    --ft-border-strong: #D6D3CA;
    --ft-radius-sm: 10px;
    --ft-radius: 14px;
    --ft-radius-lg: 16px;
    --ft-shadow-soft: 0 8px 30px rgba(25, 28, 32, .045);
}

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

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

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

.ft-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h2 {
    margin: 2.15em 0 .72em !important;
    color: var(--ft-ink);
    font-family: var(--ft-font-heading) !important;
    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;
}

.ft-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) h3 {
    margin: 1.75em 0 .65em !important;
    color: var(--ft-ink);
    font-family: var(--ft-font-heading) !important;
    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;
}

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

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

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

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

.ft-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) a:focus-visible {
    outline: 3px solid rgba(138, 101, 23, .2);
    outline-offset: 3px;
    border-radius: 3px;
}

/* =========================================================
   INTRODUCCIÓN ACF
   Elementor la pinta fuera de Post Content en algunas plantillas.
   El plugin identifica el widget sin duplicar ni reescribir el contenido.
   ========================================================= */

/*
 * Elementor puede aplicar su tipografía global directamente sobre el widget,
 * .elementor-text-editor o incluso los párrafos. Por eso el color/tamaño de
 * texto normal se fija también en los nodos de texto y no solo por herencia.
 * Esto hace que la introducción ACF coincida visualmente con Post Content.
 */
.ft-editorial-ui .ft-entry-intro-widget,
.ft-editorial-ui .ft-entry-intro-widget .elementor-widget-container,
.ft-editorial-ui .ft-entry-intro-widget .elementor-text-editor,
.ft-editorial-ui .ft-entry-intro-widget p,
.ft-editorial-ui .ft-entry-intro-widget li {
    color: var(--ft-text) !important;
    font-family: var(--ft-font-body) !important;
    font-size: 18px !important;
    line-height: 1.78 !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

.ft-editorial-ui .ft-entry-intro-widget strong {
    color: #191C20;
    font-weight: 700;
}

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

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

.ft-editorial-ui .ft-entry-intro-widget a:focus-visible {
    outline: 3px solid rgba(138, 101, 23, .2);
    outline-offset: 3px;
    border-radius: 3px;
}

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

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

.ft-editorial-ui .ft-entry-intro-widget li::marker {
    color: #8A6517;
    font-weight: 700;
}

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

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

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

.ft-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) li::marker {
    color: #8A6517;
    font-weight: 700;
}

/* =========================================================
   BLOCKQUOTES
   ========================================================= */

.ft-editorial-ui :where(
    .elementor-widget-theme-post-content,
    .entry-content
) blockquote {
    margin: 30px 0 !important;
    padding: 20px 24px !important;
    color: var(--ft-text);
    font-family: var(--ft-font-body);
    background: linear-gradient(135deg, var(--ft-blue-soft-2), var(--ft-blue-soft));
    border: 1px solid var(--ft-blue-line) !important;
    border-left: 4px solid var(--ft-accent) !important;
    border-radius: var(--ft-radius);
    box-shadow: 0 8px 26px rgba(25, 28, 32, .04);
}

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

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

.ft-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(138, 101, 23, 0),
        rgba(138, 101, 23, .30) 20%,
        rgba(138, 101, 23, .30) 80%,
        rgba(138, 101, 23, 0)
    ) !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

/* =========================================================
   CAJAS DESTACADAS
   Compatibilidad con contenido ya existente.
   A futuro: usar preferentemente la clase .ft-callout.
   ========================================================= */

/*
 * La sangría del editor clásico/TinyMCE se usa en Finantres como destacado.
 * La detectamos también fuera de .entry-content porque algunas plantillas de
 * Elementor imprimen el contenido dentro de otros wrappers.
 */
.ft-editorial-ui .ft-callout,
.ft-editorial-ui .mce-indent,
.ft-editorial-ui p[style*="padding-left"] {
    position: relative;
    margin: 28px 0 !important;
    padding: 20px 24px !important;
    color: var(--ft-text);
    font-family: var(--ft-font-body);
    background: linear-gradient(135deg, var(--ft-blue-soft-2), var(--ft-blue-soft)) !important;
    border: 1px solid var(--ft-blue-line) !important;
    border-left: 4px solid var(--ft-accent) !important;
    border-radius: var(--ft-radius);
    box-shadow: 0 8px 26px rgba(25, 28, 32, .04);
}

.ft-editorial-ui .mce-indent p,
.ft-editorial-ui p.mce-indent,
.ft-editorial-ui .ft-callout > :last-child {
    margin-bottom: 0 !important;
}

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

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

/* =========================================================
   TABLAS: CONTENEDOR
   CSS-first: Gutenberg y wrappers existentes, sin depender de JavaScript.
   ========================================================= */

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

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

.ft-editorial-ui .table-copy-btn,
.ft-editorial-ui .ft-table-copy-btn {
    appearance: none;
    background: #fff;
    color: #8A6517;
    border: 1px solid var(--ft-blue-line);
    padding: 7px 13px;
    font-size: 12px;
    font-family: var(--ft-font-body);
    line-height: 1.2;
    font-weight: 600;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(25, 28, 32, .04);
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

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

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

.ft-editorial-ui .table-copy-btn:focus-visible,
.ft-editorial-ui .ft-table-copy-btn:focus-visible {
    outline: 3px solid rgba(138, 101, 23, .22);
    outline-offset: 2px;
}

/* Scroll container */
.ft-editorial-ui :is(
    .table-wrapper,
    .ft-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(--ft-surface);
    border: 1px solid var(--ft-border);
    border-radius: var(--ft-radius-lg);
    box-shadow: var(--ft-shadow-soft);
    scrollbar-width: thin;
    scrollbar-color: #C9C7BF transparent;
}

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

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

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

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

.ft-editorial-ui :is(
    .table-wrapper,
    .ft-table-scroll,
    figure.wp-block-table
).is-scrollable:focus-visible {
    outline: 3px solid rgba(138, 101, 23, .18);
    outline-offset: 3px;
}

/* Table base */
.ft-editorial-ui :is(
    .table-wrapper,
    .ft-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(--ft-text);
    background: #fff !important;
    font-size: 15px;
    font-family: var(--ft-font-body) !important;
    line-height: 1.55;
}

/*
 * El ancho nace de las celdas, no de JS. Para tablas con muchas columnas
 * dejamos una referencia mínima adicional; si el navegador no soporta :has(),
 * los min-width de las celdas siguen generando el scroll correctamente.
 */
.ft-editorial-ui :is(.table-wrapper, .ft-table-scroll, figure.wp-block-table):has(tr > :nth-child(6)) table {
    min-width: 980px !important;
}

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

/* Cells */
.ft-editorial-ui :is(
    .table-wrapper,
    .ft-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(--ft-border) !important;
}

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

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

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

.ft-editorial-ui :is(
    .table-wrapper,
    .ft-table-scroll,
    figure.wp-block-table
) tbody td:first-child {
    color: #191C20;
    font-weight: 700;
}

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

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

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

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

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

/* Existing Gutenberg figure margins */
.ft-editorial-ui figure.wp-block-table {
    margin: 1rem 0 2rem !important;
}

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

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

@media (max-width: 768px) {

    .ft-editorial-ui .ft-entry-intro-widget,
    .ft-editorial-ui .ft-entry-intro-widget .elementor-widget-container,
    .ft-editorial-ui .ft-entry-intro-widget .elementor-text-editor,
    .ft-editorial-ui .ft-entry-intro-widget p,
    .ft-editorial-ui .ft-entry-intro-widget li {
        font-size: 17px !important;
        line-height: 1.74 !important;
    }
    .ft-editorial-ui :where(
        .elementor-widget-theme-post-content,
        .entry-content
    ) {
        font-size: 17px;
        line-height: 1.74;
    }

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

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

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

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

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

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

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

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

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

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

/* =========================================================
   IMAGEN DESTACADA - acabado editorial premium v1.3.2
   - Automatico: widget Imagen destacada de Elementor.
   - Opt-in: clase CSS 'ft-featured-image' en cualquier
     widget Imagen de Elementor usado como cabecera.
   - No cambia el tamano, el recorte ni los atributos del img.
   ========================================================= */

.ft-editorial-ui :is(
    .elementor-widget-theme-post-featured-image,
    .ft-featured-image
) {
    --ft-featured-radius: 16px;
    --ft-featured-shadow:
        0 2px 5px rgba(25, 28, 32, .055),
        0 16px 34px -12px rgba(25, 28, 32, .255),
        0 0 0 1px rgba(25, 28, 32, .075);
}

/* La sombra no cambia medidas y evita penalizar el layout. */
.ft-editorial-ui :is(
    .elementor-widget-theme-post-featured-image,
    .ft-featured-image
) .elementor-widget-container img {
    display: block;
    border-radius: var(--ft-featured-radius);
    box-shadow: var(--ft-featured-shadow);
}

/* Pie de foto editorial, centrado y discreto. */
.ft-editorial-ui :is(
    .elementor-widget-theme-post-featured-image,
    .ft-featured-image
) :is(figcaption, .widget-image-caption, .wp-caption-text) {
    margin-top: 11px;
    padding-inline: 4px;
    color: var(--ft-muted);
    font-size: 13px;
    font-family: var(--ft-font-body);
    line-height: 1.5;
    font-weight: 500;
    font-style: normal;
    letter-spacing: .01em;
    text-align: center;
}

/* El efecto de hover solo se activa si la imagen es un enlace.
   No se aplica a dispositivos tactiles ni a movimiento reducido. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
    .ft-editorial-ui :is(
        .elementor-widget-theme-post-featured-image,
        .ft-featured-image
    ) a img {
        transition: transform .22s ease, box-shadow .22s ease;
    }

    .ft-editorial-ui :is(
        .elementor-widget-theme-post-featured-image,
        .ft-featured-image
    ) a:hover img {
        transform: translateY(-2px);
        box-shadow:
            0 4px 10px rgba(25, 28, 32, .075),
            0 22px 42px -14px rgba(25, 28, 32, .30),
            0 0 0 1px rgba(25, 28, 32, .085);
    }
}

.ft-editorial-ui :is(
    .elementor-widget-theme-post-featured-image,
    .ft-featured-image
) a:focus-visible img {
    outline: 3px solid rgba(138, 101, 23, .32);
    outline-offset: 4px;
}

@media (max-width: 767px) {
    .ft-editorial-ui :is(
        .elementor-widget-theme-post-featured-image,
        .ft-featured-image
    ) {
        --ft-featured-radius: 12px;
        --ft-featured-shadow:
            0 2px 5px rgba(25, 28, 32, .05),
            0 11px 24px -11px rgba(25, 28, 32, .23),
            0 0 0 1px rgba(25, 28, 32, .07);
    }

    .ft-editorial-ui :is(
        .elementor-widget-theme-post-featured-image,
        .ft-featured-image
    ) :is(figcaption, .widget-image-caption, .wp-caption-text) {
        margin-top: 10px;
        font-size: 13px;
    }
}
