/* ==========================================================================
   Telegram Store — Paytool
   Токены из дизайн-системы «Paytool | Для Claude» (Figma)
   ========================================================================== */

/* Mariupol: положите файлы в /fonts — до этого работает системный fallback */
@font-face {
  font-family: 'Mariupol';
  src: url('../fonts/Mariupol-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Mariupol';
  src: url('../fonts/Mariupol-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* main colors */
  --c-deep-night: #111318;
  --c-white: #fcfcfc;
  --c-accent: #00cd9b;
  --c-accent-bright: #00ffc1;
  --c-payne: #393d44;

  /* tonal */
  --c-surface: rgba(57, 61, 68, 0.18);       /* payne's grey 18% */
  --c-surface-28: rgba(57, 61, 68, 0.28);
  --c-surface-hover: rgba(57, 61, 68, 0.44); /* payne's grey 44% */
  --c-surface-strong: rgba(57, 61, 68, 0.56);
  --c-border: rgba(57, 61, 68, 0.18);
  --c-divider: rgba(57, 61, 68, 0.56);
  --c-text: var(--c-white);
  --c-text-72: rgba(252, 252, 252, 0.72);
  --c-text-60: rgba(252, 252, 252, 0.6);
  --c-text-45: rgba(252, 252, 252, 0.45);
  --c-text-24: rgba(252, 252, 252, 0.24);
  --c-white-12: rgba(252, 252, 252, 0.12);
  --c-white-8: rgba(252, 252, 252, 0.08);
  --c-accent-8: rgba(0, 205, 155, 0.08);
  --c-accent-24: rgba(0, 205, 155, 0.24);
  --c-secondary-active: #1e544f;

  /* states */
  --c-error: rgba(255, 59, 52, 0.75);
  --c-attention: #f5bb2b;
  --c-attention-8: rgba(245, 187, 43, 0.08);

  /* radius, gaps */
  --r: 10px;
  --r-sm: 6px;
  --r-pill: 100px;
  --gap-s: 16px;

  --font: 'Mariupol', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --lh: 1.1;

  --page-pad: 16px;
  --page-max: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--c-deep-night);
  color: var(--c-text);
  font-family: var(--font);
  font-size: 16px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img, svg { display: block; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* ── Типографика ──────────────────────────────────────────────── */
.h1 { font-weight: 500; font-size: 32px; line-height: 1; letter-spacing: -1px; }
.h3 { font-weight: 500; font-size: 22px; line-height: var(--lh); }
.h4 { font-weight: 500; font-size: 18px; line-height: var(--lh); }
.t-16 { font-size: 16px; }
.t-14 { font-size: 14px; }
.muted { color: var(--c-text-60); }
.muted-45 { color: var(--c-text-45); }

/* ── Шапка ────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: transparent;
  transition: background 0.2s ease;
}
/* фон появляется только когда страницу прокрутили — без жёсткой полосы сверху */
.header.is-scrolled {
  background: rgba(17, 19, 24, 0.8);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.header__inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo img { height: 26px; width: auto; }

/* ── Кнопки (Figma: Buttons) ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-pill);
  font-weight: 500;
  font-size: 16px;
  line-height: var(--lh);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn--sm { height: 36px; padding: 0 12px; gap: 4px; font-size: 14px; }
.btn--block { width: 100%; }

.btn--primary {
  color: var(--c-deep-night);
  background: linear-gradient(-53deg, var(--c-accent) 1.9%, var(--c-accent-bright) 122.4%);
}
.btn--primary:hover { background: linear-gradient(-22deg, var(--c-accent) 1.3%, var(--c-accent-bright) 35.4%); }
.btn--primary:active { background: var(--c-accent-bright); }

.btn--tertiary {
  color: var(--c-text);
  background: var(--c-surface-28);
  border: 1px solid var(--c-border);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.btn--tertiary:hover { background: var(--c-surface-hover); }
.btn--tertiary:active { background: var(--c-surface-strong); }

.btn:disabled,
.btn[aria-disabled='true'] {
  cursor: not-allowed;
  color: var(--c-text-24);
  background: var(--c-white-8);
}

.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading { cursor: progress; }

.spinner {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Бейджи (Figma: Badge) ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 14px;
  line-height: var(--lh);
  white-space: nowrap;
}
.badge svg { width: 15px; height: 15px; flex: none; }
.badge--stroke { border: 1px solid var(--c-surface-hover); color: var(--c-text-72); padding: 0 12px 0 8px; }
.badge--soft { background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text-60); }
.badge--accent { background: var(--c-accent); color: var(--c-deep-night); font-weight: 500; }
.badge--xs { height: 20px; padding: 0 6px; font-size: 12px; font-weight: 500; }

/* ── Основная секция ──────────────────────────────────────────── */
.main { flex: 1; overflow-x: clip; }

/* ── Градиентные круги (как на promo.paytool.ru) ─────────────── */
.has-orbs { position: relative; isolation: isolate; }
/* блок с формой выше соседних секций — иначе плавающая панель оплаты уходит под них */
.buy.has-orbs { z-index: 2; }
.orb {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(48px);
  pointer-events: none;
}
.orb-accent { background: radial-gradient(circle, rgba(0, 205, 155, 0.55), rgba(0, 205, 155, 0) 70%); }
.orb-warm { background: radial-gradient(circle, rgba(0, 255, 193, 0.35), rgba(0, 255, 193, 0) 70%); }

.orb--hero   { width: 340px; height: 340px; top: -140px; right: 10px; opacity: 0.5; }
.orb--how    { width: 300px; height: 300px; bottom: -120px; left: 10px; opacity: 0.3; }
.orb--faq    { width: 280px; height: 280px; top: -110px; right: 10px; opacity: 0.28; }
.orb--status { width: 320px; height: 320px; top: -20px; left: 50%; transform: translateX(-50%); opacity: 0.4; }

@media (min-width: 900px) {
  .orb--hero   { width: 560px; height: 560px; top: -220px; right: 20px; }
  .orb--how    { width: 520px; height: 520px; bottom: -200px; left: 20px; }
  .orb--faq    { width: 480px; height: 480px; top: -190px; right: 20px; }
  .orb--status { width: 520px; height: 520px; top: -120px; }
}

[hidden] { display: none !important; }

.buy {
  padding-top: 20px;
  padding-bottom: 40px;
  display: grid;
  gap: 24px;
}

.buy__intro { display: grid; gap: 12px; }
.buy__badges { display: flex; flex-wrap: wrap; gap: 8px; }
.buy__lead { color: var(--c-text-72); font-size: 16px; max-width: 46ch; }

.buy__perks {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

/* ── Карточка заказа ─────────────────────────────────────────── */
.order {
  background: rgba(24, 27, 32, 0.9);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 24px;
}

.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.buy, .order, .summary { grid-template-columns: minmax(0, 1fr); }
.field__label { font-size: 14px; color: var(--c-text-60); padding: 0; }
.field__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Tabs (Figma: Tab, Fill round) */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 16px;
  border-radius: 30px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-60);
  font-size: 16px;
  cursor: pointer;
  white-space: nowrap;
}
.tab:only-child,
.tab:not(:has(.badge)) { padding-right: 16px; }
.tab:hover { background: var(--c-surface-hover); color: var(--c-text); }
.tab[aria-selected='true'] { background: var(--c-payne); border-color: var(--c-payne); color: var(--c-text); }
.tab.is-soon { cursor: default; }
.tab.is-soon:hover { background: var(--c-surface); color: var(--c-text-60); }
.tab .badge--soon { background: var(--c-surface-strong); color: var(--c-text-72); }

/* Input (Figma: Inputs, input + text hint) */
.input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 12px 0 16px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.input:hover { background: var(--c-surface-hover); }
.input:focus-within { border-color: var(--c-accent); background: var(--c-surface); }
.input.is-error { border-color: var(--c-error); }
.input__prefix { color: var(--c-text-45); font-size: 16px; }
.input:focus-within .input__prefix,
.input.has-value .input__prefix { color: var(--c-text); }
.input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--c-text);
  font: inherit;
  font-size: 16px; /* не даёт iOS зумить поле */
}
.input input::placeholder { color: var(--c-text-45); }

.hint-btn {
  flex: none;
  height: 24px;
  padding: 0 10px;
  border-radius: 20px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-hover);
  color: var(--c-text);
  font-size: 14px;
  cursor: pointer;
}
.hint-btn:hover { background: var(--c-surface-strong); }

.field__support { font-size: 14px; color: var(--c-text-45); }
.field__support.is-error { color: var(--c-error); }

/* Allert (Figma: Allert, Warning / Info) */
.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.25;
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: -1px; }
.alert--warning { background: var(--c-attention-8); border: 1px solid var(--c-attention-8); color: var(--c-attention); }
.alert--info { background: var(--c-surface); border: 1px solid var(--c-border); color: var(--c-text-72); }
.alert--info b { color: var(--c-text); font-weight: 500; }
.alert__body { display: grid; gap: 4px; }
.alert ol { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* Plans (Figma: Chip, state Active) */
.plans { display: grid; gap: 8px; }
.plan {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  min-height: 64px;
  padding: 12px 16px;
  border-radius: var(--r);
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.plan:hover { background: var(--c-surface-hover); }
.plan:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-8); }
.plan:has(input:focus-visible) { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan__name { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 500; }
.plan__sub { grid-column: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; color: var(--c-text-45); }
.plan__price { grid-row: 1 / span 2; grid-column: 2; font-size: 18px; font-weight: 500; white-space: nowrap; text-align: right; }
.plan__price.is-updating { opacity: 0.5; }

/* Checkbox (Figma: checkbox + text) */
.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.25;
}
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  flex: none;
  width: 18px; height: 18px;
  margin-top: 0;
  border-radius: 4px;
  border: 1.4px solid var(--c-text-24);
  display: grid; place-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.check__box svg { width: 12px; height: 12px; opacity: 0; }
.check input:checked + .check__box { background: var(--c-accent); border-color: var(--c-accent); }
.check input:checked + .check__box svg { opacity: 1; }
.check input:focus-visible + .check__box { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.check.is-error .check__box { border-color: var(--c-error); }
.check__text { display: grid; gap: 4px; padding-top: 1px; }
.check__error { color: var(--c-error); display: none; }
.check.is-error .check__error { display: block; }

/* Итог */
.summary { display: grid; gap: 12px; }
.summary__label { font-size: 12px; color: var(--c-text-60); }
.summary__total { font-size: 22px; font-weight: 500; letter-spacing: -0.5px; white-space: nowrap; }

/* Плавающая панель оплаты: телефон и планшет */
.paybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 12px var(--page-pad) calc(12px + env(safe-area-inset-bottom));
  background: rgba(17, 19, 24, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 -16px 32px rgba(17, 19, 24, 0.6);
  transition: transform 0.2s ease;
}
.paybar__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
}
.paybar .summary__row { display: grid; gap: 2px; flex: none; }
.paybar .btn { flex: 1; min-width: 0; }
/* место под панель, чтобы она не перекрывала низ страницы */
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
/* пока открыта клавиатура — панель прячем, чтобы не закрывала поле */
body.is-typing .paybar { transform: translateY(110%); }

@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .summary { padding-top: 16px; border-top: 1px solid var(--c-divider); }
  .paybar {
    position: static;
    padding: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
    transform: none !important;
  }
  .paybar__inner { display: grid; gap: 12px; max-width: none; }
  .paybar .summary__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
  .summary__label { font-size: 16px; }
  .summary__total { font-size: 28px; }
}
.summary__legal { font-size: 12px; line-height: 1.3; color: var(--c-text-45); }
.summary__legal a { color: var(--c-text-60); }
.summary__legal a:hover { color: var(--c-accent); }

/* Notify button (Figma: Notify button, Type=Accent) */
.notify {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--c-accent-8);
  border: 1px solid rgba(0, 205, 155, 0.16);
  color: var(--c-accent);
  font-size: 14px;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.notify:hover { background: rgba(0, 205, 155, 0.14); border-color: var(--c-accent-24); }
.notify__icon { width: 18px; height: 18px; flex: none; }
.notify__text { flex: 1; min-width: 0; color: var(--c-text-72); }
.notify__text b { color: var(--c-accent); font-weight: 500; }
.notify__arrow { width: 16px; height: 16px; flex: none; }

.form-error { display: none; }
.form-error.is-visible { display: flex; }
.form-error .btn { margin-top: 10px; }

/* ── Секции под формой ───────────────────────────────────────── */
.section { padding: 40px 0; }
.section__title { margin-bottom: 24px; }

/* Список возможностей (Figma: list item, Marker list) */
.perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.perks li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; color: var(--c-text-72); }
.perks li::before {
  content: '';
  flex: none;
  width: 6px; height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--c-accent);
}
.perks b { color: var(--c-text); font-weight: 500; }

/* Шаги (Figma: list item, Numbered list + Title) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; counter-reset: step; }
.step { display: grid; grid-template-columns: 24px 1fr; gap: 4px 8px; counter-increment: step; }
.step::before {
  content: counter(step);
  grid-row: 1;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--c-surface-hover);
  border: 0.5px solid var(--c-surface-hover);
  color: var(--c-text-72);
  font-size: 16px;
}
.step__title { align-self: center; font-size: 18px; font-weight: 500; }
.step__text { grid-column: 2; font-size: 16px; color: var(--c-text-72); }

/* FAQ (Figma: Accordion) */
.faq { display: grid; }
.faq__item { border-top: 1px solid var(--c-divider); }
.faq__item:last-child { border-bottom: 1px solid var(--c-divider); }
.faq__q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 500;
  font-size: 18px;
  line-height: var(--lh);
  cursor: pointer;
}
.faq__q svg { width: 18px; height: 18px; flex: none; margin-top: 2px; transition: transform 0.2s ease; }
.faq__q[aria-expanded='true'] svg { transform: rotate(180deg); }
.faq__a { padding: 0 0 20px; max-width: 676px; font-size: 16px; line-height: 1.35; color: var(--c-text-72); }
.faq__a a { color: var(--c-accent); }
.faq__a[hidden] { display: none; }

/* ── Подвал ──────────────────────────────────────────────────── */
.footer { padding: 28px 0 36px; font-size: 14px; color: var(--c-text-45); }
.footer__inner { display: grid; gap: 20px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.footer a { color: var(--c-text-60); text-decoration: none; }
.footer a:hover { color: var(--c-accent); }

/* ── Страница статуса ─────────────────────────────────────────── */
.status { padding: 40px 0 64px; display: grid; justify-items: center; }
.status__card {
  width: 100%;
  max-width: 480px;
  background: rgba(24, 27, 32, 0.9);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  padding: 24px 16px;
  display: grid;
  gap: 20px;
  text-align: center;
}
.status__icon {
  width: 64px; height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--c-surface-hover);
}
.status__icon svg { width: 28px; height: 28px; }
.status__icon--ok { background: var(--c-accent-24); color: var(--c-accent); }
.status__icon--fail { background: rgba(255, 59, 52, 0.16); color: #ff5b55; }
.status__icon--wait { color: var(--c-text-72); }
.status__icon--wait .spinner { width: 28px; height: 28px; border-width: 2.5px; }
.status__text { color: var(--c-text-72); line-height: 1.35; }
.status__details {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  text-align: left;
  font-size: 14px;
}
.status__details div { display: flex; justify-content: space-between; gap: 12px; }
.status__details dt { color: var(--c-text-45); }
.status__details dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.status__actions { display: grid; gap: 8px; }

/* ==========================================================================
   Адаптив: mobile-first → tablet → desktop
   ========================================================================== */
@media (min-width: 768px) {
  :root { --page-pad: 32px; }
  .h1 { font-size: 40px; letter-spacing: -1.5px; }
  .header__inner { height: 72px; }
  .buy { padding-top: 40px; padding-bottom: 56px; }
  .order { padding: 24px; }
  .plans { grid-template-columns: repeat(3, 1fr); }
  .plan {
    grid-template-columns: 1fr;
    align-content: start;
    min-height: 124px;
    padding: 16px;
    gap: 6px;
  }
  .plan__price { grid-row: auto; grid-column: 1; text-align: left; margin-top: auto; padding-top: 10px; font-size: 20px; }
  .plan__save { position: absolute; top: -10px; right: 12px; }
  .section { padding: 56px 0; }
  .steps { grid-template-columns: repeat(2, 1fr); gap: 28px 32px; }
  .footer__inner { grid-template-columns: 1fr auto; align-items: center; }
  .status__card { padding: 32px; }
}

@media (min-width: 1024px) {
  .h1 { font-size: 48px; letter-spacing: -2px; }
  .buy {
    grid-template-columns: minmax(0, 1fr) 520px;
    grid-template-areas:
      'intro order'
      'perks order';
    grid-template-rows: auto 1fr;
    gap: 40px 64px;
    align-items: start;
    padding-top: 64px;
    padding-bottom: 72px;
  }
  .buy__intro { grid-area: intro; gap: 16px; }
  .order { grid-area: order; padding: 28px; position: sticky; top: 104px; }
  .buy__perks { grid-area: perks; }
  .buy__lead { font-size: 18px; }
  .section__grid { display: grid; grid-template-columns: 320px 1fr; gap: 48px; }
  .section__title { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}
