/* ============================================================
   Coolray X50 Wiki — простой, современный, читаемый стиль.
   Одна колонка, системный шрифт, авто тёмная тема.
   ============================================================ */

:root {
  --bg:        #ffffff;
  --surface:   #f6f8fa;
  --ink:       #1b2027;
  --muted:     #5a6473;
  --border:    #e6e9ef;
  --accent:    #1f6feb;
  --accent-ink:#1856c5;
  --callout:   #eef4ff;
  --callout-bd:#cfe0ff;
  --code-bg:   #f2f4f7;
  --maxw:      760px;
  --radius:    10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #15181d;
    --surface:   #1b1f26;
    --ink:       #e6e9ef;
    --muted:     #99a2b0;
    --border:    #2a3038;
    --accent:    #6ea8fe;
    --accent-ink:#9cc2ff;
    --callout:   #182438;
    --callout-bd:#2c3f5e;
    --code-bg:   #20262e;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* --- Accessibility: skip link --- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

/* --- Header --- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 18px; min-height: 58px; }
.brand {
  font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap; flex: none;
}
.brand span { color: var(--muted); font-weight: 600; }

.site-nav {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-block; padding: 7px 11px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: .94rem; font-weight: 500;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--surface); }
.site-nav a.active { color: var(--accent); background: var(--callout); }

@media (max-width: 620px) {
  .header-inner { flex-wrap: wrap; gap: 6px 14px; padding-top: 8px; padding-bottom: 8px; min-height: 0; }
  .site-nav { margin-left: 0; width: 100%; padding-bottom: 2px; }
}

/* --- Content --- */
.content { padding: 34px 20px 56px; }
.content > *:first-child { margin-top: 0; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: 1.95rem; margin: 0 0 .5em; }
h2 {
  font-size: 1.42rem; margin: 1.9em 0 .6em;
  padding-bottom: .28em; border-bottom: 1px solid var(--border);
}
h3 { font-size: 1.16rem; margin: 1.5em 0 .45em; }
h4 { font-size: 1rem; font-weight: 650; margin: 1.4em 0 .45em; }

p { margin: 0 0 1.05em; }

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

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

ul, ol { margin: 0 0 1.05em; padding-left: 1.4em; }
li { margin: .3em 0; }
li > ul, li > ol { margin: .3em 0; }

blockquote {
  margin: 1.2em 0; padding: .6em 1.1em;
  background: var(--callout); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; color: var(--ink);
}
blockquote > *:last-child { margin-bottom: 0; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }

img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9em; background: var(--code-bg); padding: .12em .4em; border-radius: 5px;
}
pre { background: var(--code-bg); padding: 14px 16px; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }

/* --- Tables (артикулы, масла) — скроллятся по горизонтали --- */
.content table {
  display: block; width: 100%; max-width: max-content;
  overflow-x: auto; border-collapse: collapse;
  margin: 1.3em 0; font-size: .95rem;
}
.content th, .content td { padding: 9px 13px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.content th { background: var(--surface); font-weight: 650; white-space: nowrap; }
.content tbody tr:nth-child(even) { background: var(--surface); }
.content td { font-variant-numeric: tabular-nums; }

/* --- Блок оглавления: единый вид на всех страницах --- */
.toc {
  margin: 1.5em 0 2.2em;
  padding: 14px 20px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.toc-title {
  margin: 0 0 .55em;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
#markdown-toc { list-style: none; padding-left: 0; margin: 0; }
#markdown-toc li { margin: .28em 0; }
#markdown-toc > li > a { font-weight: 600; color: var(--ink); }
#markdown-toc > li > a:hover { color: var(--accent); }
#markdown-toc ul { list-style: disc; padding-left: 1.25em; margin: .3em 0 .2em; }
#markdown-toc ul a { font-weight: 400; }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  margin-top: 40px; padding: 28px 0 34px; color: var(--muted); font-size: .92rem;
}
.site-footer p { margin: .3em 0; }
