/* ------------------------------------------------------------------
   /docs/ — three-column documentation shell.

   Layout: sidebar | article | on-this-page, on one grid that collapses
   to two columns below 1200px and one below 900px. The base sheet sets
   `border-radius: 0 !important` site-wide, so nothing here is rounded
   on purpose — the square edge is the identity, not an oversight.
   ------------------------------------------------------------------ */

:root {
  --docs-maxw: 1500px;
  --docs-side: 258px;
  --docs-toc: 220px;
  --docs-navh: 81px;    /* the site nav is position:fixed — this is its height */
  --docs-barh: 48px;    /* the docs sub-header under it */
  --docs-code-bg: #17150f;
  --docs-code-ink: #ece4d1;
}

/* The site nav is fixed, so it is out of flow: without this the first line of
   every page sits underneath it. */
.docs-body { background: var(--bone); padding-top: var(--docs-navh); }

/* The base sheet carries a bare `h2 { max-width: 12ch }` for the landing page's
   display headings. Left alone it wraps every docs heading — and every sidebar
   group label — after two words. */
.docs-body h1,
.docs-body h2,
.docs-body h3 { max-width: none; }

/* ----------------------------------------------------------- sub-header */

.docs-subnav {
  position: sticky;
  top: var(--docs-navh);
  z-index: 40;
  background: rgba(245, 239, 223, .94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.docs-subnav-inner {
  max-width: var(--docs-maxw);
  margin: 0 auto;
  height: var(--docs-barh);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.docs-crumbs {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--earth-2);
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.docs-crumbs a { color: var(--earth-2); text-decoration: none; }
.docs-crumbs a:hover { color: var(--ink); }
.docs-crumbs [aria-current="page"] { color: var(--ink); }

/* search trigger — the one control on the page that has to be found instantly */
.docs-searchbtn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  padding: 0 10px 0 12px;
  background: var(--bone-2);
  border: 1px solid var(--line);
  color: var(--earth-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease;
}

.docs-searchbtn:hover { border-color: var(--ink); color: var(--ink); }
.docs-searchbtn kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: var(--bone);
  color: var(--earth-3);
}

.docs-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 11px;
  background: none;
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.docs-menu-icon {
  width: 13px;
  height: 9px;
  border-top: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  position: relative;
}
.docs-menu-icon::after {
  content: "";
  position: absolute;
  inset: 3px 0 auto 0;
  border-top: 1.5px solid currentColor;
}

/* ---------------------------------------------------------------- shell */

.docs-shell {
  max-width: var(--docs-maxw);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--docs-side) minmax(0, 1fr) var(--docs-toc);
  gap: 48px;
  align-items: start;
}

/* --------------------------------------------------------------- sidebar */

.docs-side {
  position: sticky;
  top: calc(var(--docs-navh) + var(--docs-barh));
  max-height: calc(100vh - var(--docs-navh) - var(--docs-barh));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px 0 48px;
  border-right: 1px solid var(--line);
}

.docs-side-inner { padding-right: 20px; }

.docs-navgroup + .docs-navgroup { margin-top: 26px; }

.docs-navtitle {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--earth-3);
  margin: 0 0 9px;
}

.docs-side ul,
.docs-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-side li a {
  display: block;
  padding: 5px 12px;
  margin-left: -12px;
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .12s ease, background .12s ease;
}

.docs-side li a:hover { color: var(--ink); background: rgba(16, 15, 12, .04); }

.docs-side li a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--lime);
  background: var(--lime-soft);
}

.docs-navgroup-out { border-top: 1px solid var(--line); padding-top: 20px; }

/* --------------------------------------------------------------- article */

.docs-main { min-width: 0; padding: 40px 0 76px; }

.docs-article { max-width: 760px; }

.docs-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--earth-3);
  margin-bottom: 14px;
}

.docs-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 4.6vw, 50px);
  line-height: 1.05;
  letter-spacing: -.015em;
  margin: 0 0 18px;
  color: var(--ink);
}

.docs-lede {
  font-size: 19px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0 0 14px;
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.docs-article p { font-size: 16.5px; line-height: 1.72; color: var(--ink-2); margin: 0 0 18px; }
.docs-article a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--earth-2); }
.docs-article a:hover { text-decoration-color: var(--ink); }
.docs-article strong { color: var(--ink); font-weight: 600; }

.docs-h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 27px;
  line-height: 1.22;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 46px 0 16px;
  scroll-margin-top: calc(var(--docs-navh) + var(--docs-barh) + 20px);
}

.docs-h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 32px 0 12px;
  scroll-margin-top: calc(var(--docs-navh) + var(--docs-barh) + 20px);
}

/* the anchor only shows on hover, so headings stay clean when read */
.docs-anchor {
  margin-left: 10px;
  color: var(--earth-2);
  text-decoration: none !important;
  opacity: 0;
  font-weight: 400;
  transition: opacity .12s ease;
}
.docs-h2:hover .docs-anchor,
.docs-h3:hover .docs-anchor,
.docs-anchor:focus-visible { opacity: 1; }

.docs-rule { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }

.docs-list { margin: 0 0 20px; padding-left: 20px; }
.docs-list li { font-size: 16.5px; line-height: 1.7; color: var(--ink-2); margin-bottom: 9px; }
.docs-list li::marker { color: var(--earth-2); }

.docs-article code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--bone-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  color: var(--ink);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ code */

.docs-code {
  position: relative;
  margin: 0 0 24px;
  background: var(--docs-code-bg);
  border: 1px solid var(--dark-3);
}

.docs-code-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: #9a917c;
  padding: 9px 14px;
  border-bottom: 1px solid var(--dark-3);
}

.docs-code-title span { color: #6d6553; text-transform: uppercase; font-size: 10px; letter-spacing: .1em; padding-right: 46px; }

/* the base sheet paints a `pre` with the recessed field colour — inside a dark
   code block that lands as light-on-light, so state it */
.docs-code pre {
  margin: 0;
  padding: 16px 18px;
  overflow-x: auto;
  background: none;
  border: 0;
  color: var(--docs-code-ink);
}

.docs-code code {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.65;
  background: none;
  border: 0;
  padding: 0;
  color: var(--docs-code-ink);
  white-space: pre;
}

.docs-code[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 10px;
  left: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6d6553;
  pointer-events: none;
}
.docs-code[data-lang] pre { padding-top: 30px; }
/* the title bar already carries the language, so the floating chip goes away
   and the code goes back to its normal padding. Both selectors have to match
   `[data-lang]` too, or the rules above out-specify them and the chip lands on
   top of the filename. */
.docs-code-titled[data-lang]::after { content: none; }
.docs-code-titled[data-lang] pre { padding-top: 16px; }

.docs-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .04em;
  padding: 4px 9px;
  background: rgba(245, 239, 223, .1);
  border: 1px solid #3a3529;
  color: #cfc6b0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .14s ease, background .14s ease;
}

.docs-code:hover .docs-copy,
.docs-copy:focus-visible { opacity: 1; }
.docs-copy:hover { background: rgba(245, 239, 223, .18); color: #fff; }
.docs-copy[data-copied] { opacity: 1; color: var(--lime); border-color: var(--lime); }

/* -------------------------------------------------------------- callouts */

.docs-callout {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  background: var(--bone-2);
}

.docs-callout > div { flex: 1; min-width: 0; }
.docs-callout p { margin: 0; font-size: 15.5px; }
.docs-callout p + p { margin-top: 9px; }
.docs-callout p:first-child { color: var(--ink); font-weight: 600; }
.docs-callout p:first-child:last-child { font-weight: 400; color: var(--ink-2); }

.docs-callout-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--earth-3);
  padding-top: 3px;
  flex: 0 0 auto;
}

.docs-callout-note { border-left-color: var(--earth-2); }
.docs-callout-tip { border-left-color: var(--lime); background: var(--lime-soft); }
.docs-callout-tip .docs-callout-tag { color: #6f7726; }
.docs-callout-warning { border-left-color: #b4552f; background: rgba(180, 85, 47, .07); }
.docs-callout-warning .docs-callout-tag { color: #93451f; }

/* ---------------------------------------------------------------- tables */

.docs-tablewrap { overflow-x: auto; margin: 0 0 26px; border: 1px solid var(--line); }

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  background: var(--bone);
}

.docs-table th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--earth-3);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bone-2);
  white-space: nowrap;
}

.docs-table td {
  padding: 13px 16px;
  vertical-align: top;
  color: var(--ink-2);
  line-height: 1.6;
  border-bottom: 1px solid var(--line);
}

.docs-table tr:last-child td { border-bottom: 0; }
.docs-table td:first-child { color: var(--ink); }

/* ------------------------------------------------------------------ tabs */

.docs-tabs { margin: 0 0 26px; border: 1px solid var(--line); }

.docs-tablist {
  display: flex;
  flex-wrap: wrap;
  background: var(--bone-2);
  border-bottom: 1px solid var(--line);
}

.docs-tablist button {
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--earth-2);
  cursor: pointer;
}

.docs-tablist button:hover { color: var(--ink); }
.docs-tablist button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--lime); background: var(--bone); }

.docs-tabpanel { padding: 22px 20px 4px; }
.docs-tabpanel > :last-child { margin-bottom: 18px; }

/* ----------------------------------------------------------------- steps */

.docs-steps { list-style: none; margin: 0 0 26px; padding: 0; counter-reset: step; }

.docs-steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 46px;
  border-left: 1px solid var(--line);
  margin-left: 13px;
}

.docs-steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }

.docs-steps > li::before {
  content: counter(step);
  position: absolute;
  left: -14px;
  top: -2px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  background: var(--bone);
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.docs-step-title { display: block; font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.docs-steps > li > :last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- cards */

/* Each card carries its own border rather than the grid painting one through
   a 1px gap: a row that does not fill leaves empty cells, and a painted grid
   shows them as stray blocks of colour. */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 12px;
  margin: 0 0 30px;
}

.docs-card {
  display: block;
  padding: 18px 20px;
  background: var(--bone);
  border: 1px solid var(--line);
  text-decoration: none !important;
  transition: background .14s ease, border-color .14s ease;
}

.docs-card:hover { border-color: var(--ink); }

.docs-card:hover { background: var(--bone-2); }
.docs-card-title { display: block; font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.docs-card-title::after { content: " →"; color: var(--earth-2); }
.docs-card-text { display: block; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }

/* ------------------------------------------------------- feedback + pager */

.docs-feedback {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 52px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  font-size: 14.5px;
  color: var(--earth-2);
}

.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 26px; }

.docs-pagerlink {
  display: block;
  padding: 16px 18px;
  background: var(--bone);
  text-decoration: none !important;
  transition: background .14s ease;
}

a.docs-pagerlink:hover { background: var(--bone-2); }
.docs-pagerlink span { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--earth-3); margin-bottom: 5px; }
.docs-pagerlink strong { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.docs-pagerlink-next { text-align: right; }
.docs-pagerlink-empty { background: var(--bone); }

/* --------------------------------------------------------- on this page */

.docs-toc {
  position: sticky;
  top: calc(var(--docs-navh) + var(--docs-barh));
  max-height: calc(100vh - var(--docs-navh) - var(--docs-barh));
  overflow-y: auto;
  padding: 40px 0 48px;
}

.docs-toc li a {
  display: block;
  padding: 4px 0 4px 12px;
  margin-left: -1px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--earth-2);
  text-decoration: none;
  transition: color .12s ease, border-color .12s ease;
}

.docs-toc li a:hover { color: var(--ink); }
.docs-toc li a[data-active] { color: var(--ink); border-left-color: var(--ink); }
.docs-toc-l3 a { padding-left: 24px; font-size: 13px; }

/* ---------------------------------------------------------------- search */

.docs-searchmodal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(16, 15, 12, .42);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: min(14vh, 120px) 20px 20px;
}

/* an author `display: flex` outranks the UA's [hidden] rule, so state it */
.docs-searchmodal[hidden] { display: none; }

.docs-searchbox {
  width: min(640px, 100%);
  background: var(--bone);
  border: 1px solid var(--ink);
  box-shadow: 14px 18px 0 -4px rgba(16, 15, 12, .18);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

#docsSearchInput {
  font: inherit;
  font-size: 17px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bone);
  color: var(--ink);
  outline: none;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

#docsSearchInput::placeholder { color: var(--earth-3); }

.docs-searchresults { overflow-y: auto; flex: 1; }

.docs-hit {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font: inherit;
  color: var(--ink-2);
  cursor: pointer;
  text-decoration: none !important;
}

.docs-hit:last-child { border-bottom: 0; }
.docs-hit[data-active] { background: var(--lime-soft); }
.docs-hit-title { display: block; font-size: 15px; color: var(--ink); font-weight: 600; }
.docs-hit-title em,
.docs-hit-text em { font-style: normal; background: var(--lime); padding: 0 2px; }
.docs-hit-crumb { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--earth-3); margin-bottom: 3px; }
.docs-hit-text { display: block; font-size: 13.5px; line-height: 1.5; color: var(--earth-2); margin-top: 3px; }
.docs-searchempty { padding: 22px 18px; font-size: 14.5px; color: var(--earth-2); }

.docs-searchfoot {
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: var(--bone-2);
  font-size: 11.5px;
  color: var(--earth-3);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.docs-searchfoot kbd { font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); background: var(--bone); padding: 2px 5px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1200px) {
  .docs-shell { grid-template-columns: var(--docs-side) minmax(0, 1fr); gap: 40px; }
  .docs-toc { display: none; }
}

@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 20px; }
  .docs-menu-btn { display: inline-flex; }
  .docs-crumbs { display: none; }

  /* the sidebar becomes a drawer under the sub-header */
  .docs-side {
    display: none;
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px 0 26px;
  }

  .docs-side[data-open] { display: block; }
  .docs-side-inner { padding-right: 0; }
  .docs-main { padding: 28px 0 60px; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-searchbtn-label { display: none; }
  .docs-searchbtn { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .docs-copy, .docs-card, .docs-hit, .docs-side li a { transition: none; }
}
