/* Оформление вики. Переменные названы так же, как в программе (themes.css):
   в окне программы вики берёт их у самого окна (wiki.js → borrowTheme), и
   страница одета в ту же тему, что и всё вокруг. Значения ниже — стекло Code44
   для сайта и для открытия вне программы. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --body-bg:
    radial-gradient(900px 520px at 8% -6%, rgba(124,58,237,.26), transparent 60%),
    radial-gradient(820px 480px at 96% -2%, rgba(34,211,238,.12), transparent 58%),
    #07070e;
  --shell: rgba(12,12,22,.82);
  --card: rgba(255,255,255,.035);
  --card-2: rgba(255,255,255,.06);
  --card-hover: rgba(255,255,255,.08);
  --border: rgba(255,255,255,.09);
  --border-2: rgba(255,255,255,.16);
  --text: #eef1f8;
  --text-dim: #a9b1c6;
  --text-mute: #6f7791;
  --accent: #a78bfa;
  --accent-2: #22d3ee;
  --accent-soft: rgba(167,139,250,.16);
  --brand-red: #ff3d5e;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --font-ui: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
  --side: 272px;
  --top: 60px;
}

html { scroll-padding-top: calc(var(--top) + 14px); }
body {
  min-height: 100vh;
  background: var(--body-bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.75 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
/* В окне программы подложка — фон самого окна, без стеклянных разводов. */
.in-app body { background: linear-gradient(var(--shell), var(--shell)), var(--menu-bg, #0c0c14); }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ───────────── шапка ───────────── */

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 16px;
  height: var(--top); padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--shell) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.5);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-red), #a30f34);
  color: #fff; font: 700 13px/1 var(--font-mono);
}
.brand b { font-weight: 650; }
.brand i { font-style: normal; color: var(--text-mute); font-size: 13px; }

#find {
  flex: 0 1 380px; margin-left: auto;
  height: 36px; padding: 0 13px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--card-2); color: var(--text);
  font: 14px/1 var(--font-ui);
}
#find:focus { outline: none; border-color: var(--accent); }

.menu-btn { display: none; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card-2); cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.menu-btn span { width: 16px; height: 1.5px; background: var(--text-dim); }

/* ───────────── раскладка ───────────── */

.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); max-width: 1280px; margin: 0 auto; }

.side {
  position: sticky; top: var(--top); align-self: start;
  height: calc(100vh - var(--top)); overflow: auto;
  padding: 20px 14px 40px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.side .group {
  margin: 18px 0 6px; padding: 0 10px;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-mute);
}
.side .group:first-child { margin-top: 0; }
.side .item {
  display: block; padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--text-dim); font-size: 13.5px; line-height: 1.45;
}
.side .item:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
.side .item.on { background: var(--accent-soft); color: var(--accent); }
.side [hidden] { display: none; }

.doc { padding: 30px 38px 80px; min-width: 0; max-width: 900px; }
.crumb { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 10px; }

/* ───────────── текст ───────────── */

.doc h1 { font-size: 30px; font-weight: 700; line-height: 1.25; margin-bottom: 10px; letter-spacing: -.02em; }
.doc .lead { font-size: 16.5px; color: var(--text-dim); margin-bottom: 24px; }
.doc h2 { font-size: 20px; font-weight: 650; margin: 36px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.doc h3 { font-size: 15.5px; font-weight: 650; margin: 22px 0 8px; }
.doc p { margin-bottom: 14px; color: var(--text-dim); }
.doc b, .doc strong { color: var(--text); font-weight: 600; }
.doc ul, .doc ol { margin: 0 0 16px 22px; color: var(--text-dim); }
.doc li { margin-bottom: 7px; }

.doc code { padding: 2px 6px; border-radius: 6px; background: var(--card-2); color: var(--accent-2); font: 13px/1.5 var(--font-mono); }
.doc pre { margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); overflow-x: auto; font: 13px/1.7 var(--font-mono); color: var(--text-dim); }
.doc pre code { padding: 0; background: none; color: inherit; }

kbd { padding: 1px 7px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 6px; background: var(--card-2); color: var(--text); font: 12px/1.6 var(--font-mono); white-space: nowrap; }

/* оглавление страницы */
.toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 24px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.toc b { width: 100%; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); font-weight: 500; }
.toc a { padding: 3px 10px; border-radius: 20px; background: var(--card-2); color: var(--text-dim); font-size: 13px; }
.toc a:hover { color: var(--text); text-decoration: none; background: var(--accent-soft); }

/* шаги */
.steps { counter-reset: step; list-style: none; margin: 0 0 18px !important; }
.steps li { counter-increment: step; position: relative; margin-bottom: 12px; padding-left: 38px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 1px;
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 600 12px/1 var(--font-mono);
}
[dir="rtl"] .steps li { padding-left: 0; padding-right: 38px; }
[dir="rtl"] .steps li::before { left: auto; right: 0; }

/* врезки */
.tip, .warn { margin: 0 0 18px; padding: 13px 16px; border-radius: var(--r-md); border-left: 3px solid; font-size: 14px; color: var(--text-dim); }
.tip { border-color: var(--good); background: color-mix(in srgb, var(--good) 9%, transparent); }
.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 9%, transparent); }

/* сочетания клавиш */
.keys { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.key { display: grid; grid-template-columns: minmax(170px, auto) 1fr; gap: 14px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-dim); }
.key:last-child { border-bottom: 0; }
.key .combo { white-space: nowrap; color: var(--text-mute); }

/* снимки */
figure { margin: 4px 0 22px; }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
figure img { display: block; max-width: 100%; height: auto; margin: 0 auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
figcaption { margin-top: 8px; text-align: center; font-size: 12.5px; color: var(--text-mute); }
.zoom-box { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.78); cursor: zoom-out; }
.zoom-box[hidden] { display: none; }
.zoom-box img { max-width: 100%; max-height: 100%; border-radius: var(--r-md); box-shadow: 0 30px 80px rgba(0,0,0,.6); }

/* таблицы */
table { width: 100%; border-collapse: collapse; margin-bottom: 18px; font-size: 14px; }
th { padding: 9px 12px; text-align: start; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-mute); border-bottom: 1px solid var(--border); font-weight: 500; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); vertical-align: top; }
.wide { max-width: 100%; overflow-x: auto; }
.wide table { min-width: 460px; }

/* плитки */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 10px; margin: 0 0 18px; }
.cards .card { padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); }
.cards .card b { display: block; margin-bottom: 5px; font-size: 14px; }
.cards .card span { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }

/* версии */
.vers { margin: 0 0 20px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.ver { display: grid; grid-template-columns: 62px 132px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.ver:last-child { border-bottom: 0; }
.ver .num { color: var(--accent); font: 600 13px/1.6 var(--font-mono); }
.ver .date { color: var(--text-mute); font: 12px/1.6 var(--font-mono); }
.ver .what { color: var(--text-dim); }

/* поиск */
.hits { display: flex; flex-direction: column; gap: 8px; }
.hit { display: block; padding: 12px 15px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--card); color: var(--text-dim); }
.hit:hover { border-color: var(--accent); text-decoration: none; }
.hit b { display: block; margin-bottom: 3px; color: var(--text); }
.hit span { font-size: 13.5px; line-height: 1.6; }
mark { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }

/* листалка */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 46px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 14px; }
.pager .grow { flex: 1; }
.pager a { padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text-dim); }
.pager a:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }

/* язык */
.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; height: 36px; padding: 0 13px; display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card-2); color: var(--text-dim); font-size: 13.5px; white-space: nowrap;
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: ""; width: 6px; height: 6px; margin-left: 2px; border-right: 1.5px solid var(--text-mute); border-bottom: 1.5px solid var(--text-mute); transform: rotate(45deg) translate(-2px, -2px); }
.langs summary:hover { border-color: var(--accent); color: var(--text); }
.langs .drop {
  position: absolute; right: 0; top: 44px; z-index: 20; display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  min-width: 320px; max-height: calc(100vh - 90px); overflow: auto; padding: 7px;
  border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--shell); box-shadow: 0 18px 44px rgba(0,0,0,.5);
}
.langs .drop a { padding: 7px 11px; border-radius: 8px; color: var(--text-dim); font-size: 13.5px; }
.langs .drop a:hover { background: var(--card-2); color: var(--text); text-decoration: none; }
.langs .drop a.on { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 900px) {
  .menu-btn { display: flex; }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; position: fixed; inset: var(--top) 0 0 0; z-index: 9; height: auto; background: var(--shell); border-right: 0; }
  .side-open .side { display: block; }
  .doc { padding: 24px 16px 60px; }
  .brand i { display: none; }
}
@media (max-width: 560px) {
  .top { gap: 8px; padding: 0 12px; }
  .brand > span:last-child { display: none; }
  #find { flex: 1 1 100px; }
  .langs .drop { grid-template-columns: 1fr; min-width: 190px; }
  .ver { grid-template-columns: 54px 1fr; }
  .ver .what { grid-column: 1 / -1; }
  .key { grid-template-columns: 1fr; gap: 4px; }
}
