/* Eggent docs. Same palette and type as the landing: dark, JetBrains Mono,
   Press Start 2P only for brand marks and kickers, hard-offset shadows,
   no rounded corners. */

:root {
  --bg: #080706;
  --panel: #0d0c0a;
  --panel-2: #13110f;
  --ink: #faf7f0;
  --ink-2: #ece6d6;
  --muted: #a39a8b;
  --dim: #8a8377;
  --line: #25211c;
  --line-2: #1c1915;
  --yellow: #fcd12d;
  --yellow-dark: #d9b01a;
  --red: #f31544;
  --red-dark: #70031a;
  --green: #3db04e;
  --blue: #5b9fe8;
  --topbar: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html { scroll-padding-top: calc(var(--topbar) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--yellow); color: #1a1714; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
.pixel { font-family: 'Press Start 2P', monospace; letter-spacing: .08em; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--yellow); color: #080706; padding: 8px 12px; font-weight: 700; }
.skip:focus { left: 8px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8,7,6,.92);
  border-bottom: 1px solid var(--line-2);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  height: var(--topbar);
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 20px;
}
.brand { font-size: 14px; text-decoration: none; text-shadow: 2px 2px 0 var(--red), 4px 4px 0 var(--red-dark); white-space: nowrap; }
.docs-label { color: var(--yellow); font-size: 13px; font-weight: 700; text-decoration: none; letter-spacing: .04em; }
.search { position: relative; flex: 1; max-width: 420px; margin-left: 8px; }
.search input {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid #3a352d; border-radius: 0;
  font: inherit; font-size: 16px;
}
@media (min-width: 900px) { .search input { font-size: 13px; } }
.search input::placeholder { color: var(--dim); }
.search input:focus { outline: 2px solid var(--yellow); outline-offset: 0; border-color: var(--yellow); }
.search-results {
  position: absolute; top: 44px; left: 0; right: 0; z-index: 40;
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--panel); border: 2px solid #3a352d; box-shadow: 5px 5px 0 #000;
}
.search-results a { display: block; padding: 10px 14px; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--panel-2); }
.search-results .r-title { display: block; font-weight: 700; font-size: 13px; }
.search-results .r-sub { display: block; color: var(--dim); font-size: 12px; line-height: 1.5; }
.search-results .r-empty { padding: 12px 14px; color: var(--dim); font-size: 13px; }
.topbar-links { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 13px; }
.topbar-links a { text-decoration: none; color: var(--muted); }
.topbar-links a:hover { color: var(--ink); }
.button-primary {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px;
  background: var(--yellow); color: #080706 !important; font-weight: 700; font-size: 13px;
  text-decoration: none; border: 2px solid var(--yellow); box-shadow: 3px 3px 0 var(--yellow-dark);
  transition: transform 90ms steps(3, end), box-shadow 90ms steps(3, end);
}
.button-primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--yellow-dark); }
.button-primary:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--yellow-dark); }

/* Layout */
.layout {
  max-width: 1440px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 48px;
}
.sidebar {
  position: sticky; top: var(--topbar); align-self: start;
  max-height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 28px 8px 48px 0;
  scrollbar-width: thin;
}
.sidebar-mobile { display: none; }
.nav-section + .nav-section { margin-top: 24px; }
.nav-section-title { color: var(--yellow); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
.sidebar ul, .sidebar-mobile ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a, .sidebar-mobile li a {
  display: block; padding: 4px 10px; margin-left: -10px;
  color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.5;
  border-left: 2px solid transparent;
}
.sidebar li a:hover, .sidebar-mobile li a:hover { color: var(--ink); background: var(--panel-2); }
.sidebar li a[aria-current="page"], .sidebar-mobile li a[aria-current="page"] { color: var(--ink); border-left-color: var(--yellow); background: var(--panel-2); font-weight: 700; }

main { padding: 40px 0 72px; min-width: 0; }
main:focus { outline: none; }
.doc { max-width: 760px; }
.kicker { color: var(--yellow); font-size: 10px; margin-bottom: 14px; line-height: 1.6; }
.doc h1 { margin: 0; font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -.03em; text-wrap: balance; }
.lead { margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.6; text-wrap: pretty; }

/* Prose */
.prose { margin-top: 32px; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin: 48px 0 12px; font-size: 22px; line-height: 1.3; letter-spacing: -.01em; padding-top: 24px; border-top: 1px solid var(--line-2); }
.prose h3 { margin: 32px 0 8px; font-size: 17px; line-height: 1.35; }
.prose h4 { margin: 24px 0 6px; font-size: 15px; }
.prose h2, .prose h3, .prose h4 { position: relative; }
.anchor { position: absolute; left: -22px; color: var(--dim); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose p { text-wrap: pretty; }
.prose li { margin: 4px 0; }
.prose li > ul, .prose li > ol { margin: 4px 0 0; }
.prose ul { padding-left: 22px; }
.prose ul li::marker { color: var(--yellow); content: "▸  "; font-size: 12px; }
.prose ol { padding-left: 26px; }
.prose ol li::marker { color: var(--yellow); font-weight: 700; }
.prose a { color: var(--yellow); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { color: var(--ink); }
.prose hr { border: 0; border-top: 1px dashed var(--line); margin: 32px 0; }
.prose code {
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 1px 5px; font-size: 13px; color: var(--ink-2);
  overflow-wrap: anywhere;
}
.prose pre {
  margin: 0 0 20px; padding: 16px 18px; overflow-x: auto;
  background: var(--panel); border: 2px solid var(--line); box-shadow: 4px 4px 0 #000;
  font-size: 13px; line-height: 1.65;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; overflow-wrap: normal; }
.prose blockquote { margin: 0 0 16px; padding: 4px 16px; border-left: 3px solid var(--line); color: var(--muted); }
.prose img { max-width: 100%; height: auto; border: 2px solid var(--line); }
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); }
.prose table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.55; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.prose th { background: var(--panel-2); color: var(--ink); font-weight: 700; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }

.callout { margin: 0 0 20px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--blue); }
.callout p:last-child { margin-bottom: 0; }
.callout-tip { border-left-color: var(--green); }
.callout-warning { border-left-color: var(--yellow); }
.callout::before { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
html[lang="en"] .callout-note::before { content: "Note"; color: var(--blue); }
html[lang="en"] .callout-tip::before { content: "Tip"; color: var(--green); }
html[lang="en"] .callout-warning::before { content: "Important"; color: var(--yellow); }
html[lang="ru"] .callout-note::before { content: "Заметка"; color: var(--blue); }
html[lang="ru"] .callout-tip::before { content: "Совет"; color: var(--green); }
html[lang="ru"] .callout-warning::before { content: "Важно"; color: var(--yellow); }

/* Cards on the home page */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 8px 0 24px; }
.cards a {
  display: block; padding: 18px; text-decoration: none; color: var(--ink);
  background: var(--panel-2); border: 2px solid #23201c; box-shadow: 4px 4px 0 #000;
  transition: box-shadow 110ms steps(3, end), border-color 140ms linear;
}
.cards a:hover { border-color: #3a352d; box-shadow: 6px 6px 0 #000; }
.cards strong { display: block; font-size: 15px; margin-bottom: 4px; }
.cards span { display: block; color: var(--dim); font-size: 13px; line-height: 1.55; }

.md-link { margin-top: 48px; font-size: 12px; }
.md-link a { color: var(--dim); }
.md-link a:hover { color: var(--ink); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.pager a {
  display: block; padding: 14px 16px; text-decoration: none;
  border: 2px solid var(--line); background: var(--panel);
  transition: border-color 120ms linear;
}
.pager a:hover { border-color: var(--yellow); }
.pager small { display: block; color: var(--dim); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.pager span { display: block; font-weight: 700; font-size: 14px; }
.pager-next { text-align: right; }

/* On this page */
.toc-column { padding-top: 40px; }
.toc { position: sticky; top: calc(var(--topbar) + 24px); font-size: 12px; }
.toc-title { color: var(--dim); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 11px; margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 3px 0 3px 12px; margin-left: -1px; color: var(--muted); text-decoration: none; line-height: 1.5; border-left: 1px solid transparent; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--yellow); border-left-color: var(--yellow); }

/* Footer */
.site-footer { border-top: 1px solid var(--line-2); padding: 24px 0; color: var(--dim); font-size: 12px; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 0 24px; display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer-brand { font-size: 10px; text-shadow: 2px 2px 0 #350207; }
.footer-links { margin-left: auto; display: flex; gap: 16px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
  .toc-column { display: none; }
}
@media (max-width: 860px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .docs-label { display: none; }
  .hide-sm { display: none !important; }
  .search { margin-left: 0; }
  .layout { display: block; padding: 0 16px; }
  .sidebar { display: none; }
  .sidebar-mobile { display: block; margin-top: 16px; border: 2px solid var(--line); background: var(--panel); }
  .sidebar-mobile summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 13px; list-style: none; min-height: 44px; display: flex; align-items: center; }
  .sidebar-mobile summary::-webkit-details-marker { display: none; }
  .sidebar-mobile summary::before { content: "▸"; color: var(--yellow); margin-right: 10px; }
  .sidebar-mobile[open] summary::before { content: "▾"; }
  .sidebar-mobile nav { padding: 4px 14px 16px 24px; }
  .sidebar-mobile li a { padding: 8px 10px; }
  main { padding-top: 28px; }
  .cards, .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
  .anchor { display: none; }
  .footer-links { margin-left: 0; }
}
@media (max-width: 420px) {
  .brand { font-size: 11px; }
  .topbar-links { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .button-primary, .cards a, .pager a { transition-duration: 0.01ms; }
}
