/* Resquad — кит. Только токены из tokens.css, ни одного литерала.
   Состояние — модификатор .is-* на блоке (чтобы витрина показывала его без мыши),
   плюс тот же стиль на настоящем :hover / :focus-visible / :active.
   Реестр решений — PATTERNS.md. Матрица состояний — DESIGN-SYSTEM.md §3. */

/* ---------- база ---------- */
.rs {
  font-family: var(--g-font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
.rs :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -0.2em; }
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 24px; height: 24px; }

/* ---------- типографика ---------- */
.t-display { font-size: var(--fs-display); line-height: var(--lh-tight); font-weight: var(--fw-regular); letter-spacing: var(--ls-display); text-wrap: balance; margin: 0; }
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-head); font-weight: var(--fw-bold); letter-spacing: var(--ls-head); text-wrap: balance; margin: 0; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-head); font-weight: var(--fw-bold); letter-spacing: var(--ls-head); text-wrap: balance; margin: 0; }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-head); font-weight: var(--fw-bold); margin: 0; }
.t-lead { font-size: var(--fs-lead); line-height: 1.35; margin: 0; }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); margin: 0; }
.t-small { font-size: var(--fs-small); line-height: 1.4; color: var(--text-muted); margin: 0; }
.t-accent { color: var(--accent); }
.t-muted { color: var(--text-muted); }
.eyebrow { font-size: var(--fs-micro); font-weight: var(--fw-medium); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-muted); }

/* ---------- кнопка ---------- */
.btn {
  --_bg: transparent; --_fg: var(--text); --_line: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--h-ctl); padding: 0 var(--sp-5);
  border-radius: var(--r-pill); border: 1px solid var(--_line);
  background: var(--_bg); color: var(--_fg);
  font: var(--fw-medium) var(--fs-body)/1 var(--g-font);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
}
.btn--sm { height: var(--h-ctl-sm); padding: 0 var(--sp-4); font-size: var(--fs-small); }
.btn--primary { --_bg: var(--btn-primary-bg); --_fg: var(--btn-primary-fg); }
.btn--secondary { --_fg: var(--btn-secondary-fg); --_line: var(--btn-secondary-line); }
.btn--ghost { --_fg: var(--text); padding-inline: var(--sp-2); }

.btn--primary:hover, .btn--primary.is-hover { --_bg: color-mix(in srgb, var(--btn-primary-bg) 85%, var(--g-white)); }
.btn--secondary:hover, .btn--secondary.is-hover { --_line: var(--text); }
.btn--ghost:hover, .btn--ghost.is-hover { --_fg: var(--accent); }
.btn:active, .btn.is-active { transform: scale(.97); }
.btn.is-focus { outline: 2px solid var(--focus); outline-offset: 3px; }
.btn:disabled, .btn.is-disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.is-loading { color: transparent; position: relative; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--_fg); border-right-color: transparent; animation: rs-spin .7s linear infinite;
}
.btn .icon { transition: transform var(--t-fast) var(--ease-out); }
.btn:hover .icon--arrow, .btn.is-hover .icon--arrow { transform: translate(2px, -2px); }
@keyframes rs-spin { to { transform: rotate(360deg); } }

/* ---------- чип ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-pill);
  background: var(--chip-bg); color: var(--chip-fg);
  font-size: var(--fs-micro); line-height: 1; white-space: nowrap;
}
.chip--accent { background: var(--accent-fill); color: var(--on-accent); font-weight: var(--fw-medium); }

/* ---------- строка запроса (p-01) ---------- */
.prompt {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: var(--h-ctl); padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-4);
  border: 1px solid var(--prompt-line); border-radius: var(--r-md);
  background: var(--prompt-bg); backdrop-filter: blur(14px);
  transition: border-color var(--t-fast), box-shadow var(--t-base);
}
.prompt__input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: var(--fs-body)/1.3 var(--g-font); padding: var(--sp-2) 0;
}
.prompt__input::placeholder { color: var(--text-muted); }
.prompt__input:focus { outline: none; }
.prompt__send {
  display: grid; place-items: center; width: var(--h-ctl-sm); height: var(--h-ctl-sm);
  border: 0; border-radius: var(--r-sm); background: var(--accent-fill); color: var(--on-accent); cursor: pointer;
}
.prompt:focus-within, .prompt.is-focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.prompt.is-glow { box-shadow: 0 0 32px color-mix(in srgb, var(--accent-fill) 45%, transparent); border-color: var(--accent); }
.prompt.is-disabled { opacity: .5; pointer-events: none; }
.prompt__caret { display: inline-block; width: 1px; height: 1.1em; background: var(--text); vertical-align: -0.2em; animation: rs-blink 1s steps(1) infinite; }
@keyframes rs-blink { 50% { opacity: 0; } }

/* ---------- карточка разработчика (p-02) ---------- */
.dev-card {
  position: relative; display: grid; justify-items: center; gap: var(--sp-2); text-align: center;
  width: 176px; padding: var(--sp-3) var(--sp-3) var(--sp-4);
  border: 1px solid var(--glass-line); border-radius: var(--r-md);
  background: var(--glass-bg); backdrop-filter: blur(16px);
  color: var(--text);
}
.dev-card__photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: var(--surface); }
.dev-card__name { font-weight: var(--fw-bold); font-size: var(--fs-body); line-height: 1.1; }
.dev-card__role { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.2; }
.dev-card__meta { font-size: var(--fs-micro); color: var(--text-muted); }
.dev-card__check { position: absolute; top: var(--sp-2); right: var(--sp-2); color: var(--accent); }
.dev-card.is-hover, .dev-card:hover { border-color: var(--accent); }
.dev-card.is-loading .dev-card__photo, .dev-card.is-loading .dev-card__name,
.dev-card.is-loading .dev-card__role, .dev-card.is-loading .dev-card__meta {
  color: transparent; background: var(--surface); border-radius: var(--r-sm); animation: rs-pulse 1.2s ease-in-out infinite;
}
.dev-card.is-loading .dev-card__photo { border-radius: 50%; }
.dev-card.is-loading .dev-card__check { visibility: hidden; }
@keyframes rs-pulse { 50% { opacity: .5; } }

/* ---------- плитка цифры (p-03) ---------- */
.stat {
  display: grid; align-content: space-between; gap: var(--sp-5);
  min-height: 140px; padding: var(--sp-4); border-radius: var(--r-md);
  background: var(--stat-bg); color: var(--text);
}
.stat__value { font-size: var(--fs-h2); font-weight: var(--fw-bold); line-height: 1; letter-spacing: var(--ls-head); font-variant-numeric: tabular-nums; }
.stat__value sup { font-size: .45em; vertical-align: .9em; margin-left: 2px; }
.stat__label { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.3; }
.stat--accent { background: var(--accent-fill); color: var(--on-accent); }
.stat--accent .stat__label { color: var(--on-accent); opacity: .7; }

/* ---------- было / стало (p-04) ---------- */
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); border-radius: var(--r-lg); overflow: hidden; }
.way { display: grid; gap: var(--sp-4); align-content: start; padding: var(--sp-6); }
.way__list { list-style: none; margin: 0; padding: var(--sp-3) 0 0; border-top: 1px solid var(--line); display: grid; gap: var(--sp-3); }
.way__item { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2); align-items: start; }
.way__item .icon { width: 18px; height: 18px; margin-top: 3px; }
.way--old .icon { color: var(--negative); }
.way--new .icon { color: var(--positive); }

/* ---------- плитка иконки ---------- */
.icon-tile { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--surface); color: var(--accent); }
.icon-tile--accent { background: var(--accent-fill); color: var(--on-accent); }

/* ---------- шаг процесса (p-05) ---------- */
.step { display: grid; gap: var(--sp-2); align-content: start; }
.step__num { font-size: var(--fs-h3); font-weight: var(--fw-bold); color: var(--accent); display: flex; align-items: center; gap: var(--sp-3); }
.step__num::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .6; }
.step__title { font-weight: var(--fw-bold); }
.step__text { font-size: var(--fs-small); color: var(--text-muted); }

/* ---------- вопрос FAQ (p-06) ---------- */
.faq { border-bottom: 1px solid var(--line); }
.faq__q {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5) 0; cursor: pointer; list-style: none; font-size: var(--fs-lead); font-weight: var(--fw-medium);
}
.faq__q::-webkit-details-marker { display: none; }
.faq__q .icon { transition: transform var(--t-base) var(--ease-out); color: var(--text-muted); }
.faq[open] .faq__q .icon { transform: rotate(45deg); color: var(--accent); }
.faq__q:hover, .faq.is-hover .faq__q { color: var(--accent); }
.faq__a { padding: 0 0 var(--sp-5); color: var(--text-muted); max-width: 68ch; }

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