/* =====================================================================
   Experiencia y retención — danielsalinasremax.com
   Vista rápida de propiedades, favoritas, filtros, asistente de WhatsApp,
   avisos, alertas de propiedades y accesibilidad.
   Lo usan index.html y en/index.html junto con assets/experiencia.js.
   ===================================================================== */
:root {
  --exp-suave: cubic-bezier(.16, 1, .3, 1);
  --exp-sombra: 0 30px 80px rgba(0, 20, 60, .28);
}

/* ---------- Accesibilidad ---------- */
.saltar {
  position: fixed; top: -80px; left: 1rem; z-index: 1000;
  background: #fff; color: var(--blue); font-weight: 700; font-size: .85rem;
  padding: .75rem 1.1rem; border-radius: 10px; box-shadow: var(--exp-sombra);
  transition: top .2s;
}
.saltar:focus { top: 1rem; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--red); outline-offset: 3px;
}
#contenido:focus, .vista-titulo:focus, .favs-cab h2:focus { outline: none; }
html.dialogo-abierto, html.menu-abierto { overflow: hidden; }
html.dialogo-abierto .md-dot, html.dialogo-abierto .md-ring { opacity: 0 !important; }

/* ---------- Menú: sección activa y botón de favoritas ---------- */
nav#nav .nav-logo { margin-right: auto; }
.nav-links a.activo::after { width: 100%; }
nav#nav.scrolled:not(.nav-oscura) .nav-links a.activo { color: var(--blue); }
.nav-acciones { display: flex; align-items: center; gap: .6rem; margin-left: 1.3rem; }
.nav-fav {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .3); color: #fff;
  transition: background .3s, color .3s, transform .3s var(--exp-suave);
}
.nav-fav[hidden] { display: none; }
.nav-fav:hover { transform: scale(1.06); }
nav#nav.scrolled:not(.nav-oscura) .nav-fav { background: var(--blue-pale); border-color: transparent; color: var(--red); }
.nav-fav svg { width: 18px; height: 18px; fill: currentColor; }
.nav-fav-n {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 10px; background: var(--red); color: #fff;
  font-size: .64rem; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px #fff;
}
.nav-fav.latido { animation: expLatido .6s var(--exp-suave); }
@keyframes expLatido { 0% { transform: scale(1); } 35% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---------- Propiedades: filtros, corazón y vista rápida ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: .55rem; margin: -2.4rem 0 2.2rem; }
.filtro {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--gray-300); background: #fff; color: var(--text-2);
  border-radius: 100px; padding: .6rem 1.05rem; cursor: pointer;
  font: 600 .8rem/1 'Inter', sans-serif; letter-spacing: .01em;
  transition: background .25s, color .25s, border-color .25s, transform .25s;
}
.filtro:hover { border-color: var(--blue); color: var(--blue); }
.filtro span { color: var(--text-3); font-weight: 500; }
.filtro[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.filtro[aria-pressed="true"] span { color: rgba(255, 255, 255, .72); }

.props-grid > .prop-item { position: relative; min-width: 0; transition: opacity .28s, transform .28s; }
.prop-item.prop-item-destacada { grid-column: 1 / -1; }
.prop-item.fuera, .props-grid > .prop-card.fuera { display: none; }
.props-grid.cambiando > .prop-item { opacity: 0; transform: translateY(14px); }
.prop-item .prop-tour-flag { right: 4.1rem; top: 1.15rem; }
.prop-card .prop-img picture { display: contents; }
.prop-card[data-vista] { cursor: zoom-in; }

.fav-btn {
  position: absolute; top: .9rem; right: .9rem; z-index: 6;
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(10, 16, 32, .42); color: #fff;
  border: 1px solid rgba(255, 255, 255, .45);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .6s .35s, transform .25s var(--exp-suave), background .25s, color .25s;
}
.prop-card.on ~ .fav-btn, .prop-card:not(.r) ~ .fav-btn { opacity: 1; }
.fav-btn:hover { transform: scale(1.08); background: rgba(10, 16, 32, .62); }
.fav-btn svg, .vista-fav svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.fav-btn[aria-pressed="true"] { background: #fff; color: var(--red); border-color: #fff; }
.fav-btn[aria-pressed="true"] svg, .vista-fav[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn.pop, .vista-fav.pop svg { animation: expLatido .5s var(--exp-suave); }

/* Vista rápida */
dialog.vista {
  margin: auto; /* el reinicio de la página (* { margin: 0 }) quitaba el centrado */
  width: min(1080px, calc(100vw - 2rem)); max-width: none;
  max-height: calc(100svh - 2rem);
  padding: 0; border: 0; border-radius: 22px; overflow: hidden;
  background: #fff; color: var(--text); box-shadow: 0 40px 120px rgba(0, 0, 0, .45);
}
dialog.vista[open] { animation: expEntra .5s var(--exp-suave); }
dialog::backdrop { background: rgba(5, 10, 24, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes expEntra { from { opacity: 0; transform: translateY(26px) scale(.98); } }
.vista-grid { display: grid; grid-template-columns: 1.25fr 1fr; max-height: calc(100svh - 2rem); }
.vista-foto { position: relative; margin: 0; min-height: 440px; background: #0b1d4d; }
.vista-foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vista-info { padding: 2.4rem 2.2rem 2rem; overflow: auto; display: flex; flex-direction: column; gap: .85rem; }
.vista-etiqueta {
  align-self: flex-start; background: var(--blue); color: #fff;
  font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: .32rem .7rem; border-radius: 4px;
}
.vista-precio { font-family: 'Playfair Display', serif; font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 700; color: var(--blue); line-height: 1; }
.vista-titulo { font-size: 1.15rem; font-weight: 600; line-height: 1.35; color: var(--text); }
.vista-ubic { font-size: .9rem; color: var(--text-3); }
.vista-meta { list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; margin: .2rem 0 .4rem; }
.vista-meta li { background: var(--gray-100); border: 1px solid var(--gray-200); border-radius: 100px; padding: .38rem .8rem; font-size: .8rem; color: var(--text-2); }
.vista-botones { display: grid; gap: .6rem; margin-top: auto; }
.vista-btn {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  padding: .95rem 1.2rem; border-radius: 12px; font-size: .88rem; font-weight: 700;
  border: 1px solid var(--gray-300); color: var(--blue); background: #fff;
  transition: background .25s, transform .25s, box-shadow .25s;
}
.vista-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 48, 135, .12); }
.vista-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.vista-btn.vista-wa { background: #25D366; border-color: #25D366; color: #fff; }
.vista-btn.vista-wa svg { fill: currentColor; }
.vista-btn.vista-tour { background: var(--blue); border-color: var(--blue); color: #fff; }
.vista-btn[hidden] { display: none; }
.vista-btn .ico-ext { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.vista-acciones { display: flex; gap: .5rem; }
.vista-acciones button {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem; border-radius: 12px; border: 1px solid var(--gray-300); background: #fff;
  color: var(--text-2); font: 600 .82rem 'Inter', sans-serif; cursor: pointer;
  transition: border-color .25s, color .25s;
}
.vista-acciones button:hover { border-color: var(--blue); color: var(--blue); }
.vista-fav[aria-pressed="true"] { color: var(--red); border-color: rgba(227, 24, 55, .4); }
.vista-compartir svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dlg-cerrar {
  position: absolute; top: .9rem; right: .9rem; z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.dlg-cerrar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (max-width: 760px) {
  dialog.vista { width: 100vw; height: 100svh; max-height: 100svh; margin: 0; border-radius: 0; }
  .vista-grid { grid-template-columns: 1fr; height: 100%; max-height: none; overflow: auto; }
  .vista-foto { min-height: 44svh; }
  .vista-info { padding: 1.6rem 1.3rem 2rem; overflow: visible; }
}

/* ---------- Lista de favoritas (panel lateral) ---------- */
dialog.favs {
  margin: 0 0 0 auto; height: 100svh; max-height: 100svh; width: min(430px, 100vw); max-width: 100vw;
  padding: 0; border: 0; background: #fff; color: var(--text);
  box-shadow: -30px 0 80px rgba(0, 0, 0, .3);
  display: none; flex-direction: column;
}
dialog.favs[open] { display: flex; animation: expDesliza .5s var(--exp-suave); }
@keyframes expDesliza { from { transform: translateX(100%); } }
.favs-cab { padding: 1.6rem 1.5rem 1.1rem; border-bottom: 1px solid var(--gray-200); }
.favs-cab h2 { font-family: 'Playfair Display', serif; font-size: 1.45rem; color: var(--blue); padding-right: 3rem; }
.favs-cab p { font-size: .8rem; color: var(--text-3); margin-top: .35rem; }
.favs-lista { list-style: none; overflow: auto; flex: 1; padding: .6rem 1rem; }
.favs-vacio { padding: 2rem 1.5rem; font-size: .92rem; line-height: 1.7; color: var(--text-3); }
.fav-fila { display: flex; align-items: center; gap: .6rem; padding: .55rem .4rem; border-bottom: 1px solid var(--gray-200); }
.fav-abrir { flex: 1; display: flex; align-items: center; gap: .9rem; text-align: left; background: none; border: 0; cursor: pointer; padding: .3rem; border-radius: 10px; color: inherit; font: inherit; }
.fav-abrir:hover { background: var(--gray-100); }
.fav-abrir img { width: 84px; height: 62px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: var(--gray-200); }
.fav-abrir b { display: block; font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--blue); }
.fav-abrir em { display: block; font-style: normal; font-size: .82rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.fav-abrir small { display: block; font-size: .74rem; color: var(--text-3); }
.fav-quitar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; cursor: pointer; color: var(--text-3); display: grid; place-items: center; flex-shrink: 0; }
.fav-quitar:hover { background: var(--gray-100); color: var(--red); }
.fav-quitar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.favs-pie { padding: 1.1rem 1.5rem calc(1.4rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--gray-200); display: grid; gap: .6rem; }
.favs-pie .vista-btn[hidden] { display: none; }

/* ---------- Asistente de WhatsApp ---------- */
.asistente {
  position: fixed; right: 1.8rem; bottom: 6.6rem; z-index: 160;
  width: min(340px, calc(100vw - 2.4rem));
  background: #fff; color: var(--text); border-radius: 20px;
  box-shadow: 0 26px 70px rgba(0, 20, 60, .3);
  padding: 1.1rem 1.1rem 1.05rem;
  opacity: 0; visibility: hidden; transform: translateY(18px) scale(.96); transform-origin: 90% 100%;
  transition: opacity .4s var(--exp-suave), transform .5s var(--exp-suave), visibility 0s linear .5s;
}
.asistente.visible { opacity: 1; visibility: visible; transform: none; transition: opacity .4s var(--exp-suave), transform .5s var(--exp-suave), visibility 0s; }
.asistente::after {
  content: ''; position: absolute; right: 22px; bottom: -7px; width: 16px; height: 16px;
  background: #fff; transform: rotate(45deg); border-radius: 3px;
}
.asis-cab { display: flex; align-items: center; gap: .7rem; padding-right: 2rem; }
.asis-cab img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; }
.asis-cab b { display: block; font-size: .9rem; }
.asis-cab small { display: flex; align-items: center; gap: .35rem; font-size: .72rem; color: var(--text-3); }
.asis-cab small::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #25D366; }
.asis-msg { background: var(--gray-100); border-radius: 4px 16px 16px 16px; padding: .75rem .95rem; font-size: .9rem; line-height: 1.5; margin: .85rem 0 .8rem; }
.asis-opciones { display: flex; flex-wrap: wrap; gap: .45rem; }
.asis-opciones a {
  border: 1px solid var(--blue); color: var(--blue); border-radius: 100px;
  padding: .5rem .85rem; font-size: .78rem; font-weight: 600;
  transition: background .2s, color .2s;
}
.asis-opciones a:hover { background: var(--blue); color: #fff; }
.asis-cerrar { position: absolute; top: .65rem; right: .65rem; width: 32px; height: 32px; border-radius: 50%; border: 0; background: none; cursor: pointer; color: var(--text-3); display: grid; place-items: center; }
.asis-cerrar:hover { background: var(--gray-100); }
.asis-cerrar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (max-width: 680px) { .asistente { right: 1rem; bottom: 6rem; } }
/* En celular primero se asoma en pequeño (una pastilla junto al botón de WhatsApp);
   al tocarla se abre completo. Así no tapa lo que el visitante está viendo. */
.asis-mini { display: none; font-style: normal; }
.asistente.mini {
  width: auto; max-width: calc(100vw - 6.2rem); padding: .4rem 2.5rem .4rem .4rem; border-radius: 100px;
  right: 5.4rem; bottom: 2rem; cursor: pointer; transform-origin: 100% 50%;
}
.asistente.mini::after { display: none; }
.asistente.mini .asis-msg, .asistente.mini .asis-opciones, .asistente.mini .asis-cab small { display: none; }
.asistente.mini .asis-cab { padding-right: 0; gap: .6rem; }
.asistente.mini .asis-cab img { width: 38px; height: 38px; }
.asistente.mini .asis-cab b { font-size: .8rem; line-height: 1.2; }
.asistente.mini .asis-mini { display: block; font-size: .74rem; line-height: 1.25; color: var(--text-3); }
.asistente.mini .asis-cerrar { top: 50%; translate: 0 -50%; right: .3rem; width: 30px; height: 30px; }

/* ---------- Avisos (toasts) ---------- */
.avisos {
  position: fixed; left: 50%; bottom: 1.6rem; translate: -50% 0; z-index: 170;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  pointer-events: none; width: max-content; max-width: calc(100vw - 2rem);
}
.aviso {
  pointer-events: auto; display: flex; align-items: center; gap: 1rem;
  background: rgba(10, 16, 32, .94); color: #fff;
  padding: .8rem .85rem .8rem 1.2rem; border-radius: 14px;
  font-size: .86rem; line-height: 1.4; box-shadow: 0 16px 40px rgba(0, 0, 0, .3);
  animation: expAvisoEntra .45s var(--exp-suave);
}
.aviso button {
  background: #fff; color: var(--blue); border: 0; border-radius: 100px;
  padding: .45rem .9rem; font: 700 .78rem 'Inter', sans-serif; cursor: pointer; white-space: nowrap;
}
.aviso.sale { animation: expAvisoSale .3s forwards; }
@keyframes expAvisoEntra { from { opacity: 0; transform: translateY(14px); } }
@keyframes expAvisoSale { to { opacity: 0; transform: translateY(10px); } }
@media (max-width: 680px) { .avisos { bottom: 5.8rem; } }

/* ---------- Alertas de propiedades ---------- */
.alertas { background: linear-gradient(135deg, #0b1d4d 0%, #003087 60%, #1a4db5 100%); color: #fff; }
.alertas-caja { display: grid; grid-template-columns: 1fr 1.1fr; gap: 3.5rem; align-items: center; }
.alertas .tag { color: #ffb3bf; }
.alertas .tag::before { background: #ffb3bf; }
.alertas .section-title { color: #fff; }
.alertas .section-desc { color: rgba(255, 255, 255, .78); margin-top: 1rem; }
.alertas-form {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 20px; padding: 1.7rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.alertas-form label { display: flex; flex-direction: column; gap: .45rem; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255, 255, 255, .78); }
.alertas-form label span { text-transform: none; letter-spacing: 0; font-weight: 400; color: rgba(255, 255, 255, .55); }
.alertas-form input, .alertas-form select {
  font: 400 .95rem 'Inter', sans-serif; padding: .85rem 1rem; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .25); background: #fff; color: var(--text);
}
.alertas-form .ancho, .alertas-form button, .alertas-form .form-nota { grid-column: 1 / -1; }
.alertas-form button { justify-content: center; border: 0; cursor: pointer; }
.form-nota { font-size: .8rem; line-height: 1.5; color: rgba(255, 255, 255, .72); }
.form-nota.ok { color: #9ff2c0; font-weight: 600; }
.form-submit.ok, .alertas-form button.ok { background: #25D366 !important; }
@media (max-width: 900px) { .alertas-caja { grid-template-columns: 1fr; gap: 2rem; } }
@media (max-width: 560px) { .alertas-form { grid-template-columns: 1fr; padding: 1.3rem; } }

@media (prefers-reduced-motion: reduce) {
  dialog.vista[open], dialog.favs[open], .aviso, .nav-fav.latido, .fav-btn.pop { animation: none; }
  .asistente, .props-grid > .prop-item { transition: none; }
}

/* Sobre mí: la foto ahora va dentro de <picture> */
.about-img-wrap picture { display: block; }
