/* Мобильное меню AppFox (вариант 4Б: рыжие пункты).
   Все классы с префиксом afm, переменные с префиксом --afm: со стилями сайта не пересекаются.
   Шрифты Unbounded и Ubuntu на appfox.ru уже подключены, отдельно грузить не нужно. */

.afm, .afm-burger {
  --afm-orange: #FF711C;
  --afm-orange-d: #E8600F;
  --afm-ink: #040404;
  --afm-gray: #5B5F66;
  --afm-gray2: #8A8F98;
  --afm-line: #EDEDED;
  --afm-soft: #F7F7F8;
  --afm-tint: #FFF3EA;
  --afm-orange-line: rgba(255, 113, 28, .16);
  --afm-tap: 48px;
  --afm-r: 14px;
  --afm-pad: 15px;
  --afm-ease: cubic-bezier(.4, 0, .2, 1);
  --afm-head: 'Unbounded', 'Arial', sans-serif;
  --afm-text: 'Ubuntu', 'Arial', sans-serif;
}

/* ---------- кнопка в шапке ---------- */
.afm-burger {
  width: var(--afm-tap); height: var(--afm-tap); padding: 0; border: 0; border-radius: 12px;
  background: transparent; cursor: pointer; display: inline-grid; place-content: center; gap: 5px;
}
.afm-burger span { display: block; width: 26px; height: 3px; border-radius: 2px; background: var(--afm-orange); }
.afm-burger:active { background: var(--afm-soft); }
.afm-burger:focus-visible, .afm button:focus-visible, .afm a:focus-visible, .afm input:focus-visible {
  outline: 2px solid var(--afm-orange); outline-offset: 2px;
}

/* ---------- панель ---------- */
/* z-index выше шапки сайта (999) и ниже окон Bootstrap (1040): форма заявки
   открывается поверх. Анимируются только transform и opacity, сдвиг целый:
   дробные пиксели Safari рисует с дрожанием */
.afm {
  position: fixed; inset: 0; z-index: 1001;
  display: flex; flex-direction: column;
  background: #fff; color: var(--afm-ink); font: 400 15px/1.5 var(--afm-text);
  opacity: 0; transform: translateY(-10px); will-change: transform, opacity;
  transition: opacity .22s ease, transform .28s var(--afm-ease);
  -webkit-text-size-adjust: 100%;
}
.afm[hidden] { display: none; }
.afm.is-open { opacity: 1; transform: none; }
.afm *, .afm *::before, .afm *::after { box-sizing: border-box; }
.afm p { margin: 0; }
.afm .hidden { display: none !important; }

/* на планшете меню не растягивается на всю ширину: колонка как на телефоне */
.afm__bar, .afm__scroll > *, .afm__foot > * { width: 100%; max-width: 560px; margin-left: auto; margin-right: auto; }

.afm__bar {
  flex: none; display: flex; align-items: center; justify-content: space-between;
  height: 66px; padding: 0 var(--afm-pad); border-bottom: 1px solid var(--afm-line);
}
.afm__logo { display: flex; align-items: center; gap: 9px; color: var(--afm-ink); text-decoration: none; }
.afm__logo img { display: block; width: 34px; height: 30px; }
.afm__name { font: 700 17px/1 var(--afm-text); letter-spacing: .2px; }
.afm__name b { color: var(--afm-orange); }
.afm__close {
  width: var(--afm-tap); height: var(--afm-tap); margin-right: -12px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--afm-orange); cursor: pointer; display: grid; place-content: center;
}
.afm__close:active { background: var(--afm-soft); }
.afm__ic, .afm__chev, .afm__search-ic, .afm__arrow {
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.afm__ic { width: 22px; height: 22px; }

.afm__scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 14px var(--afm-pad) 8px;
}

/* ---------- поиск: без плашки, тонкая полоса снизу, как на сайте ---------- */
.afm__search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 4px; margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 113, 28, .2); color: var(--afm-orange);
}
.afm__search:focus-within { border-bottom-color: var(--afm-orange); }
.afm__search-ic { width: 20px; height: 20px; flex: none; }
.afm__input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none;
  font: 400 16px var(--afm-text); color: var(--afm-ink);   /* 16 px: iOS не увеличивает страницу при вводе */
}
.afm__input::placeholder { color: #343434; opacity: 1; }

/* ---------- пункты ---------- */
.afm__nav { display: grid; }
.afm__link, .afm__head {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 8px 4px;
  border: 0; border-bottom: 1px solid var(--afm-orange-line); background: transparent;
  font: 400 25px/1.2 var(--afm-head); color: var(--afm-orange); text-decoration: none; text-align: left; cursor: pointer;
}
.afm__link:active, .afm__head:active { color: var(--afm-orange-d); }
.afm__item { border-bottom: 1px solid var(--afm-orange-line); }
.afm__item .afm__head { border-bottom: 0; transition: background .2s; }
.afm__title { flex: 1; }
.afm__count {
  font: 400 12px/1 var(--afm-text); color: var(--afm-orange); background: var(--afm-tint);
  border-radius: 20px; padding: 5px 9px;
}
.afm__chev { width: 22px; height: 22px; flex: none; transform: rotate(90deg); transition: transform .26s var(--afm-ease); }
/* все пункты рыжие, поэтому раскрытый отмечаем подложкой, а не цветом.
   Подложка шире строки на 8 px с боков, чтобы текст не сдвигался */
.afm__head[aria-expanded="true"] {
  background: var(--afm-tint); margin: 0 -8px; width: calc(100% + 16px);
  padding-left: 12px; padding-right: 12px; border-radius: 12px;
}
.afm__head[aria-expanded="true"] .afm__chev { transform: rotate(-90deg); }

/* раскрытие высотой через grid-template-rows: без замера высоты в скрипте.
   Свёрнутый раздел прячем ещё и visibility, иначе Tab ходит по невидимым ссылкам */
.afm__panel {
  display: grid; grid-template-rows: 0fr; visibility: hidden;
  transition: grid-template-rows .3s var(--afm-ease), visibility 0s linear .3s;
}
.afm__head[aria-expanded="true"] + .afm__panel { grid-template-rows: 1fr; visibility: visible; transition-delay: 0s; }
.afm__inner { overflow: hidden; min-height: 0; }
.afm__all {
  display: block; min-height: 44px; line-height: 44px; color: var(--afm-orange); text-decoration: none;
  font-size: 14px; border-bottom: 1px dashed var(--afm-line);
}
.afm__group { padding: 10px 0 4px; }
.afm__group-h, .afm__h {
  font: 500 11px/1.4 var(--afm-text); letter-spacing: 1.2px; text-transform: uppercase; color: var(--afm-gray2);
}
.afm__group-h { margin-bottom: 4px; }
.afm__sub {
  display: flex; align-items: center; min-height: var(--afm-tap); padding: 4px 0;
  border-bottom: 1px solid var(--afm-soft); color: var(--afm-ink); text-decoration: none; font-size: 15px;
}
.afm__sub:active { color: var(--afm-orange); }

/* ---------- написать сразу ---------- */
.afm__block { margin-top: 18px; }
.afm__h { margin-bottom: 8px; }
.afm__msgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.afm__msg {
  display: grid; justify-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--afm-line);
  border-radius: var(--afm-r); color: var(--afm-gray); text-decoration: none; font-size: 12px;
  transition: border-color .18s, background .18s;
}
.afm__msg img { width: 28px; height: 28px; }
.afm__msg:active { border-color: var(--afm-orange); background: var(--afm-tint); color: var(--afm-orange); }

/* ---------- площадки, лис, логотип ---------- */
.afm__brand { padding-bottom: 14px; }
/* лис уходит к правому краю экрана: правое поле колонки компенсируем */
.afm__brand-top {
  display: grid; grid-template-columns: 1fr 118px; align-items: center; gap: 8px;
  margin-right: calc(-1 * var(--afm-pad)); min-height: 212px;
}
.afm__socs { display: grid; gap: 6px; position: relative; z-index: 1; }
.afm__soc {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px 6px 6px;
  border: 1px solid var(--afm-line); border-radius: var(--afm-r); background: rgba(255, 255, 255, .86);
  color: var(--afm-ink); text-decoration: none; transition: border-color .2s, background .2s;
}
.afm__soc:active { border-color: var(--afm-orange); background: var(--afm-tint); }
.afm__soc-ic { flex: none; display: grid; place-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--afm-tint); }
.afm__soc-ic img { width: 40px; height: 40px; }
.afm__soc-t { display: grid; flex: 1; min-width: 0; }
.afm__soc-t b { font: 500 15px/1.25 var(--afm-text); }
.afm__soc-t span { font-size: 12px; color: var(--afm-gray2); }
.afm__arrow { width: 18px; height: 18px; flex: none; color: var(--afm-gray2); transition: transform .2s, color .2s; }
.afm__soc:active .afm__arrow { color: var(--afm-orange); transform: translate(2px, -2px); }
.afm__fox { width: 118px; height: 212px; justify-self: end; }
.afm__word { display: block; width: 100%; max-width: 330px; height: auto; margin: 14px 0 6px; }
.afm__slogan { font: 400 14px/1.2 var(--afm-text); letter-spacing: 1px; color: var(--afm-orange); }
.afm__tel {
  display: inline-block; margin-top: 6px; font: 400 25px/1.3 var(--afm-head);
  color: var(--afm-orange); text-decoration: none;
}

/* ---------- кнопка внизу, видна всегда ---------- */
.afm__foot {
  flex: none; border-top: 1px solid var(--afm-line); background: #fff;
  padding: 12px var(--afm-pad) calc(12px + env(safe-area-inset-bottom));
}
.afm__cta {
  display: flex; align-items: center; justify-content: center; min-height: 58px;
  border: 1.5px solid var(--afm-orange); border-radius: 29px; color: var(--afm-orange); text-decoration: none;
  font: 400 19px var(--afm-head); transition: background .2s, color .2s;
}
.afm__cta:active { background: var(--afm-orange); color: #fff; }

/* пока меню открыто, страница под ним не прокручивается (menu.js) */
html.afm-lock, html.afm-lock body { overflow: hidden; }

/* Integration with the shared desktop navigation and legacy search styles. */
@media (max-width: 1199px) {
  .header .header-navigation { display: none !important; }
}
.afm .afm__search { border-radius: 0; background: transparent; }
.afm .afm__input { width: 100%; padding: 0; box-shadow: none; color: var(--afm-ink) !important; }
.afm .afm__input::placeholder { color: #343434 !important; opacity: 1 !important; }
.afm .afm__results {
  position: static; max-height: none; padding: 12px;
  border: 1px solid var(--afm-line); border-radius: 12px; background: var(--afm-soft);
}
.afm__results .search-result__scrollbar { max-height: 240px; overflow-y: auto; }
.afm .afm__h { margin-bottom: 8px; }
.afm .afm__group-h { margin-bottom: 4px; }
@media (max-width: 359px) {
  .afm__link, .afm__head { font-size: 21px; }
  .afm__soc { gap: 6px; padding-right: 6px; }
  .afm__soc-t b { font-size: 13px; }
  .afm__tel { font-size: 22px; }
  .afm__cta { font-size: 17px; }
}

/* меню и кнопка живут только там, где на сайте бургер: до 1200 px */
@media (min-width: 1200px) {
  .afm, .afm-burger { display: none !important; }
}

/* «Меньше движения» уважаем. Класс afm-motion на <html> включает анимации всё равно:
   он нужен только для показа, в сеансе RDP Windows выключает их сама */
@media (prefers-reduced-motion: reduce) {
  :root:not(.afm-motion) .afm,
  :root:not(.afm-motion) .afm *,
  :root:not(.afm-motion) .afm-burger span { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
