/* Компоненты: кнопки, поля, карточки, плитки-«иконки», шапка, нижнее меню,
   подвал, бейджи, уведомления, модальное окно, скелетоны. */

/* ── Кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 0 26px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: var(--fs-md); white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.btn--lg { min-height: 58px; padding: 0 30px; }
.btn--block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: 0.7; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 46px; height: 46px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: background var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.count-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}

/* «Показать все ›» */
.more-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 16px;
  border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast);
}
.more-link:hover { background: var(--surface-2); }
.more-link svg { width: 16px; height: 16px; }

/* ── Чипы, бейджи ── */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted);
  font-size: var(--fs-sm); font-weight: 500; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip__count { opacity: 0.6; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.badge--muted { color: var(--muted); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--good { background: rgba(61, 220, 151, 0.12); color: var(--good); }
.badge--done { background: var(--accent); color: var(--accent-ink); }
.badge--warn { background: rgba(245, 184, 75, 0.12); color: var(--warn); }

/* ── Карточки и поверхности ── */
.card { border-radius: var(--r-lg); background: var(--surface); }
.card--pad { padding: clamp(20px, 3vw, 32px); }

/* ── Плитка сервиса в стиле иконки приложения ──
   Квадрат со скруглением в цвете бренда (--tile), белый логотип; под ним
   название, короткое описание и «от N ₽». */
.tile { display: grid; gap: 14px; align-content: start; text-align: center; color: var(--text); }
.tile__icon {
  position: relative; display: grid; place-items: center;
  aspect-ratio: 1; border-radius: 22%;
  background: var(--tile, var(--surface-2));
  overflow: hidden;
  transition: transform var(--t) var(--ease-out), box-shadow var(--t);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.tile__icon::after { /* мягкий блик сверху */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 42%);
  pointer-events: none;
}
.tile__icon img { width: 44%; height: 44%; object-fit: contain; filter: brightness(0) invert(1); }
.tile--light .tile__icon img { filter: brightness(0); }
.tile:hover .tile__icon { transform: translateY(-6px) scale(1.02); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 18px 40px -12px var(--tile-glow, rgba(0, 0, 0, 0.6)); }
.tile__new { position: absolute; z-index: 1; top: 10px; right: 10px; padding: 3px 8px; border-radius: 999px; background: var(--bg); color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.tile__name { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.tile__lead { margin-top: -8px; color: var(--muted); font-size: var(--fs-sm); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile__price { font-size: var(--fs-md); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px) clamp(12px, 1.8vw, 20px); }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile__name { font-size: var(--fs-md); }
}
/* Полка: на телефоне листается вбок */
@media (max-width: 760px) {
  .tiles--shelf {
    display: grid; grid-auto-flow: column; grid-auto-columns: 42%; grid-template-columns: none;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  }
  .tiles--shelf::-webkit-scrollbar { display: none; }
  .tiles--shelf .tile { scroll-snap-align: start; }
}

/* ── Комплекты ── */
.bundles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bundle { position: relative; display: grid; gap: 18px; align-content: start; padding: 26px; overflow: hidden; transition: background var(--t-fast), transform var(--t) var(--ease-out); }
.bundle::before { content: ""; position: absolute; inset: auto -30% -60% auto; width: 70%; aspect-ratio: 1; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent); pointer-events: none; }
/* в карточке --accent — цвет комплекта, плашка берёт его же, а не фирменный бирюзовый */
.bundle .badge--accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: color-mix(in srgb, var(--accent) 45%, #fff); }
.bundle:hover { background: var(--surface-2); transform: translateY(-4px); }
.bundle__logos { display: flex; height: 64px; }
.bundle__logo { display: grid; place-items: center; width: 64px; height: 64px; margin-left: calc(var(--k) * -14px); border-radius: 18px; background: var(--tile); border: 3px solid var(--surface); transition: transform var(--t) var(--ease-out); }
.bundle__logo img { width: 46%; height: 46%; filter: brightness(0) invert(1); }
.bundle__logo.is-light img { filter: brightness(0); }
.bundle:hover .bundle__logo { transform: translateX(calc(var(--k) * 6px)); }
.bundle__body { display: grid; gap: 8px; justify-items: start; }
.bundle__body h3 { font-size: var(--fs-xl); }
.bundle__lead { color: var(--muted); font-size: var(--fs-sm); }
.bundle__services { color: var(--faint); font-size: var(--fs-xs); }
.bundle__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.bundle__price { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; }
.bundle__price small { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }

@media (max-width: 1100px) { .bundles { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .bundles { grid-template-columns: 1fr; } }

/* ── Поля ── */
.field { display: grid; gap: 8px; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
.field__input {
  width: 100%; height: 52px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field__input::placeholder { color: var(--faint); }
.field__input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field__hint { font-size: var(--fs-xs); color: var(--faint); }
.form-status { min-height: 1.2em; font-size: var(--fs-sm); color: var(--muted); }
.form-status.is-error { color: var(--bad); }
.form-status.is-success { color: var(--good); }

/* ── Шапка ── */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 100; height: var(--header-h);
  display: flex; align-items: center;
  transition: background var(--t), backdrop-filter var(--t), box-shadow var(--t);
}
.site-header[data-state="scrolled"] { background: rgba(14, 16, 17, 0.82); backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 1px 0 var(--line); }
.site-header__inner { position: relative; z-index: 2; display: flex; align-items: center; gap: 14px; width: min(1360px, 100% - var(--gutter) * 2); margin-inline: auto; } /* над занавесом мега-меню */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.32rem; letter-spacing: -0.03em; }
.brand__mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); }
.brand__mark svg { width: 30px; height: 30px; }
.menu-btn { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 18px; border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.menu-btn svg { width: 18px; height: 18px; }
.menu-btn:hover { background: var(--accent-hover); }
.site-nav { display: flex; gap: 4px; margin-left: 6px; }
.site-nav a { padding: 10px 14px; border-radius: var(--r-xs); color: var(--muted); font-weight: 500; font-size: var(--fs-sm); transition: color var(--t-fast), background var(--t-fast); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); background: var(--surface); }
.site-header__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.user-pill { display: inline-flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px 0 6px; border-radius: var(--r-sm); background: var(--surface); font-weight: 600; font-size: var(--fs-sm); }
.user-pill:hover { background: var(--surface-2); }
.user-pill__avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); font-size: var(--fs-sm); }
@media (max-width: 960px) { .site-nav { display: none; } }
@media (max-width: 760px) {
  .menu-btn span, .site-header .btn--login span { display: none; }
  .menu-btn { width: 46px; padding: 0; justify-content: center; }
  .user-pill { padding-right: 12px; }
}

/* ── Мега-меню «Каталог» ──
   Занавес: clip-path раскрывается сверху вниз; категории появляются по
   очереди (--i), плитки сервисов «перетасовываются» при смене категории,
   3D-иконка вплывает справа. Фон страницы затемняется и размывается. */
.mega {
  position: fixed; left: 0; right: 0; top: 0; z-index: 1; /* внутри слоя шапки: ниже её строки (z 2), но над страницей */
  padding: calc(var(--header-h) + 10px) var(--gutter) 28px;
  background: rgba(14, 16, 17, 0.94); backdrop-filter: blur(24px) saturate(1.3);
  border-bottom: 1px solid var(--line);
  clip-path: inset(0 0 100% 0 round 0 0 32px 32px);
  visibility: hidden;
  transition: clip-path 700ms var(--ease-out), visibility 0s 700ms;
}
.mega.is-open { clip-path: inset(0 0 0 0 round 0 0 32px 32px); visibility: visible; transition: clip-path 700ms var(--ease-out), visibility 0s; }
.mega-open body::after { content: ""; position: fixed; inset: 0; z-index: 90; background: rgba(5, 6, 7, 0.55); backdrop-filter: blur(6px); animation: fade-in 400ms; }
.mega__inner { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr) 240px; gap: clamp(20px, 3vw, 44px); width: min(1360px, 100%); margin-inline: auto; }
.mega__cats { display: grid; gap: 2px; align-content: start; }
.mega__cats a {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: var(--r-sm); font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; color: var(--muted);
  opacity: 0; transform: translateY(-10px);
  transition: background var(--t-fast), color var(--t-fast), opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}
.mega.is-open .mega__cats a { opacity: 1; transform: none; transition-delay: 0s, 0s, calc(160ms + var(--i) * 45ms), calc(160ms + var(--i) * 45ms); }
.mega__cats a img { width: 40px; height: 40px; transition: transform var(--t) var(--ease-out); }
.mega__cats a small { color: var(--faint); font-size: var(--fs-xs); font-weight: 500; }
.mega__cats a:hover, .mega__cats a.is-active { background: var(--surface); color: var(--text); }
.mega__cats a.is-active img { transform: scale(1.12) rotate(-8deg); }
.mega__preview { display: grid; gap: 16px; align-content: start; min-width: 0; }
.mega__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mega__title { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.03em; }
.mega__all { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
.mega__all svg { width: 16px; height: 16px; transition: transform var(--t-fast); }
.mega__all:hover svg { transform: translateX(4px); }
.mega__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mega__item {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 12px; border-radius: var(--r-md); background: var(--surface);
  animation: mega-in 520ms var(--ease-out) both; animation-delay: calc(var(--i) * 40ms);
  transition: background var(--t-fast), transform var(--t) var(--ease-out);
}
.mega__item:hover { background: var(--surface-2); transform: translateY(-3px); }
.mega__icon { grid-row: span 2; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--tile); }
.mega__icon img { width: 50%; height: 50%; filter: brightness(0) invert(1); }
.mega__item.is-light .mega__icon img { filter: brightness(0); }
.mega__name { font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mega__price { color: var(--muted); font-size: var(--fs-xs); }
.mega__stage { display: grid; place-items: center; }
.mega__art { width: 200px; height: 200px; object-fit: contain; filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.6)); opacity: 0; transform: translateY(24px) scale(0.85) rotate(8deg); }
.mega__art.is-in { opacity: 1; transform: none; transition: opacity 500ms var(--ease-out), transform 700ms cubic-bezier(0.34, 1.4, 0.64, 1); animation: float-y 6s 700ms ease-in-out infinite; }
@keyframes mega-in { from { opacity: 0; transform: translateY(14px) scale(0.96); } }
.menu-btn svg { transition: transform var(--t) var(--ease-out); }
.menu-btn.is-open svg { transform: rotate(45deg); }
@keyframes float-y { 50% { translate: 0 -10px; } }
@media (max-width: 1100px) { .mega__inner { grid-template-columns: minmax(200px, 260px) 1fr; } .mega__stage { display: none; } .mega__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .mega { max-height: 100svh; overflow-y: auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .mega__inner { grid-template-columns: 1fr; }
  .mega__cats { grid-template-columns: 1fr 1fr; }
  .mega__cats a { font-size: var(--fs-md); grid-template-columns: 32px 1fr; }
  .mega__cats a img { width: 32px; height: 32px; }
  .mega__cats a small { display: none; }
  .mega__grid { grid-template-columns: 1fr 1fr; }
}

/* ── Нижнее меню (телефон) ── */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed; inset: auto 0 0; z-index: 90;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(14, 16, 17, 0.9); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
  }
  .bottom-nav__item { position: relative; display: grid; justify-items: center; gap: 4px; padding: 6px 0; border: 0; background: none; color: var(--faint); font-size: 11px; font-weight: 500; }
  .bottom-nav__item svg { width: 22px; height: 22px; }
  .bottom-nav__item[aria-current="page"] { color: var(--text); }
  .bottom-nav__item .count-badge { top: 0; right: calc(50% - 22px); }
}

/* ── Подвал ── */
.site-footer { margin-top: var(--section); padding: 0 var(--gutter) calc(var(--gutter) + 8px); }
.site-footer__card { width: min(1360px, 100%); margin-inline: auto; padding: clamp(24px, 4vw, 44px); border-radius: var(--r-xl); background: var(--surface); display: grid; gap: 28px; }
.site-footer__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; }
.site-footer__contacts { display: flex; flex-wrap: wrap; gap: 8px; }
.site-footer__cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 24px; }
.site-footer__cols h4 { margin-bottom: 12px; font-size: var(--fs-sm); color: var(--faint); font-weight: 500; letter-spacing: 0; }
.site-footer__cols a { display: block; padding: 4px 0; color: var(--muted); font-size: var(--fs-sm); }
.site-footer__cols a:hover { color: var(--text); }
.site-footer__legal { padding-top: 22px; border-top: 1px solid var(--line); display: grid; gap: 4px; color: var(--faint); font-size: var(--fs-xs); }

/* ── Пустые состояния, скелетоны ── */
.empty { display: grid; justify-items: center; gap: 12px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--faint); }
.empty--page { padding: 80px 16px; }
.empty--page h1 { font-size: var(--fs-2xl); color: var(--text); }
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ── Уведомления ── */
.toast-region { position: fixed; left: 50%; bottom: 24px; z-index: 400; display: grid; gap: 8px; transform: translateX(-50%); width: min(420px, 100vw - 32px); }
@media (max-width: 760px) { .toast-region { bottom: calc(92px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: var(--shadow); font-size: var(--fs-sm); animation: toast-in var(--t) var(--ease-out); }
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.toast--success::before { background: var(--good); }
.toast--error::before { background: var(--bad); }
.toast__text { flex: 1; }
.toast__action { border: 0; background: none; color: var(--accent); font-weight: 600; }
.toast.is-leaving { animation: toast-out var(--t) var(--ease-out) forwards; }

/* ── Модальное окно ── */
.modal { position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px; background: rgba(5, 6, 7, 0.7); backdrop-filter: blur(6px); animation: fade-in var(--t); }
.modal__dialog { position: relative; width: min(440px, 100%); padding: 32px 28px 26px; border-radius: var(--r-lg); background: var(--surface); text-align: center; display: grid; gap: 12px; animation: pop-in var(--t) var(--ease-out); }
.modal__icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.modal__icon svg { width: 26px; height: 26px; }
.modal__dialog p { color: var(--muted); }
.modal__actions { display: grid; gap: 8px; margin-top: 10px; }
.modal__close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.modal__close:hover { background: var(--surface-2); }
.modal__close svg { width: 18px; height: 18px; }

/* ── Появление при прокрутке ([data-reveal]) ── */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out); transition-delay: var(--d, 0ms); }
[data-reveal].is-revealed { opacity: 1; transform: none; }
.no-js [data-reveal] { opacity: 1; transform: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } }
