/* ==========================================================================
   DashaMail REST API v2 — документация

   Раскладка: боковая навигация + две колонки (текст слева, код справа).
   Оформление повторяет dashamail.ru: Geologica в заголовках, Inter в тексте,
   фиолетовая гамма (--brand-*), карточки со скруглением 16px.

   Шрифты лежат рядом, в assets/fonts/. Отдавать их с dashamail.ru нельзя:
   тот хост не присылает Access-Control-Allow-Origin, и браузер заблокирует
   загрузку шрифта с поддомена.
   ========================================================================== */

/* ── Фирменные шрифты ────────────────────────────────────────────────────── */

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

@font-face {
  font-family: 'Geologica';
  src: url('fonts/Geologica/Geologica-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geologica';
  src: url('fonts/Geologica/Geologica-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geologica';
  src: url('fonts/Geologica/Geologica-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ── Токены ──────────────────────────────────────────────────────────────── */

:root {
  /* Фирменная палитра — значения взяты с dashamail.ru */
  --brand:          #6F4EAF;   /* --color-primary      */
  --brand-dark:     #593F8D;   /* --color-primary-dark */
  --brand-mid:      #8C72C0;   /* --purple-purple-60   */
  --brand-light:    #A995D0;   /* --light-purple       */
  --brand-tint:     rgba(124, 58, 237, .1);   /* --color-secondary-bg */

  --ink:            #2E2E38;   /* --color-text */
  --ink-soft:       #4a4a59;
  --ink-muted:      #77778a;
  --line:           #e4dfea;
  --line-soft:      #f0ecf4;
  --bg:             #ffffff;
  --bg-soft:        #F7F5F9;   /* --color-bg   */
  --bg-tint:        #F2F3F7;   /* --b-100      */
  --bg-footer:      #EEEBF1;
  --accent:         var(--brand);
  --accent-ink:     var(--brand-dark);
  --highlight:      var(--brand-tint);

  /* Тёмная панель кода: глубокий баклажан, чтобы не выпадать из гаммы */
  --code-bg:        #251E33;
  --code-bg-head:   #1C1729;
  --code-ink:       #EDE9F3;
  --code-ink-dim:   #A99FBD;
  --code-str:       #D9C7F2;
  --code-key:       #A995D0;

  --verb-get:       #6F4EAF;
  --verb-post:      #2f7d32;
  --verb-put:       #a06000;
  --verb-delete:    #b3261e;

  --radius:         8px;       /* кнопки и мелкие элементы  */
  --radius-lg:      16px;      /* карточки, как на сайте    */
  --shadow-card:    0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);

  --sidebar-w:      272px;
  --content-max:    1320px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Geologica', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}

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

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

/* ── Шапка ───────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 64px;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.topbar .brand:hover { text-decoration: none; }

/* Логотип — тот же файл, что и на сайте (assets/img/logo.svg) */
.topbar .brand-logo {
  display: block;
  width: 152px;
  height: 28px;
  background: url('img/logo.svg') no-repeat center center;
  background-size: contain;
  font-size: 0;
  line-height: 0;
}

.topbar .brand-sub {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-muted);
  white-space: nowrap;
}

.topbar .brand .badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-tint);
  border-radius: var(--radius);
  padding: 3px 8px;
}

.topbar .spacer { flex: 1; }
.topbar .topnav { display: flex; gap: 22px; font-size: 14px; }
.topbar .topnav a { color: var(--ink-soft); font-weight: 500; }
.topbar .topnav a:hover { color: var(--brand); text-decoration: none; }

.nav-toggle {
  display: none;
  border: 0;
  background: var(--brand-tint);
  color: var(--brand);
  border-radius: var(--radius);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* ── Каркас ──────────────────────────────────────────────────────────────── */

.shell {
  display: flex;
  align-items: flex-start;
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--bg);
}

.sidebar {
  position: sticky;
  top: 64px;
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 28px 20px 60px 24px;
  border-right: 1px solid var(--line);
}

.sidebar h4 {
  margin: 26px 0 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.sidebar h4:first-child { margin-top: 0; }

.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
  display: block;
  padding: 6px 10px;
  margin-left: -10px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.sidebar li a:hover { background: var(--bg-soft); color: var(--brand); text-decoration: none; }
.sidebar li.active > a { background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }

.sidebar .sublist { margin: 2px 0 8px 12px; border-left: 1px solid var(--line); }
.sidebar .sublist a { font-size: 13px; color: var(--ink-muted); padding-left: 12px; margin-left: 0; }

.main {
  flex: 1 1 auto;
  min-width: 0;
  padding: 40px 40px 120px;
}

/* ── Типографика ─────────────────────────────────────────────────────────── */

.main h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.15;
  color: var(--brand-dark);
}
.page-lede {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;   /* Light (300) не поставляем — иначе браузер подделает начертание */
  color: var(--ink-soft);
  max-width: 68ch;
}

.main h2 {
  margin: 56px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--brand-dark);
}
.main h2:first-of-type { border-top: 0; padding-top: 0; }

.main h3 {
  margin: 34px 0 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  color: var(--brand-dark);
}
.main h4 { margin: 24px 0 8px; font-size: 15px; font-weight: 600; }

.main p, .main ul, .main ol { max-width: 68ch; }
.main li { margin: 4px 0; }

.anchor {
  margin-left: 8px;
  color: var(--brand-light);
  font-weight: 400;
  opacity: 0;
  transition: opacity .12s;
}
h2:hover .anchor, h3:hover .anchor { opacity: 1; }

.main :not(pre) > code {
  padding: .12em .38em;
  font-size: .875em;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  color: var(--brand-dark);
  white-space: nowrap;
}

/* ── Врезки ──────────────────────────────────────────────────────────────── */

.callout {
  margin: 18px 0;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--brand);
  background: var(--bg-soft);
  font-size: 15px;
  max-width: 68ch;
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child  { margin-bottom: 0; }
.callout--warn { border-left-color: #b3261e; background: #fdf4f3; }
.callout--tip  { border-left-color: #2f7d32; background: #f4f9f4; }

/* ── Таблицы ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; margin: 12px 0 20px; }

table.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}
table.params th {
  text-align: left;
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
table.params td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
table.params td:last-child, table.params th:last-child { padding-right: 0; }

.p-name  { white-space: nowrap; }
.p-name code { font-size: 13.5px; font-weight: 600; }
.p-type  { white-space: nowrap; color: var(--ink-muted); font-size: 13px; }
.p-type .p-default { display: block; margin-top: 3px; font-size: 12px; }
.p-desc  { color: var(--ink-soft); }
.p-desc p:first-child { margin-top: 0; }
.p-desc p:last-child  { margin-bottom: 0; }
.p-values { margin-top: 6px; font-size: 13px; color: var(--ink-muted); }

.req {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #b3261e;
  vertical-align: 1px;
}

table.errors-mini td { padding-top: 8px; padding-bottom: 8px; }

/* ── HTTP-глаголы ────────────────────────────────────────────────────────── */

.verb {
  display: inline-block;
  min-width: 58px;
  padding: 3px 9px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  color: #fff;
}
.verb--get    { background: var(--verb-get); }
.verb--post   { background: var(--verb-post); }
.verb--put    { background: var(--verb-put); }
.verb--delete { background: var(--verb-delete); }

/* ── Блок эндпоинта: две колонки ─────────────────────────────────────────── */

.endpoint {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}
.endpoint:first-of-type { border-top: 0; }

.endpoint-doc { min-width: 0; }
.endpoint-doc p, .endpoint-doc ul { max-width: none; }

.endpoint-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--brand-dark);
}

.endpoint-route {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.endpoint-route .route {
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 4px 9px;
}

.endpoint-desc { color: var(--ink-soft); }
.endpoint-desc p:first-child { margin-top: 0; }

.params-title {
  margin: 22px 0 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.endpoint-code { min-width: 0; }

/* ── Код ─────────────────────────────────────────────────────────────────── */

.code-card {
  position: sticky;
  top: 88px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-card);
}
.code-card--response { position: static; margin-top: 16px; }

.code-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  background: var(--code-bg-head);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.code-tab {
  appearance: none;
  border: 0;
  background: none;
  padding: 11px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--code-ink-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.code-tab:hover { color: var(--code-ink); }
.code-tab.is-active { color: var(--code-ink); border-bottom-color: var(--brand-light); }
.code-tabs--static .code-tab { cursor: default; }

.http-status {
  margin-left: auto;
  padding-right: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--code-ink-dim);
}
.http-status--ok  { color: #8fd8b0; }
.http-status--err { color: #ff9b8f; }

.code-body {
  display: none;
  position: relative;
  margin: 0;
  padding: 16px 18px;
  max-height: 60vh;
  overflow: auto;
  font-size: 13px;
  line-height: 1.6;
  color: var(--code-ink);
  white-space: pre;
  tab-size: 2;
}
.code-body.is-active { display: block; }
.code-body code { font-size: inherit; color: inherit; }

.copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 5px;
  background: rgba(255,255,255,.06);
  color: var(--code-ink-dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.code-body:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--code-ink); border-color: var(--brand-light); }
.copy-btn.is-done { color: #8fd8b0; border-color: #8fd8b0; opacity: 1; }

/* Отдельно стоящие блоки кода в прозаических страницах */
.main > pre, .callout pre, .prose pre {
  margin: 16px 0;
  padding: 16px 18px;
  max-width: 68ch;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: var(--radius-lg);
  font-size: 13px;
  line-height: 1.6;
}
.main > pre code, .prose pre code { color: inherit; }

/* ── Оглавление раздела ──────────────────────────────────────────────────── */

.section-toc {
  margin: 24px 0 8px;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 32px;
  max-width: 68ch;
}
.section-toc li { break-inside: avoid; margin: 3px 0; font-size: 14.5px; }
.section-toc .verb { min-width: 52px; font-size: 10.5px; margin-right: 6px; }

/* ── Подвал ──────────────────────────────────────────────────────────────── */

.footer {
  background: var(--bg-footer);
  padding: 28px 40px 60px;
  color: var(--ink-soft);
  font-size: 14px;
}
.footer .footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* ── Адаптив ─────────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .endpoint { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .code-card { position: static; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .topbar .topnav { display: none; }
  .topbar .brand-sub { display: none; }
  .sidebar {
    display: none;
    position: fixed;
    top: 64px; left: 0; bottom: 0;
    width: 300px;
    background: var(--bg);
    z-index: 30;
    box-shadow: 0 10px 40px rgba(46,46,56,.18);
  }
  .sidebar.is-open { display: block; }
  .main { padding: 28px 20px 90px; }
  .main h1 { font-size: 30px; }
  .section-toc { columns: 1; }
}
