/* ============================================================
   КОМПОНЕНТЫ
   Кнопки, кнопки мессенджеров, теги, поля формы, модальное окно,
   тост, кнопка «наверх», прелоадер, cookie-баннер.
   Всё, что встречается больше чем в одном блоке страницы.
   ============================================================ */

/* ---------------- Кнопки ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 26px;
  border: 1px solid transparent;
  border-radius: var(--r-s);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  transition: transform .18s ease, background .18s ease,
    border-color .18s ease, box-shadow .18s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn svg {
  flex: none;
}

.btn--accent {
  background: var(--acc);
  color: #0D0D0D;
}

.btn--accent:hover {
  background: var(--acc-2);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--acc);
  color: var(--acc);
}

.btn--max {
  background: var(--max);
  color: #fff;
}

.btn--max:hover {
  background: #7D3FFB;
}

.btn--large {
  padding: 19px 34px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.btn--small {
  padding: 12px 16px;
  font-size: 14px;
}

.btn--block {
  width: 100%;
}

.btn--pulse {
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 184, 0, .45);
  }

  70% {
    box-shadow: 0 0 0 18px rgba(255, 184, 0, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 184, 0, 0);
  }
}

/* ---------------- Кнопки мессенджеров ---------------- */
.contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.contacts--center {
  justify-content: center;
}

.contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease,
    border-color .18s ease, box-shadow .18s ease;
}

.contact:hover {
  transform: scale(1.06);
}

.contact--telegram:hover {
  background: #229ED9;
  border-color: #229ED9;
}

.contact--whatsapp:hover {
  background: #25D366;
  border-color: #25D366;
  color: #062D15;
}

.contact--max {
  border-color: rgba(108, 42, 242, .5);
}

.contact--max:hover {
  background: var(--max);
  border-color: var(--max);
  box-shadow: 0 0 22px rgba(108, 42, 242, .55);
}

.contact--phone:hover {
  background: var(--acc);
  border-color: var(--acc);
  color: #0D0D0D;
}

.contact--compact {
  padding: 10px 14px;
  font-size: 13px;
}

/* Буква M вместо иконки MAX */
.max-letter {
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 16px;
  line-height: 1;
}

/* ---------------- Теги ---------------- */
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12.5px;
  padding: 6px 12px;
}

/* ---------------- Иконка в шестиугольнике ---------------- */
.hex-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 58px;
  color: var(--acc);
}

.hex-icon__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hex-icon__glyph {
  width: 24px;
  height: 24px;
}

/* ---------------- Статус мастера ---------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.status__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.status--online {
  color: var(--ok);
}

.status--online .status__dot {
  background: var(--ok);
  animation: blink 2s infinite;
}

.status--busy {
  color: var(--acc);
}

.status--busy .status__dot {
  background: var(--acc);
}

@keyframes blink {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, .6);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(76, 175, 80, 0);
  }
}

/* ---------------- Поля формы ---------------- */
.field {
  margin: 0 0 18px;
}

/* Ловушка для ботов: вне экрана, а не display:none — так простые скрипты её всё равно находят и заполняют */
.field--trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field__label {
  display: block;
  margin: 0 0 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.field__label span {
  color: var(--acc);
}

.field input,
.field textarea {
  width: 100%;
  padding: 15px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: 16px;
  /* меньше 16px — iOS зумит страницу при фокусе */
  transition: border-color .2s, box-shadow .2s;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #808080;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, .14);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.field__error {
  display: none;
  margin: 7px 0 0;
  color: var(--err);
  font-size: 12.5px;
}

.field.has-error input {
  border-color: var(--err);
}

.field.has-error .field__error {
  display: block;
}

/* ---------------- Модальное окно ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 20px;
  overflow-y: auto;
}

.modal.is-open {
  display: grid;
  place-items: center;
}

.modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(4px);
  animation: fade .3s ease;
}

.modal__box {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: clamp(24px, 4vw, 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  animation: pop .3s cubic-bezier(.2, .9, .3, 1.1);
}

.modal__close-x {
  position: absolute;
  right: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: .2s;
}

.modal__close-x:hover {
  border-color: var(--err);
  color: var(--err);
}

.modal__badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 0 16px;
  border-radius: 14px;
  background: var(--max);
  font-family: var(--f-display);
  font-weight: 900;
  font-size: 24px;
}

.modal__title {
  margin: 0 0 8px;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 21px;
  text-transform: uppercase;
}

.modal__text {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

@keyframes fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Карточка мастера внутри модалки MAX */
.phone-card {
  margin: 0 0 14px;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.phone-card__name {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.phone-card__number {
  margin: 0 0 12px;
  padding: 13px 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 19px;
}

.phone-card__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------------- Тост ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 200;
  max-width: 90vw;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--ok);
  color: #062D15;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  transform: translate(-50%, 200%);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.2);
  box-shadow: 0 12px 40px -10px rgba(0, 0, 0, .7);
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

/* ---------------- Кнопка «наверх» ---------------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 55;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--acc);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: .28s;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  border-color: var(--acc);
}

/* ---------------- Липкая панель на мобильных ---------------- */
.mobile-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 58;
  display: none;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(13, 13, 13, .94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

.mobile-bar .btn {
  flex: 1;
  padding: 14px 10px;
  font-size: 14.5px;
}

/* ---------------- Cookie ---------------- */
.cookie {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 70;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 16px 50px -14px rgba(0, 0, 0, .8);
}

.cookie.is-visible {
  display: flex;
}

/* ---------------- Прелоадер ---------------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  text-align: center;
  transition: opacity .45s ease, visibility .45s;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.preloader img {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  animation: beat 1.2s ease-in-out infinite;
}

.preloader__note {
  max-width: 34ch;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.preloader__note code {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--acc);
  font-size: 13px;
}

@keyframes beat {

  0%,
  100% {
    transform: scale(1);
    opacity: .85;
  }

  50% {
    transform: scale(1.07);
    opacity: 1;
  }
}

/* ---------------- Мобильные правки ---------------- */
@media (max-width: 900px) {
  .mobile-bar {
    display: flex;
  }

  .to-top {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }

  .cookie {
    bottom: 88px;
    left: 10px;
    right: 10px;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px;
    font-size: 11.5px;
    line-height: 1.35;
    text-align: left;
  }

  .cookie span {
    flex: 1 1 auto;
    min-width: 0;
  }

  .cookie #cookie-accept {
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 12.5px;
  }
}

@media (max-width: 520px) {
  .phone-card__actions {
    grid-template-columns: 1fr;
  }
}