/* Основа: сброс, сетка, шапка, подвал, кнопки, нижняя панель. Цвета — из theme.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
  overflow-x: clip;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0 0 .6em; letter-spacing: .01em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.accent { color: var(--accent); }
.ico { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 40px); margin: 0 auto; padding: 0 20px; }
.wrap--narrow { max-width: calc(var(--wrap-narrow) + 40px); }

.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--btn-bg); color: #fff; padding: 8px 14px; }
.skip:focus { left: 10px; top: 10px; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 12px 24px; border-radius: var(--radius-btn);
  font: 600 15px/1.2 var(--font-head); letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid transparent; cursor: pointer; text-decoration: none !important;
  transition: transform .15s, filter .15s, background-color .15s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn--primary, .btn--phone { background: var(--btn-bg); color: var(--btn-text); box-shadow: 0 8px 24px color-mix(in srgb, var(--btn-bg) 35%, transparent); }
.btn--max { background: var(--max); color: #fff; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.btn-col { display: grid; gap: 10px; margin-top: 16px; }
.btn-col .btn { width: 100%; }

/* ---------- Шапка ---------- */
.hdr {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  border-bottom: 1px solid var(--border);
}
/* Размытие — на отдельном слое: backdrop-filter на самой шапке сделал бы её рамкой для мобильного меню (position: fixed) */
.hdr::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--header-bg); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
}
.hdr__in { height: 100%; display: flex; align-items: center; gap: 24px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex: none; }
.logo__star { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--btn-bg); color: #fff; }
.logo__star .ico { width: 20px; height: 20px; }
.logo__text { font: 700 22px/1 var(--font-head); letter-spacing: .06em; text-transform: uppercase; }

.nav { flex: 1; }
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 18px; }
@media (min-width: 1151px) and (max-width: 1280px) { .nav__list { gap: 2px 12px; } .nav__link { font-size: 12.5px; letter-spacing: .06em; } }
@media (min-width: 1151px) and (max-width: 1199px) { .nav__list { gap: 2px 8px; } .nav__link { letter-spacing: .03em; } }
.nav__link { font: 500 13px/1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 0; display: inline-block; text-decoration: none !important; border-bottom: 2px solid transparent; }
.nav__link:hover, .nav__link.is-active { color: var(--text); border-bottom-color: var(--brand); }
.nav__contacts { display: none; }
/* выпадающий список (пункт меню с children) */
.nav__item--sub { position: relative; }
.nav__item--sub > .nav__link::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 0 3px 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.nav__sub { list-style: none; margin: 0; padding: 8px 0; position: absolute; top: 100%; left: -16px; min-width: 230px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .15s, transform .15s, visibility .15s; }
.nav__item--sub:hover > .nav__sub, .nav__item--sub:focus-within > .nav__sub { opacity: 1; visibility: visible; transform: none; }
.nav__sub .nav__link { display: block; padding: 11px 16px; border-bottom: 0; white-space: nowrap; }
.nav__sub .nav__link:hover, .nav__sub .nav__link.is-active { background: var(--bg-alt); }

.hdr__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.hdr__phone { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--btn-bg); color: #fff; }
.hdr__phone span { display: none; }
.hdr__phone .ico { color: #fff; width: 20px; height: 20px; }
.hdr__max { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--max); color: #fff; }
.hdr__max .ico { width: 21px; height: 21px; }
.theme-btn, .burger {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.theme-btn .ico, .burger .ico { width: 20px; height: 20px; }
[data-theme="dark"] .theme-btn__moon, [data-theme="light"] .theme-btn__sun { display: none; }
.burger { display: none; }
.burger__close { display: none; }

/* ---------- Подвал ---------- */
.ftr { background: var(--bg-alt); border-top: 1px solid var(--border); padding: 56px 0 24px; margin-top: 0; }
.ftr__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.ftr__about p { color: var(--muted); margin-top: 16px; font-size: .95rem; }
.ftr__title { font: 600 14px/1 var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.ftr__nav ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 20px; }
.ftr__nav li { margin-bottom: 8px; break-inside: avoid; }
.ftr__nav a { color: var(--text); font-size: .95rem; }
.ftr__phone { font: 600 24px/1.2 var(--font-head); color: var(--text); display: inline-block; margin-bottom: 8px; }
.ftr__bottom { border-top: 1px solid var(--border); margin-top: 40px; padding-top: 20px; color: var(--muted); font-size: .85rem; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.ftr__bottom p { margin: 0; max-width: 820px; }

/* ---------- Нижняя панель на телефоне ---------- */
.callbar { display: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 1150px) {
  :root { --header-h: 64px; }
  .burger { display: grid; }
  .nav {
    position: fixed; inset: var(--header-h) 0 0 0; height: calc(100dvh - var(--header-h)); z-index: 55;
    background: var(--bg); padding: 24px 20px 120px; overscroll-behavior: contain;
    overflow-y: auto; opacity: 0; transform: translateY(-10px); visibility: hidden; flex: none;
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .menu-open .nav { opacity: 1; transform: none; visibility: visible; }
  .menu-open .burger__open { display: none; }
  .menu-open .burger__close { display: block; }
  .menu-open { overflow: hidden; }
  .menu-open .callbar { display: none; }
  .nav__list { flex-direction: column; gap: 0; }
  .nav__link { display: block; font-size: 20px; padding: 16px 0; border-bottom: 1px solid var(--border); color: var(--text); }
  .nav__contacts { display: block; margin-top: 24px; }
  .nav__item--sub > .nav__link::after { display: none; }
  .nav__sub { position: static; opacity: 1; visibility: visible; transform: none; transition: none; min-width: 0;
    background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0 0 0 18px; }
  .nav__sub .nav__link { font-size: 17px; padding: 13px 0; border-bottom: 1px solid var(--border); white-space: normal; }
  .nav__sub .nav__link:hover, .nav__sub .nav__link.is-active { background: none; }
  .nav__hours { color: var(--muted); text-align: center; margin-top: 12px; }
  .hdr__in { justify-content: space-between; }
}
@media (max-width: 760px) {
  body { font-size: 16px; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .logo__text { font-size: 19px; }
  .ftr__grid { grid-template-columns: 1fr; gap: 28px; }
  .callbar {
    display: flex; gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--header-bg);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border);
  }
  .callbar__btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 10px;
    font: 600 15px/1 var(--font-head); letter-spacing: .05em; text-transform: uppercase; color: #fff; text-decoration: none !important;
  }
  .callbar__btn--phone { background: var(--btn-bg); }
  .callbar__btn--max { background: var(--max); }
  .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Предложение установить приложение ---------- */
.install {
  position: fixed; z-index: 70; left: 20px; bottom: 20px; width: min(420px, calc(100vw - 40px));
  display: grid; grid-template-columns: 48px 1fr; gap: 12px 14px; align-items: start;
  padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(16px); transition: opacity .25s, transform .25s;
}
.install.is-open { opacity: 1; transform: none; }
.install[hidden] { display: none; }
.install__icon { border-radius: 12px; }
.install__title { font: 600 17px/1.25 var(--font-head); letter-spacing: .02em; margin: 2px 0 4px; }
.install__text { color: var(--muted); font-size: .9rem; margin: 0; }
.install__actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.install__btn { flex: 1; min-height: 44px; }
.install__close { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; }
.install__close .ico { width: 18px; height: 18px; }
@media (max-width: 760px) {
  .install { left: 10px; right: 10px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .install__btn { width: auto; }
}

/* Узкие телефоны: в шапке только телефон, тема и меню — MAX есть в нижней панели и в меню */
@media (max-width: 480px) {
  .hdr__in { gap: 10px; padding: 0 14px; }
  .hdr__actions { gap: 8px; }
  .hdr__max { display: none !important; }
  .hdr__phone, .theme-btn, .burger { width: 40px; height: 40px; }
  .logo { gap: 8px; }
  .logo__star { width: 32px; height: 32px; }
  .logo__text { font-size: 18px; }
}

/* Telegram */
.btn--tg { background: #229ed9; color: #fff; }
.hdr__tg { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: #229ed9; color: #fff; }
.hdr__tg .ico { width: 20px; height: 20px; }
.callbar__btn--tg { background: #229ed9; }
@media (max-width: 480px) {
  .hdr__tg { display: none !important; }
  .callbar__btn { font-size: 13px; gap: 6px; }
}

/* Подпись разработчика в подвале */
.ftr__credit { width: 100%; }
.ftr__credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.ftr__credit a:hover { color: var(--accent); }
