/* Docs: a documentation layout. Sidebar, article, on-this-page index. Built for reading. */

.dx { display: grid; grid-template-columns: 260px minmax(0, 760px) 200px; justify-content: center; gap: 56px; padding: 110px var(--gutter) 12vh; max-width: 1440px; margin: 0 auto; }

/* Sidebar. */
.dx-side__in { position: sticky; top: 96px; max-height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; padding-right: 6px; }
.dx-search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--hairline); color: var(--grey-2); }
.dx-search:focus-within { box-shadow: 0 0 0 2px var(--gold); }
.dx-search svg { width: 16px; height: 16px; flex: 0 0 auto; }
.dx-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: 400 14.5px var(--sans); color: var(--ink); }
.dx-search kbd { padding: 2px 6px; border-radius: 5px; background: #f3f2ed; font-size: 10.5px; }
.dx-results[hidden] { display: none; }
.dx-results { margin-top: 8px; padding: 6px; border-radius: 14px; background: #fff; box-shadow: var(--sheet-shadow); display: grid; gap: 6px; }
.dx-results__list { list-style: none; margin: 0; padding: 0; display: grid; }
.dx-results__list a { display: grid; gap: 1px; padding: 8px 10px; border-radius: 9px; color: var(--ink); }
.dx-results__list a:hover, .dx-results__list a:focus-visible { background: #f3f2ed; }
.dx-results__list b { font-size: 14px; font-weight: 500; }
.dx-results__list .mono { color: var(--grey-3); font-size: 10.5px; }
.dx-none { padding: 8px 10px; color: var(--grey-2); font-size: 13px; }
.dx-ans { padding: 12px; border-radius: 12px; background: var(--night); color: #e9e6dd; display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }
.dx-ans[hidden] { display: none; }
.dx-ans header { display: flex; align-items: center; gap: 8px; }
.dx-ans header span { width: 24px; height: 24px; border-radius: 50%; background: #f1f0eb; display: grid; place-items: center; color: var(--ink); }
.dx-ans header .monad-svg { width: 18px; height: 18px; }
.dx-ans p { margin: 0; }
.dx-ans code { color: #e9d6a6; font-size: 11.5px; word-break: break-all; }
.dx-ans a { color: var(--gold); font-size: 11px; }
.dx-nav { display: grid; margin-top: 22px; }
.dx-nav__h { margin: 18px 0 6px; padding: 0 10px; color: var(--grey-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.dx-nav__h:first-child { margin-top: 0; }
.dx-nav a { padding: 6px 10px; border-radius: 8px; font-size: 14.5px; color: var(--grey-1); transition: background-color 150ms, color 150ms; }
.dx-nav a:hover { background: rgba(10,10,10,0.04); color: var(--ink); }
.dx-nav a.is-on { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--hairline); font-weight: 500; }
.dx-menu { display: none; }

/* Article. */
.dx-main { min-width: 0; font-size: 16.5px; line-height: 1.7; color: var(--ink-soft); }
.dx-crumb { margin: 0 0 18px; color: var(--grey-3); }
.dx-crumb a { color: var(--grey-2); }
.dx-main h1 { margin: 0; font: 600 clamp(40px, 4.4vw, 60px)/1.02 var(--sans); letter-spacing: -0.045em; color: var(--ink); }
.dx-lead { margin: 18px 0 0; font-size: 19px; line-height: 1.6; color: var(--grey-1); }
.dx-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 30px; }
.dx-card { display: grid; gap: 4px; padding: 18px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px var(--hairline), 0 12px 24px -20px rgba(20,20,30,0.3); color: var(--ink); transition: box-shadow 200ms, transform 200ms var(--ease-out); }
.dx-card .mono { color: #7a6231; font-size: 10.5px; }
.dx-card b { font-size: 17px; letter-spacing: -0.015em; }
.dx-card small { color: var(--grey-2); font-size: 14px; line-height: 1.45; }
@media (hover: hover) and (pointer: fine) { .dx-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--hairline-strong), 0 18px 30px -20px rgba(20,20,30,0.35); } }
.dx-sec { margin-top: 72px; padding-top: 8px; }
.dx-sec h2 { margin: 0 0 12px; font: 600 30px/1.15 var(--sans); letter-spacing: -0.03em; color: var(--ink); }
.dx-sec h3 { margin: 0; font: 600 18px/1.3 var(--sans); letter-spacing: -0.015em; color: var(--ink); }
.dx-sec p { margin: 12px 0 0; }
.dx-main a:not(.dx-card):not(.btn) { color: var(--ink); text-decoration: underline; text-decoration-color: rgba(201,166,97,0.6); text-underline-offset: 3px; }
.dx-main code { padding: 2px 6px; border-radius: 6px; background: #efede7; font: 500 13.5px var(--mono); color: var(--ink); }
.dx-steps { list-style: none; counter-reset: s; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; }
.dx-steps li { counter-increment: s; position: relative; padding-left: 48px; }
.dx-steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 14px var(--sans); background: var(--ink); color: #fff; }
.dx-steps li:not(:last-child)::after { content: ''; position: absolute; left: 14.5px; top: 36px; bottom: -22px; width: 1px; background: var(--hairline-strong); }
.dx-opt { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: #efede7; color: var(--grey-2); font-size: 10.5px; vertical-align: 2px; }
.dx-code { position: relative; margin-top: 14px; border-radius: 14px; background: #12110f; overflow: hidden; box-shadow: 0 0 0 1px rgba(10,10,10,0.08); }
.dx-code__tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.dx-code__tabs button { padding: 5px 11px; border-radius: 8px; font: 500 12.5px var(--sans); color: #8f8b82; cursor: pointer; }
.dx-code__tabs button[aria-selected='true'] { background: rgba(255,255,255,0.08); color: #f1f0eb; }
.dx-code pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; }
.dx-code code { padding: 0; background: none; color: #e9d6a6; font-size: 13px; line-height: 1.65; white-space: pre; }
.dx-copy { position: absolute; right: 8px; top: 7px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.08); color: #f1f0eb; font-size: 11px; cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .dx-copy:hover { background: var(--gold); color: var(--night); } }
.dx-callout { margin-top: 28px !important; padding: 16px 18px; border-radius: 14px; background: rgba(201,166,97,0.1); box-shadow: inset 3px 0 0 var(--gold); font-size: 15.5px; }
.dx-defs { margin: 20px 0 0; display: grid; }
.dx-defs div { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--hairline); }
.dx-defs dt { font-weight: 600; color: var(--ink); }
.dx-defs dd { margin: 0; font-size: 15.5px; }
.dx-table { width: 100%; margin-top: 18px; border-collapse: collapse; font-size: 14.5px; }
.dx-table th { text-align: left; padding: 10px 12px; font: 500 11px var(--mono); color: var(--grey-3); border-bottom: 1px solid var(--hairline-strong); }
.dx-table td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.dx-table td:first-child { white-space: nowrap; }
.dx-table td code { font-size: 12.5px; }
.dx-table--narrow td:nth-child(2) { font: 600 14px var(--mono); color: #7a6231; }
.dx-small { font-size: 14px; color: var(--grey-2); }
.dx-api { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; margin-top: 18px; }
.dx-api__list { list-style: none; margin: 0; padding: 6px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--hairline); display: grid; gap: 2px; align-content: start; }
.dx-api__list button { width: 100%; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 9px 10px; border-radius: 10px; text-align: left; cursor: pointer; }
.dx-api__list button[aria-pressed='true'] { background: #f3f2ed; }
.dx-api__list code { background: none; padding: 0; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dx-api__list small { grid-column: 2; color: var(--grey-2); font-size: 12px; line-height: 1.35; }
.dx-api__io { display: grid; gap: 8px; align-content: start; }
.dx-api__req, .dx-api__res { margin: 0; padding: 14px 16px; border-radius: 14px; background: #12110f; color: #cfcbc1; font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.dx-api__res { min-height: 220px; }
.dx-api__req i, .dx-api__res i { font-style: normal; }
.dx-api__req .c { color: var(--gold); }
.dx-api__req .s, .dx-api__res .s { color: #e9d6a6; }
.dx-api__res .k { color: #9fb8ea; }
.dx-api__res .n { color: #8fd49a; }
.api-ok { color: #8fd49a; }
.api-m { justify-self: start; padding: 2px 7px; border-radius: 5px; font-size: 10px; }
.api-m.is-get { background: rgba(110,192,122,0.16); color: #2f6b3a; }
.api-m.is-post { background: rgba(91,141,239,0.14); color: #2c56a8; }
.dx-guides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.dx-g { padding: 16px 18px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--hairline); }
.dx-g h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.dx-g h3 i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.dx-g ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.dx-g a { font-size: 14.5px; }
.dx-help { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.dx-help div { padding: 18px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--hairline); }
.dx-help b { color: var(--ink); }
.dx-help p { font-size: 14.5px; line-height: 1.55; margin-top: 6px; }

/* On this page. */
.dx-toc > * { position: sticky; }
.dx-toc { align-self: start; position: sticky; top: 110px; }
.dx-toc .mono { margin: 0 0 10px; color: var(--grey-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.dx-toc nav { display: grid; border-left: 1px solid var(--hairline-strong); }
.dx-toc a { padding: 5px 0 5px 14px; margin-left: -1px; font-size: 13.5px; color: var(--grey-2); border-left: 2px solid transparent; transition: color 150ms, border-color 150ms; }
.dx-toc a:hover { color: var(--ink); }
.dx-toc a.is-on { color: var(--ink); border-left-color: var(--gold); }

@media (max-width: 1200px) { .dx { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; } .dx-toc { display: none; } }
@media (max-width: 900px) {
  .dx { grid-template-columns: minmax(0, 1fr); padding: 92px var(--gutter) 10vh; }
  .dx-menu { display: flex; position: fixed; left: 50%; bottom: 18px; translate: -50% 0; z-index: 40; align-items: center; height: 44px; padding: 0 18px; border-radius: 999px; background: var(--ink); color: #fff; font: 600 14px var(--sans); box-shadow: 0 16px 30px -12px rgba(0,0,0,0.5); cursor: pointer; }
  .dx-side { position: fixed; inset: 0 0 0 auto; z-index: 39; width: min(320px, 86vw); padding: 80px 16px 90px; background: var(--canvas); box-shadow: -20px 0 60px -20px rgba(0,0,0,0.3); transform: translateX(105%); transition: transform 350ms var(--ease-out); overflow-y: auto; }
  .dx-side.is-open { transform: none; }
  .dx-side__in { position: static; max-height: none; }
  .dx-main { font-size: 16px; }
  .dx-cards, .dx-guides, .dx-help, .dx-api { grid-template-columns: minmax(0, 1fr); }
  .dx-defs div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  /* Stacked on a phone: each command over what it does, instead of a table that scrolls sideways
     with its descriptions off screen. The narrow tables (group, count, example) still fit as rows. */
  .dx-table:not(.dx-table--narrow) thead { display: none; }
  .dx-table:not(.dx-table--narrow), .dx-table:not(.dx-table--narrow) tbody, .dx-table:not(.dx-table--narrow) tr { display: block; }
  .dx-table:not(.dx-table--narrow) tr { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
  .dx-table:not(.dx-table--narrow) td { display: block; padding: 2px 0; border: 0; }
  .dx-table:not(.dx-table--narrow) td:first-child { white-space: normal; overflow-wrap: anywhere; }
}

/* Docs pages: the real articles. */
.dx-nav__top { font-weight: 600; }
.dx-nav a { font-size: 14px; padding: 5px 10px; }
.dx-article h1 { margin: 0 0 12px; }
.dx-article .dx-lead { margin: 0 0 8px; }
.dx-article h2 { margin: 48px 0 10px; font: 600 26px/1.2 var(--sans); letter-spacing: -0.025em; color: var(--ink); scroll-margin-top: 90px; }
.dx-article h3 { margin: 28px 0 6px; font: 600 18px/1.3 var(--sans); color: var(--ink); }
.dx-article h4 { margin: 20px 0 4px; font-size: 15px; color: var(--ink); }
.dx-article p { margin: 10px 0 0; }
.dx-article ul, .dx-article ol { margin: 10px 0 0; padding-left: 22px; }
.dx-article li { margin: 4px 0; }
.dx-article li::marker { color: var(--gold); }
.dx-article table { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: 14.5px; }
.dx-article th { text-align: left; padding: 9px 10px; font: 500 11px var(--mono); color: var(--grey-3); border-bottom: 1px solid var(--hairline-strong); }
.dx-article td { padding: 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.dx-pre { position: relative; margin-top: 14px; }
.dx-pre pre, .dx-article pre { margin: 0; padding: 16px 18px; border-radius: 14px; background: #12110f; color: #e9d6a6; overflow-x: auto; font: 13px/1.65 var(--mono); }
.dx-article pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
.dx-pre .dx-copy { top: 8px; }
.api-endpoint { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--hairline); }
.api-endpoint > div { min-width: 0; }
.api-endpoint > div:first-child > div:first-child { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.api-endpoint code { font-size: 13px; }
.api-endpoint > div:first-child > div:not(:first-child) > div:first-child:not(:has(pre)) { margin-top: 12px; font: 500 10.5px var(--mono); color: var(--grey-3); letter-spacing: 0.04em; }
.api-endpoint pre { font-size: 12px; }
.api-m.is-patch { background: rgba(201,166,97,0.18); color: #7a6231; }
.api-m.is-delete { background: rgba(180,68,44,0.12); color: #b4442c; }
.api-s { display: inline-block; margin-right: 8px; padding: 2px 7px; border-radius: 5px; font: 600 10.5px var(--mono); }
.api-s.is-2xx { background: rgba(110,192,122,0.16); color: #2f6b3a; }
.api-s.is-4xx, .api-s.is-5xx { background: rgba(180,68,44,0.12); color: #b4442c; }
.dx-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; }
.dx-pager a { display: grid; gap: 2px; padding: 16px 18px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--hairline); color: var(--ink) !important; text-decoration: none !important; font-weight: 600; }
.dx-pager a .mono { font-weight: 400; color: var(--grey-3); font-size: 10.5px; }
.dx-pager .is-next { text-align: right; }
.dx-pager a:hover { box-shadow: 0 0 0 1px var(--hairline-strong), 0 14px 24px -18px rgba(20,20,30,0.3); }
@media (max-width: 900px) { .api-endpoint { grid-template-columns: minmax(0, 1fr); } .dx-pager { grid-template-columns: minmax(0, 1fr); } }

/* ---- Infinite docs (js/dc/infinite.js). ---- */
.dx-chapter + .dx-chapter { padding-top: 8px; }
.dx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 6px; font-size: 11px; color: var(--grey-3); }
.dx-meta__g { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); }
.dx-meta__g::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.dx-meta__b { margin-left: 0; padding: 5px 10px; border: 0; border-radius: 999px; font: inherit; color: var(--ink); background: rgba(10,10,10,0.05); cursor: pointer; transition: background-color 200ms; }
.dx-meta__b:first-of-type { margin-left: auto; }
.dx-meta__b:hover { background: rgba(10,10,10,0.1); }

/* Between two pages: what comes next, and Chip fetching it. */
.dx-next { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 14px; margin: 64px 0 40px; padding: 16px 18px; border-radius: 18px;
  background: color-mix(in srgb, var(--c) 7%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 22%, transparent); }
.dx-next::before { content: ''; position: absolute; left: 0; right: 0; top: -32px; border-top: 1px dashed var(--hairline); pointer-events: none; }
.dx-next__face { width: 40px; height: 40px; }
.dx-next .mono { display: block; font-size: 10.5px; color: var(--grey-3); }
.dx-next b { display: block; font-size: 20px; letter-spacing: -0.02em; margin-top: 2px; }
.dx-next > a { font-size: 11px; color: var(--grey-2); text-decoration: underline; text-underline-offset: 3px; }
.dx-next.is-failed b::after { content: ' · open it from here'; font-weight: 400; color: var(--grey-3); font-size: 14px; }

/* The reading bar, under the nav, in the colour of the page's group. */
.dx-read { position: fixed; left: 0; right: 0; top: 0; z-index: 60; height: 3px; pointer-events: none; }
.dx-read i { display: block; height: 100%; background: var(--c, #c9a661); transform-origin: left; transform: scaleX(var(--k, 0)); }

@media (max-width: 900px) {
  .dx-meta__b:first-of-type { margin-left: 0; }
  .dx-next { grid-template-columns: 34px minmax(0, 1fr); }
  .dx-next > a { grid-column: 2; }
}
