/*
 * El Mercante – Estilo Visual
 * Inicio — v0.3.3 (base aprobada v0.2.3 + correcciones de uniformidad)
 *
 * Ajuste puntual sobre v0.2.0/v0.2.1:
 * - Quita definitivamente las cajas violetas detrás de los títulos.
 * - Deja los títulos como texto violeta sobre fondo blanco.
 * - Aplica el estilo de botón solo al botón final de cada tarjeta.
 * - No modifica contenido ni funcionamiento.
 */

body.home {
    --em-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --em-violeta: #5e32a2;
    --em-violeta-2: #6f38b6;
    --em-texto: #2f2638;
    --em-texto-suave: #6f6479;
    --em-borde: rgba(94, 50, 162, 0.14);
    --em-sombra: 0 10px 28px rgba(47, 27, 73, 0.09);
    --em-radio: 16px;
}

/* INTERFAZ */
body.home .wp-block-navigation,
body.home .wp-block-navigation-item,
body.home .wp-block-navigation-item__content,
body.home button,
body.home input,
body.home select,
body.home textarea,
body.home label,
body.home .wp-block-button__link {
    font-family: var(--em-ui-font) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.home header.wp-block-template-part .wp-block-navigation-item__content {
    font-weight: 500;
    text-decoration: none;
}

body.home header.wp-block-template-part > .wp-block-group {
    padding-top: 18px !important;
    padding-bottom: 18px !important;
}

/* BUSCADOR */
body.home .wp-block-search__inside-wrapper,
body.home form.woocommerce-product-search {
    gap: 12px;
    align-items: center;
}

body.home .wp-block-search__input,
body.home .woocommerce-product-search .search-field,
body.home input[type="search"] {
    min-height: 54px;
    padding: 0 20px !important;
    background: #fff;
    border: 1px solid rgba(94, 50, 162, 0.22) !important;
    border-radius: 999px !important;
    box-shadow: 0 3px 12px rgba(47, 27, 73, 0.04);
    font-family: var(--em-ui-font) !important;
}

body.home .wp-block-search__button,
body.home .woocommerce-product-search button,
body.home form[role="search"] button {
    min-height: 54px;
    padding: 0 28px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--em-violeta) !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 5px 14px rgba(94, 50, 162, 0.18);
}

/* TARJETAS */
body.home .em-home-subastas-grilla,
body.home .em-home-trueques [class*="grilla"],
body.home .em-home-recientes [class*="grilla"] {
    gap: 28px !important;
    align-items: stretch;
}

body.home .em-home-subasta-tarjeta,
body.home .em-home-trueques article,
body.home .em-home-recientes article {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff !important;
    border: 1px solid var(--em-borde) !important;
    border-radius: var(--em-radio) !important;
    overflow: hidden;
    box-shadow: var(--em-sombra) !important;
}

body.home .em-home-subasta-imagen,
body.home .em-home-trueques article img,
body.home .em-home-recientes article img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

body.home .em-home-subasta-contenido,
body.home .em-home-trueques article > div:last-child,
body.home .em-home-recientes article > div:last-child {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 20px !important;
}

/* TÍTULOS: completos, violeta sobre blanco */
body.home .em-home-subasta-titulo,
body.home .em-home-trueques article h3,
body.home .em-home-recientes article h3 {
    display: block !important;
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: initial !important;
    margin: 0 0 14px !important;
    font-family: var(--em-ui-font) !important;
    font-size: 18px !important;
    line-height: 1.32 !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em;
    color: var(--em-violeta) !important;
    background: transparent !important;
}

/* El enlace del título debe verse como texto, nunca como botón */
body.home .em-home-subasta-titulo a,
body.home .em-home-trueques article h3 a,
body.home .em-home-recientes article h3 a {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--em-violeta) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    font-weight: inherit !important;
    text-align: left !important;
    text-decoration: none !important;
}

/* Corrección específica: el enlace del título NO es un botón */
body.home .em-home-trueques article h3 a,
body.home .em-home-recientes article h3 a {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--em-violeta) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-family: var(--em-ui-font) !important;
    font-size: inherit !important;
    line-height: inherit !important;
    font-weight: inherit !important;
    text-align: left !important;
    text-decoration: none !important;
}

/* Textos secundarios */
body.home .em-home-subasta-cierre,
body.home .em-home-trueques article p,
body.home .em-home-recientes article p {
    font-family: var(--em-ui-font) !important;
    font-size: 15px !important;
    line-height: 1.48 !important;
    color: var(--em-texto-suave) !important;
}

/* Precios / valores */
body.home .em-home-subasta-precio,
body.home .em-home-trueques article strong,
body.home .em-home-recientes article p:last-of-type {
    font-family: var(--em-ui-font) !important;
    font-size: 18px !important;
    line-height: 1.3 !important;
    font-weight: 700 !important;
    color: var(--em-violeta) !important;
}

/* Botones */
body.home .em-home-subasta-boton,
body.home .em-home-trueques article > div:last-child > a:last-child,
body.home .em-home-recientes article > div:last-child > a:last-child {
    display: block;
    margin-top: auto !important;
    padding: 13px 18px !important;
    border-radius: 12px !important;
    background: var(--em-violeta) !important;
    color: #fff !important;
    font-family: var(--em-ui-font) !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-align: center;
    text-decoration: none !important;
    box-shadow: none !important;
}

/* El enlace de título prevalece sobre la regla genérica anterior */
body.home .em-home-trueques article h3 a,
body.home .em-home-recientes article h3 a {
    display: inline !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    color: var(--em-violeta) !important;
    border-radius: 0 !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    text-align: left !important;
}

/* FOOTER */
body.home footer.wp-block-template-part {
    margin-top: 46px !important;
    background: #f4eef9;
    border-top: 1px solid rgba(94, 50, 162, 0.12);
}

body.home footer.wp-block-template-part > .wp-block-group {
    padding-top: 30px !important;
    padding-bottom: 30px !important;
}

body.home footer.wp-block-template-part,
body.home footer.wp-block-template-part p,
body.home footer.wp-block-template-part a {
    font-family: var(--em-ui-font) !important;
}

body.home footer.wp-block-template-part a {
    color: var(--em-violeta);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

body.home footer.wp-block-template-part .wp-block-button__link {
    background: #fff !important;
    color: var(--em-violeta) !important;
    border: 1px solid rgba(94, 50, 162, 0.22) !important;
    border-radius: 999px !important;
    padding: 11px 18px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
}

@media (max-width: 782px) {
    body.home header.wp-block-template-part > .wp-block-group {
        padding-top: 14px !important;
        padding-bottom: 14px !important;
    }

    body.home .em-home-subasta-contenido,
    body.home .em-home-trueques article > div:last-child,
    body.home .em-home-recientes article > div:last-child {
        padding: 17px !important;
    }

    body.home .em-home-subasta-titulo,
    body.home .em-home-trueques article h3,
    body.home .em-home-recientes article h3 {
        font-size: 17px !important;
    }

    body.home footer.wp-block-template-part > .wp-block-group {
        padding-top: 24px !important;
        padding-bottom: 24px !important;
    }
}


/* =========================================================
   6. PRECIOS — UNIFICACIÓN FINAL v0.2.3
   Todos los importes quedan con peso normal para que
   Subastas, Trueques y Recientes se vean consistentes.
   ========================================================= */

body.home .em-home-subasta-precio {
    font-weight: 400 !important;
}

/* En Trueques, el último párrafo es la línea "Valor estimado". */
body.home .em-home-trueques article p:last-of-type,
body.home .em-home-trueques article p:last-of-type strong {
    font-weight: 400 !important;
}

/* En Recientes mantenemos el importe sin negrita. */
body.home .em-home-recientes article p:last-of-type,
body.home .em-home-recientes article p:last-of-type strong {
    font-weight: 400 !important;
}


/* =========================================================
   BOTÓN GLOBAL "POR QUÉ EL MERCANTE" — v0.3.1
   Se unifica con fondo violeta y letras blancas.
   ========================================================= */
body.home a[href*="/por-que-el-mercante"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #5e32a2 !important;
    color: #fff !important;
    border: 1px solid #5e32a2 !important;
    border-radius: 999px !important;
    padding: 11px 18px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: none !important;
}


/* =========================================================
   CORRECCIÓN v0.3.3 — "POR QUÉ EL MERCANTE" EN INICIO
   ========================================================= */
body.home footer.wp-block-template-part a.em-visual-btn-porque,
body.home footer.wp-block-template-part button.em-visual-btn-porque {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #5e32a2 !important;
    color: #fff !important;
    border: 1px solid #5e32a2 !important;
    border-radius: 999px !important;
    padding: 11px 18px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 16px !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    box-shadow: none !important;
}
