/* =========================================================
   FLOATING CONTACTS — ГОРОДЕЯ
   ========================================================= */

.floating-contacts {
  position: relative;
  z-index: 950;
}

.floating-contacts *,
.floating-contacts *::before,
.floating-contacts *::after {
  box-sizing: border-box;
}


/* =========================================================
   DESKTOP
   ========================================================= */

.floating-contacts__desktop {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 950;

  display: flex;
  flex-direction: column;
  align-items: flex-end;

  pointer-events: none;
}


/* =========================================================
   MAIN TOGGLE
   ========================================================= */

.floating-contacts__toggle {
  position: relative;

  width: 68px;
  height: 68px;
  padding: 0;

  border: 1px solid rgba(184, 160, 106, 0.42);
  border-radius: 22px;

  background: linear-gradient(
    180deg,
    rgba(58, 63, 68, 0.98) 0%,
    rgba(32, 36, 42, 0.98) 100%
  );

  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;

  box-shadow:
    0 18px 42px rgba(32, 36, 42, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;

  cursor: pointer;
  pointer-events: auto;

  appearance: none;
  -webkit-appearance: none;
  outline: none;

  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    background 0.24s ease,
    border-color 0.24s ease;
}

.floating-contacts__toggle:hover {
  transform: translateY(-3px);

  border-color: rgba(184, 160, 106, 0.7);

  box-shadow:
    0 22px 48px rgba(32, 36, 42, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.floating-contacts__toggle:focus,
.floating-contacts__toggle:focus-visible {
  outline: none;
}

.floating-contacts__toggle::before {
  content: "";

  position: absolute;
  inset: 6px;

  border-radius: 17px;
  border: 1px solid rgba(184, 160, 106, 0.18);

  pointer-events: none;
}

.floating-contacts__toggle::after {
  content: "";

  position: absolute;
  right: 9px;
  top: 9px;

  width: 11px;
  height: 11px;

  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-anthracite);

  box-shadow: 0 0 0 5px rgba(184, 160, 106, 0.12);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.floating-contacts.is-open
.floating-contacts__toggle::after {
  opacity: 0;
  transform: scale(0);
}

.floating-contacts__toggle-icon {
  position: absolute;

  display: flex;
  align-items: center;
  justify-content: center;

  transition:
    opacity 0.22s ease,
    transform 0.25s ease;
}

.floating-contacts__toggle-icon--chat {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.floating-contacts__toggle-icon--chat svg {
  width: 31px;
  height: 31px;
  display: block;
  fill: currentColor;
}

.floating-contacts__toggle-icon--close {
  opacity: 0;
  font-size: 36px;
  line-height: 1;
  font-weight: 300;
  color: var(--color-accent);
  transform: scale(0.7) rotate(-45deg);
}

.floating-contacts.is-open
.floating-contacts__toggle-icon--chat {
  opacity: 0;
  transform: scale(0.7) rotate(45deg);
}

.floating-contacts.is-open
.floating-contacts__toggle-icon--close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}


/* =========================================================
   EXPANDED PANEL
   ========================================================= */

.floating-contacts__panel {
  position: absolute;
  right: 0;
  bottom: 82px;

  width: 250px;
  padding: 11px;

  border: 1px solid rgba(184, 160, 106, 0.32);
  border-radius: 24px;

  background: rgba(255, 255, 255, 0.98);

  box-shadow:
    0 26px 70px rgba(32, 36, 42, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.72) inset;

  opacity: 0;
  visibility: hidden;

  transform:
    translateY(10px)
    scale(0.96);

  transform-origin: bottom right;

  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease,
    transform 0.28s ease;
}

.floating-contacts__panel::before {
  content: "";

  position: absolute;
  right: 24px;
  bottom: -7px;

  width: 14px;
  height: 14px;

  background: rgba(255, 255, 255, 0.98);

  border-right: 1px solid rgba(184, 160, 106, 0.32);
  border-bottom: 1px solid rgba(184, 160, 106, 0.32);

  transform: rotate(45deg);
}

.floating-contacts.is-open
.floating-contacts__panel {
  opacity: 1;
  visibility: visible;
  transform:
    translateY(0)
    scale(1);
  pointer-events: auto;
}


/* =========================================================
   PANEL ITEMS
   ========================================================= */

.floating-contacts__item {
  width: 100%;
  min-height: 58px;
  padding: 9px 12px;

  border-radius: 16px;

  display: flex;
  align-items: center;
  gap: 13px;

  color: var(--color-text);
  text-decoration: none;

  transition:
    background 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.floating-contacts__item + .floating-contacts__item {
  margin-top: 4px;
}

.floating-contacts__item:hover {
  background: #f8f6f1;
  transform: translateY(-1px);

  box-shadow:
    0 8px 20px rgba(184, 160, 106, 0.12);
}

.floating-contacts__icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;

  border-radius: 13px;

  background: linear-gradient(
    180deg,
    var(--color-accent) 0%,
    #a98d56 100%
  );

  display: flex;
  align-items: center;
  justify-content: center;

  color: #ffffff;

  box-shadow:
    0 8px 18px rgba(184, 160, 106, 0.24);
}

.floating-contacts__icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.floating-contacts__icon--max {
  font-size: 17px;
  line-height: 1;
  font-weight: 900;
}

.floating-contacts__label {
  min-width: 0;

  color: var(--color-text);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
}


/* =========================================================
   HINT
   ========================================================= */

.floating-contacts__hint {
  position: absolute;
  right: 82px;
  bottom: 10px;

  width: 300px;
  padding: 16px 42px 16px 18px;

  border: 1px solid rgba(184, 160, 106, 0.34);
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.98);

  box-shadow:
    0 20px 54px rgba(32, 36, 42, 0.14);

  opacity: 0;
  visibility: hidden;

  transform:
    translateY(8px)
    scale(0.98);

  pointer-events: none;

  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.32s ease;
}

.floating-contacts__hint::after {
  content: "";

  position: absolute;
  right: -7px;
  top: 50%;

  width: 14px;
  height: 14px;

  background: rgba(255, 255, 255, 0.98);

  border-top: 1px solid rgba(184, 160, 106, 0.34);
  border-right: 1px solid rgba(184, 160, 106, 0.34);

  transform:
    translateY(-50%)
    rotate(45deg);
}

.floating-contacts__hint.is-visible {
  opacity: 1;
  visibility: visible;
  transform:
    translateY(0)
    scale(1);
  pointer-events: auto;
}

.floating-contacts.is-open
.floating-contacts__hint {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.floating-contacts__hint-content {
  display: grid;
  gap: 4px;
}

.floating-contacts__hint-content strong {
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
}

.floating-contacts__hint-content span {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
}

.floating-contacts__hint-close {
  position: absolute;
  right: 8px;
  top: 8px;

  width: 28px;
  height: 28px;
  padding: 0;

  border: none;
  border-radius: 9px;

  background: transparent;
  color: var(--color-muted);

  display: flex;
  align-items: center;
  justify-content: center;

  font-family: inherit;
  font-size: 18px;
  line-height: 1;

  cursor: pointer;

  appearance: none;
  -webkit-appearance: none;
  outline: none;

  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.floating-contacts__hint-close:hover {
  background: #f7f5ef;
  color: var(--color-text);
}


/* =========================================================
   MOBILE
   ========================================================= */

.floating-contacts__mobile {
  display: none;
}


/* =========================================================
   TABLET / MOBILE
   ========================================================= */

@media (max-width: 960px) {
  .floating-contacts__desktop {
    display: none;
  }

  .floating-contacts__mobile {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 950;

    min-height: 58px;
    padding: 6px 7px;

    border: 1px solid rgba(211, 214, 218, 0.9);
    border-radius: 20px;

    background: rgba(255, 255, 255, 0.97);

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;

    box-shadow:
      0 12px 34px rgba(32, 36, 42, 0.12);
  }

  .floating-contacts__mobile-item {
    position: relative;

    min-width: 0;
    min-height: 46px;
    padding: 5px 4px;

    border-radius: 14px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;

    color: var(--color-anthracite);
    text-decoration: none;

    -webkit-tap-highlight-color: transparent;
  }

  .floating-contacts__mobile-item + .floating-contacts__mobile-item::before {
    content: "";

    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;

    width: 1px;
    background: var(--color-divider);
  }

  .floating-contacts__mobile-item svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
  }

  .floating-contacts__mobile-max {
    height: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 16px;
    line-height: 1;
    font-weight: 900;
  }

  .floating-contacts__mobile-item span {
    overflow: hidden;
    max-width: 100%;

    color: var(--color-muted);
    font-size: 9px;
    line-height: 1.1;
    font-weight: 700;

    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .floating-contacts__mobile-item:active {
    background: var(--color-page);
  }

  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 520px) {
  .floating-contacts__mobile {
    left: 8px;
    right: 8px;
    bottom: calc(7px + env(safe-area-inset-bottom, 0px));

    min-height: 56px;
    padding: 5px;
    border-radius: 18px;

    box-shadow:
      0 10px 28px rgba(32, 36, 42, 0.12);
  }

  .floating-contacts__mobile-item {
    min-height: 44px;
  }

  .floating-contacts__mobile-item svg {
    width: 19px;
    height: 19px;
  }

  .floating-contacts__mobile-max {
    height: 19px;
    font-size: 15px;
  }

  .floating-contacts__mobile-item span {
    font-size: 8px;
  }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  .floating-contacts__toggle,
  .floating-contacts__toggle-icon,
  .floating-contacts__panel,
  .floating-contacts__hint,
  .floating-contacts__item {
    transition: none;
  }
}


/* =========================================================
   DESKTOP — ПУЛЬСАЦИЯ КНОПКИ СВЯЗИ
   ========================================================= */

@media (min-width: 961px) {

  .floating-contacts__toggle {
    animation:
      floatingContactsPulse 2.4s ease-out infinite;
  }


  @keyframes floatingContactsPulse {

    0% {
      box-shadow:
        0 18px 42px rgba(32, 36, 42, 0.22),
        0 0 0 0 rgba(184, 160, 106, 0.42);
    }

    55% {
      box-shadow:
        0 20px 46px rgba(32, 36, 42, 0.24),
        0 0 0 11px rgba(184, 160, 106, 0);
    }

    100% {
      box-shadow:
        0 18px 42px rgba(32, 36, 42, 0.22),
        0 0 0 0 rgba(184, 160, 106, 0);
    }

  }


  /*
   * Когда пользователь открыл панель —
   * пульсацию временно останавливаем.
   */
  .floating-contacts.is-open
  .floating-contacts__toggle {
    animation: none;

    box-shadow:
      0 20px 48px rgba(32, 36, 42, 0.26),
      0 0 0 1px rgba(184, 160, 106, 0.28);
  }

}


/* Уважаем системную настройку уменьшения анимации */

@media (prefers-reduced-motion: reduce) {

  .floating-contacts__toggle {
    animation: none !important;
  }

}