/* docs.minimus.tv — on top of minimus.tv's site.css (tokens, type, header,
 * buttons). Only what a documentation page adds lives here: the three
 * columns, prose, code, callouts, steps, tabs, cards and the API reference.
 * Colours come from site.css's tokens; the few added below are defined for
 * both themes, like site.css's own. */

:root {
  --code-bg: #121722;
  --code-ink: #e8ecf2;
  --code-muted: #9aa4b5;
  --code-rule: #263045;
  --tint: color-mix(in srgb, var(--ink) 5%, var(--paper));
  --m-get: #00708a;
  --m-post: #17703a;
  --m-put: #7a5c00;
  --m-delete: #b0281f;
  --sidebar: 248px;
  --toc: 208px;
  --header-h: 68px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --code-bg: #070b14;
    --m-get: #22c3e6;
    --m-post: #3ccb6e;
    --m-put: #f2cc2e;
    --m-delete: #f05a4e;
  }
}
:root[data-theme="dark"] {
  --code-bg: #070b14;
  --m-get: #22c3e6;
  --m-post: #3ccb6e;
  --m-put: #f2cc2e;
  --m-delete: #f05a4e;
}

html { scroll-padding-top: calc(var(--header-h) + 16px); }
body.docs { font-size: 1rem; }

/* ── Header ────────────────────────────────────────────────────────── */

.docs .site-header .wrap { gap: 20px; }
.docs-wrap { width: min(100% - 2 * var(--gutter), 1440px); }
.docs-tag {
  font-size: 0.82rem; font-weight: 650; color: var(--muted); border: 1px solid var(--rule-strong);
  border-radius: 999px; padding: 2px 9px; margin-left: 2px; letter-spacing: 0.01em;
}
.docs-tabs { display: flex; gap: 4px; margin-left: 8px; }
.docs-tabs a, .sidebar-tabs a {
  text-decoration: none; color: var(--muted); font-size: 0.95rem; padding: 8px 12px; border-radius: 999px;
}
.docs-tabs a:hover, .sidebar-tabs a:hover { color: var(--ink); }
.docs-tabs a[aria-current="page"], .sidebar-tabs a[aria-current="page"] { color: var(--ink); background: var(--tint); font-weight: 650; }
.header-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.header-link { color: var(--muted); text-decoration: none; font-size: 0.95rem; white-space: nowrap; }
.header-link:hover { color: var(--ink); }
.docs-menu-toggle { display: none; }

/* Search */
.search { position: relative; }
.search input {
  font: inherit; font-size: 0.95rem; width: 220px; min-height: 40px; padding: 0 14px;
  color: var(--ink); background: var(--raised); border: 1px solid var(--rule-strong); border-radius: 999px;
}
.search input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(460px, calc(100vw - 2 * var(--gutter)));
  max-height: min(70vh, 520px); overflow-y: auto; z-index: 40; padding: 6px;
  background: var(--raised); border: 1px solid var(--rule-strong); border-radius: 12px;
  box-shadow: 0 24px 48px -28px color-mix(in srgb, var(--ink) 55%, transparent);
}
.search-results a {
  display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--ink);
}
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--tint); }
.search-results .r-title { display: flex; gap: 8px; align-items: baseline; font-weight: 650; }
.search-results .r-where { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 2px; overflow-wrap: anywhere; }
.search-results .r-none { padding: 12px; color: var(--muted); }

/* ── Three columns ─────────────────────────────────────────────────── */

.docs-layout {
  width: min(100% - 2 * var(--gutter), 1440px);
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  gap: clamp(24px, 3vw, 48px); align-items: start;
}
.docs-layout:not(:has(.toc)) { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.docs-layout.is-wide { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.docs-layout.is-wide .toc { display: none; }

.docs-sidebar {
  position: sticky; top: var(--header-h); max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: 28px 8px 40px 0; font-size: 0.93rem; overscroll-behavior: contain;
}
.sidebar-tabs { display: none; }
.nav-group + .nav-group { margin-top: 22px; }
.nav-group-title {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 6px 10px;
}
.docs-sidebar ul { list-style: none; margin: 0; padding: 0; }
.docs-sidebar a {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 8px;
  color: color-mix(in srgb, var(--ink) 80%, var(--paper)); text-decoration: none; line-height: 1.35;
}
.docs-sidebar a:hover { color: var(--ink); background: var(--tint); }
.docs-sidebar a[aria-current="page"] { color: var(--ink); background: var(--tint); font-weight: 650; box-shadow: inset 3px 0 0 var(--ink); }
.nav-sub { margin: 2px 0 6px 10px !important; padding-left: 8px !important; border-left: 1px solid var(--rule) !important; }
.nav-sub a { font-size: 0.86rem; padding: 5px 8px; }
.nav-sub .method { font-size: 0.62rem; min-width: 3.6em; }

.docs-main { min-width: 0; padding: 36px 0 56px; }
.toc {
  position: sticky; top: var(--header-h); padding: 36px 0 24px; font-size: 0.86rem;
  max-height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.toc-title { font-weight: 700; margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
.toc li a { display: block; padding: 4px 0 4px 12px; color: var(--muted); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.toc li.l3 a { padding-left: 24px; }
.toc li a:hover, .toc li a.is-here { color: var(--ink); border-left-color: var(--ink); }

@media (max-width: 1180px) {
  .docs-layout, .docs-layout:not(:has(.toc)) { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1020px) {
  .docs-tabs, .header-link { display: none; }
  .docs-menu-toggle { display: grid; }
  .docs-layout, .docs-layout:not(:has(.toc)), .docs-layout.is-wide { grid-template-columns: minmax(0, 1fr); }
  .docs-sidebar {
    display: none; position: fixed; inset: var(--header-h) 0 0 0; z-index: 30; max-height: none;
    padding: 16px var(--gutter) 40px; background: var(--paper); border-top: 1px solid var(--rule);
  }
  .docs-sidebar.is-open { display: block; }
  .sidebar-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
  .docs-main { padding-top: 24px; }
}
@media (max-width: 560px) {
  .search input { width: 132px; }
  .search input:focus { width: min(220px, 52vw); }
  .docs-tag { display: none; }
  .docs .site-header .wrap { gap: 8px; }
  .header-tools { gap: 6px; }
}

/* ── Prose ─────────────────────────────────────────────────────────── */

.prose-doc { max-width: 76ch; }
.prose-doc h1 {
  font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 780; letter-spacing: -0.02em;
  font-variation-settings: "wdth" 112; line-height: 1.1; overflow-wrap: anywhere;
}
.prose-doc .lede { margin-top: 14px; max-width: 62ch; font-size: 1.12rem; }
.prose-doc h2 {
  font-size: 1.5rem; font-weight: 740; margin: 48px 0 12px; font-variation-settings: "wdth" 108;
  padding-top: 20px; border-top: 1px solid var(--rule);
}
.prose-doc h3 { font-size: 1.15rem; margin: 30px 0 8px; }
.prose-doc h4 { font-size: 1rem; margin: 22px 0 6px; }
.prose-doc h2 + h3 { margin-top: 18px; }
.prose-doc p, .prose-doc ul, .prose-doc ol, .prose-doc .table-scroll, .prose-doc figure.code,
.prose-doc .tabs, .prose-doc .code-group, .prose-doc .cards, .prose-doc details, .prose-doc aside.callout { margin: 14px 0 0; }
.prose-doc ul, .prose-doc ol { padding-left: 1.3em; }
.prose-doc li + li { margin-top: 6px; }
.prose-doc li > p { margin-top: 6px; }
.prose-doc a { text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent); }
.prose-doc a:hover { text-decoration-color: var(--ink); }
.prose-doc strong { font-weight: 680; }
.anchor {
  margin-left: 8px; color: var(--rule-strong); text-decoration: none; font-weight: 400; opacity: 0;
}
h2:hover > .anchor, h3:hover > .anchor, h4:hover > .anchor, .anchor:focus-visible { opacity: 1; }
.prose-doc :not(pre) > code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.88em;
  background: var(--tint); border: 1px solid var(--rule); border-radius: 5px; padding: 0.08em 0.36em;
  overflow-wrap: anywhere;
}
.prose-doc hr { border: 0; border-top: 1px solid var(--rule); margin: 32px 0; }
.prose-doc img { border-radius: 10px; border: 1px solid var(--rule); }

.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; }
.prose-doc table { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
.prose-doc th, .prose-doc td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
.prose-doc th { background: var(--tint); font-weight: 680; }
.prose-doc tr:last-child td { border-bottom: 0; }

/* ── Code ──────────────────────────────────────────────────────────── */

figure.code {
  position: relative; margin: 0; background: var(--code-bg); color: var(--code-ink);
  border: 1px solid var(--code-rule); border-radius: 12px; overflow: hidden;
}
figure.code figcaption {
  font-size: 0.8rem; color: var(--code-muted); padding: 8px 14px; border-bottom: 1px solid var(--code-rule);
}
figure.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
figure.code code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.6;
  white-space: pre;
}
.copy {
  position: absolute; top: 6px; right: 6px; font: inherit; font-size: 0.75rem; font-weight: 650;
  color: var(--code-muted); background: var(--code-bg); border: 1px solid var(--code-rule); border-radius: 999px;
  padding: 4px 10px; cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
figure.code:hover .copy, .copy:focus-visible, .copy.is-done { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }
.copy:hover { color: var(--code-ink); }
.hljs-keyword, .hljs-built_in, .hljs-literal, .hljs-attr { color: #22c3e6; }
.hljs-string, .hljs-meta .hljs-string { color: #3ccb6e; }
.hljs-number, .hljs-variable, .hljs-template-variable { color: #f2cc2e; }
.hljs-comment { color: var(--code-muted); font-style: italic; }
.hljs-title, .hljs-section, .hljs-name { color: #8ea4ff; }
.hljs-params, .hljs-subst { color: var(--code-ink); }
.hljs-meta, .hljs-symbol { color: #e04bc0; }

/* ── Tabs and code groups ──────────────────────────────────────────── */

.tab-list { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); margin-bottom: 14px; }
.tab-list button {
  font: inherit; font-size: 0.92rem; color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; min-height: 44px;
}
.tab-list button:hover { color: var(--ink); }
.tab-list button[aria-selected="true"] { color: var(--ink); font-weight: 650; border-bottom-color: var(--ink); }
.tabs.is-ready .tab-title { display: none; }
.tabs.is-ready > .tab-panel:not(.is-active) { display: none; }
.tabs .tab-panel > :first-child, .tabs .tab-panel > h4 + * { margin-top: 0; }

.code-group { background: var(--code-bg); border: 1px solid var(--code-rule); border-radius: 12px; overflow: hidden; }
.code-group > .tab-list { margin: 0; padding: 0 8px; border-bottom-color: var(--code-rule); }
.code-group > .tab-list button { color: var(--code-muted); font-size: 0.82rem; min-height: 40px; }
.code-group > .tab-list button[aria-selected="true"] { color: var(--code-ink); border-bottom-color: var(--code-ink); }
.code-group figure.code, .prose-doc .code-group figure.code { border: 0; border-radius: 0; margin: 0; }
.code-group.is-ready figure.code:not(.is-active) { display: none; }
.code-group.is-ready figure.code figcaption { display: none; }
.code-group figure.code + figure.code { border-top: 1px solid var(--code-rule); }
.code-group.is-ready figure.code + figure.code { border-top: 0; }

/* ── Callouts, steps, cards, accordions ────────────────────────────── */

aside.callout {
  padding: 14px 16px 14px 18px; border-radius: 10px; background: var(--raised);
  border: 1px solid var(--rule); border-left: 4px solid var(--accent, var(--c-data));
}
aside.callout > :first-child { margin-top: 0; }
aside.callout.tip, aside.callout.check { --accent: var(--c-guide); }
aside.callout.info { --accent: var(--c-apps); }
aside.callout.warning { --accent: var(--c-source); }
aside.callout.note { --accent: var(--c-data); }

ol.doc-steps { list-style: none; padding: 0; counter-reset: step; }
ol.doc-steps > li.doc-step { position: relative; padding: 0 0 6px 44px; counter-increment: step; }
ol.doc-steps > li.doc-step + li.doc-step { margin-top: 18px; }
ol.doc-steps > li.doc-step::before {
  content: counter(step); position: absolute; left: 0; top: -1px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 750; font-size: 0.88rem;
  background: var(--ink); color: var(--paper);
}
ol.doc-steps > li.doc-step:not(:last-child)::after {
  content: ""; position: absolute; left: 13.5px; top: 34px; bottom: -14px; width: 1px; background: var(--rule-strong);
}
.step-title { font-weight: 700; font-size: 1.05rem; margin: 0 !important; }

.cards { display: grid; gap: 12px; }
.cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .cards.cols-2, .cards.cols-3 { grid-template-columns: 1fr; } }
.card {
  position: relative; padding: 16px 18px; border: 1px solid var(--rule-strong); border-radius: 12px;
  background: var(--raised); color: var(--ink);
}
.card:has(a.card-title):hover { border-color: var(--ink); }
.card-title { display: block; font-weight: 700; color: var(--ink); text-decoration: none !important; }
a.card-title::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
a.card-title:focus-visible { outline: none; }
a.card-title:focus-visible::after { outline: 2px solid var(--focus); outline-offset: 2px; }
.card p { margin: 6px 0 0 !important; color: var(--muted); font-size: 0.94rem; }

details.accordion { border: 1px solid var(--rule); border-radius: 10px; background: var(--raised); }
details.accordion + details.accordion { margin-top: 8px; }
details.accordion summary { cursor: pointer; padding: 12px 16px; font-weight: 650; min-height: 44px; }
details.accordion > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.accordion > :last-child { margin-bottom: 14px; }

/* ── Pager and footer ──────────────────────────────────────────────── */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager a {
  display: block; padding: 14px 16px; border: 1px solid var(--rule-strong); border-radius: 12px;
  text-decoration: none; color: var(--ink); font-weight: 650;
}
.pager a:hover { border-color: var(--ink); }
.pager span { display: block; font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.pager .next { text-align: right; grid-column: 2; }
.docs-footer { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); font-size: 0.9rem; color: var(--muted); max-width: 76ch; }
.docs-footer p + p { margin-top: 6px; }
.docs-footer a { color: inherit; }

/* ── API reference ─────────────────────────────────────────────────── */

.method {
  display: inline-block; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.72rem; font-weight: 750; letter-spacing: 0.02em; padding: 2px 6px; border-radius: 5px;
  min-width: 4.2em; text-align: center; flex: none;
  color: var(--m); background: color-mix(in srgb, var(--m) 13%, transparent);
}
.method.get { --m: var(--m-get); }
.method.post { --m: var(--m-post); }
.method.put, .method.patch { --m: var(--m-put); }
.method.delete { --m: var(--m-delete); }

.op-list { list-style: none; padding: 0 !important; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-top: 24px !important; }
.op-list li + li { margin: 0; border-top: 1px solid var(--rule); }
.op-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 12px 16px; text-decoration: none !important; color: var(--ink); align-items: baseline; }
.op-row:hover { background: var(--tint); }
.op-summary { font-weight: 650; }
.op-path { grid-column: 2; color: var(--muted); font-size: 0.82rem; background: none !important; border: 0 !important; padding: 0 !important; overflow-wrap: anywhere; }

.op { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr); gap: clamp(24px, 3vw, 44px); align-items: start; }
.prose-doc:has(.op) { max-width: none; }
.op-main { min-width: 0; max-width: 72ch; }
.op-aside { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 14px; min-width: 0; }
.op-aside figure.code pre { max-height: 420px; }
@media (max-width: 1280px) { .op { grid-template-columns: minmax(0, 1fr); } .op-aside { position: static; } }
.eyebrow { font-size: 0.85rem; font-weight: 650; color: var(--muted); margin: 0 0 6px !important; }
.eyebrow a { color: inherit; text-decoration: none; }
.endpoint {
  display: flex; gap: 10px; align-items: center; margin-top: 16px; padding: 10px 12px;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 10px; overflow-x: auto;
}
.endpoint code { background: none !important; border: 0 !important; padding: 0 !important; font-size: 0.9rem; white-space: nowrap; }
.scope-line { color: var(--muted); font-size: 0.94rem; }
.scope {
  display: inline-block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 999px; margin-right: 4px; color: var(--paper);
}
.scope.read { background: var(--m-get); }
.scope.write { background: var(--m-put); }
.scope.manage { background: var(--m-delete); }
:root[data-theme="dark"] .scope { color: #0c111c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scope { color: #0c111c; } }
.op-description { margin-top: 14px; }

ul.fields { list-style: none; padding: 0 !important; border-top: 1px solid var(--rule); }
ul.fields > li.field { padding: 12px 0; border-bottom: 1px solid var(--rule); margin: 0; }
ul.fields.nested { border: 0; margin: 10px 0 0 6px !important; padding-left: 14px !important; border-left: 1px solid var(--rule-strong); }
ul.fields.nested > li.field { padding: 8px 0; border-bottom: 1px dashed var(--rule); }
ul.fields.nested > li.field:last-child { border-bottom: 0; }
.field-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.field-name { font-weight: 700; background: none !important; border: 0 !important; padding: 0 !important; font-size: 0.9rem !important; }
.field-type { color: var(--muted); font-size: 0.86rem; }
.pill { font-size: 0.72rem; font-weight: 650; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--muted); }
.pill.req { color: var(--m-delete); border-color: color-mix(in srgb, var(--m-delete) 45%, transparent); }
.field-text, .field-enum, .field-default { font-size: 0.93rem; color: color-mix(in srgb, var(--ink) 82%, var(--paper)); }
.field-text > :first-child { margin-top: 4px; }
.field-enum, .field-default { margin-top: 6px !important; overflow-wrap: anywhere; }
h3.status { display: flex; gap: 10px; align-items: baseline; font-size: 1rem; margin-top: 18px; }
.status-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 750; font-size: 0.85rem; padding: 1px 6px; border-radius: 5px; background: var(--tint); }
.status-code.ok { color: var(--m-post); }
ul.errors { list-style: none; padding: 0 !important; }
ul.errors li { display: flex; gap: 10px; align-items: baseline; }
.media { color: var(--muted); }
