/* Advia — публичные страницы (документы, главная, 404). Без фреймворков и веб-шрифтов:
   страницы открываются во встроенном браузере приложения и должны грузиться мгновенно. */

:root {
  --accent: #ff3b30;
  --accent-2: #ff6b35;
  --grad: linear-gradient(135deg, #ff6b35 0%, #ff3b30 100%);
  --bg: #ffffff;
  --bg-soft: #f6f6f8;
  --card: #ffffff;
  --text: #1c1c1e;
  --text-2: #55555c;
  --text-3: #8a8a92;
  --line: rgba(60, 60, 67, 0.14);
  --link: #e8352b;
  --note-bg: #fff4ee;
  --note-line: #ffd5c2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --radius: 14px;
  --wrap: 760px;
  --gutter: 20px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --bg-soft: #17171a;
    --card: #1b1b1f;
    --text: #f2f2f5;
    --text-2: #b4b4bc;
    --text-3: #85858e;
    --line: rgba(235, 235, 245, 0.12);
    --link: #ff7a55;
    --note-bg: #2a1a14;
    --note-line: #5a2c1c;
    --shadow: none;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.62 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue",
    "Noto Sans", "Noto Sans Armenian", "Arian AMU", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
  word-break: normal;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-left)) 0 max(var(--gutter), env(safe-area-inset-right));
}

/* ── Шапка и подвал ─────────────────────────────────────────────── */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding-top: max(0px, env(safe-area-inset-top));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; display: block; }
.site-nav { display: flex; gap: 4px 16px; flex-wrap: wrap; justify-content: flex-end; font-size: 14px; }
.site-nav a { color: var(--text-2); }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.site-foot {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text-3);
  font-size: 14px;
}
.site-foot .wrap { padding-top: 22px; padding-bottom: max(26px, env(safe-area-inset-bottom)); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; padding: 0; list-style: none; }
.foot-links a { color: var(--text-2); }
.site-foot p { margin: 0; }

/* Показ внутри приложения (?embed=1): у экрана уже есть своя навигация. */
html.embed .site-head,
html.embed .site-foot,
html.embed .hide-embed { display: none !important; }
html.embed .page { padding-top: 14px; }
html.embed h1 { font-size: 24px; }
html.embed .eyebrow { display: none; }

/* ── Языки: показываем только выбранный ─────────────────────────── */

.doc,
.i18n > [lang] { display: none; }
html[data-lang="en"] .doc[lang="en"],
html[data-lang="ru"] .doc[lang="ru"],
html[data-lang="fr"] .doc[lang="fr"],
html[data-lang="hy"] .doc[lang="hy"],
html[data-lang="zh-Hans"] .doc[lang="zh-Hans"] { display: block; }
html[data-lang="en"] .i18n > [lang="en"],
html[data-lang="ru"] .i18n > [lang="ru"],
html[data-lang="fr"] .i18n > [lang="fr"],
html[data-lang="hy"] .i18n > [lang="hy"],
html[data-lang="zh-Hans"] .i18n > [lang="zh-Hans"] { display: inline; }
div.i18n > [lang] { display: none !important; }
html[data-lang="en"] div.i18n > [lang="en"],
html[data-lang="ru"] div.i18n > [lang="ru"],
html[data-lang="fr"] div.i18n > [lang="fr"],
html[data-lang="hy"] div.i18n > [lang="hy"],
html[data-lang="zh-Hans"] div.i18n > [lang="zh-Hans"] { display: block !important; }

/* ── Документ ───────────────────────────────────────────────────── */

.page { padding-top: 28px; padding-bottom: 56px; flex: 1 0 auto; }

.doc-head { margin-bottom: 18px; }
.eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h1 {
  margin: 0 0 8px;
  font-size: clamp(26px, 5.4vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.updated { margin: 0; color: var(--text-3); font-size: 14px; }

.langs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.langs button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 34px;
}
.langs button[aria-pressed="true"] {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
}

.note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--note-line);
  background: var(--note-bg);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.note a { font-weight: 600; }

.meta {
  margin: 18px 0 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-soft);
  font-size: 14px;
  color: var(--text-2);
}
.doc .meta p { margin: 3px 0; }
.meta b { color: var(--text); font-weight: 600; }

.toc {
  margin: 16px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.toc summary {
  cursor: pointer;
  list-style: none;
  padding: 13px 16px;
  font-weight: 650;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-3);
  border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg);
  transition: transform 0.2s;
  margin-right: 4px;
}
.toc[open] summary::after { transform: rotate(-135deg); }
.toc ol {
  margin: 0;
  padding: 2px 16px 12px;
  list-style: none;
  font-size: 14.5px;
  line-height: 1.4;
}
.toc li { border-top: 1px solid var(--line); }
.toc li a { display: flex; gap: 10px; padding: 9px 0; color: var(--text); }
.toc li a .n { color: var(--accent); font-weight: 700; min-width: 1.6em; font-variant-numeric: tabular-nums; }

.doc section { padding-top: 10px; }
.doc h2 {
  margin: 30px 0 10px;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.03em;
  font-weight: 750;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.doc h2 .n,
.doc h3 .n {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.doc h2 .n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0;
}
.doc h3 {
  margin: 22px 0 6px;
  font-size: 16.5px;
  line-height: 1.35;
  font-weight: 680;
  display: flex;
  gap: 8px;
}
.doc p { margin: 0 0 12px; }
.doc ul { margin: 4px 0 14px; padding-left: 1.25em; }
.doc li { margin: 0 0 8px; padding-left: 0.2em; }
.doc li::marker { color: var(--accent); }
.doc .contact { margin: 0 0 4px; }
.doc :target { animation: flash 1.6s ease-out 1; }
@keyframes flash { from { background: var(--note-bg); } to { background: transparent; } }

.doc[lang="zh-Hans"] { line-height: 1.8; }
.doc[lang="zh-Hans"] h2 { letter-spacing: 0; }

.totop {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(255, 59, 48, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
}
.totop.show { opacity: 1; pointer-events: auto; transform: none; }
.totop:hover { text-decoration: none; }
.totop svg { width: 18px; height: 18px; }

/* ── Главная и служебные страницы ───────────────────────────────── */

.hero { padding: 48px 0 12px; text-align: center; }
.hero img { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 10px 30px rgba(255, 59, 48, 0.28); }
.hero h1 { margin-top: 18px; font-size: clamp(30px, 7vw, 44px); }
.hero .lead { margin: 6px auto 0; max-width: 520px; color: var(--text-2); font-size: 17px; }

.stores { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 26px 0 8px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 15px;
  min-height: 48px;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn small { display: block; font-size: 11px; font-weight: 500; opacity: 0.75; line-height: 1.1; }
.btn span { line-height: 1.15; text-align: left; }

.cards { display: grid; gap: 12px; margin: 34px 0 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  display: block;
  height: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card b { display: block; font-size: 16px; margin-bottom: 4px; }
.card span { color: var(--text-2); font-size: 14px; line-height: 1.45; }

.doc.prose h2 { margin: 30px 0 10px; font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; display: block; }
.prose p, .prose li { color: var(--text); }
.prose ol, .prose ul { padding-left: 1.3em; margin: 0 0 14px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--accent); font-weight: 700; }
.prose .muted { color: var(--text-2); font-size: 15px; }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 14px 12px 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  margin-bottom: 8px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.path { font-weight: 650; }

.center { text-align: center; }
.lang-row { margin-top: 28px; }
.lang-row .langs { justify-content: center; }
.big-code {
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  margin: 40px 0 8px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 420px) {
  :root { --gutter: 16px; }
  body { font-size: 15.5px; }
  .site-nav { font-size: 13px; gap: 4px 12px; }
  .doc h2 { font-size: 14.5px; }
}

@media print {
  .site-head, .site-foot, .langs, .toc, .totop { display: none !important; }
  body { background: #fff; color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .totop, .toc summary::after { transition: none; }
  .doc :target { animation: none; }
}
