/* ============================================================
   ПАПЕРКА — каркас: контейнер, секции, хедер, меню, футер, сетки
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--maxw-narrow); }

/* ----------------------------- СЕКЦИИ ----------------------- */
.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(28px, 4vw, 52px); }
.section--surface { background: var(--surface); }

/* --- тональные секции (ТЗ §4) -------------------------------
   Чередуя эти классы на главной, получаем визуальную глубину:
   белый → холодный серо-голубой → брендовый светлый → тёмный.  */
.section--cool   { background: var(--surface-cool); }
.section--cool-2 { background: var(--surface-cool-2); }
.section--brand  { background: var(--surface-brand); }
.section--grad   { background: var(--grad-brand-soft); }

.section--ink,
.section--dark {
  background: var(--dark);
  color: var(--on-dark);
  --line: var(--dark-line);
  --line-strong: rgba(255,255,255,.22);
  --ink: var(--on-dark);
  --ink-700: var(--on-dark);
  --ink-500: var(--on-dark-muted);
  --ink-400: var(--on-dark-muted);
  --surface: rgba(255,255,255,.05);
  --surface-2: rgba(255,255,255,.08);
  --bg: transparent;
}
.section--deep {
  background: var(--grad-brand);
  color: var(--on-dark);
  --line: var(--dark-line);
  --line-strong: rgba(255,255,255,.22);
  --ink: var(--on-dark);
  --ink-700: var(--on-dark);
  --ink-500: #C2D6E6;          /* 7.0:1 на --grad-brand */
  --ink-400: #C2D6E6;
  --surface: rgba(255,255,255,.07);
  --surface-2: rgba(255,255,255,.1);
  --bg: transparent;
}
.section--deep, .section--deep * { border-color: var(--dark-line); }

/* на тёмном фоне кикер и заголовок не должны оставаться синими */
.section--ink .section__kicker,
.section--dark .section__kicker,
.section--deep .section__kicker { color: var(--brand-200); }
.section--ink .section__kicker::before,
.section--dark .section__kicker::before,
.section--deep .section__kicker::before { background: var(--brand-200); }
.section--ink .section__title,
.section--dark .section__title,
.section--deep .section__title { color: #fff; }

/* мягкая линия между двумя светлыми секциями одного тона */
.section--hairline { border-top: 1px solid var(--line); }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-6);
  margin-bottom: clamp(22px, 3vw, 38px);
}
.section__head > * { min-width: 0; }
.section__titlewrap { max-width: 62ch; }
.section__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand-700);
}
.section__kicker::before {
  content: "";
  width: 22px; height: 2px;
  background: var(--brand);
  border-radius: 2px;
}
.section__title { font-size: var(--fs-2xl); }
.section__sub {
  margin: var(--sp-3) 0 0;
  color: var(--ink-500);
  font-size: var(--fs-md);
  max-width: 62ch;
}
.section__action { flex: 0 0 auto; }

/* ----------------------------- СЕТКИ ------------------------ */
/* fluid, без жёстких брейкпоинтов (CONTRACT §5) */
.grid {
  display: grid;
  gap: clamp(12px, 2vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min, 260px)), 1fr));
}
.grid > * { min-width: 0; }
.grid--wide  { --card-min: 320px; }
.grid--tiles { --card-min: 200px; }
@media (max-width: 640px) {
  .grid--tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}
@media (max-width: 360px) {
  .grid--tiles {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
.grid--narrow{ --card-min: 168px; }

.cols {
  display: grid;
  gap: clamp(20px, 3vw, 44px);
  grid-template-columns: 1fr;
}
.cols > * { min-width: 0; }
@media (min-width: 900px) {
  .cols--2 { grid-template-columns: 1fr 1fr; }
  .cols--sidebar { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
}

/* ----------------------------- ХЕДЕР ------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(170%) blur(14px);
  -webkit-backdrop-filter: saturate(170%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(30, 41, 55, .04), 0 8px 24px rgba(30, 41, 55, .06);
}
@supports not (backdrop-filter: blur(4px)) {
  .site-header { background: #fff; }
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  min-height: 64px;
  padding-block: 10px;
}
@media (min-width: 900px) { .header__inner { min-height: 76px; } }

/* логотип */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
}
.logo:hover { color: var(--ink); }
.logo__mark { width: 36px; height: 36px; flex: 0 0 auto; }
@media (min-width: 900px) { .logo__mark { width: 42px; height: 42px; } }
.logo__text { display: flex; flex-direction: column; line-height: 1; }
.logo__name {
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
@media (min-width: 900px) { .logo__name { font-size: 1.25rem; } }
.logo__tag {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand-700);
  white-space: nowrap;
}
.logo__slogan {
  margin-top: 1px;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-400);
  white-space: nowrap;
}
@media (max-width: 480px) { .logo__slogan { display: none; } }
@media (max-width: 360px) { .logo__tag { display: none; } }

/* навигация (десктоп) */
.nav { display: none; }
/* Порог десктопного меню — 1024px, а не 900. В полосе 900…1023 строка шапки
   с шестью пунктами, логотипом и правой группой не помещается: замер показал
   наезд последнего пункта на правую группу на 6px. Ужимать отступы и дальше
   значит вернуться к слипшимся кнопкам, поэтому ниже 1024 работает выездное
   меню — в нём те же пункты и места в нём достаточно. */
@media (min-width: 1024px) {
  .nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-inline: auto;
  }
}
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--r-md);
  color: var(--ink-700);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav__link:hover { color: var(--ink); background: var(--surface-2); }
.nav__link[aria-current="page"] { color: var(--brand-700); }
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 4px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

/* правая группа */
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
  flex: 0 0 auto;
}
.header__phone {
  display: none;
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink);
  white-space: nowrap;
  padding: 0 4px;
}
.header__phone:hover { color: var(--brand-700); }
@media (min-width: 1080px) { .header__phone { display: inline-flex; align-items: center; } }
@media (max-width: 899px) { .header__actions .btn--call { display: none; } }

/* бургер */
.burger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 650;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.burger:hover { background: var(--line); }
.burger:active { transform: translateY(1px); }
@media (min-width: 1024px) { .burger { display: none; } }
.burger__bars { position: relative; width: 18px; height: 12px; flex: 0 0 auto; }
.burger__bars span {
  position: absolute; left: 0;
  width: 100%; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--t), opacity var(--t-fast);
}
.burger__bars span:nth-child(1) { top: 0; }
.burger__bars span:nth-child(2) { top: 5px; }
.burger__bars span:nth-child(3) { top: 10px; }
.burger[aria-expanded="true"] .burger__bars span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.burger[aria-expanded="true"] .burger__bars span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] .burger__bars span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 360px) {
  .header__inner {
    gap: 8px;
    padding-block: 8px;
  }
  .header__actions {
    gap: 4px;
  }
  .logo__name {
    font-size: 1rem;
    letter-spacing: .06em;
  }
  .burger {
    padding: 0 10px;
    min-height: 40px;
    width: 40px;
    justify-content: center;
  }
  .burger span:last-child {
    display: none;
  }
}

/* ----------------------------- ВЫЕЗДНОЕ МЕНЮ ---------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  background: rgba(30, 41, 55, .46);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* скрытая панель не должна влиять на ширину страницы */
.drawer[hidden] { display: none !important; }

.drawer {
  position: fixed;
  top: 0; right: 0;
  z-index: calc(var(--z-drawer) + 1);
  display: flex;
  flex-direction: column;
  width: min(360px, 88vw);
  height: 100%;
  padding: var(--sp-4) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  box-shadow: var(--sh-3);
  transform: translateX(102%);
  transition: transform var(--t-slow);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.is-open { transform: none; }
@media (min-width: 900px) { .drawer, .drawer-backdrop { display: none; } }

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: var(--fs-md); font-weight: 700; }
.drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: var(--surface-2);
  border: 0;
  border-radius: var(--r-md);
  color: var(--ink);
}
.drawer__close:hover { background: var(--line); }

.drawer__nav { display: flex; flex-direction: column; gap: 2px; }
.drawer__link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: background var(--t-fast);
}
.drawer__link:hover { background: var(--surface); color: var(--ink); }
.drawer__link[aria-current="page"] { background: var(--brand-50); color: var(--brand-700); }
.drawer__link svg { flex: 0 0 auto; color: var(--brand); }

.drawer__foot {
  margin-top: auto;
  padding-top: var(--sp-5);
  display: grid;
  gap: var(--sp-3);
}
.drawer__meta { font-size: var(--fs-sm); color: var(--ink-500); }
.drawer__meta b { display: block; color: var(--ink); font-size: var(--fs-base); }

/* ----------------------------- НИЖНЯЯ НАВИГАЦИЯ ------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-bottomnav);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Без промежутка области нажатия соседних кнопок соприкасались (замер
     давал 0 px) и панель читалась как одна сплошная полоса. */
  gap: var(--sp-2);
  padding-inline: var(--sp-2);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@supports not (backdrop-filter: blur(4px)) { .bottom-nav { background: #fff; } }
@media (min-width: 900px) { .bottom-nav { display: none; } }

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 59px;
  padding: 0 2px;
  color: var(--ink-500);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
  transition: color var(--t-fast);
}
.bottom-nav__item svg { width: 22px; height: 22px; flex: 0 0 auto; }
.bottom-nav__item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-nav__item:hover { color: var(--ink); }
.bottom-nav__item[aria-current="page"] { color: var(--brand-700); }
.bottom-nav__item[aria-current="page"] svg { color: var(--brand); }
@media (min-width: 390px) { .bottom-nav__item { font-size: 11.5px; } }

/* плавающая кнопка «Позвонить» — над нижней навигацией */
.call-fab {
  position: fixed;
  right: var(--sp-4);
  bottom: calc(59px + env(safe-area-inset-bottom, 0px) + var(--sp-4));
  z-index: calc(var(--z-bottomnav) + 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 18px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 700;
  box-shadow: var(--sh-brand);
  transition: transform var(--t), box-shadow var(--t), background var(--t-fast);
}
.call-fab:hover { background: var(--brand-600); color: #fff; }
.call-fab:active { transform: translateY(1px) scale(.99); }
.call-fab svg { width: 20px; height: 20px; }
@media (min-width: 900px) { .call-fab { display: none; } }

/* ----------------------------- ФУТЕР ------------------------ */
.footer {
  margin-top: var(--section-y);
  padding-top: clamp(40px, 5vw, 72px);
  background: var(--ink);
  color: #C9D0D9;
  font-size: var(--fs-sm);
}
.footer a { color: #C9D0D9; }
.footer a:hover { color: #fff; }

.footer__grid {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  grid-template-columns: 1fr;
}
@media (min-width: 640px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .footer__grid { grid-template-columns: 1.4fr 1fr 1fr 1.1fr; } }
.footer__grid > * { min-width: 0; }

.footer__title {
  margin: 0 0 var(--sp-4);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.footer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer__list a { display: inline-flex; min-height: 24px; align-items: center; }

.footer .logo__name { color: #fff; }
.footer .logo__tag { color: #8A93A0; }
.footer__about { margin: var(--sp-4) 0 0; max-width: 42ch; color: #9AA3AF; }

.footer__contact { display: grid; gap: var(--sp-3); }
.footer__contact b { display: block; color: #fff; font-size: var(--fs-md); }
.footer__sched { display: grid; gap: 4px; }
.footer__sched div { display: flex; justify-content: space-between; gap: var(--sp-4); max-width: 260px; }
.footer__sched span:last-child { color: #fff; }

/* --- соцсети: настоящие логотипы заказчика (ТЗ §9, §60) ---
   Один размер, один ритм, одинаковые отступы и hover. */
.social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin: var(--sp-5) 0 0;
  padding: 0;
  list-style: none;
}
.social__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 14px 6px 8px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-pill);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.social__link:hover {
  background: rgba(255, 255, 255, .14);
  border-color: rgba(255, 255, 255, .34);
  transform: translateY(-2px);
  color: #fff;
}
.social__logo {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: block;
  border-radius: 7px;      /* логотипы уже со скруглением, это лишь страховка */
}
.social__name { white-space: nowrap; }

/* компактный вариант — только логотипы (страница контактов, узкие места) */
.social--icon { gap: var(--sp-2); }
.social--icon .social__link {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: var(--r-md);
}
.social--icon .social__logo { width: 26px; height: 26px; }

/* на светлом фоне (не подвал) */
.social--light .social__link {
  background: var(--bg);
  border-color: var(--line);
  color: var(--ink);
}
.social--light .social__link:hover {
  background: var(--surface);
  border-color: var(--brand-400);
  color: var(--brand-700);
}

.footer__legal {
  margin-top: clamp(32px, 4vw, 56px);
  padding: var(--sp-5) 0 calc(var(--sp-6) + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: #8A93A0;
  font-size: var(--fs-xs);
  line-height: 1.65;
}
.footer__legal p { margin: 0 0 var(--sp-2); }
.footer__legal b { color: #C9D0D9; font-weight: 650; }
.footer__copy {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  justify-content: space-between;
  margin-top: var(--sp-4);
}

/* ─────────── ссылка на личный кабинет в шапке ─────────── */
.header__account {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong);
  color: var(--ink-700);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.header__account:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-50);
}
.header__account-icon { font-size: 15px; }
.header__account-text { white-space: nowrap; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; }

/* ─────────── кнопка «Админ-панель» (только для админ-сессии) ─────────── */
.header__admin {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  background: var(--brand);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1;
  transition: background var(--t-fast), transform var(--t-fast);
}
.header__admin:hover { background: var(--brand-700); transform: translateY(-1px); }
.header__admin svg { display: block; }
@media (max-width: 1280px) {
  .header__admin-text { display: none; }
  .header__admin { padding: 8px 10px; }
}

/* На узких экранах подпись прячем — остаётся понятная иконка с aria-label.
   Порог 1080px выбран так, чтобы «Позвонить» и телефон не сжимались. */
@media (max-width: 1080px) {
  .header__account-text { display: none; }
  .header__account { padding: 8px 10px; }
}

/* Для администраторов скрываем текстовый телефон, чтобы кнопка «Админ-панель» не наезжала на навигацию */
.site-header--admin .header__phone,
.site-header:has(.header__admin) .header__phone {
  display: none !important;
}
.site-header--admin .header__inner,
.site-header:has(.header__admin) .header__inner {
  gap: var(--sp-2);
}
.site-header--admin .nav,
.site-header:has(.header__admin) .nav {
  gap: 0;
}
.site-header--admin .nav__link,
.site-header:has(.header__admin) .nav__link {
  padding: 0 10px;
}
