/* Сайт покупки Pro. Цвета тем (фон плиток и миниатюры выдачи) — в themes.css, его собирает
   `npm run site-themes` из расширения. Здесь — каркас и токены страницы.

   Светлая и тёмная ветки — через light-dark(): у плитки темы свой color-scheme (из
   themes.css), и токены, которые на ней используются, берут ветку темы, а не страницы. */

:root {
  color-scheme: light dark;

  --bg: light-dark(#f5f6fa, #0b0f1a);
  --surface: light-dark(#ffffff, #141a2a);
  --text: light-dark(#161a24, #e7eaf3);
  --muted: light-dark(#4f5669, #a4abbe);
  --line: light-dark(#d9dce6, #2a3246);
  --accent: light-dark(#2f55d4, #8fb0ff);
  --accent-ink: light-dark(#ffffff, #0b0f1a);
  --focus: light-dark(#1d3fb8, #b4c8ff);
  --ok: light-dark(#17693f, #7fdca6);
  --error: light-dark(#a3261b, #ff9d91);

  /* Подложка подписей поверх фона темы и полосы в миниатюре выдачи */
  --scrim: light-dark(rgb(255 255 255 / .82), rgb(8 10 18 / .62));
  --scrim-ink: light-dark(#141821, #f3f5fb);
  --glass: light-dark(rgb(255 255 255 / .62), rgb(12 16 28 / .5));
  --glass-line: light-dark(rgb(255 255 255 / .9), rgb(255 255 255 / .14));
  --ink-soft: light-dark(rgb(20 24 33 / .28), rgb(255 255 255 / .3));

  --radius: .9rem;
  --page: 68rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--font);
}

a { color: var(--accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem); margin: 0 0 1rem; letter-spacing: -.02em; }
h2 { font-size: 1.45rem; margin: 2rem 0 .6rem; }
p { text-wrap: pretty; }
code { font-family: var(--mono); font-size: .92em; }

.skip {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  padding: .5rem 1rem;
  border-radius: .5rem;
  background: var(--surface);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- шапка и подвал ---------- */

.top, .bottom, main {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1.5rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: inherit;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.top ul, .bottom ul {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.top nav a { color: inherit; font-weight: 600; text-decoration: none; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--accent); }
.top nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }

main { flex: 1; padding-block: 1rem 3rem; }
main:focus { outline: none; }

.bottom {
  padding-block: 0 2rem;
  color: var(--muted);
  font-size: .9rem;
}
/* Линия — по колонке текста, а не по полям подвала */
.bottom::before {
  content: "";
  display: block;
  margin-bottom: 1.5rem;
  border-top: 1px solid var(--line);
}
.bottom p { margin: .5rem 0 0; }
.bottom a { color: inherit; }
.bottom a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---------- кнопки ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .6rem 1.3rem;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button.ghost { background: transparent; color: var(--accent); }
.button:disabled { opacity: .55; cursor: not-allowed; filter: none; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin: 1.5rem 0 0; }
.soon { color: var(--muted); font-weight: 600; }

/* ---------- главная ---------- */

.hero {
  display: grid;
  gap: 2rem;
  align-items: center;
  padding-block: 1.5rem 1rem;
}
@media (width >= 52rem) {
  .hero { grid-template-columns: 1.1fr 1fr; gap: 3rem; }
}
.lead { font-size: 1.2rem; color: var(--muted); margin: 0; }

.block { padding-block: 1.5rem; }
.narrow { max-width: 40rem; }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.features li {
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.features h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
.features p { margin: 0; color: var(--muted); }

/* Призыв установить расширение в конце главной — на фоне темы, как карточка покупки на
   /pro: color-scheme ставит themes.css, color задаётся заново по той же причине. */
.cta {
  margin-block: 1.5rem 0;
  padding: clamp(1.5rem, 5vw, 3rem);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--theme-bg);
  color: var(--text);
  text-align: center;
}
.cta h2 { margin-top: 0; }
.cta p { margin-inline: auto; max-width: 34rem; }
.cta .actions { justify-content: center; }
.cta .soon { color: var(--text); }

/* Миниатюра выдачи: фон темы, поисковая строка и карточки-стекло. Ширина полос — разная,
   чтобы читалось как текст, а не как таблица. */
.mock {
  display: grid;
  align-content: start;
  gap: .9rem;
  padding: 1.4rem;
  border-radius: calc(var(--radius) * 1.4);
  background: var(--theme-bg);
  box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 18px 40px -12px rgb(0 0 0 / .35);
  overflow: hidden;
  transition: background .3s;
}
.mock-search {
  height: 2.2rem;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  padding: .7rem 1rem;
}
.mock-search span, .mock-card b, .mock-card i {
  display: block;
  height: .55rem;
  border-radius: 999px;
}
.mock-search span { width: 38%; height: 100%; background: var(--ink-soft); }
.mock-card {
  display: grid;
  gap: .5rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
}
.mock-card b { width: 62%; height: .75rem; background: var(--theme-title); }
.mock-card i { background: var(--ink-soft); }
.mock-card i:last-child { width: 78%; }
.mock-card:nth-child(3) b { width: 48%; }
.mock-card:nth-child(4) b { width: 70%; background: var(--theme-accent); }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: .9rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  aspect-ratio: 3 / 2;
  padding: .5rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--theme-bg);
  box-shadow: inset 0 0 0 1px rgb(127 127 127 / .25);
  color: var(--scrim-ink);
  font: inherit;
  text-align: start;
}
button.tile { cursor: pointer; }
button.tile:hover { border-color: var(--line); }
.tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.tile-name, .badge {
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 650;
  line-height: 1.5;
}
.tile-name { background: var(--scrim); }
/* Метка Pro — в углу: внизу рядом с названием она переносила длинные названия на две строки */
.badge {
  position: absolute;
  top: .5rem;
  inset-inline-end: .5rem;
  background: var(--theme-accent);
  color: light-dark(#fff, #000);
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- покупка ---------- */

.pro-intro { padding-bottom: .5rem; }
.pro-intro h1 { margin-bottom: .5rem; }

.pro-grid {
  display: grid;
  gap: 2rem;
  align-items: start;
}
@media (width >= 56rem) {
  .pro-grid { grid-template-columns: minmax(0, 26rem) 1fr; gap: 3rem; }
}
.pro-grid h2 { margin-top: 0; }

/* Карточка покупки — стекло на фоне темы. color-scheme сцене ставит themes.css, и токены
   страницы (light-dark) на ней берут ветку темы; color задаётся заново, потому что
   унаследованный цвет — уже вычисленный, ветки страницы. */
.stage {
  padding: clamp(1rem, 4vw, 2rem);
  border-radius: calc(var(--radius) * 1.6);
  background: var(--theme-bg);
  color: var(--text);
}
.offer {
  padding: 1.5rem;
  border-radius: calc(var(--radius) * 1.2);
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(16px) saturate(1.3);
}
.offer h2 { font-size: 1.1rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.price { margin: .25rem 0 0; font-size: 2.6rem; font-weight: 750; line-height: 1.1; min-height: 1.1em; }
.price-note, .fine { color: var(--muted); font-size: .9rem; }
.price-note { margin: .4rem 0 1rem; }
.fine { margin: 1rem 0 0; }
.fine a { color: inherit; }

.checks { margin: 0 0 1.25rem; padding: 0; list-style: none; display: grid; gap: .45rem; }
.checks li { padding-inline-start: 1.6rem; position: relative; }
.checks li::before {
  content: "";
  position: absolute;
  inset-inline-start: .2rem;
  top: .45em;
  width: .7rem;
  height: .38rem;
  border-inline-start: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}
.offer .button { width: 100%; }

.status:empty { display: none; }
.status { margin: .9rem 0 0; font-weight: 600; }
.status.is-error { color: var(--error); }
.status.is-ok { color: var(--ok); }

.tiles.small { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .7rem; }

.steps { display: grid; gap: .75rem; padding-inline-start: 1.4rem; max-width: 46rem; }
.steps li::marker { font-weight: 700; color: var(--accent); }

.faq { max-width: 46rem; }
.faq h3 { font-size: 1.05rem; margin: 1.4rem 0 .3rem; }
.faq p { margin: 0; color: var(--muted); }

/* Ключ после оплаты */
.welcome label { display: block; margin: 1.5rem 0 .4rem; font-weight: 700; }
.welcome textarea {
  width: 100%;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) * .7);
  background: var(--surface);
  color: var(--text);
  font: .95rem/1.5 var(--mono);
  word-break: break-all;
  /* Высота постоянная: ключ около 200 знаков — четыре строки на широком экране; на узком
     он прокручивается внутри поля, а не растягивает страницу. */
  height: 7.5rem;
  resize: none;
  overflow-y: auto;
}
.welcome .actions { margin-top: 1rem; }
.welcome .status { font-size: 1.1rem; }
.hint { color: var(--muted); }

/* ---------- юридические страницы ---------- */

.legal { max-width: 44rem; }
.legal .meta { color: var(--muted); margin-top: -.5rem; }
.legal h2 { font-size: 1.25rem; }

/* ---------- доступность ---------- */

@media (forced-colors: active) {
  .tile, .mock, .mock-card, .mock-search { border: 1px solid CanvasText; }
  .tile[aria-pressed="true"] { outline: 3px solid Highlight; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
