/* ============================================================
   soloviy — Довідковий центр (GitBook-style docs)
   Легка тема контенту + темний топбар. Мобільний drawer.
   ============================================================ */

@font-face {
  font-family: "e-Ukraine";
  src: url("../fonts/e-Ukraine-Regular.woff2") format("woff2");
  font-weight: 400; font-display: swap; font-style: normal;
}
@font-face {
  font-family: "e-Ukraine";
  src: url("../fonts/e-Ukraine-Medium.woff2") format("woff2");
  font-weight: 500; font-display: swap; font-style: normal;
}
@font-face {
  font-family: "e-Ukraine";
  src: url("../fonts/e-Ukraine-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap; font-style: normal;
}

:root {
  --bg-dark: #191C1F;
  --paper: #F7F8F5;
  --card: #FFFFFF;
  --line: #EAECE6;
  --line-soft: #F0F1EC;
  --ink: #191C1F;
  --ink-soft: #363A3F;
  --muted: #6C7278;
  /* Було #9AA0A6: на білому це 2,64 при нормі 4,5. Цим кольором набрані підписи
     сайдбара, плейсхолдер пошуку і підписи «Назад / Далі» — тобто справжній текст,
     а не декор. Тепер 4,90. */
  --muted-2: #6E7176;
  --lime: #BCE31A;
  --lime-ink: #4E7A0B;
  --lime-tint: #F1F8DC;
  --lime-tint-2: #E7F3C4;
  --sidebar-w: 288px;
  --toc-w: 220px;
  --top-h: 60px;
}

* { font-family: "e-Ukraine", sans-serif; box-sizing: border-box; }

html { background: var(--bg-dark); color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }

a { color: inherit; }

/* ---------- Топбар ---------- */
.dl-top {
  position: sticky; top: 0; z-index: 60;
  height: var(--top-h);
  background: var(--bg-dark);
  display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px)) 20px 0;
  box-sizing: content-box;
}
.dl-burger {
  width: 40px; height: 40px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: #fff; cursor: pointer;
  border-radius: 10px; margin-left: -8px;
}
.dl-burger:hover { background: rgba(255,255,255,.08); }
.dl-burger svg { width: 22px; height: 22px; }
.dl-top__logo { display: inline-flex; align-items: center; text-decoration: none; }
.dl-top__logo img { width: 104px; height: auto; display: block; }
.dl-top__tag {
  color: rgba(255,255,255,.55); font-size: 14px; font-weight: 400;
  padding-left: 14px; margin-left: 4px; border-left: 1px solid rgba(255,255,255,.16);
}
.dl-top__spacer { flex: 1; }
.dl-top__home {
  color: rgba(255,255,255,.72); font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 10px; transition: background .16s ease, color .16s ease;
}
.dl-top__home:hover { background: rgba(255,255,255,.08); color: #fff; }
.dl-top__home svg { width: 16px; height: 16px; }

/* ---------- Каркас ---------- */
.dl-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1400px; margin: 0 auto;
}

/* ---------- Сайдбар ---------- */
.dl-side {
  position: sticky; top: var(--top-h);
  height: calc(100vh - var(--top-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 18px 14px 40px;
}
.dl-search {
  position: relative; margin-bottom: 16px;
}
.dl-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-2); pointer-events: none;
}
.dl-search input {
  width: 100%; height: 42px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper);
  padding: 0 12px 0 38px;
  font-size: 14.5px; color: var(--ink); outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.dl-search input::placeholder { color: var(--muted-2); }
.dl-search input:focus {
  border-color: var(--lime); background: #fff;
  box-shadow: 0 0 0 3px rgba(188,227,26,.18);
}
.dl-nav__group { margin-top: 18px; }
.dl-nav__group:first-of-type { margin-top: 2px; }
.dl-nav__label {
  font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-2); padding: 0 10px; margin-bottom: 6px;
}
.dl-nav__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.35;
  text-decoration: none; cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.dl-nav__link:hover { background: var(--line-soft); color: var(--ink); }
.dl-nav__link.is-active {
  background: var(--lime-tint); color: var(--ink); font-weight: 500;
}
.dl-nav__link .dl-ico {
  width: 18px; height: 18px; flex: none; color: var(--muted-2);
}
.dl-nav__link.is-active .dl-ico { color: var(--lime-ink); }
.dl-nav__empty {
  display: none; padding: 14px 10px; color: var(--muted); font-size: 14px;
}
.dl-nav.is-empty .dl-nav__empty { display: block; }
.dl-nav.is-empty .dl-nav__group { display: none; }

.dl-side__foot {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 9px;
}
.dl-side__foot a { color: var(--muted); font-size: 13px; text-decoration: none; }
.dl-side__foot a:hover { color: var(--lime-ink); }

/* ---------- Основна колонка ---------- */
.dl-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-w);
  gap: 48px;
  padding: 40px clamp(24px, 4vw, 64px) 96px;
}
.dl-main { min-width: 0; max-width: 760px; }

.dl-crumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted); margin-bottom: 22px;
}
.dl-crumbs span[aria-hidden] { color: var(--muted-2); }
.dl-crumbs b { color: var(--ink-soft); font-weight: 500; }

.doc-page { display: none; animation: dpfade .28s ease; }
.doc-page.is-shown { display: block; }
@keyframes dpfade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.dp h1 {
  font-size: clamp(27px, 4.4vw, 36px); font-weight: 700; line-height: 122%;
  letter-spacing: -0.3px; color: var(--ink); margin: 0;
}
.dp__lead { color: var(--muted); font-size: 17px; line-height: 158%; margin: 12px 0 0; }
.dp h2 {
  font-size: 21px; font-weight: 500; line-height: 134%; letter-spacing: -0.2px;
  color: var(--ink); margin: 40px 0 0; scroll-margin-top: calc(var(--top-h) + 20px);
}
.dp h3 { font-size: 17px; font-weight: 500; color: var(--ink); margin: 26px 0 0; }
.dp p, .dp li { color: var(--ink-soft); font-size: 16px; line-height: 166%; letter-spacing: -0.1px; }
.dp p { margin: 14px 0 0; }
.dp ul, .dp ol { margin: 14px 0 0; padding-left: 4px; list-style: none; }
.dp ul > li, .dp ol > li { position: relative; padding-left: 26px; margin-top: 10px; }
.dp ul > li::before {
  content: ""; position: absolute; left: 6px; top: 10px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--lime-ink); opacity: .55;
}
.dp a { color: var(--lime-ink); text-underline-offset: 2px; }
.dp a:hover { text-decoration: underline; }
.dp strong { color: var(--ink); font-weight: 500; }
.dp code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--lime-tint); color: #3c5f08;
  padding: 1px 6px; border-radius: 6px; font-size: 13.5px;
}

/* Нумеровані кроки */
ol.dp-steps { counter-reset: st; margin-top: 18px; padding-left: 0; }
ol.dp-steps > li {
  counter-increment: st; position: relative; padding-left: 46px; margin-top: 16px;
}
ol.dp-steps > li::before {
  content: counter(st); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--lime); color: #26340a; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; background: var(--lime);
}
ol.dp-steps > li strong { display: block; margin-bottom: 2px; }

/* Callout-и: чистий лівий акцент-бордер, без емодзі */
.dp-note, .dp-tip, .dp-warn {
  margin-top: 22px; padding: 15px 18px; position: relative;
  border-radius: 12px; font-size: 15px; line-height: 162%;
  border: 1px solid var(--line); border-left-width: 3px;
}
.dp-note p:first-child, .dp-tip p:first-child, .dp-warn p:first-child { margin-top: 0; }
.dp-note { background: var(--card); color: var(--ink-soft); border-left-color: var(--muted-2); }
.dp-tip  { background: var(--lime-tint); border-color: var(--lime-tint-2); border-left-color: var(--lime-ink); color: #3f560f; }
.dp-warn { background: #FFF8E8; border-color: #FBE6B0; border-left-color: #E0A800; color: #6b5316; }
.dp-tip a, .dp-warn a { color: inherit; text-decoration: underline; }

/* Картки-посилання */
.dp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.dp-cards a {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.dp-cards a:hover { transform: translateY(-2px); border-color: #DBDED4; box-shadow: 0 12px 28px rgba(25,28,31,.08); }
.dp-cards b { display: block; color: var(--ink); font-size: 15.5px; font-weight: 500; }
.dp-cards span { display: block; color: var(--muted); font-size: 13.5px; margin-top: 3px; line-height: 1.45; }

/* Кнопка-CTA всередині контенту */
.dp-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 22px;
  background: var(--lime); color: #26340a; font-weight: 700; font-size: 15px;
  padding: 12px 20px; border-radius: 12px; text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease;
}
.dp-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(188,227,26,.4); }

/* Prev / Next */
.dl-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 56px; }
.dl-pager__link {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px;
  background: var(--card); text-decoration: none; cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.dl-pager__link:hover { border-color: #DBDED4; box-shadow: 0 10px 24px rgba(25,28,31,.07); transform: translateY(-2px); }
.dl-pager__link[hidden] { display: none; }
.dl-pager__k { font-size: 12.5px; color: var(--muted-2); }
.dl-pager__t { font-size: 15px; color: var(--ink); font-weight: 500; }
.dl-pager__next { text-align: right; }

/* ---------- Правий TOC ---------- */
.dl-toc {
  position: sticky; top: calc(var(--top-h) + 40px);
  align-self: start; max-height: calc(100vh - var(--top-h) - 60px); overflow-y: auto;
}
.dl-toc__title {
  font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted-2); margin-bottom: 10px;
}
.dl-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.dl-toc li { margin: 0; }
.dl-toc a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13.5px; line-height: 1.4; color: var(--muted); text-decoration: none;
  transition: color .14s ease, border-color .14s ease;
}
.dl-toc a:hover { color: var(--ink); }
.dl-toc a.is-active { color: var(--lime-ink); border-left-color: var(--lime-ink); font-weight: 500; }
.dl-toc.is-empty { display: none; }

/* ---------- Оверлей для drawer ---------- */
.dl-overlay {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(20,22,24,.44); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .26s ease, visibility .26s ease;
}
.dl-overlay.is-open { opacity: 1; visibility: visible; }

/* ============================================================
   Планшет / мобілка
   ============================================================ */
@media (max-width: 1180px) {
  .dl-body { grid-template-columns: minmax(0, 1fr); }
  .dl-toc { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 300px; }
  .dl-layout { display: block; }
  .dl-side {
    position: fixed; top: 0; left: 0; z-index: 58;
    height: 100dvh; width: var(--sidebar-w); max-width: 86vw;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    transform: translateX(-100%);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 0 44px rgba(0,0,0,.18);
  }
  .dl-side.is-open { transform: none; }
  .dl-body { padding: 26px 20px 88px; gap: 0; }
  .dl-main { max-width: 100%; }
  .dl-burger { display: inline-flex; }
}

@media (min-width: 901px) {
  .dl-burger { display: none; }
  .dl-overlay { display: none; }
}

/* Дрібні екрани */
@media (max-width: 560px) {
  .dl-top__tag { display: none; }
  .dl-top__home .dl-top__home-t { display: none; }
  .dp-cards { grid-template-columns: 1fr; }
  .dl-pager { grid-template-columns: 1fr; }
  .dl-pager__next { text-align: left; }
}

/* Плавний скрол по якорях + прибрати стрибки */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .doc-page { animation: none; }
  .dl-side { transition: none; }
}
