/* Smeltery docs: layout (sidebar, article, "On this page"), prose, pager, search dialog.
   Uses the design system's custom properties from site.css; code blocks (.code / .hl / .code-copy)
   are styled by site.css and only sized here. Mobile first. */

.page-docs { overflow-x: hidden; }

/* Text colours that keep 4.5:1 in both themes (ember / amber / text-3 are too light on the light background). */
.docs-shell, .docs-search { --docs-link: var(--ember, #ff7a1a); --docs-hi: var(--amber, #ffb22e); --docs-faint: var(--text-3, #a08a7c); }
:root[data-theme="light"] .docs-shell, :root[data-theme="light"] .docs-search {
  --docs-link: var(--accent, #c42d14); --docs-hi: var(--copper, #9c5428); --docs-faint: var(--text-2, #5a4436);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .docs-shell, :root:not([data-theme="dark"]) .docs-search {
    --docs-link: var(--accent, #c42d14); --docs-hi: var(--copper, #9c5428); --docs-faint: var(--text-2, #5a4436);
  }
}

/* ---------------------------------------------------------------- shell */

.docs-shell {
  --docs-top: calc(var(--header-h, 64px) + 16px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 40px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.docs-article { min-width: 0; padding-top: 24px; }
.docs-toc { display: none; }

@media (min-width: 900px) {
  .docs-shell { grid-template-columns: 240px minmax(0, 1fr); padding: 0 24px 80px; }
}
@media (min-width: 1200px) {
  .docs-shell { grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 0 48px; padding: 0 32px 96px; }
  .docs-toc { display: block; }
  .docs-toc-inline { display: none; }
}

/* ---------------------------------------------------------------- sidebar */

.docs-sidebar { min-width: 0; padding-top: 16px; }
.docs-sidebar-inner { display: flex; flex-wrap: wrap; gap: 8px; }

.docs-search-btn, .docs-menu-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2, #56382a); border-radius: var(--radius, 10px);
  background: var(--bg-2, #1e1410); color: var(--text-2, #cbb6a8);
  font: 500 14px/1 var(--font-text, system-ui, sans-serif);
  cursor: pointer;
}
.docs-search-btn { flex: 1 1 auto; }
.docs-search-btn span { flex: 1; text-align: left; }
.docs-search-btn:hover, .docs-menu-toggle:hover { color: var(--text, #f6ebe2); border-color: var(--ember, #ff7a1a); }

.docs-kbd, .docs-search kbd {
  display: inline-block; padding: 2px 6px; min-width: 1.6em; text-align: center;
  border: 1px solid var(--line-2, #56382a); border-bottom-width: 2px; border-radius: 6px;
  background: var(--bg-3, #2a1c16); color: var(--text-2, #cbb6a8);
  font: 500 11px/1.4 var(--font-mono, ui-monospace, monospace);
}

.docs-menu-icon, .docs-menu-icon::before, .docs-menu-icon::after {
  display: block; width: 14px; height: 2px; border-radius: 2px; background: currentColor; position: relative;
}
.docs-menu-icon::before, .docs-menu-icon::after { content: ""; position: absolute; left: 0; }
.docs-menu-icon::before { top: -5px; }
.docs-menu-icon::after { top: 5px; }

.docs-nav-panel { flex: 1 0 100%; }
/* Mobile: the navigation folds behind "Menu" once docs.js runs (without JS it stays open). */
.docs-js .docs-nav-panel { display: none; }
.docs-js .docs-sidebar.is-open .docs-nav-panel { display: block; }
.docs-menu-toggle[aria-expanded="true"] { color: var(--text, #f6ebe2); border-color: var(--ember, #ff7a1a); }

.docs-nav {
  margin-top: 8px; padding: 8px 4px 8px 0;
  border-bottom: 1px solid var(--line, #3a2820);
}
.docs-nav-group { margin: 0 0 18px; }
.docs-nav-title {
  margin: 0 0 6px; padding: 0 10px;
  color: var(--text, #f6ebe2);
  font: 700 12px/1.4 var(--font-display, system-ui, sans-serif);
  letter-spacing: .06em; text-transform: uppercase;
}
.docs-nav ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line, #3a2820); margin-left: 10px; }
.docs-nav li { margin: 0; }
.docs-nav a {
  display: block; margin-left: -1px; padding: 5px 10px 5px 14px;
  border-left: 2px solid transparent;
  color: var(--text-2, #cbb6a8); text-decoration: none;
  font: 400 14px/1.45 var(--font-text, system-ui, sans-serif);
  overflow-wrap: anywhere;
}
.docs-nav a:hover { color: var(--text, #f6ebe2); border-left-color: var(--line-2, #56382a); }
.docs-nav a[aria-current="page"] {
  color: var(--docs-link); border-left-color: var(--accent, #ff4a1c); font-weight: 600;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent, #ff4a1c) 12%, transparent), transparent 80%);
}
.docs-nav code { font-family: var(--font-mono, monospace); font-size: .92em; }

@media (min-width: 900px) {
  .docs-menu-toggle { display: none; }
  .docs-js .docs-nav-panel, .docs-nav-panel { display: block; }
  .docs-sidebar-inner {
    position: sticky; top: var(--docs-top);
    display: flex; flex-direction: column; flex-wrap: nowrap;
    max-height: calc(100vh - var(--docs-top)); padding: 8px 0 0;
  }
  .docs-search-btn { flex: none; margin-right: 6px; }
  .docs-nav-panel {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 0 6px 24px 0; scrollbar-width: thin;
  }
  .docs-sidebar { padding-top: 16px; }
  .docs-nav { border-bottom: 0; margin-top: 12px; }
}

/* ---------------------------------------------------------------- article head */

.docs-article-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 8px;
}
.docs-eyebrow {
  margin: 0; color: var(--copper, #d9824a);
  font: 600 13px/1.4 var(--font-text, system-ui, sans-serif); letter-spacing: .04em; text-transform: uppercase;
}
.docs-tools { display: flex; align-items: center; gap: 8px; }
.docs-version {
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--amber, #ffb22e) 45%, transparent);
  background: color-mix(in srgb, var(--amber, #ffb22e) 10%, transparent);
  color: var(--docs-hi); font: 600 12px/1.4 var(--font-mono, monospace);
}
.docs-copy-md {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line-2, #56382a); border-radius: 8px;
  background: var(--bg-2, #1e1410); color: var(--text-2, #cbb6a8);
  font: 500 13px/1 var(--font-text, system-ui, sans-serif); cursor: pointer;
}
.docs-copy-md:hover { color: var(--text, #f6ebe2); border-color: var(--ember, #ff7a1a); }
.docs-copy-md.is-done { color: var(--gold, #ffd76a); border-color: var(--gold, #ffd76a); }

.docs-article h1 {
  margin: 0 0 24px;
  color: var(--text, #f6ebe2);
  font: 800 clamp(30px, 6vw, 44px)/1.12 var(--font-display, system-ui, sans-serif);
  letter-spacing: -.02em; overflow-wrap: anywhere;
  scroll-margin-top: var(--docs-top);
}
.docs-article h1 code { font-family: var(--font-mono, monospace); font-size: .82em; color: var(--docs-link); }

/* "On this page" inside the article below 1200px */
.docs-toc-inline {
  margin: 0 0 28px; border: 1px solid var(--line, #3a2820); border-radius: var(--radius, 10px);
  background: var(--bg-2, #1e1410);
}
.docs-toc-inline summary {
  padding: 10px 14px; cursor: pointer; color: var(--text, #f6ebe2);
  font: 600 14px/1.4 var(--font-text, system-ui, sans-serif);
}
.docs-toc-inline ul { list-style: none; margin: 0; padding: 0 14px 12px; }
.docs-toc-inline li.lvl3 { padding-left: 14px; }
.docs-toc-inline a { display: block; padding: 4px 0; color: var(--text-2, #cbb6a8); text-decoration: none; font-size: 14px; }
.docs-toc-inline a:hover { color: var(--docs-link); }

/* ---------------------------------------------------------------- prose */

.docs-prose {
  color: var(--text, #f6ebe2);
  font: 400 16px/1.72 var(--font-text, system-ui, sans-serif);
  overflow-wrap: anywhere;
}
.docs-article-head, .docs-prose, .docs-pager, .docs-toc-inline { max-width: 52rem; }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose p { margin: 0 0 1.1em; }
.docs-prose strong { color: var(--text, #f6ebe2); font-weight: 700; }

.docs-prose h2, .docs-prose h3, .docs-prose h4 {
  position: relative; color: var(--text, #f6ebe2);
  font-family: var(--font-display, system-ui, sans-serif); letter-spacing: -.01em;
  scroll-margin-top: var(--docs-top);
}
.docs-prose h2 {
  margin: 2.4em 0 .7em; padding-top: 1em; border-top: 1px solid var(--line, #3a2820);
  font-size: clamp(22px, 4vw, 28px); line-height: 1.25; font-weight: 750;
}
.docs-prose h3 { margin: 1.9em 0 .6em; font-size: 20px; line-height: 1.3; font-weight: 700; }
.docs-prose h4 { margin: 1.6em 0 .5em; font-size: 17px; font-weight: 700; }
.docs-prose h2 code, .docs-prose h3 code { font-size: .86em; }

.docs-prose .anchor {
  margin-left: .35em; color: var(--docs-faint); text-decoration: none; font-weight: 400;
  opacity: 0; transition: opacity .15s;
}
.docs-prose h2:hover .anchor, .docs-prose h3:hover .anchor, .docs-prose h4:hover .anchor,
.docs-prose .anchor:focus-visible { opacity: 1; }
.docs-prose .anchor:hover { color: var(--docs-link); }

.docs-prose a { color: var(--docs-link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.docs-prose a:hover { color: var(--docs-hi); }

.docs-prose ul, .docs-prose ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.docs-prose li { margin: .35em 0; }
.docs-prose li > p { margin: 0 0 .6em; }
.docs-prose li::marker { color: var(--copper, #d9824a); }
.docs-prose li.task { list-style: none; position: relative; }
.docs-prose .task-box {
  position: absolute; left: -1.4em; top: .38em; width: 14px; height: 14px;
  border: 1.5px solid var(--copper, #d9824a); border-radius: 4px;
}

.docs-prose :not(pre) > code {
  padding: .12em .38em; border-radius: 5px;
  border: 1px solid var(--line, #3a2820);
  background: var(--bg-2, #1e1410);
  color: var(--gold, #ffd76a);
  font: 500 .86em/1.4 var(--font-mono, ui-monospace, monospace);
  overflow-wrap: anywhere;
}
.docs-prose a code { color: inherit; }

.docs-prose blockquote {
  margin: 1.4em 0; padding: 12px 16px;
  border-left: 3px solid var(--ember, #ff7a1a); border-radius: 0 var(--radius, 10px) var(--radius, 10px) 0;
  background: color-mix(in srgb, var(--ember, #ff7a1a) 8%, var(--bg-2, #1e1410));
  color: var(--text-2, #cbb6a8);
}
.docs-prose blockquote > :last-child { margin-bottom: 0; }

.docs-prose hr { border: 0; border-top: 1px solid var(--line, #3a2820); margin: 2em 0; }

/* Code blocks (styled by site.css): only fit them to the column and keep the scroll inside. */
.docs-prose .code { max-width: 100%; margin: 1.3em 0 1.5em; }
.docs-prose .code pre { overflow-x: auto; max-width: 100%; overflow-wrap: normal; }
.docs-prose .code code { overflow-wrap: normal; white-space: pre; }
.docs-prose li .code { margin: .8em 0 1em; }
/* Pygments' function-name class is "nf"; keep any page-level .nf rule (the 404 page) off code tokens. */
.hl .nf { display: inline; min-height: 0; padding: 0; place-items: normal; text-align: inherit; }

/* Tables */
.docs-prose .table-wrap {
  margin: 1.3em 0 1.6em; max-width: 100%; overflow-x: auto;
  border: 1px solid var(--line, #3a2820); border-radius: var(--radius, 10px);
  background: var(--bg-2, #1e1410);
}
.docs-prose table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.55; }
.docs-prose th, .docs-prose td {
  padding: 9px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line, #3a2820);
  overflow-wrap: normal; word-break: normal;
}
.docs-prose td { min-width: 9em; }
.docs-prose td:first-child { min-width: 0; }
.docs-prose th {
  background: var(--bg-3, #2a1c16); color: var(--text, #f6ebe2);
  font-weight: 700; font-size: 13px; white-space: nowrap;
}
.docs-prose tr:last-child td { border-bottom: 0; }
.docs-prose td code { white-space: nowrap; overflow-wrap: normal; }
.docs-prose td:last-child code { white-space: normal; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- pager */

.docs-pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 56px 0 0; padding-top: 24px; border-top: 1px solid var(--line, #3a2820);
}
.docs-pager a {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 14px 16px; border: 1px solid var(--line, #3a2820); border-radius: var(--radius, 10px);
  background: var(--bg-2, #1e1410); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.docs-pager a:hover { border-color: var(--ember, #ff7a1a); transform: translateY(-1px); }
.docs-pager span { color: var(--docs-faint); font-size: 13px; }
.docs-pager strong { color: var(--text, #f6ebe2); font: 650 15px/1.35 var(--font-display, system-ui, sans-serif); overflow-wrap: anywhere; }
.docs-pager strong code { font-family: var(--font-mono, monospace); font-size: .9em; }
.docs-pager-next { text-align: right; grid-column: 2; }
.docs-pager-prev span::before { content: "\2190\00a0"; }
.docs-pager-next span::after { content: "\00a0\2192"; }

/* ---------------------------------------------------------------- on this page */

.docs-toc-inner {
  position: sticky; top: var(--docs-top);
  max-height: calc(100vh - var(--docs-top)); overflow-y: auto; padding: 32px 0 24px; scrollbar-width: thin;
}
.docs-toc-title {
  margin: 0 0 10px; color: var(--text, #f6ebe2);
  font: 700 12px/1.4 var(--font-display, system-ui, sans-serif); letter-spacing: .06em; text-transform: uppercase;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line, #3a2820); }
.docs-toc li.lvl3 a { padding-left: 24px; font-size: 13px; }
.docs-toc a {
  display: block; margin-left: -1px; padding: 4px 0 4px 12px; border-left: 2px solid transparent;
  color: var(--text-2, #cbb6a8); text-decoration: none; font-size: 13.5px; line-height: 1.45;
  overflow-wrap: anywhere;
}
.docs-toc a:hover { color: var(--text, #f6ebe2); }
.docs-toc a.is-active { color: var(--docs-link); border-left-color: var(--accent, #ff4a1c); }

/* ---------------------------------------------------------------- landing */

.docs-lead { max-width: 70ch; color: var(--text-2, #cbb6a8); font-size: 18px; line-height: 1.6; margin: 0 0 32px; }
.docs-index-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 720px) { .docs-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .docs-index-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.docs-index-group {
  padding: 18px 18px 8px; border: 1px solid var(--line, #3a2820); border-radius: var(--radius-lg, 16px);
  background: var(--bg-2, #1e1410);
}
.docs-index-group h2 {
  margin: 0 0 10px; color: var(--docs-hi);
  font: 700 15px/1.3 var(--font-display, system-ui, sans-serif); letter-spacing: .03em; text-transform: uppercase;
  scroll-margin-top: var(--docs-top);
}
.docs-index-group ul { list-style: none; margin: 0; padding: 0; }
.docs-index-group li { padding: 8px 0; border-top: 1px solid var(--line, #3a2820); }
.docs-index-group li:first-child { border-top: 0; }
.docs-index-group a { color: var(--text, #f6ebe2); font-weight: 650; text-decoration: none; }
.docs-index-group a:hover { color: var(--docs-link); }
.docs-index-group a code { font-family: var(--font-mono, monospace); font-size: .9em; }
.docs-index-group span {
  display: block; margin-top: 2px; color: var(--text-2, #cbb6a8); font-size: 13.5px; line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- search dialog */

.docs-search {
  width: min(680px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 96px));
  margin: 72px auto auto; padding: 0;
  border: 1px solid var(--line-2, #56382a); border-radius: var(--radius-lg, 16px);
  background: var(--bg-2, #1e1410); color: var(--text, #f6ebe2);
  box-shadow: 0 24px 80px rgb(0 0 0 / .55), 0 0 0 1px color-mix(in srgb, var(--accent, #ff4a1c) 15%, transparent);
  overflow: hidden;
}
.docs-search[open] { display: flex; flex-direction: column; }
.docs-search::backdrop { background: rgb(8 4 2 / .6); }

.docs-search-box {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line, #3a2820); color: var(--text-2, #cbb6a8);
}
.docs-search-box input {
  flex: 1; min-width: 0; height: 36px; padding: 0 4px;
  border: 0; outline: 0; background: transparent; color: var(--text, #f6ebe2);
  font: 400 17px/1.3 var(--font-text, system-ui, sans-serif);
}
.docs-search-box input::placeholder { color: var(--docs-faint); }
.docs-search-box input::-webkit-search-cancel-button { display: none; }
.docs-search-close { border: 0; background: none; padding: 4px; cursor: pointer; color: inherit; }

.docs-search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.docs-search-results:empty { display: none; }
.docs-search-results li { margin: 0; }
.docs-search-results a {
  display: block; padding: 10px 12px; border-radius: var(--radius, 10px);
  color: var(--text, #f6ebe2); text-decoration: none; border: 1px solid transparent;
}
.docs-search-results .r-path { display: block; color: var(--docs-faint); font-size: 12px; line-height: 1.4; }
.docs-search-results .r-head { display: block; font-weight: 650; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.docs-search-results .r-text {
  display: block; margin-top: 2px; color: var(--text-2, #cbb6a8); font-size: 13px; line-height: 1.5;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.docs-search-results mark { background: color-mix(in srgb, var(--amber, #ffb22e) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.docs-search-results [aria-selected="true"] a, .docs-search-results a:hover {
  background: color-mix(in srgb, var(--accent, #ff4a1c) 12%, var(--bg-3, #2a1c16));
  border-color: color-mix(in srgb, var(--ember, #ff7a1a) 45%, transparent);
}
.docs-search-results [aria-selected="true"] .r-head { color: var(--docs-link); }
.docs-search-empty { padding: 20px 12px; color: var(--text-2, #cbb6a8); text-align: center; }

.docs-search-foot {
  display: none; gap: 16px; margin: 0; padding: 8px 14px;
  border-top: 1px solid var(--line, #3a2820); color: var(--docs-faint); font-size: 12px;
}
.docs-search-foot span { display: inline-flex; align-items: center; gap: 4px; }
@media (min-width: 640px) { .docs-search-foot { display: flex; } }

/* ---------------------------------------------------------------- focus, a11y, motion */

.docs-shell a:focus-visible, .docs-shell button:focus-visible, .docs-shell summary:focus-visible,
.docs-search a:focus-visible, .docs-search button:focus-visible {
  outline: 2px solid var(--amber, #ffb22e); outline-offset: 2px; border-radius: 6px;
}
.docs-search-box:focus-within { box-shadow: inset 0 -2px 0 var(--ember, #ff7a1a); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .docs-pager a, .docs-prose .anchor { transition: none; }
  .docs-pager a:hover { transform: none; }
}

@media print {
  .docs-sidebar, .docs-toc, .docs-pager, .docs-tools, .docs-toc-inline, .docs-search { display: none !important; }
  .docs-shell { display: block; }
}
