/* Ficha Homesya (ES, México, Bali) — mosaico 1+4, cabecera con H1 sobre las
   columnas, datos clave bajo el precio y secciones en tarjeta. 5-oct-2026.
   Acento = --hy-primary del portal (índigo ES, color propio MX/Bali). */
:root {
    --hyf-accent: var(--hy-primary, #3433b2);
    --hyf-line: #e7e3da;
    --hyf-ink: #1e293b;
    --hyf-muted: #64748b;
    --hyf-radius: 18px;
}

/* ── Galería ─────────────────────────────────────────────── */
.hy-gal {
    position: relative;
    max-width: 1110px;
    margin: 8px auto 20px;
}
.hy-gal-track {
    display: grid;
    gap: 8px;
    height: 460px;
    border-radius: var(--hyf-radius);
    overflow: hidden;
}
.hy-gal--n5 .hy-gal-track { grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.hy-gal--n4 .hy-gal-track,
.hy-gal--n3 .hy-gal-track { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }

.hy-gal--n5 .hy-gal-item:nth-child(n+6),
.hy-gal--n4 .hy-gal-item:nth-child(n+4),
.hy-gal--n3 .hy-gal-item:nth-child(n+4) { display: none; }

.hy-gal-item {
    all: unset;
    position: relative;
    display: block;
    overflow: hidden;
    cursor: zoom-in;
    background: #ece8e0;
    min-width: 0;
    min-height: 0;
}
.hy-gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .5s ease, filter .3s ease;
}
.hy-gal-item:hover img { transform: scale(1.03); filter: brightness(.94); }
.hy-gal .hy-gal-item--main { grid-row: 1 / span 2; }
.hy-gal-item:focus-visible { outline: 3px solid var(--hyf-accent); outline-offset: -3px; }
.hy-gal--sold .hy-gal-item img { filter: grayscale(1); }

.hy-gal-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.hy-gal-badge--sold { background: #dc2626; }

.hy-gal-all {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--hyf-ink);
    border-radius: 999px;
    background: #fff;
    color: var(--hyf-ink);
    font: 600 13px/1 inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    transition: transform .15s ease;
}
.hy-gal-all:hover { transform: translateY(-1px); }
.hy-gal-count { display: none; }

/* ── Cabecera ────────────────────────────────────────────── */
.hy-head {
    max-width: 1110px;
    margin: 0 auto 22px;
}
.hy-head-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 8px;
    color: var(--hyf-accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.hy-head-eyebrow::before {
    content: "";
    width: 26px;
    height: 2px;
    background: currentColor;
    flex-shrink: 0;
}
.hy-head-title {
    margin: 0;
    color: var(--hyf-ink);
    font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2.1rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.01em;
    text-wrap: balance;
}

/* Con mosaico, la galería vieja (slider) sobra en todos los tamaños. */
.hy-has-mosaic .listing-primary-column > .image-gallery { display: none !important; }

/* ── Tarjeta de precio ───────────────────────────────────── */
.hy-ficha .price-card {
    border: 1px solid var(--hyf-line) !important;
    border-radius: var(--hyf-radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .07);
}
.hy-ficha .sidebar-card { border-radius: var(--hyf-radius); }
.hy-facts {
    margin: 16px 0 4px;
    padding: 4px 14px;
    border: 1px solid var(--hyf-line);
    border-radius: 12px;
    background: #faf8f4;
}
.hy-facts > div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}
.hy-facts > div + div { border-top: 1px solid #efebe3; }
.hy-facts dt { color: var(--hyf-muted); margin: 0; }
.hy-facts dd { margin: 0; color: var(--hyf-ink); font-weight: 600; text-align: right; }

/* ── Secciones en tarjeta ────────────────────────────────── */
.hy-ficha .listing-primary-column > .product-description,
.hy-ficha .listing-primary-column > .accordion-section,
.hy-ficha .listing-primary-column > section,
.hy-ficha .listing-primary-column > .location-section {
    background: #fff;
    border: 1px solid var(--hyf-line) !important;
    border-radius: var(--hyf-radius) !important;
    box-shadow: none !important;
}
.hy-ficha .description-title {
    color: var(--hyf-ink);
    letter-spacing: -.01em;
}

/* ── Móvil / tablet: carrusel con scroll-snap ────────────── */
@media (max-width: 1105px) {
    .hy-gal { margin: 0 0 14px; }
    .hy-gal-track {
        display: flex;
        height: auto;
        gap: 8px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        border-radius: 0;
        -webkit-overflow-scrolling: touch;
    }
    .hy-gal-track::-webkit-scrollbar { display: none; }
    .hy-gal .hy-gal-item,
    .hy-gal .hy-gal-item:nth-child(n) {
        display: block;
        flex: 0 0 88%;
        aspect-ratio: 4 / 3;
        scroll-snap-align: start;
        border-radius: 14px;
    }
    .hy-gal-item:first-child { margin-left: 12px; }
    .hy-gal-item:last-child { margin-right: 12px; }
    .hy-gal-item:hover img { transform: none; filter: none; }
    .hy-gal-badge { left: 24px; }
    .hy-gal-all { display: none; }
    .hy-gal-count {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        right: 22px;
        bottom: 10px;
        padding: 4px 10px;
        border-radius: 999px;
        background: rgba(15, 23, 42, .7);
        color: #fff;
        font-size: 12px;
        font-weight: 600;
        pointer-events: none;
    }
    .hy-head { padding: 0 16px; margin-bottom: 10px; }
}
@media (min-width: 1106px) and (max-width: 1180px) {
    .hy-gal, .hy-head { padding: 0 15px; }
}

/* ── Ficha v2 (15-oct-2026): datos primero, un solo contacto ─────────
   Petición usuario: la ficha móvil enseñaba dos contactos (chat de soporte
   lila + Contactar), "vende el tuyo" antes que los datos y una barra de 6
   iconos. Aquí: acciones sobre la foto, datos clave bajo el precio,
   descripción plegada y barra fija con precio + contacto. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Papelera "no volver a ver": nadie la entendía. */
.hy-ficha-page .action-discard { display: none !important; }

/* Acciones sobre la foto: solo móvil/tablet (en escritorio sigue la barra). */
.hy-gal-actions { display: none; }

/* Datos clave bajo el precio */
.hy-ppm { margin: 2px 0 0; color: var(--hyf-muted); font-size: 14px; font-weight: 500; }
.hy-keyfacts {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 14px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid var(--hyf-line);
    color: var(--hyf-ink);
    font-size: 15px;
}
.hy-keyfacts li { display: inline-flex; align-items: baseline; gap: 4px; }
.hy-keyfacts strong { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.hy-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.hy-chips li {
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f0fb;
    color: #2e2c8f;
    font-size: 13px;
    font-weight: 600;
}
.hy-updated { margin: 12px 0 0; color: var(--hyf-muted); font-size: 13px; }

/* Descripción plegada a ~8 líneas */
.hy-ficha #descriptionContent.is-clamped {
    max-height: 13em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 70%, transparent);
            mask-image: linear-gradient(#000 70%, transparent);
}
.hy-desc-more {
    margin: 10px 0 0;
    min-height: 44px;
    padding: 0 18px;
    border: 1.5px solid var(--hyf-ink);
    border-radius: 999px;
    background: #fff;
    color: var(--hyf-ink);
    font: 700 14px/1 inherit;
    cursor: pointer;
}
.hy-desc-more[hidden] { display: none; }
.hy-desc-more:focus-visible, .hy-gal-act:focus-visible, .hy-pager a:focus-visible, .hy-sell:focus-visible {
    outline: 3px solid var(--hyf-accent); outline-offset: 2px;
}

/* Anunciante */
.hy-seller-kind { margin: 2px 0 0; color: var(--hyf-muted); font-size: 13px; }

/* Anterior / siguiente con texto */
.hy-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    max-width: 1110px;
    margin: 24px auto 0;
    font-size: 14px;
    font-weight: 600;
}
.hy-pager a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--hyf-ink); text-decoration: none; }
.hy-pager a[rel="next"] { justify-self: end; }
.hy-pager .hy-pager-back { color: var(--hyf-accent); }

/* "¿Vendes o alquilas en…?" — una sola vez, al final */
.hy-sell {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 1110px;
    margin: 28px auto;
    padding: 16px 18px;
    border: 1px solid var(--hyf-line);
    border-radius: var(--hyf-radius);
    background: #faf8f4;
    color: var(--hyf-ink);
    text-decoration: none;
}
.hy-sell-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hy-sell-txt strong { font-size: 16px; }
.hy-sell-txt span { color: var(--hyf-muted); font-size: 14px; }
.hy-sell-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--hyf-ink);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 1105px) {
    /* La barra de 6 iconos se sustituye por las acciones sobre la foto. */
    .hy-ficha-page.hy-has-gal .ad-navigation-bar { display: none !important; }
    /* El chat de soporte flotante duplicaba "Contactar" y lo tapaba. */
    .hy-ficha-page > div[style*="2147483000"] { display: none !important; }

    .hy-gal-actions {
        display: flex;
        gap: 10px;
        position: absolute;
        top: 10px;
        left: 22px;
        right: 22px;
        pointer-events: none;
    }
    .hy-gal-act-spacer { flex: 1; }
    .hy-gal-act {
        all: unset;
        pointer-events: auto;
        box-sizing: border-box;
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, .94);
        color: var(--hyf-ink);
        font-size: 17px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
        cursor: pointer;
    }
    .hy-gal-act--fav.is-on { color: #e11d48; }
    .hy-gal-badge { top: 62px; }

    .hy-head-eyebrow { font-size: 11px; letter-spacing: .1em; margin-bottom: 6px; }
    .hy-head-title { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
    .hy-ficha .mobile-listing-top .price { font-size: 30px; }

    .hy-sell { margin: 24px 16px; flex-wrap: wrap; }
    .hy-pager { margin: 20px 16px 0; }
}
@media (max-width: 768px) {
    .sticky-action-bar.hy-sab { align-items: center; justify-content: space-between; gap: 12px; }
    .hy-sab-price {
        flex: 0 1 auto;
        min-width: 0;
        color: var(--hyf-ink);
        font-size: 18px;
        font-weight: 800;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .sticky-action-bar.hy-sab .mobile-action-btn { flex: 1 1 auto; max-width: 260px; padding: 13px 16px; }
    .sticky-action-bar.hy-sab .btn-whatsapp-inline { flex: 0 0 auto; }
}
/* Sin hueco entre los datos clave y Características (el bloque trae margin-top inline). */
.hy-ficha .listing-primary-column > .property-details { margin-top: 12px !important; }
.hy-ficha .listing-primary-column > .product-description { margin-top: 12px; }
/* "% confianza" del anunciante: en inmuebles de agencia asustaba más que ayudaba. */
.hy-ficha-page #trust-inline-badge { display: none !important; }
