/* =======================================================================
   ULDA Daux Theme • v3.1
   - Навигация на CSS Grid: идеальное выравнивание стрелки и текста
   - Стрелка крупнее, клик-зона больше, плавный поворот
   ======================================================================= */

/* ---- Tokens ---------------------------------------------------------- */
:root {
  --background: 212 28% 7%;
  --foreground: 210 20% 98%;
  --card: 215 28% 15%;
  --card-foreground: 210 20% 98%;
  --popover: 212 28% 7%;
  --popover-foreground: 210 20% 98%;

  --primary: 200 85% 51%;
  --primary-foreground: 210 20% 98%;
  --secondary: 215 27.9% 16.9%;
  --secondary-foreground: 210 20% 98%;
  --muted: 215 27.9% 16.9%;
  --muted-foreground: 217.9 10.6% 64.9%;
  --accent: 215 27.9% 16.9%;
  --accent-foreground: 210 20% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 20% 98%;

  --border: 215 28% 15%;
  --input: 215 27.9% 16.9%;
  --ring: 200 85% 51%;
  --radius: 1rem;

  /* NAV sizes */
  --nav-toggle-size: 32px;   /* кликабельная зона кнопки */
  --nav-icon-size: 32px;     /* физический размер стрелки */
}

html { color-scheme: dark; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout ---------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 300px;
  background: linear-gradient(180deg, hsl(var(--secondary)) 0%, hsl(var(--secondary)) 60%, hsl(217 20% 18%) 100%);
  border-right: 1px solid hsl(var(--border));
  padding: 18px 14px;
}
.brand { font-weight: 700; letter-spacing: -.01em; font-size: 1.05rem; margin: 6px 8px 14px; }
.content { flex: 1; min-width: 0; padding: 2.5rem 2.25rem; }
@media (min-width: 1280px){ .content { padding: 3rem; } }

/* ---- Typography ------------------------------------------------------ */
h1, h2, h3 { line-height: 1.25; margin: 1.3em 0 .6em; }
h4, h5, h6 { line-height: 1.35; margin: 1.1em 0 .5em; }
h1 { font-size: clamp(2rem, 1.3rem + 2vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: clamp(1.25rem, 1.05rem + .6vw, 1.5rem); font-weight: 600; letter-spacing: -.01em; }
h4 { font-size: 1.125rem; font-weight: 600; }
p { line-height: 1.7; margin: 1em 0; }
ul, ol { margin: 1em 0 1.25em 1.5em; }
blockquote {
  margin: 1.5rem 0; padding: 1rem 1.25rem;
  background: hsl(var(--muted)); color: hsl(var(--muted-foreground));
  border-left: 3px solid hsl(var(--primary)); border-radius: var(--radius);
}

/* ---- Tables ---------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid hsl(var(--border)); padding: .65rem .75rem; vertical-align: top; }
tbody tr:hover { background: hsl(var(--muted) / .25); }

/* ---- Code ------------------------------------------------------------ */
pre {
  background: hsl(217 22% 16%);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow: auto;
}
pre code { background: transparent; border: 0; }
code:not(.hljs) {
  background: hsl(217 16% 22%);
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  padding: .18em .45em;
}

/* ---- Buttons & Inputs ------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 2.25rem; padding: 0 .9rem; font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  cursor: pointer;
}
.btn:hover { background: hsl(var(--accent)); }
.btn.primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); border-color: transparent; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring) / .65); }

input, select, textarea {
  background: hsl(var(--input)); border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground)); border-radius: .6rem; padding: .55rem .7rem; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: hsl(var(--ring)); box-shadow: 0 0 0 2px hsl(var(--ring) / .35); }

/* ---- Images ---------------------------------------------------------- */
img { max-width: 100%; height: auto; border-radius: .75rem; }

/* ======================================================================
   Sidebar Navigation (get_navigation output) — GRID
   ====================================================================== */

.Nav { list-style: none; margin: 0; padding: 0; }
.Nav ul { list-style: none; margin: 0; padding-left: 14px; }

/* Каждый li — сетка из двух колонок: [стрелка | содержимое] */
.Nav .Nav__item {
  display: grid;
  grid-template-columns: var(--nav-toggle-size) 1fr;
  align-items: center;            /* стрелка и текст по одной линии */
  position: relative;
}

/* Кнопка-стрелка — в первой колонке сетки */
.Nav__toggle {
  grid-column: 1; grid-row: 1;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  width: var(--nav-toggle-size); height: var(--nav-toggle-size);
  border-radius: .35rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: hsl(var(--muted-foreground));   /* inline-SVG берёт currentColor */
  line-height: 0;                         /* никакого baseline сдвига */
  transition: color .12s ease;
}
.Nav__toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px hsl(var(--ring)/.55); }
.Nav__item--open > .Nav__toggle { color: hsl(var(--foreground)); }

/* Сам SVG */
.Nav__toggle svg {
  display: block;
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  transform-origin: 50% 50%;
  transition: transform .2s ease;
}
.Nav__item--open > .Nav__toggle svg { transform: rotate(90deg); }

/* Ссылка — всегда во второй колонке сетки */
.Nav__item > a {
  grid-column: 2; grid-row: 1;
  display: block;
  padding: .5rem .6rem;
  margin: 2px 6px;
  border-radius: .6rem;
  color: hsl(var(--foreground));
  text-decoration: none;
  line-height: 1.35;
}
.Nav__item > a:hover { background: hsl(var(--secondary)); }

/* Вложенный список — тоже во 2-й колонке (чтобы ровно под текстом) */
.Nav .Nav__item > ul { grid-column: 2; display: none; }
.Nav .Nav__item.Nav__item--open > ul { display: block; }

/* Верхний уровень — слегка тяжелее */
.Nav > .Nav__item > a { font-weight: 600; margin-top: .35rem; opacity: .95; }

/* Активный пункт — тонкая полоса слева */
.Nav__item--active > a {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  position: relative;
}
.Nav__item--active > a::before {
  content: "";
  position: absolute; left: -6px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px; background: hsl(var(--primary));
}

/* Узлы без детей тоже выглядят ровно (первый столбец пустой, но высота одинаковая) */
.Nav__item:not(.has-children) > a { /* ничего не делаем — сетка уже даёт отступ */ }

/* Убить старые псевдо-стрелки, если остались */
.Nav__toggle::before { content: none !important; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) { .Nav__toggle svg { transition: none; } }

/* Breadcrumbs */
.breadcrumbs{
  display:flex; align-items:center; gap:.5rem;
  color:hsl(var(--muted-foreground));
  font-size:.98rem;
  margin:0 0 .9rem;
  padding:.15rem .25rem .8rem;
  border-bottom:1px solid hsl(var(--border));
}
.breadcrumbs a{ color:hsl(var(--muted-foreground)); text-decoration:none; }
.breadcrumbs a:hover{ color:hsl(var(--foreground)); text-decoration:underline; }
.breadcrumbs .crumb-current{ color:hsl(var(--foreground)); font-weight:600; }
.breadcrumbs .crumb-sep{ opacity:.55; }


/* Комфортный ритм в статье */
.markdown { font-size: 16px; }
.markdown p, .markdown li { line-height: 1.75; }

/* заголовки в статье */
.markdown h1, .markdown h2, .markdown h3 { margin-top: 1.3em; margin-bottom: .6em; }
.markdown > h1:first-child,
.markdown > h2:first-child { margin-top: .4rem; }  /* сразу под крошками */


/* Спрятать встроенную якорную "#" у заголовков */
.markdown h1 > a:first-child,
.markdown h2 > a:first-child,
.markdown h3 > a:first-child,
.markdown h4 > a:first-child,
.markdown h5 > a:first-child,
.markdown h6 > a:first-child { 
  display: none !important;
}

/* Page path (top) */
.doc-path{
  display:flex; align-items:center; flex-wrap:wrap; gap:.5rem;
  color:hsl(var(--muted-foreground));
  font-size:.98rem;
  margin:0 0 .9rem;
  padding:.15rem .25rem .8rem;
  border-bottom:1px solid hsl(var(--border));
}
.doc-path a{ color:hsl(var(--muted-foreground)); text-decoration:none; }
.doc-path a:hover{ color:hsl(var(--foreground)); text-decoration:underline; }
.doc-path__current{ color:hsl(var(--foreground)); font-weight:600; }
.doc-path__sep{ opacity:.55; }

/* Крупные кнопки в стиле лендинга */
.btn-lg{ height:2.75rem; padding:0 1rem; font-size:.95rem; }
.btn.outline{
  background:transparent; border:1px solid hsl(var(--border)); color:hsl(var(--foreground));
}
.btn.outline:hover{ background:hsl(var(--secondary)); }

/* Pager: Previous / Next */
.pager{
  display:grid; grid-template-columns:1fr 1fr; gap:.75rem;
  margin-top:2.25rem; padding-top:1rem; border-top:1px solid hsl(var(--border));
}
.pager a.btn{ text-decoration:none; }
.pager .prev{ justify-self:start; }
.pager .next{ justify-self:end; }
@media (max-width:720px){
  .pager{ grid-template-columns:1fr; }
  .pager .prev,.pager .next{ justify-self:stretch; }
}

/* Brand: same color, centered, slightly bigger, no big box */
.sidebar .brand{
  margin: 8px 8px 14px;
  text-align: center;
}

.sidebar .brand a{
  display: inline-block;
  font-weight: 800;
  font-size: 1.2rem;         /* <- подправь, если нужно 1.25rem/1.3rem */
  letter-spacing: -.01em;
  color: hsl(var(--primary));            /* тот же цвет, что и раньше */
  text-decoration: none;

  /* убираем «рамку/плитку» и избыточные отступы */
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}

.sidebar .brand a:hover{
  background: transparent !important;
  text-decoration: underline;
}
