/* ===========================
   HERO SECTION
   =========================== */

.hero {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  /* ❗ Паддинг сверху отключён */
  padding-top: 0;

  /* ❗ Высота hero:
     - desktop: около первого экрана (но не опасный 100vh)
     - mobile: ровно по контенту 
  */
  min-height: min(90vh, 780px);
}

@media (max-width: 768px) {
  .hero {
    min-height: calc(100svh - var(--header-height));
    padding-bottom: 0;
  }
}

.hero__bg-slider {
  position: absolute;
  inset: 0;
  z-index: 0; /* фон */
  overflow: hidden;
}

.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1);
  transition: opacity 1.6s ease, transform 12s ease;
}

.hero__slide--active {
  opacity: 1;
  transform: scale(1.06);
}

.hero__bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* Параллакс */
.hero[data-parallax="true"] .hero__slide--active .hero__bg-image {
  transform: translateY(var(--parallax-offset, 0px)) scale(1.06);
}

/* Контент hero должен быть сверху */
.hero__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* стеклянная панель с текстом + формой */
.hero__panel {
  max-width: 780px;
  width: 100%;
  padding: clamp(20px, 4vw, 32px);
  border-radius: 24px;
  position: relative;
  overflow: visible; /* даём поповерам фильтров выходить за границы */
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: clamp(260px, 40vh, 340px);
  background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.78),
      rgba(226, 232, 240, 0.76)
    ),
    linear-gradient(120deg, rgba(255, 255, 255, 0.4), rgba(226, 232, 240, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.hero__panel::before,
.hero__panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero__panel::before {
  background: radial-gradient(
    circle at 20% 20%,
    rgba(255, 255, 255, 0.3),
    transparent 36%
  );
}

.hero__panel::after {
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.18) 0%,
    transparent 40%,
    rgba(255, 255, 255, 0.1) 70%
  );
  mix-blend-mode: screen;
  opacity: 0.7;
}

.hero__title {
  margin: 0 0 12px 0;
  font-size: clamp(2.2rem, 4.2vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text-main);
  min-height: 2.7em; /* удерживает высоту при смене текста слайдера */
}

.hero__subtitle {
  margin: 0 0 20px 0;
  font-size: clamp(1.05rem, 1.7vw, 1.25rem);
  color: var(--color-text-muted);
  min-height: 2.4em; /* предотвращает скачок высоты */
}

/* форма тянется на всю ширину панели */
.hero__search {
  margin-top: 4px;
}

/* контекстные факты под формой */
.hero__highlights {
  margin: 18px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
}

.hero__highlight {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.hero__highlight-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-text-strong);
}

/* на мобильных – панель растягивается и чуть проще */
@media (max-width: 768px) {
  .hero__panel {
    border-radius: 20px;
    padding: 18px 16px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.28);
    gap: 14px;
    min-height: auto;
  }

  .hero__title,
  .hero__subtitle {
    min-height: auto;
  }

  .hero__title {
    margin-bottom: 6px;
  }

  .hero__subtitle {
    margin-bottom: 12px;
  }

  .hero__search [data-filter="hero_city"],
  .hero__search [data-filter="hero_priceMax"] {
    display: none;
  }

  .hero__highlights {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .hero {
    padding-bottom: 32px;
  }

  .hero__content {
    gap: 16px;
  }

  .hero__panel {
    padding: 16px 14px;
    border-radius: 18px;
    gap: 10px;
  }

  .hero__title {
    font-size: clamp(1.7rem, 6.2vw, 2.1rem);
  }

  .hero__subtitle {
    font-size: 0.95rem;
    margin-bottom: 10px;
  }

  .hero__search {
    gap: 8px;
  }

  .hero .filter-pill {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .hero__button {
    min-height: 42px;
    font-size: 0.9rem;
  }

  .hero__highlights {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
  }

  .hero__highlight {
    align-items: baseline;
    gap: 4px;
  }

  .hero__highlight-label {
    font-size: 0.9rem;
  }
}

/* ===== FORM ===== */

.hero__search {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  width: 100%;
}

@media (min-width: 769px) {
  .hero__search {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.hero__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.hero__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* подгоняем под поля формы */
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-strong)
  );
  color: var(--color-white);
  font-size: 0.95rem;
  transition: background-color var(--transition-fast),
    transform var(--transition-fast);
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.2);
  width: 100%; /* ширина в линию с полями */
}

.hero__button:hover {
  background: linear-gradient(
    135deg,
    var(--color-primary-strong),
    var(--color-primary-deep)
  );
  transform: translateY(-1px);
}

.hero__button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* Badges */

.hero__badge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
  font-weight: 600;
  color: var(--color-text-main);
  pointer-events: none;
}

.hero__badge--top {
  top: 18px;
}

.hero__badge--bottom {
  bottom: 18px;
}

/* Parallax состояние */
[data-parallax] {
  will-change: transform;
  transition: transform 700ms cubic-bezier(0.21, 0.61, 0.35, 1);
}

/* При появлении (из reveal.js) */
.reveal--visible [data-parallax] {
  transform: translateY(0);
}

.hero__mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.25));
  opacity: 1;
  transition: opacity 1s ease;
  z-index: 1;
}

.hero__bg-slider--mask-fade .hero__mask {
  opacity: 0.6; /* мягкое затухание */
}

.hero__progress {
  height: 4px;
  width: 160px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  margin-top: 20px;
  overflow: hidden;
  position: relative;
}

.hero__progress::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-white);
  transform: translateX(-100%);
  animation: hero-progress linear forwards;
}

@keyframes hero-progress {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}
