/* Evil6 – docs layout (sidebar · content · on-page TOC). Tokens come from site.css. */

.docs-shell { max-width: 1320px; }
.docs-layout {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 210px;
  gap: 48px;
  padding: 40px 0 72px;
  align-items: start;
}

/* ---------- Sidebar ---------- */

.docs-sidebar {
  position: sticky; top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px);
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
}
.docs-menu-toggle { display: none; }
.docs-nav { display: grid; gap: 22px; font-size: 0.93rem; }
.docs-nav-home {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--text-muted); font-weight: 600;
}
.docs-nav-home:hover { color: #fff; background: var(--surface); text-decoration: none; }
.docs-nav-title {
  margin: 0 0 6px; padding: 0 12px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim);
}
.docs-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.docs-nav li a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 8px;
  color: var(--text-muted); border-left: 2px solid transparent;
}
.docs-nav li a:hover { color: #fff; background: var(--surface); text-decoration: none; }
.docs-nav li a[aria-current="page"] {
  color: #fff; background: var(--accent-soft);
  border-left-color: var(--accent);
  border-radius: 0 8px 8px 0;
}

/* ---------- Main column ---------- */

.docs-main { min-width: 0; }
.docs-breadcrumb ol {
  display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 20px; padding: 0;
  font-size: 0.85rem; color: var(--text-dim);
}
.docs-breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--text-dim); }
.docs-breadcrumb a { color: var(--text-muted); }
.docs-breadcrumb [aria-current] { color: var(--text-muted); }

.docs-header { padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--border); }
.docs-header-icon {
  display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 18px;
  font-size: 1.6rem; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.docs-header h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 12px; }
.docs-header .lead { margin: 0; }

.docs-content { overflow-wrap: break-word; }
.docs-content h2, .docs-content h3 { scroll-margin-top: calc(var(--header-h) + 20px); }
.docs-content h2 { padding-top: 24px; border-top: 1px solid var(--border); }
.docs-content > h2:first-child { border-top: 0; padding-top: 0; }
.heading-anchor {
  margin-left: 6px; color: var(--text-dim); font-weight: 400;
  text-decoration: none !important; opacity: 0; transition: opacity 0.15s;
}
h2:hover > .heading-anchor, h3:hover > .heading-anchor, .heading-anchor:focus { opacity: 1; }
.heading-anchor:hover { color: var(--accent-hover); }

.docs-content .table-wrap { margin: 1.2em 0 1.6em; }
.docs-content .table td { line-height: 1.55; }
.docs-content .dc { margin: 1.4em 0 1.8em; }
.dc.dc-single { grid-template-columns: minmax(0, 1fr); }
.docs-content .card { margin: 0; }
.docs-content .grid { margin: 1.2em 0 1.6em; }
.docs-content .card h4 { margin: 0 0 6px; }
.docs-content .card p { margin: 0; }

.docs-example-label {
  display: block; margin: 1.4em 0 -0.8em;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
}

/* Command tables */
.cmd-table td { vertical-align: middle; }
.cmd-cell { min-width: 190px; }
.cmd-args { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-dim); white-space: nowrap; }
.perm-cell { white-space: nowrap; }
@media (max-width: 640px) {
  .cmd-table thead { display: none; }
  .cmd-table, .cmd-table tbody, .cmd-table tr, .cmd-table td { display: block; width: 100%; }
  .cmd-table tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .cmd-table tr:last-child { border-bottom: 0; }
  .cmd-table td { padding: 2px 0; border: 0; min-width: 0; }
  .cmd-table td.perm-cell { padding-top: 6px; }
  .cmd-args { white-space: normal; }
}

/* Steps */
.docs-steps { list-style: none; counter-reset: step; padding: 0 !important; margin: 1.4em 0 1.8em; display: grid; gap: 14px; }
.docs-steps > li {
  counter-increment: step; position: relative; margin: 0;
  padding: 16px 18px 16px 62px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.docs-steps > li::before {
  content: counter(step);
  position: absolute; left: 16px; top: 16px;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font: 700 0.9rem/1 var(--font-display);
}
.docs-steps > li > strong:first-child { display: block; margin-bottom: 4px; }
.docs-steps > li > :last-child { margin-bottom: 0; }

/* Key/value facts inside prose */
.docs-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 1em 0 1.4em; }
.docs-kv dt { margin: 0; }
.docs-kv dd { margin: 0; }
@media (max-width: 520px) { .docs-kv { grid-template-columns: 1fr; gap: 2px; } .docs-kv dd { margin-bottom: 10px; } }

/* Status marks in tables */
.mark-yes { color: var(--ok); font-weight: 700; }
.mark-no { color: var(--text-dim); font-weight: 700; }

/* ---------- Pager ---------- */

.docs-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border);
}
.docs-pager-link {
  display: grid; gap: 4px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 0.92rem;
  transition: border-color 0.2s, background 0.2s;
}
.docs-pager-link strong { color: #fff; }
.docs-pager-link:hover { text-decoration: none; border-color: var(--accent-line); background: var(--surface-2); }
.docs-pager-link.is-next { text-align: right; grid-column: 2; }
@media (max-width: 520px) {
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager-link.is-next { grid-column: auto; }
}

/* ---------- On-page TOC ---------- */

.docs-toc {
  position: sticky; top: calc(var(--header-h) + 24px);
  max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto;
  font-size: 0.86rem;
}
.docs-toc-title {
  margin: 0 0 10px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim);
}
.docs-toc ul { list-style: none; margin: 0 0 28px; padding: 0; border-left: 1px solid var(--border); }
.docs-toc li a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px;
  color: var(--text-muted); border-left: 2px solid transparent; line-height: 1.4;
}
.docs-toc li.toc-l3 a { padding-left: 26px; font-size: 0.83rem; }
.docs-toc li a:hover { color: #fff; text-decoration: none; }
.docs-toc li a.is-active { color: #fff; border-left-color: var(--accent); }
.docs-toc-help { display: grid; gap: 4px; padding-top: 16px; border-top: 1px solid var(--border); }
.docs-toc-help p { margin: 0 0 2px; }

/* ---------- Command reference ---------- */

.cmd-search { position: relative; margin: 0 0 8px; }
.cmd-search .input { padding-left: 40px; min-height: 48px; font-size: 1rem; }
.cmd-search::before {
  content: ""; position: absolute; left: 15px; top: 50%; width: 13px; height: 13px;
  border: 2px solid var(--text-dim); border-radius: 50%; transform: translateY(-62%);
  pointer-events: none;
}
.cmd-search::after {
  content: ""; position: absolute; left: 27px; top: 29px; width: 7px; height: 2px;
  background: var(--text-dim); transform: rotate(45deg); pointer-events: none;
}
.cmd-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.cmd-filters button {
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted);
  font: 600 0.8rem/1.2 var(--font-sans);
}
.cmd-filters button[aria-pressed="true"] { background: var(--surface-3); color: #fff; border-color: var(--border-strong); }
.cmd-empty { padding: 20px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.cmd-group-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap;
  margin-top: 2.4em; padding-top: 24px; border-top: 1px solid var(--border);
}
.docs-content .cmd-group-head h2 { margin: 0; padding: 0; border: 0; }
.cmd-group-head a { font-size: 0.88rem; }
[data-cmd-group][hidden], [data-cmd-row][hidden] { display: none !important; }

/* ---------- Overview ---------- */

.docs-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; list-style: none; margin: 28px 0 0; padding: 0; color: var(--text-muted); }
.docs-facts strong { font: 700 1.5rem/1 var(--font-display); color: #fff; margin-right: 4px; }
.docs-home-section { padding-top: 0; }
.docs-home-title { font-size: 1.35rem; margin: 48px 0 18px; }
.docs-home-section .container > .docs-home-title:first-child { margin-top: 0; }
.docs-card h3 { font-size: 1.08rem; }
.docs-card p { margin: 0; font-size: 0.92rem; }
.docs-home-callout { margin: 24px 0 0; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .docs-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 40px; }
  .docs-toc { display: none; }
}
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 20px; }
  .docs-sidebar {
    position: static; max-height: none; overflow: visible; padding: 0;
    margin-bottom: 24px;
  }
  .docs-menu-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    min-height: 48px; padding: 10px 16px;
    background: var(--surface); color: #fff; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    font: 600 0.92rem/1.3 var(--font-sans); text-align: left;
  }
  .docs-menu-current { color: var(--text-muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .docs-menu-toggle::after {
    content: ""; flex: none; width: 8px; height: 8px;
    border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
    transform: rotate(45deg) translateY(-3px); transition: transform 0.2s;
  }
  .docs-menu-toggle[aria-expanded="true"]::after { transform: rotate(-135deg) translateY(-2px); }
  .js .docs-nav { display: none; }
  .js .docs-nav.is-open { display: grid; }
  .docs-nav {
    margin-top: 8px; padding: 16px 8px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  }
}

@media (max-width: 640px) {
  .docs-content .table th, .docs-content .table td { padding: 10px 12px; }
  .docs-content .table .badge { white-space: normal; text-align: center; }
}
