/*
 * ui-polish.css — Millores d'accessibilitat i coherència (auditoria Impeccable, 2026-12-05)
 * Es carrega DESPRÉS d'immoac.css. No toca el bloc [VALIDAT] de colors de marca:
 *   - #62a6d5 (blau IMMOAC) es manté per a fons decoratius, mapes, tints i icones.
 *   - Per a TEXT i BOTONS amb text s'usa el mateix to, més fosc: #2b71a1 (5,3:1 sobre blanc, WCAG AA).
 * Pendent de validació de Loti a test.immoac.com abans de passar a producció.
 */

:root {
    --ink-primary:       #2b71a1;   /* blau IMMOAC per a text/botons (AA) */
    --ink-primary-hover: #245f88;
    --ink-muted:         #5f6873;   /* gris secundari (≥5:1 sobre blanc) */
    /* Les variables "de text" del template passen a l'ombra accessible */
    --color-primary:     #2b71a1;
    --Primary:           #2b71a1;
    --Text-3:            rgba(44, 46, 51, 0.78);
    --Text-4:            rgba(44, 46, 51, 0.72);
    --Text-5:            rgba(44, 46, 51, 0.72);
}

/* ── 1. Contrast ─────────────────────────────────────────────────────────── */
/* Botons de color primari: fons més fosc perquè el text blanc es llegeixi */
.bg-color-primary, .btn-primary, .tf-btn.bg-color-primary,
.isb-op-btn.active, .section-CTA.style-2 .content-inner {
    background-color: var(--ink-primary) !important;
    border-color: var(--ink-primary) !important;
}
.tf-btn.bg-color-primary:hover, .btn-primary:hover { background-color: var(--ink-primary-hover) !important; }
/* Venda = blau · Lloguer = taronja (warning) — Loti 2026-12-05 */
.isb-op-btn[data-value="rent"].active { background-color: #e67e22 !important; border-color: #e67e22 !important; color: #fff !important; box-shadow: 0 2px 8px rgba(230,126,34,.35) !important; }
.section-CTA.style-2 .tf-btn.style-2, .section-CTA .tf-btn.style-2 { color: var(--ink-primary) !important; }

/* Text en blau: preus, comptadors, enllaços, molles de pa */
.text-color-primary, .isb-live-count, .breadcrumb a, .breadcrumb a.home,
.mk-nw-src, .bl-lt em, a.text-color-3 { color: var(--ink-primary) !important; }

/* Grisos que no arribaven a 4,5:1 (només sobre fons clars; el peu fosc manté els seus grisos) */
body.page-propietat .box-overview .heading .price, .price-block .price { color: var(--ink-primary) !important; }
body.page-propietat .box-overview .heading .price span { color: var(--ink-muted) !important; }
.price-block .price-m2, .box-icon .content .text-4, .nb-src, .mk-rr2 .n, .mk-hi-h .s,
.gd-rs-in label small, .row.cash small, .gd-disc, .mk-af2-rr .mk-af2-hd, .mk-af2-rr .mk-af2-hd span, .bl-help p,
.gd-w-cta span, .mk-hi-h b > small { color: var(--ink-muted) !important; }
.qc-wa { color: #17803f !important; }
li.on .bl-sc-t { color: var(--ink-primary-hover) !important; }
.breadcrumb li, .mk-nw-top time, .nb-v span, .nb-l small, .mk-pqd-k .l,
.mk-src, .mk-src a, .detalls-label, .mk-af2-rr p.mk-src { color: var(--ink-muted) !important; }
.mk-tag.t-habitatge { color: #24618d !important; }
.mk-tag.t-lloguer   { color: #96500f !important; }
.mk-tk.dn           { color: #1a6f52 !important; }

/* ── 4. Mides de lletra (mínim ~13px al mòbil, 12px per a etiquetes curtes en majúscules) ── */
.meta-list li.text-1, .meta-list li.text-1 span,
.box-house .content p.location, .box-house .content p.location span { font-size: 13px !important; }
.box-tag .flat-tag { font-size: 12px !important; }
.isb-label-top, .adv-label { font-size: 12.5px !important; }
.isb-live-count { font-size: 12.5px !important; }
.mk-nw-top time, .mk-tag { font-size: 12.5px !important; }
.mk-src, .mk-chart .big small, .bl-lt em { font-size: 12.5px !important; }
.lang-dd-btn .lang-code { font-size: 13px !important; }
@media (max-width: 767px) {
    .mk-kick    { font-size: 12px !important; letter-spacing: .14em !important; }
    .mk-kpi-l   { font-size: 11.5px !important; letter-spacing: .03em !important; }
    .mk-src     { font-size: 12.5px !important; }
    .nb-v span, .nb-l small { font-size: 13px !important; }
    .mk-kpi-v small, .mk-kpi-d, .mk-kpi-d span, .mk-note, .mk-rr2 .n, .mk-hi-h .s, .mk-hi-lg li,
    .mk-af2-r .t span, .mk-tk, .mk-pqd-sub, .mk-hero-sub, .nb-src, .bl-topic-t small,
    .mk-wrap b > small, .box-location .content a.tf-btn { font-size: 12.5px !important; }
    .mk-hero-sub { font-size: 14px !important; }
    .mk-map svg text { font-size: 11px !important; }
}

/* ── 5. Zones tàctils (mínim 44px d'alt al mòbil; l'àrea creix sense canviar l'aspecte) ── */
@media (pointer: coarse), (max-width: 767px) {
    .lang-dd-btn            { min-height: 44px; padding-top: 10px !important; padding-bottom: 10px !important; }
    .fav-header-btn, .card-fav, .card-mmap, .bl-sh { min-width: 44px !important; min-height: 44px !important;
                              display: inline-flex !important; align-items: center; justify-content: center; }
    .isb-op-btn             { min-height: 44px !important; }
    .isb-ms-btn             { min-height: 44px !important; }
    .breadcrumb li a        { display: inline-block; padding: 12px 2px; }
    .mk-src a               { display: inline-block; padding: 12px 0; }
    .box-house .content .title a, .box-location .content h6 a, .content h6 > a,
    .tf-btn-link, ul.contact li a { display: inline-block; padding: 11px 0; }
    /* punts de carrusel: àrea tàctil invisible de 44px al voltant del punt */
    .mk-dots button, .swiper-pagination-bullet { position: relative; }
    .mk-dots button::after, .swiper-pagination-bullet::after {
        content: ""; position: absolute; inset: -16px; }
}

/* ── 9. Coherència: un sol sistema de botons i estats ────────────────────── */
.tf-btn, .btn, button.isb-op-btn, .isb-btns .tf-btn { border-radius: 10px; }
.tf-btn, .btn { transition: background-color .18s ease-out, color .18s ease-out, box-shadow .18s ease-out; }
/* Focus visible per a teclat, del color de la marca */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--ink-primary); outline-offset: 2px; border-radius: 6px;
}
/* Superfícies del navegador amb la paleta */
::selection { background: rgba(98, 166, 213, 0.28); color: #161e2d; }
input, textarea { caret-color: var(--ink-primary); }
a { text-underline-offset: 0.18em; }
/* Xifres tabulars a preus i dades (no ballen en llistes i taules) */
.price, .box-house .price, .mk-kpi, .mk-pqd-k, table td, .detalls-cell { font-variant-numeric: tabular-nums; }

/* ══ Fase 2 (auditoria Impeccable amb motor, 2026-12-05): fora recursos genèrics i tipografia més neta ══ */

/* Etiquetes petites ("kickers") sobre els títols: el títol ja parla sol.
   La de Notícies porta la data d'actualització: es manté, però com a text petit SOTA el títol. */
.mk-head .mk-kick, .mk-hero-in > .mk-kick { display: none !important; }
#noticies .mk-head > div { display: flex; flex-direction: column-reverse; }
#noticies .mk-head .mk-kick { display: block !important; letter-spacing: 0 !important; text-transform: none !important;
    font-weight: 500 !important; font-size: 13.5px !important; color: var(--ink-muted) !important; margin-top: 6px; }

/* Punt "en directe" que parpelleja sense parar → punt fix */
.mk-live, .ct-badge i { animation: none !important; box-shadow: none !important; }

/* Quadrícula decorativa al fons de la capçalera del mercat */
.mk-hero-grid { display: none !important; }

/* Targetes dins de targetes: la interior perd l'ombra i el fons propi */
.mk-map .mk-pqd { box-shadow: none !important; background: transparent !important; padding-left: 0 !important; padding-right: 0 !important; }
.ct-card .ct-seg, .ct-card2 .ct-seg { background: transparent; }
.promo-units-table { box-shadow: none !important; }

/* Barra lateral de color a la caixa "En resum" de les guies → caixa amb vora completa i tint */
.bl-key { border-left: 0 !important; border: 1px solid #d9e7f2 !important; background: #f6fafd !important; }
html[dir="rtl"] .bl-key { border-right: 0 !important; border: 1px solid #d9e7f2 !important; }

/* ── Tipografia: títols equilibrats, paràgrafs sense paraules soles, línies de lectura còmodes ── */
h1, h2, h3, .h1, .h2, .h3, .mk-nw h3, .title-heading, .blh2-t { text-wrap: balance; }
p, li { text-wrap: pretty; }
h1, .h1, h2, .h2 { letter-spacing: -0.015em; }
.gd-body p, .gd-body li, .bl-body p, .bl-body li { max-width: 68ch; line-height: 1.7; }
.pz-txt p { max-width: 72ch; }
.ct-head p { line-height: 1.5 !important; }
/* Índex de guies: escala de títols més clara (abans 14/16/19/20/24 px, pas de 1,2) */
.blh2-t { font-size: clamp(30px, 3.4vw, 44px) !important; line-height: 1.12 !important; }
.page-blog .title.h4, body.page-guies .title.h4 { font-size: 20px; line-height: 1.3; }

/* ══ Fase 3: targetes de propietat més netes i "premium" (2026-12-05) ══ */
.box-house { border: 1px solid #e8edf2 !important; border-radius: 18px !important; background: #fff !important;
    box-shadow: 0 1px 2px rgba(16,32,46,.04), 0 8px 24px -16px rgba(16,32,46,.18) !important; }
.box-house.hover-img:hover { transform: translateY(-4px) !important; box-shadow: 0 2px 4px rgba(16,32,46,.05), 0 22px 40px -22px rgba(16,32,46,.32) !important; }
.box-house .image-wrap { border-radius: 0 !important; aspect-ratio: 4 / 3; }
.box-house .image-wrap > a, .box-house .image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.box-house .content, .section-property-layout.style-1 .box-house .content { background: #fff !important; padding: 16px 18px 18px !important; }
/* Títol i ubicació: una línia cadascun, la referència discreta */
.box-house .content .title { margin-bottom: 4px !important; font-size: 17px !important; line-height: 1.3 !important; }
.box-house .content .title a { color: #1f242a !important; }
.box-house .content .location { flex-wrap: nowrap !important; white-space: nowrap; overflow: hidden; margin-bottom: 12px !important;
    font-size: 13.5px !important; color: #5f6873 !important; }
.box-house .content .location > span.text-color-primary { margin-left: auto !important; opacity: 1 !important; color: #6b7480 !important;
    font-size: 11.5px !important; font-weight: 500; letter-spacing: .02em; flex-shrink: 0; }
/* Dades en una sola línia, compactes */
.box-house .meta-list { display: flex !important; flex-wrap: wrap !important; gap: 6px 14px !important; padding-bottom: 12px !important;
    margin-bottom: 12px !important; border-bottom: 1px solid #eef2f5 !important; }
.box-house .meta-list li { font-size: 13.5px !important; color: #5f6873 !important; gap: 5px !important; align-items: center !important; white-space: nowrap; }
.box-house .meta-list li i { font-size: 16px !important; color: #8b949e; }
.box-house .meta-list li span { color: #1f242a !important; font-weight: 600 !important; }
/* Preu: protagonista, color de text fosc amb el blau només a l'hover */
.box-house .price { font-size: 21px !important; font-weight: 700 !important; color: #1f242a !important; letter-spacing: -.01em; }
.box-house.hover-img:hover .price { color: var(--ink-primary) !important; }
/* Etiquetes Venda/Lloguer: més petites i sòbries */
.box-house .flat-tag { font-size: 12px !important; padding: 4px 10px !important; border-radius: 999px !important; letter-spacing: .01em;
    background: var(--ink-primary) !important; color: #fff !important; }
/* Venda = blau · Lloguer = taronja (warning) — Loti 2026-12-05 */
.box-house .flat-tag.tag-rent { background: #e67e22 !important; color: #fff !important; }
.box-house .flat-tag.tag-new-build { background: rgba(31,36,42,.78) !important; color: #fff !important; }

/* Mòbil: una sola columna (abans dues columnes de ~150 px amb el text partit en tres línies) */
@media (max-width: 575px) {
    .tf-grid-layout.sm-col-2:has(> .box-house), .tf-grid-layout.sm-col-2:has(> * > .box-house) { grid-template-columns: 1fr !important; }
    .box-house .content .title { font-size: 18px !important; }
}
.box-house .image-wrap > a { display: block !important; }
.box-house .image-wrap img { width: 100% !important; max-width: none !important; height: 100% !important; object-fit: cover !important; }

/* ══ Fase 4: barra de contacte fixa a la fitxa (mòbil) ══ */
@media (max-width: 991px) {
    .pd-sticky { display: flex !important; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 9990;
        gap: 8px; padding: 8px; border-radius: 18px; background: rgba(255,255,255,.94); backdrop-filter: blur(14px) saturate(1.3);
        -webkit-backdrop-filter: blur(14px) saturate(1.3); box-shadow: 0 10px 30px -8px rgba(16,32,46,.35), 0 0 0 1px rgba(16,32,46,.06);
        animation: pdUp .5s cubic-bezier(.2,.7,.2,1) both .6s; }
    .pd-sticky a { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; border-radius: 12px;
        font-size: 14.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }
    .pd-st-wa  { background: #17803f; color: #fff !important; }
    .pd-st-tel { background: #fff; color: #1f242a !important; border: 1px solid #dfe5ea; }
    .pd-st-vis { background: var(--ink-primary); color: #fff !important; }
    body.page-propietat { padding-bottom: 84px; }
    body.page-propietat #scroll-top, body.page-propietat .progress-wrap { bottom: 96px !important; }
    @keyframes pdUp { from { transform: translateY(120%); opacity: 0; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .pd-sticky { animation: none !important; } }

/* ══ Fase 5: un sol sistema de botons, colors de text i capçalera més neta ══ */
/* Colors de text: 3 tons (títols, cos, secundari) en lloc de ~20 grisos diferents */
:root { --Heading: #1f242a; --Text: #4b5561; --Text-2: #1f242a; }
body { color: #4b5561; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: #1f242a; }
/* Botons: primari (blau), secundari (vora) i text — mateixa alçada, radi, pes i transició a tot el web */
.tf-btn, .btn, button.tf-btn, a.tf-btn { border-radius: 12px !important; font-weight: 600 !important; letter-spacing: 0 !important;
    min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.tf-btn.bg-color-primary, .tf-btn.style-1, .btn-primary, .tf-btn:not(.style-border):not(.style-2):not(.style-3):not(.tf-btn-link):not(.btn-icon) {
    background-color: var(--ink-primary) !important; border-color: var(--ink-primary) !important; color: #fff !important; }
.tf-btn.bg-color-primary:hover, .tf-btn.style-1:hover { background-color: var(--ink-primary-hover) !important; transform: translateY(-1px);
    box-shadow: 0 8px 18px -10px rgba(43,113,161,.6); }
.tf-btn.style-border, .tf-btn.style-2, .tf-btn.style-3 { background: #fff !important; color: #1f242a !important; border: 1px solid #dfe5ea !important; }
.tf-btn.style-border:hover, .tf-btn.style-2:hover, .tf-btn.style-3:hover { border-color: var(--ink-primary) !important; color: var(--ink-primary) !important; }
.tf-btn::before, .tf-btn::after { display: none !important; }   /* efectes de farciment animat de la plantilla */
/* Capçalera: sense els separadors verticals entre grups; l'opció activa es marca amb un subratllat */
.main-menu .navigation > li.nav-gap::before { display: none !important; }
.main-menu .navigation > li.nav-gap { margin-inline-start: 0 !important; }
@media (min-width: 1200px) {
    .main-menu .navigation > li > a { position: relative; }
    .main-menu .navigation > li.current > a::after, .main-menu .navigation > li.current-menu-item > a::after {
        content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px; background: var(--brand-line, #62a6d5); }
}
.header { box-shadow: 0 1px 0 rgba(16,32,46,.06) !important; }
@media (max-width: 991px) { .pd-sticky a { font-size: 13.5px; gap: 6px; padding: 0 6px; } }
@media (max-width: 400px) { .pd-sticky a svg { display: none; } }

/* Hover de targeta: preu i títol (tipus · zona) agafen el color de l'operació — Loti 2026-12-05 */
.box-house .content .title a, .box-house .price { transition: color .25s ease; }
.box-house.hover-img:hover .content .title a,
.box-house.hover-img:hover .price { color: var(--ink-primary) !important; }
.box-house.hover-img:has(.tag-rent):hover .content .title a,
.box-house.hover-img:has(.tag-rent):hover .price { color: #b35a0c !important; }

/* Auditoria contrast (2026-12-05) */
.box-house .price .price-old{color:#6b7480 !important;opacity:1 !important;}
.box-house .price .price-off{background:#c63d33 !important;}
.form-control::placeholder,input::placeholder,textarea::placeholder{color:#6b7480;}
.mk-clau span.l,.mk-pc .mk-pc-t,.mk-pc .mk-pc-l,#pqd-sub{color:#56616d !important;}
.mk-clau span.d,.mk-pqd-k b>small{color:#5f6b77 !important;}
.ct-office-h b,.page-contacte em{color:#5f6b77 !important;}

/* Cercador (Loti 2026-12-05): el filtre avançat s'amaga mentre no és funcional;
   Lloguer = taronja (mateix to que la franja d'entorn de proves), Venda = blau → botó de cerca i recompte segueixen l'operació */
.isb-btn-filtres { display: none !important; }
body:not(.dark-theme) form:has(.isb-op-btn[data-value="rent"].active) { --ink-primary: #e67e22; --ink-primary-hover: #cf6d17; --color-primary: #e67e22; }
body:not(.dark-theme) form:has(.isb-op-btn[data-value="rent"].active) .isb-submit { background-color: #e67e22 !important; border-color: #e67e22 !important; color: #fff !important; }
body:not(.dark-theme) form:has(.isb-op-btn[data-value="rent"].active) .isb-live-count,
body:not(.dark-theme) form:has(.isb-op-btn[data-value="rent"].active) .isb-live-count * { color: #d1660f !important; }
body:not(.dark-theme) form:has(.isb-op-btn[data-value="sale"].active) .isb-live-count,
body:not(.dark-theme) form:has(.isb-op-btn[data-value="sale"].active) .isb-live-count * { color: #2b71a1 !important; }

/* Desplegables del cercador per sobre de la secció següent (Loti 2026-12-05) */
.flat-title.pl-hero, .page-title.home01, .flat-title.style-2 { position: relative; z-index: 30; }
.isb-ms-panel, .immo-search-bar .nice-select .list { z-index: 50 !important; }
