/* Компоненты: кнопки, поля, карточки, шапка, подвал, нижняя навигация,
   корзина, модалка, уведомления. Названия классов — БЭМ-подобные:
   .block, .block__part, .block--variant. */

/* ── Кнопки ─────────────────────────────────────────────── */

.btn {
  --btn-h: 48px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-h);
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t) var(--ease-out),
    border-color var(--t) var(--ease-out), background-color var(--t) var(--ease-out), opacity var(--t);
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }

.btn--primary {
  color: #14110a;
  background: var(--foil-sheen);
  background-size: 220% 100%;
  background-position: 0% 50%;
  box-shadow: var(--glow-foil);
  transition: background-position 0.9s var(--ease-out), transform var(--t-fast) var(--ease-out), box-shadow var(--t);
}
.btn--primary:hover { background-position: 100% 50%; box-shadow: 0 14px 40px -10px rgba(201, 161, 90, 0.85); }
/* Блик, который периодически пробегает по главной кнопке */
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 250, 235, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: btn-glint 5.5s var(--ease-in-out) infinite;
}

.btn--ghost {
  color: var(--cream);
  background: var(--glass);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--line-strong); background: rgba(244, 234, 217, 0.08); }

.btn--quiet { color: var(--cream-dim); background: transparent; padding: 0 12px; }
.btn--quiet:hover { color: var(--foil-light); }

.btn--sm { --btn-h: 38px; padding: 0 16px; font-size: var(--fs-xs); }
.btn--lg { --btn-h: 56px; padding: 0 32px; font-size: var(--fs-md); }
.btn--block { width: 100%; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(20, 17, 10, 0.25);
  border-top-color: #14110a;
  animation: spin 0.7s linear infinite;
}
.btn--ghost.is-loading::before { border-color: rgba(244, 234, 217, 0.2); border-top-color: var(--cream); }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--cream);
  transition: border-color var(--t), background var(--t), transform var(--t-fast);
}
.icon-btn:hover { border-color: var(--line-strong); background: rgba(244, 234, 217, 0.08); }
.icon-btn svg { width: 20px; height: 20px; }

.count-badge {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--foil-sheen);
  color: #14110a;
  font-size: 11px;
  font-weight: 800;
  line-height: 19px;
  text-align: center;
  animation: pop-in var(--t) var(--ease-out);
}

/* ── Чипы, бейджи ───────────────────────────────────────── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--cream-dim);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all var(--t) var(--ease-out);
}
.chip:hover { border-color: var(--line-strong); color: var(--cream); }
.chip[aria-pressed="true"], .chip.is-active {
  color: #14110a;
  background: var(--foil-sheen);
  background-size: 200% 100%;
  border-color: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--foil-light);
  border: 1px solid var(--line);
  background: rgba(201, 161, 90, 0.08);
}
.badge--good { color: var(--good); border-color: rgba(95, 191, 142, 0.35); background: rgba(95, 191, 142, 0.08); }
.badge--done { color: #1a140a; border-color: transparent; background: var(--foil-sheen); background-size: 200% 100%; }
.badge--muted { color: var(--muted); border-color: var(--line-soft); background: var(--glass); }

/* ── Карточки ───────────────────────────────────────────── */

.card {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(31, 94, 70, 0.16), rgba(11, 20, 16, 0.6) 60%), var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}
.card--pad { padding: clamp(20px, 3vw, 32px); }

/* ── Поля ввода ─────────────────────────────────────────── */

.field { display: grid; gap: 8px; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--cream-dim); }
.field__hint { font-size: var(--fs-xs); color: var(--faint); }
.field__input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: rgba(7, 13, 10, 0.55);
  color: var(--cream);
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.field__input::placeholder { color: var(--faint); }
.field__input:focus { outline: none; border-color: var(--foil); box-shadow: 0 0 0 4px rgba(201, 161, 90, 0.14); background: rgba(7, 13, 10, 0.8); }
.field__input[aria-invalid="true"] { border-color: var(--bad); }
textarea.field__input { height: auto; min-height: 96px; padding: 12px 16px; resize: vertical; }

.form-status { min-height: 1.4em; font-size: var(--fs-sm); color: var(--muted); }
.form-status.is-error { color: var(--bad); }
.form-status.is-success { color: var(--good); }

/* ── Сегментированный переключатель ─────────────────────── */

.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: rgba(7, 13, 10, 0.5);
}
.seg__btn {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  transition: color var(--t), background var(--t);
}
.seg__btn[aria-selected="true"] { color: #14110a; background: var(--foil-sheen); background-size: 200% 100%; }

/* ── Выбор тарифа ───────────────────────────────────────── */

.plans { display: grid; gap: 10px; }
.plan {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: rgba(7, 13, 10, 0.4);
  text-align: left;
  transition: border-color var(--t), background var(--t), transform var(--t-fast);
}
.plan:hover { border-color: var(--line-strong); }
.plan[aria-checked="true"] { border-color: var(--foil); background: rgba(201, 161, 90, 0.08); }
.plan__dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); display: grid; place-items: center; }
.plan[aria-checked="true"] .plan__dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--foil-light); }
.plan__text { display: grid; gap: 2px; }
.plan__title { font-weight: 700; }
.plan__sub { font-size: var(--fs-xs); color: var(--faint); }
.plan__price { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--foil-light); white-space: nowrap; }
.plan__badge { position: absolute; top: -9px; right: 14px; }

/* ── Цена ───────────────────────────────────────────────── */

.price { display: inline-flex; align-items: baseline; gap: 6px; }
.price__value { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; color: var(--foil-light); }
.price__from, .price__period { font-size: var(--fs-xs); color: var(--faint); }
.price__old { font-size: var(--fs-sm); color: var(--faint); text-decoration: line-through; }

/* ── Шапка ──────────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-header);
  height: var(--header-h);
  transition: background var(--t), border-color var(--t), transform var(--t) var(--ease-out), backdrop-filter var(--t);
  border-bottom: 1px solid transparent;
}
.site-header[data-state="scrolled"], .site-header[data-state="hidden"] {
  background: rgba(7, 13, 10, 0.78);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line-soft);
}
.site-header[data-state="hidden"] { transform: translateY(-100%); }
/* корзина раскрывается из шапки — пока она открыта, шапка всегда на месте */
.cart-open .site-header[data-state="hidden"] { transform: none; }

.site-header__inner { display: flex; align-items: center; gap: 28px; height: 100%; }

.brand { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  --mark-bg: var(--bg-2);
  color: var(--foil-light);
}
.brand__mark svg { width: 26px; height: 26px; }
.brand__text { display: grid; line-height: 1.05; }
.brand__text strong { font-family: var(--font-display); font-size: 1.12rem; font-weight: 600; }
.brand__text small { font-size: 10.5px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--foil-light); }

.site-nav { display: flex; gap: 4px; }
.site-nav a {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  transition: color var(--t);
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 50%; bottom: 4px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--foil-light);
  transform: translateX(-50%) scale(0);
  transition: transform var(--t) var(--ease-out);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--cream); }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: translateX(-50%) scale(1); }

.site-header__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
/* на узком экране у «Войти» остаётся только ключ — иначе кнопка уходит за край */
@media (max-width: 420px) {
  .header-login { width: 40px; padding: 0; justify-content: center; }
  .header-login__text { display: none; }
  .user-chip__balance { display: none; }
  .user-chip { padding: 0 4px; }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 5px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--glass);
  transition: border-color var(--t);
}
.user-chip:hover { border-color: var(--line-strong); }
.user-chip__avatar {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--bg-3));
  border: 1px solid var(--line-strong);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--foil-light);
}
.user-chip__balance { font-weight: 700; font-size: var(--fs-sm); color: var(--foil-light); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .site-header__actions .user-chip__balance { display: none; }
  .site-header__actions .user-chip { padding-right: 5px; }
}

/* ── Нижняя навигация (телефон): плавающая капсула ───────── */

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-bottom-nav);
  display: none;
  grid-template-columns: repeat(5, 1fr);
  padding: 0 4px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-1);
}
.bottom-nav__item {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  height: 58px;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color var(--t-fast);
}
.bottom-nav__item svg { width: 22px; height: 22px; stroke-width: 1.5; }
.bottom-nav__item::before {
  content: "";
  position: absolute; top: -1px; left: 50%;
  width: 24px; height: 2px; margin-left: -12px;
  border-radius: 0 0 2px 2px;
  background: var(--foil);
  transform: scaleX(0);
  transition: transform var(--t) var(--ease-out);
}
.bottom-nav__item[aria-current="page"] { color: var(--foil-light); }
.bottom-nav__item[aria-current="page"]::before { transform: scaleX(1); }
.bottom-nav__item:active { color: var(--cream); }
.bottom-nav__item .count-badge {
  top: 7px; right: calc(50% - 20px);
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--foil); font-size: 10px; box-shadow: 0 0 0 2px var(--bg-1);
}

@media (max-width: 900px) {
  .bottom-nav { display: grid; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
}

/* ── Подвал ─────────────────────────────────────────────── */

.site-footer {
  position: relative;
  z-index: var(--z-content);
  margin-top: 40px;
  padding: 56px 0 32px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, transparent, rgba(7, 13, 10, 0.7));
}
.site-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.site-footer__about p { margin-top: 14px; color: var(--muted); font-size: var(--fs-sm); max-width: 36ch; }
.site-footer h4 { font-family: var(--font-body); font-size: var(--fs-xs); letter-spacing: 0.14em; text-transform: uppercase; color: var(--foil-light); margin-bottom: 14px; }
.site-footer nav { display: grid; gap: 10px; }
.site-footer nav a { color: var(--cream-dim); font-size: var(--fs-sm); transition: color var(--t); }
.site-footer nav a:hover { color: var(--foil-light); }
.site-footer__requisites {
  display: grid;
  gap: 2px;
  margin-top: 36px;
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--faint);
}
.site-footer__requisites strong { color: var(--cream-dim); font-weight: 600; }
.site-footer__requisites a { color: var(--cream-dim); }
.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  color: var(--faint);
  font-size: var(--fs-xs);
}
.site-footer__bottom a { text-decoration: underline; text-decoration-color: var(--line); }

@media (max-width: 760px) {
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
  .site-footer__about { grid-column: 1 / -1; }
}

/* ── Модальное окно ─────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 4, 0.7);
  backdrop-filter: blur(6px);
  animation: fade-in var(--t) var(--ease-out);
}
.modal__dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 36px 30px 30px;
  text-align: center;
  display: grid;
  gap: 14px;
  justify-items: center;
  animation: rise-in var(--t-slow) var(--ease-out);
}
.modal__icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--foil-light); background: var(--bg-3); }
.modal__icon svg { width: 28px; height: 28px; }
.modal__dialog p { color: var(--muted); }
.modal__actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.modal__close { position: absolute; top: 14px; right: 14px; }

/* ── Уведомления ────────────────────────────────────────── */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  display: grid;
  gap: 10px;
  width: min(420px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
@media (max-width: 900px) { .toast-region { bottom: calc(100px + env(safe-area-inset-bottom)); } }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: rgba(13, 24, 19, 0.95);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  font-size: var(--fs-sm);
  font-weight: 600;
  pointer-events: auto;
  animation: toast-in var(--t-slow) var(--ease-out);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--foil-light); flex: none; box-shadow: 0 0 12px var(--foil-light); }
.toast--success::before { background: var(--good); box-shadow: 0 0 12px var(--good); }
.toast--error::before { background: var(--bad); box-shadow: 0 0 12px var(--bad); }
.toast.is-leaving { animation: toast-out var(--t) var(--ease-in-out) forwards; }

/* ── Пустые состояния и загрузка ────────────────────────── */

.empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty svg { width: 42px; height: 42px; color: var(--line-strong); }
.empty--page { min-height: 60vh; align-content: center; }
.empty--page h1 { font-size: var(--fs-2xl); color: var(--cream); }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, rgba(244, 234, 217, 0.04), rgba(244, 234, 217, 0.1), rgba(244, 234, 217, 0.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ── Хлебные крошки ─────────────────────────────────────── */

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--fs-xs); color: var(--faint); margin-bottom: 22px; }
.crumbs a:hover { color: var(--foil-light); }
.crumbs span[aria-hidden] { opacity: 0.5; }

/* Кнопка, которая выглядит как ссылка (внутри текста) */
.link-btn { padding: 0; border: 0; background: none; color: var(--foil-light); font: inherit; text-decoration: underline; text-underline-offset: 3px; }
