/**
 * hero.css - Portada del home (index.php).
 *
 * Pantalla completa con el header transparente encima, fondo en fundido entre
 * la foto de la marca y las propiedades destacadas, y un buscador estilo
 * portal: pestañas de operación y una sola barra con tipo, zona y dormitorios.
 * En el celular el buscador se abre como panel desde abajo.
 *
 * Se carga solo en el home (ver $extra_css). Los campos del buscador reusan
 * los estilos de .hero.hero-cover que están en custom.css.
 */

/* --------------------------------------------------------------
 # Header transparente sobre la foto
--------------------------------------------------------------- */
body.index-page #header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transition: background-color 0.4s, box-shadow 0.4s, padding 0.4s;
}

body.index-page:not(.scrolled) #header {
  background-color: transparent;
  box-shadow: none;
}

/* El logo pasa a blanco mientras está sobre la foto */
body.index-page:not(.scrolled) #header .logo img {
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
  transition: filter 0.4s;
}

body.index-page:not(.scrolled):not(.mobile-nav-active) #header .mobile-nav-toggle {
  color: #ffffff;
}

@media (min-width: 1200px) {
  body.index-page:not(.scrolled) .navmenu > ul > li > a {
    color: rgba(255, 255, 255, 0.86);
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
  }

  body.index-page:not(.scrolled) .navmenu > ul > li > a:hover,
  body.index-page:not(.scrolled) .navmenu > ul > li > a.active {
    color: #ffffff;
  }

}

/* --------------------------------------------------------------
 # Estructura
--------------------------------------------------------------- */
.hero.hx {
  min-height: 100svh;
  max-height: none;
  align-items: stretch;
  flex-direction: column;
  background-color: var(--hero-ink);
}

@supports not (height: 100svh) {
  .hero.hx {
    min-height: 100vh;
  }
}

.hx-slides {
  position: absolute;
  inset: 0;
  z-index: -3;
  overflow: hidden;
}

.hx-slide {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 1.6s ease, transform 9s ease-out;
}

/* Ken Burns: la foto activa se acerca muy despacio */
.hx-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

/* Velo: denso arriba (header) y abajo (leyenda), liviano al medio */
.hx-veil {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg,
      rgba(13, 16, 23, 0.74) 0%,
      rgba(13, 16, 23, 0.48) 28%,
      rgba(13, 16, 23, 0.52) 60%,
      rgba(13, 16, 23, 0.90) 100%),
    /* Sombra suave detrás del título y el buscador: separa el texto de las
       zonas claras del video (cielo, techos blancos) */
    radial-gradient(60% 45% at 50% 42%, rgba(13, 16, 23, 0.38) 0%, rgba(13, 16, 23, 0) 100%),
    radial-gradient(120% 80% at 50% 45%, rgba(13, 16, 23, 0) 40%, rgba(13, 16, 23, 0.45) 100%);
}

.hx-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 130px;
  padding-bottom: 32px;
  text-align: center;
}

/* --------------------------------------------------------------
 # Título
--------------------------------------------------------------- */
.hx-heading {
  max-width: 1200px;
  margin-bottom: 40px;
  animation: hx-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hx-heading h1 {
  margin: 0 0 18px;
  font-family: var(--heading-font);
  font-size: clamp(34px, 4.3vw, 64px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 6px 40px rgba(0, 0, 0, 0.45);
}

.hx-heading h1 .highlight,
.hx-heading h1 span,
.hx-heading h1 mark {
  color: var(--hero-yellow);
  background: none;
}

/* Dos renglones: "ENCONTRÁ TU PROPIEDAD IDEAL / EN LA RIOJA". El corte va
   después de lo resaltado. En el celular no entra en dos y se deja libre. */
.hx-heading h1 .txt-highlight::after {
  content: "\A";
  white-space: pre;
}

.hx-heading p {
  max-width: 620px;
  margin: 0 auto;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 4px 24px rgba(0, 0, 0, 0.4);
}

@keyframes hx-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------
 # Buscador
--------------------------------------------------------------- */
.hx-search {
  width: 100%;
  max-width: 980px;
  text-align: left;
  /* backwards y no both: si la animación deja un transform puesto al terminar,
     el panel fijo del celular se posiciona respecto del formulario y no de la
     pantalla, y queda a la vista aunque esté cerrado. */
  animation: hx-rise 0.9s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.hx-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(13, 16, 23, 0.38);
  backdrop-filter: blur(10px);
}

.hx-tab {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.hx-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.hx-tab span {
  display: block;
  padding: 9px 20px;
  border-radius: 999px;
  font-family: var(--nav-font);
  font-size: 14.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.82);
  transition: background-color 0.25s, color 0.25s;
}

.hx-tab:hover span {
  color: #ffffff;
}

.hx-tab input:checked + span {
  background: #ffffff;
  color: var(--hero-ink);
}

.hx-tab input:focus-visible + span {
  outline: 2px solid var(--hero-yellow);
  outline-offset: 2px;
}

/* Barra única: tipo, zona, dormitorios y el botón */
.hero.hero-cover .hx-panel.searchbar-form {
  grid-template-columns: 1fr 1.4fr 1fr auto;
  padding: 12px;
  border-radius: 20px;
}

.hero.hero-cover .hx-panel .searchbar-field label {
  padding-left: 12px;
}

.hero.hero-cover .hx-panel .searchbar-btn {
  height: 56px;
  min-width: 210px;
  border-radius: 14px;
  font-size: 15.5px;
}

.hero.hero-cover .hx-panel .field-control select {
  height: 56px;
}

/* Vidrio oscuro (de tablet para arriba). Un vidrio BLANCO sobre un video
   oscurecido se ve gris; el oscuro deja ver el paisaje de verdad y el texto
   blanco se lee perfecto. En el celular el panel es una hoja blanca y no
   lleva nada de esto. */
@media (min-width: 768px) {
  .hero.hero-cover .hx-panel.searchbar-form {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(13, 16, 23, 0.26);
    backdrop-filter: blur(10px) saturate(1.25);
    -webkit-backdrop-filter: blur(10px) saturate(1.25);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  }

  .hero.hero-cover .hx-panel .searchbar-field label {
    color: rgba(255, 255, 255, 0.72);
  }

  .hero.hero-cover .hx-panel .field-control > i {
    color: rgba(255, 255, 255, 0.85);
  }

  .hero.hero-cover .hx-panel .searchbar-field + .searchbar-field::before {
    background-color: rgba(255, 255, 255, 0.18);
  }

  .hero.hero-cover .hx-panel .field-control select {
    border-color: transparent;
    background-color: rgba(255, 255, 255, 0.08);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23ffffff'%3E%3Cpath d='M3.5 6h9L8 11.5z'/%3E%3C/svg%3E");
    color: #ffffff;
  }

  .hero.hero-cover .hx-panel .field-control select:hover {
    background-color: rgba(255, 255, 255, 0.14);
  }

  .hero.hero-cover .hx-panel .field-control select:focus {
    border-color: rgba(255, 255, 255, 0.55);
    background-color: rgba(255, 255, 255, 0.16);
    box-shadow: none;
  }

  /* La lista desplegable la dibuja el sistema: va en oscuro sobre blanco */
  .hero.hero-cover .hx-panel .field-control select option,
  .hero.hero-cover .hx-panel .field-control select optgroup {
    background-color: #ffffff;
    color: #1a2030;
  }
}

/* El encabezado del panel y el disparador solo existen en el celular */
.hx-panel-head,
.hx-trigger,
.hx-backdrop {
  display: none;
}

.hx-owner {
  margin-top: 22px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
  animation: hx-rise 0.9s 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hx-owner strong {
  color: var(--hero-yellow);
  white-space: nowrap;
}

.hx-owner i {
  display: inline-block;
  transition: transform 0.25s;
}

.hx-owner:hover {
  color: #ffffff;
}

.hx-owner:hover i {
  transform: translateX(4px);
}

/* --------------------------------------------------------------
 # Leyenda de la propiedad de fondo
--------------------------------------------------------------- */
.hx-foot {
  /* En el flujo, debajo del contenido y no superpuesta: así nunca queda
     cortada por el borde inferior en pantallas de poca altura */
  position: relative;
  z-index: 3;
  padding-bottom: 28px;
}

.hx-foot-inner {
  /* Lugar para el botón flotante de WhatsApp, abajo a la derecha */
  padding-right: 84px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}

.hx-captions {
  position: relative;
  min-height: 74px;
  flex: 1;
}

.hx-caption {
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 460px;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--hero-yellow);
  color: #ffffff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.6s, transform 0.6s;
}

.hx-caption.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.hx-caption-kicker {
  font-family: var(--nav-font);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.hx-caption-title {
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.hx-caption-price {
  font-family: var(--nav-font);
  font-size: 15px;
  font-weight: 700;
  color: var(--hero-yellow);
}

.hx-caption-price i {
  display: inline-block;
  transition: transform 0.25s;
}

.hx-caption:hover {
  color: #ffffff;
}

.hx-caption:hover .hx-caption-price i {
  transform: translateX(4px);
}

.hx-caption-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* Con video: las destacadas van como tarjeta con foto chica */
.hx-foot.has-cards .hx-caption {
  padding: 10px 18px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(13, 16, 23, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hx-foot.has-cards .hx-caption:hover {
  background: rgba(13, 16, 23, 0.6);
}

.hx-caption-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
}

.hx-foot.has-cards .hx-captions {
  min-height: 94px;
}

/* Video de fondo. Abajo está la portada como fondo del contenedor: se ve
   mientras carga y si el teléfono bloquea el video. */
.hx-slides {
  background-position: center;
  background-size: cover;
}

.hx-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* iOS bloqueó la reproducción (modo de bajo consumo): fuera el video, queda
   la portada del contenedor */
.hx-video.is-blocked {
  visibility: hidden;
}

/* Los controles que dibuja Safari cuando no puede reproducir solo (botón de
   play, ±10 s) no tienen que aparecer nunca: es un fondo, no un video para
   mirar */
.hx-video::-webkit-media-controls,
.hx-video::-webkit-media-controls-panel,
.hx-video::-webkit-media-controls-overlay-play-button,
.hx-video::-webkit-media-controls-start-playback-button {
  display: none !important;
  -webkit-appearance: none;
  opacity: 0 !important;
}

/* Puntos con barra de progreso: muestran cuándo cambia la foto */
.hx-dots {
  display: flex;
  gap: 8px;
  padding-bottom: 6px;
}

.hx-dot {
  width: 34px;
  height: 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hx-dot span {
  position: relative;
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.32);
  overflow: hidden;
}

.hx-dot span::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #ffffff;
  transform: scaleX(0);
  transform-origin: left;
}

.hx-dot.is-done span::after {
  transform: scaleX(1);
}

.hx-dot.is-active span::after {
  animation: hx-progress var(--hx-delay, 6.5s) linear forwards;
}

.hx.is-paused .hx-dot.is-active span::after {
  animation-play-state: paused;
}

@keyframes hx-progress {
  to { transform: scaleX(1); }
}

/* --------------------------------------------------------------
 # Responsive
--------------------------------------------------------------- */
@media (max-width: 991px) {
  .hero.hero-cover .hx-panel.searchbar-form {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .hero.hero-cover .hx-panel .searchbar-action {
    grid-column: 1 / -1;
  }

  .hero.hero-cover .hx-panel .searchbar-btn {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .hx-search {
    animation: none;
  }

  .hx-inner {
    justify-content: flex-end;
    padding-top: 110px;
    padding-bottom: 36px;
  }

  .hx-heading {
    margin-bottom: 26px;
  }

  .hx-heading h1 {
    font-size: 36px;
    line-height: 1.1;
  }

  .hx-heading h1 .txt-highlight::after {
    content: none;
  }

  .hx-heading p {
    font-size: 15.5px;
  }

  .hx-tabs {
    display: flex;
    width: 100%;
  }

  .hx-tab {
    flex: 1;
  }

  .hx-tab span {
    padding: 9px 4px;
    font-size: 13.5px;
    text-align: center;
  }

  /* Disparador con forma de barra de búsqueda */
  .hx-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    background: rgba(13, 16, 23, 0.3);
    backdrop-filter: blur(10px) saturate(1.25);
    -webkit-backdrop-filter: blur(10px) saturate(1.25);
    color: #ffffff;
    text-align: left;
    box-shadow: 0 20px 50px rgba(13, 16, 23, 0.35);
  }

  .hx-trigger > i {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--hero-yellow);
    color: var(--hero-ink);
    font-size: 18px;
  }

  .hx-trigger strong {
    display: block;
    font-family: var(--nav-font);
    font-size: 15.5px;
  }

  .hx-trigger small {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.72);
  }

  /* El panel se vuelve una hoja que sube desde abajo */
  .hero.hero-cover .hx-panel.searchbar-form {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2001;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    max-height: 88vh;
    padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    overflow-y: auto;
    background: #ffffff;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .hx-search.is-open .hx-panel.searchbar-form {
    transform: none;
  }

  .hero.hero-cover .hx-panel .searchbar-field + .searchbar-field::before {
    display: none;
  }

  .hero.hero-cover .hx-panel .field-control select {
    background-color: #f3f4f6;
  }

  .hx-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
  }

  .hx-panel-head strong {
    font-family: var(--heading-font);
    font-size: 19px;
    color: var(--hero-ink);
  }

  .hx-panel-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #f3f4f6;
    color: var(--hero-ink);
  }

  .hx-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: block;
    background: rgba(13, 16, 23, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .hx-search.is-open + .hx-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .hx-owner {
    font-size: 14px;
  }

  .hx-foot {
    padding-bottom: 22px;
  }

  .hx-caption-title {
    font-size: 15.5px;
  }

  .hx-caption-thumb {
    width: 56px;
    height: 56px;
  }

  .hx-foot.has-cards .hx-captions {
    min-height: 78px;
  }

  .hx-foot.has-cards .hx-caption {
    right: 0;
    max-width: none;
  }

  .hx-foot.has-cards .hx-dots {
    display: none;
  }

  .hx-captions {
    min-height: 66px;
  }

  .hx-dot {
    width: 20px;
  }
}

/* Pantallas de poca altura (notebooks): todo más compacto para que el
   buscador y la tarjeta entren sin scroll */
@media (min-width: 768px) and (max-height: 860px) {
  .hx-inner {
    padding-top: 110px;
    padding-bottom: 20px;
  }

  .hx-heading {
    margin-bottom: 26px;
  }

  .hx-heading h1 {
    font-size: clamp(32px, 3.8vw, 54px);
    margin-bottom: 14px;
  }

  .hx-owner {
    margin-top: 14px;
  }

  .hx-foot {
    padding-bottom: 18px;
  }
}

/* Sin animaciones para quien las desactivó en el sistema */
@media (prefers-reduced-motion: reduce) {
  .hx-slide,
  .hx-heading,
  .hx-search,
  .hx-owner {
    animation: none;
    transition: opacity 0.4s;
    transform: none;
  }
}

/* Con el panel del celular abierto: sin scroll de fondo y sin el header ni el
   botón flotante, que quedarían por encima de la hoja. */
body.hx-sheet-open {
  overflow: hidden;
}

body.hx-sheet-open #header,
body.hx-sheet-open .whatsapp-float,
body.hx-sheet-open .hx-foot {
  opacity: 0;
  pointer-events: none;
}

/* La hoja vive dentro del hero: su bloque tiene que quedar por encima de la
   leyenda y de todo lo demás mientras está abierta. */
body.hx-sheet-open .hx-inner {
  z-index: 10;
}
