/* Athanor — печь, что держит секрет вне текста.
   Палитра: тёплая сажа/пергамент, два металлических акцента (сурьмяное
   золото — Sol, вердигри — Venus/медь), редкая киноварь только для
   предупреждений. Дисплей — Cormorant (гравированные манускрипты),
   длинное чтение — Literata, код и служебные подписи — IBM Plex Mono. */

:root {
  --void: #14100c;
  --void-2: #1b1610;
  --ash: #23201b;
  --ash-line: #3a352c;
  --parchment: #e8dfc8;
  --parchment-dim: #a89e88;
  --sol: #c9a24b;
  --sol-dim: #8a723c;
  --verdigris: #5c9686;
  --vermilion: #b1462f;

  --display: "Cormorant SC", "Cormorant Garamond", Georgia, serif;
  --display-text: "Cormorant Garamond", Georgia, serif;
  --body: "Literata", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --measure: 68ch;
  --radius: 2px;
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
	margin: 0;
	background-color: var(--void);
	background-image:
		linear-gradient(rgba(20, 16, 12, 0.84), rgba(20, 16, 12, 0.94)),
		url("background-texture.webp");
	background-size: cover;
	background-position: center top;
	background-attachment: fixed;
  color: var(--parchment);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.68;
  font-optical-sizing: auto;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

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

::selection {
  background: var(--sol-dim);
  color: var(--void);
}

a {
  color: var(--sol);
  text-decoration: none;
  border-bottom: 1px solid var(--sol-dim);
}
a:hover { border-bottom-color: var(--sol); }
a:visited { color: var(--verdigris); border-bottom-color: var(--verdigris); }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--sol);
  outline-offset: 3px;
}

code, pre {
  font-family: var(--mono);
}

pre {
  background: var(--ash);
  border: 1px solid var(--ash-line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  /* a soft fade on the right edge hints "this scrolls" instead of letting a
     long line look like it was simply cut off */
  mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
}
pre.no-fade,
pre:hover {
  mask-image: none;
  -webkit-mask-image: none;
}

/* a visible scrollbar, not just the fade above — on touch devices and
   Firefox the fade alone isn't enough of a hint that a wide block scrolls */
pre {
  scrollbar-width: thin;
  scrollbar-color: var(--sol-dim) var(--ash);
}
pre::-webkit-scrollbar {
  height: 8px;
}
pre::-webkit-scrollbar-track {
  background: var(--ash);
}
pre::-webkit-scrollbar-thumb {
  background: var(--sol-dim);
  border-radius: var(--radius);
}

/* ASCII diagrams: each fenced as ```diagram-<slug> so this can target them
   specifically — smaller, tighter type gives box-drawing/arrow characters
   more room per line before a diagram needs to scroll at all. */
pre code[class*="language-diagram-"] {
  display: block;
  font-size: 0.82rem;
  line-height: 1.5;
  letter-spacing: 0;
}

:not(pre) > code {
  background: var(--ash);
  border: 1px solid var(--ash-line);
  border-radius: var(--radius);
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--parchment);
}

h1 { font-size: 2.6rem; line-height: 1.15; margin: 0 0 0.6rem; }
h2 { font-size: 1.5rem; margin: 2.6rem 0 1rem; padding-top: 1.4rem; border-top: 1px solid var(--ash-line); }
h3 { font-size: 1.15rem; margin: 1.8rem 0 0.8rem; }

p { margin: 0 0 1.15rem; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  font-size: 0.9rem;
}
th, td {
  border: 1px solid var(--ash-line);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
th {
  font-family: var(--display-text);
  font-weight: 600;
  color: var(--sol);
  background: var(--ash);
}

hr {
  border: none;
  border-top: 1px solid var(--ash-line);
  margin: 2.4rem 0;
}

/* ---------- eyebrow / wordmark ---------- */

.eyebrow {
  font-family: var(--display-text);
  font-style: italic;
  color: var(--parchment-dim);
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.wordmark {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  color: var(--parchment);
}
.wordmark:hover { border-bottom: none; }

/* ---------- sigil ---------- */

.sigil {
  display: block;
  object-fit: contain;
}
.sigil--hero {
  width: 108px;
  height: 108px;
  margin: 0 auto 1.6rem;
}
.sigil--mark {
  width: 22px;
  height: 22px;
}

/* ---------- top bar (shared) ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--ash-line);
  font-family: var(--mono);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.topbar a.github {
  color: var(--parchment-dim);
  border-bottom: none;
	font-size: 0.9rem;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}
.topbar a.github:hover { color: var(--sol); }
.topbar a.lang-switch {
  color: var(--parchment-dim);
  border: 1px solid var(--ash-line);
  border-radius: var(--radius);
	padding: 0.45rem 0.65rem;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.topbar a.lang-switch:hover { color: var(--sol); border-color: var(--sol-dim); }

/* ---------- language gate (site root) ---------- */

.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.6rem;
}
.gate h1 {
  font-size: 2.6rem;
  letter-spacing: 0.14em;
  margin: 0;
}
.gate-choice {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--display-text);
  font-style: italic;
  font-size: 1.15rem;
}
.gate-choice a {
  color: var(--parchment-dim);
	border-bottom: 1px solid transparent;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}
.gate-choice a:hover { color: var(--sol); border-bottom-color: var(--sol-dim); }
.gate-divider { color: var(--ash-line); }

/* ---------- landing page ---------- */

.hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
  text-align: center;
}
.hero h1 { font-size: 3.4rem; }
.hero .thesis {
  font-family: var(--display-text);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--parchment-dim);
  max-width: 480px;
  margin: 0 auto 2.2rem;
}
.hero .cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}
.button {
  font-family: var(--mono);
  font-size: 0.92rem;
  padding: 0.65rem 1.3rem;
  border: 1px solid var(--sol-dim);
  border-radius: var(--radius);
  color: var(--parchment);
	border-bottom: 1px solid var(--sol-dim);
	min-height: 44px;
	display: inline-flex;
	align-items: center;
}
.button:hover { border-color: var(--sol); color: var(--sol); }
.button--ghost { border-color: var(--ash-line); color: var(--parchment-dim); }
.button--ghost:hover { border-color: var(--parchment-dim); color: var(--parchment); }

.operations {
  max-width: 920px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  border-top: 1px solid var(--ash-line);
  border-bottom: 1px solid var(--ash-line);
}
.operation {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.operation .glyph {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 50%;
	display: block;
	margin: 0 0 0.8rem;
	opacity: 0.86;
}
.operation h3 { margin-top: 0; }
.operation p { width: 100%; color: var(--parchment-dim); font-size: 0.98rem; line-height: 1.65; margin-bottom: 0; }

.section-divider {
	display: block;
	width: min(100%, 1200px);
	height: auto;
	margin: 1rem auto 0;
	opacity: 0.65;
}

.grimoire {
  max-width: 640px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}
.grimoire h2 { border-top: none; margin-top: 0; text-align: center; }
.chapter-list { list-style: none; margin: 1.6rem 0 0; padding: 0; }
.chapter-list li {
  border-bottom: 1px solid var(--ash-line);
}
.chapter-list a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.85rem 0.2rem;
  border-bottom: none;
  color: var(--parchment);
}
.chapter-list a:hover { color: var(--sol); }
.chapter-list a:hover .num { color: var(--sol); }
.chapter-list .num {
  font-family: var(--display-text);
  color: var(--sol-dim);
  font-size: 1.1rem;
  min-width: 1.6em;
}
.chapter-list .arrow { margin-left: auto; color: var(--parchment-dim); }

.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem 3rem;
  color: var(--parchment-dim);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.site-footer a { color: var(--parchment-dim); border-bottom-color: var(--ash-line); }

/* ---------- docs layout ---------- */

.docs-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, var(--measure));
  gap: 3rem;
  max-width: 980px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  justify-content: center;
}

.docs-nav {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  font-size: 0.88rem;
  font-family: var(--mono);
}
.docs-nav .back {
  display: block;
  color: var(--parchment-dim);
  border-bottom: none;
  margin-bottom: 1.2rem;
}
.docs-nav ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--ash-line);
}
.docs-nav li { margin: 0; }
.docs-nav a {
  display: block;
  padding: 0.4rem 0 0.4rem 0.9rem;
  margin-left: -1px;
  border-left: 1px solid transparent;
  border-bottom: none;
  color: var(--parchment-dim);
  line-height: 1.4;
}
.docs-nav a:hover { color: var(--parchment); border-left-color: var(--parchment-dim); }
.docs-nav a.current {
  color: var(--sol);
  border-left-color: var(--sol);
}

.docs-content {
  min-width: 0;
  font-size: 1.0625rem;
  line-height: 1.72;
  letter-spacing: 0.003em;
}

/* checkpoint callout — bespoke component for the guide's recurring
   "Контрольный вопрос / Ответ" pair */
.checkpoint {
  border: 1px solid var(--sol-dim);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  margin: 2.2rem 0;
  background: var(--ash);
  position: relative;
}
.checkpoint::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 10px; height: 10px;
  border-top: 1px solid var(--sol);
  border-left: 1px solid var(--sol);
}
.checkpoint::after {
  content: "";
  position: absolute;
  bottom: -1px; right: -1px;
  width: 10px; height: 10px;
  border-bottom: 1px solid var(--sol);
  border-right: 1px solid var(--sol);
}
.checkpoint p:last-child { margin-bottom: 0; }
.checkpoint p:first-child strong { color: var(--sol); }
.checkpoint em { color: var(--verdigris); font-style: normal; }

.chapter-nav {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--ash-line);
  font-size: 0.9rem;
  font-family: var(--mono);
}
.chapter-nav p { margin: 0; color: var(--parchment-dim); }

@media (max-width: 760px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-nav { position: static; }
  .operations { grid-template-columns: 1fr; }
	.hero h1 { font-size: 2.5rem; }
	body { background-attachment: scroll; }
	.operation .glyph { margin-left: -0.35rem; }
}
