/**
 * Skeleton страницы ЖК (не квартиры): оверлей до ответа API.
 * #complexPage.is-loading — показывается .complex-skeleton-overlay (каркас как на Яндекс.Недвижимость, ЖК).
 */
#complexPage {
  --skel-base: #ededed;
  --skel-highlight: #ffffff;
  --skel-bg-page: #ffffff;
  position: relative;
}

#complexPage.is-loading {
  min-height: 2800px;
}

@keyframes skeletonShimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.complex-skeleton-overlay {
  display: none;
}

#complexPage.is-loading .complex-skeleton-overlay {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  min-height: 100%;
  z-index: 8;
  background: var(--skel-bg-page);
  pointer-events: none;
}

#complexPage.is-loading .complex-skeleton-overlay .skel-el {
  color: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  background: linear-gradient(
    90deg,
    var(--skel-base) 25%,
    var(--skel-highlight) 50%,
    var(--skel-base) 75%
  ) !important;
  background-size: 1000px 100% !important;
  animation: skeletonShimmer 1.5s infinite linear;
  border-radius: 8px;
  user-select: none;
}

#complexPage.is-loading .complex-skeleton-overlay .skel-el--round {
  border-radius: 50%;
}

/* Акцентный шиммер: место под статус «В продаже» / «Сдан» и красные CTA */
#complexPage.is-loading .complex-skeleton-overlay .skel-el--red {
  background: linear-gradient(
    90deg,
    #f5d0d0 25%,
    #ffe8e8 50%,
    #f5d0d0 75%
  ) !important;
  background-size: 1000px 100% !important;
  animation: skeletonShimmer 1.5s infinite linear;
}

/* --- Блок 1: псевдо-меню + крошки + заголовок ЖК --- */
.skel-zhk-faux-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 20px;
  align-items: center;
}

.skel-zhk-faux-nav__bar {
  height: 10px;
  border-radius: 5px;
}

.skel-zhk-faux-nav__bar--1 {
  width: 72px;
}
.skel-zhk-faux-nav__bar--2 {
  width: 110px;
}
.skel-zhk-faux-nav__bar--3 {
  width: 88px;
}
.skel-zhk-faux-nav__bar--4 {
  width: 96px;
}
.skel-zhk-faux-nav__bar--5 {
  width: 64px;
}
.skel-zhk-faux-nav__bar--6 {
  width: 120px;
  margin-left: auto;
}

.skel-zhk-crumbs {
  margin-bottom: 12px;
  min-height: 18px;
  width: 70%;
  max-width: 520px;
}

.skel-zhk-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 24px;
}

.skel-zhk-title {
  flex: 1 1 280px;
  min-height: 48px;
  max-width: 720px;
  border-radius: 10px;
}

.skel-zhk-status {
  width: 120px;
  min-height: 28px;
  border-radius: 999px;
}

/* --- Блок 2: Hero ЖК --- */
.skel-zhk-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 36px;
}

@media (max-width: 1000px) {
  .skel-zhk-hero {
    grid-template-columns: 1fr;
  }
}

.skel-zhk-gallery {
  position: relative;
  min-height: 420px;
  border-radius: 16px;
  overflow: hidden;
}

@media (max-width: 700px) {
  .skel-zhk-gallery {
    min-height: 280px;
  }
}

.skel-zhk-gallery__play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 64px;
  height: 64px;
  min-width: 64px;
  min-height: 64px;
  aspect-ratio: 1;
  border-radius: 50%;
  flex-shrink: 0;
}

.skel-zhk-gallery__captions {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skel-zhk-gallery__cap {
  width: 100px;
  min-height: 22px;
}

.skel-zhk-sticky {
  padding: 22px;
  border-radius: 18px;
  border: 1px solid #ececf0;
  box-shadow: 0 8px 32px rgba(30, 30, 36, 0.08);
  background: #fff;
}

.skel-zhk-sticky__name {
  width: 85%;
  min-height: 22px;
  margin-bottom: 12px;
}

.skel-zhk-sticky__addr {
  width: 100%;
  min-height: 18px;
  margin-bottom: 20px;
}

.skel-zhk-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 20px;
}

.skel-zhk-params__cell {
  min-height: 40px;
}

.skel-zhk-sticky__price {
  width: 68%;
  min-height: 44px;
  margin-bottom: 16px;
  border-radius: 10px;
}

.skel-zhk-sticky__btn {
  width: 100%;
  min-height: 48px;
  margin-bottom: 10px;
  border-radius: 10px;
}

.skel-zhk-sticky__btn--secondary {
  min-height: 46px;
}

.skel-zhk-dev {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid #f0f0f3;
}

/* Логотип застройщика: строго круг 40×40, без овала в flex */
.skel-zhk-dev__logo {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  aspect-ratio: 1;
  flex-shrink: 0;
  box-sizing: border-box;
}

.skel-zhk-dev__lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skel-zhk-dev__line1 {
  width: 55%;
  min-height: 16px;
}

.skel-zhk-dev__line2 {
  width: 40%;
  min-height: 14px;
}

/* --- Блок 3: линейка характеристик ЖК --- */
.skel-zhk-features {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px 12px;
  margin-bottom: 40px;
}

@media (max-width: 900px) {
  .skel-zhk-features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .skel-zhk-features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.skel-zhk-feature {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.skel-zhk-feature__ico {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  aspect-ratio: 1;
  flex-shrink: 0;
  box-sizing: border-box;
}

.skel-zhk-feature__lbl {
  width: 70%;
  min-height: 14px;
}

.skel-zhk-feature__val {
  width: 90%;
  min-height: 22px;
}

/* --- Блок 4: Выбор квартир (агрегаты) --- */
.skel-zhk-section-title {
  width: 220px;
  min-height: 26px;
  margin-bottom: 16px;
  border-radius: 6px;
}

.skel-zhk-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.skel-zhk-tab {
  width: 88px;
  min-height: 36px;
  border-radius: 999px;
}

.skel-zhk-type-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 44px;
}

@media (max-width: 800px) {
  .skel-zhk-type-cards {
    grid-template-columns: 1fr;
  }
}

.skel-zhk-type-card {
  border: 1px solid #ececf0;
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.skel-zhk-type-card__thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: 12px;
  border-radius: 12px;
}

.skel-zhk-type-card__name {
  width: 60%;
  min-height: 18px;
  margin-bottom: 10px;
}

.skel-zhk-type-card__line {
  width: 100%;
  min-height: 14px;
  margin-bottom: 8px;
}

.skel-zhk-type-card__line--short {
  width: 75%;
}

.skel-zhk-type-card__price {
  width: 55%;
  min-height: 22px;
  margin: 12px 0 14px;
}

.skel-zhk-type-card__btn {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
}

/* --- Блок 5: история цен --- */
.skel-zhk-history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.skel-zhk-history-title {
  width: 160px;
  min-height: 24px;
}

.skel-zhk-history-tabs1 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.skel-zhk-history-tabs1 .skel-el {
  width: 56px;
  min-height: 32px;
  border-radius: 8px;
}

.skel-zhk-history-tabs2 {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.skel-zhk-history-tabs2 .skel-el {
  width: 140px;
  min-height: 30px;
  border-radius: 8px;
}

.skel-zhk-chart {
  width: 100%;
  min-height: 220px;
  border-radius: 16px;
  margin-bottom: 40px;
}

/* --- Ипотека (краткий блок как у ЖК на Яндексе) --- */
.skel-zhk-mortgage-title {
  width: 240px;
  min-height: 24px;
  margin-bottom: 14px;
}

.skel-zhk-mortgage-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

@media (max-width: 700px) {
  .skel-zhk-mortgage-row {
    grid-template-columns: 1fr;
  }
}

.skel-zhk-mortgage-box {
  min-height: 120px;
  border-radius: 16px;
}

/* --- Блок 6: описание + карта --- */
.skel-zhk-desc-title {
  width: 140px;
  min-height: 24px;
  margin-bottom: 14px;
}

.skel-zhk-desc-lines {
  margin-bottom: 14px;
}

.skel-zhk-desc-line {
  width: 100%;
  min-height: 14px;
  margin-bottom: 10px;
  border-radius: 4px;
}

.skel-zhk-desc-line--90 {
  width: 90%;
}

.skel-zhk-desc-line--75 {
  width: 75%;
}

.skel-zhk-desc-line--60 {
  width: 60%;
}

.skel-zhk-more {
  width: 120px;
  min-height: 36px;
  margin-bottom: 40px;
  border-radius: 10px;
}

.skel-zhk-map-title {
  width: 260px;
  min-height: 24px;
  margin-bottom: 14px;
}

.skel-zhk-map-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.skel-zhk-map-chips .skel-el {
  width: 96px;
  min-height: 32px;
  border-radius: 999px;
}

.skel-zhk-map-box {
  width: 100%;
  min-height: 380px;
  border-radius: 16px;
  margin-bottom: 48px;
}

/* --- Блок 7: похожие --- */
.skel-zhk-similar-title {
  width: 200px;
  min-height: 24px;
  margin-bottom: 16px;
}

.skel-zhk-similar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 32px;
}

@media (max-width: 900px) {
  .skel-zhk-similar-grid {
    grid-template-columns: 1fr;
  }
}

.skel-zhk-sim-card__img {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 12px;
  margin-bottom: 10px;
}

.skel-zhk-sim-card__price {
  width: 50%;
  min-height: 20px;
  margin-bottom: 8px;
}

.skel-zhk-sim-card__addr {
  width: 100%;
  min-height: 14px;
}

@media (prefers-reduced-motion: reduce) {
  #complexPage.is-loading .complex-skeleton-overlay .skel-el,
  #complexPage.is-loading .complex-skeleton-overlay .skel-el--red {
    animation: none !important;
    background: var(--skel-base) !important;
  }
}

/* Fatal поверх скелета */
#fatalState:not([hidden]) {
  position: relative;
  z-index: 12;
}
