/* Mutara docs and FAQ. Builds on site.css: the same tokens, fonts and
   frame. The reading column stays calm, so the nebula is dimmer here. */

body.docs .cloud { opacity: calc(var(--cloud) * .4); }
body.docs .c3 { opacity: calc(var(--cloud) * .28); }

.skip { position: absolute; left: 16px; top: -60px; z-index: 30; padding: 10px 16px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-weight: 650; text-decoration: none; }
.skip:focus { top: 12px; }

nav a[aria-current="page"]:not(.btn) { color: var(--text); }

/* Layout: sidebar | page. The page has its own columns: text | contents. */
.docs-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 48px; padding-top: 36px; padding-bottom: 56px; align-items: start; }
.docs-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 4px 24px 0; scrollbar-width: thin; }
.docs-main { display: grid; grid-template-columns: minmax(0, 1fr) 200px; grid-template-areas: "head toc" "body toc" "pager pager"; column-gap: 48px; align-items: start; min-width: 0; }
.doc-head { grid-area: head; }
.doc-body { grid-area: body; min-width: 0; max-width: 72ch; }
.toc { grid-area: toc; position: sticky; top: 84px; }
.pager { grid-area: pager; }

@media (max-width: 1180px) {
  .docs-main { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "toc" "body" "pager"; }
  .toc { position: static; margin: 0 0 8px; }
}
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .docs-side { position: static; max-height: none; overflow: visible; padding: 0; }
  .js .side-toggle[aria-expanded="false"] + .docs-nav { display: none; }
  .docs-nav { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
}
@media (max-width: 600px) {
  nav { gap: 16px; }
}

/* Sidebar */
.side-toggle { width: 100%; justify-content: space-between; }
.side-toggle[hidden] { display: none; }
@media (min-width: 901px) { .side-toggle { display: none; } }
.side-toggle::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .25s var(--ease); }
.side-toggle[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.docs-nav ul { list-style: none; margin: 0 0 6px; padding: 0; }
.docs-nav, .toc { display: block; }
.docs-nav a:not(.btn) { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.35; transition: color .2s, background .2s; }
.docs-nav a:not(.btn):hover { color: var(--text); background: var(--raised); }
.docs-nav a:not(.btn)[aria-current="page"] { color: var(--text); background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent-line); }
.docs-nav .nav-home { font-weight: 650; }
.nav-group { margin: 22px 0 6px; padding: 0 10px; font: 650 13px var(--sans); color: var(--accent-soft); }
.docs-nav .next-beta { display: table; margin: 5px 0 1px; }
.toc .next-beta { display: table; margin: 2px 0 4px; }
.doc-body .sec-badge { margin: -4px 0 12px; }

/* Page head */
.doc-head h1 { font-size: clamp(32px, 4.6vw, 52px); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 16px; max-width: 18ch; }
.doc-head .lede { max-width: 40em; margin: 0 0 28px; }
.doc-head .next-beta { margin: -4px 0 16px; }

/* Contents of this page */
.toc { border-left: 1px solid var(--line); padding-left: 16px; font-size: 14px; }
.toc-title { margin: 0 0 8px; font-weight: 650; color: var(--text); }
.toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.toc a:not(.btn) { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; line-height: 1.35; }
.toc a:not(.btn):hover, .toc a:not(.btn).on { color: var(--text); }
.toc a:not(.btn).on { color: var(--accent-soft); }
@media (max-width: 1180px) {
  .toc { border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; background: var(--panel-soft); }
  .toc ul { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); column-gap: 20px; }
}

/* Body text */
.doc-body h2 { font-size: clamp(22px, 2.6vw, 28px); margin: 56px 0 14px; scroll-margin-top: 84px; }
.doc-body h2:first-child { margin-top: 8px; }
.doc-body h3 { margin: 32px 0 10px; font-size: 18px; }
.doc-body p { margin: 0 0 14px; }
.doc-body ul:not(.checks), .doc-body ol:not(.steps) { padding-left: 22px; margin: 0 0 16px; }
.doc-body li { margin-bottom: 6px; min-width: 0; }
.doc-body .steps { margin: 0 0 16px; }
.doc-body .checks { margin: 0 0 16px; }
.doc-body pre.block { margin: 0 0 16px; }
.doc-body p code, .doc-body li code, .doc-body dd code { overflow-wrap: anywhere; }
.doc-body :target { scroll-margin-top: 84px; }
.doc-body h2:target, .doc-body h3:target { color: var(--accent-soft); }
.doc-body h3 .anchor { font-size: .9em; }
:is(h2, h3, summary):hover > .anchor { opacity: 1; }
.result { color: var(--body); }
.result b:first-child { color: var(--ok); }

/* Notes and cautions: a full 1px border and a tint, never a thick side bar. */
.box { border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; margin: 0 0 18px; background: var(--surface); }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }
.box.note { border-color: var(--note-line); background: var(--note-tint); color: var(--note-text); }
.box.note > b:first-child, .box.note > p:first-child > b:first-child { color: var(--cyan); }
.box.caution { border-color: var(--warn-line); background: var(--warn-tint); color: var(--warn-text); }
.box.caution > b:first-child, .box.caution > p:first-child > b:first-child { color: var(--warn); }

/* The release badge */
.next-beta { display: inline-block; font: 650 12px/1.5 var(--sans); letter-spacing: .02em; color: var(--cyan); border: 1px solid var(--note-line); background: var(--note-tint); border-radius: 999px; padding: 1px 9px; white-space: nowrap; vertical-align: 2px; }
h2 .next-beta, h3 .next-beta { margin-left: 8px; font-family: var(--sans); letter-spacing: .02em; }

/* Technical details link at the end of an operator section */
.techref { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 20px 0 8px; padding: 10px 16px; border: 1px dashed var(--line-dash); border-radius: 12px; font-size: 15px; }
.techref span { color: var(--muted); font-weight: 650; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.table-wrap caption { text-align: left; padding: 12px 16px 0; color: var(--muted); font-size: 14px; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: 9px 16px; border-top: 1px solid var(--line); }
.table-wrap thead th { border-top: 0; color: var(--text); font-weight: 650; white-space: nowrap; }
.table-wrap td:first-child { white-space: nowrap; }
.table-wrap td code, .table-wrap td kbd { white-space: nowrap; }
.table-wrap kbd { min-width: 0; }
.table-wrap.wrapcells td:first-child { white-space: normal; }

/* Screenshots */
.shot-fig { margin: 8px 0 24px; }
.shot-fig img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--panel); }
.shot-fig.phone img { width: min(300px, 80%); margin: 0 auto; border-radius: 26px; border: 6px solid var(--bezel); }
.shot-fig.narrow img { width: min(560px, 100%); margin: 0 auto; }
.shot-fig figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
.shot-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 560px) { .shot-pair { grid-template-columns: minmax(0, 1fr); } }

/* Diagrams. Without script, the text version is the diagram. */
.diagram { margin: 8px 0 24px; padding: 18px 18px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--diagram-bg); }
.diagram pre.mermaid { margin: 0; padding: 0; background: none; border: 0; text-align: center; font: 14px var(--sans); color: var(--text); overflow-x: auto; }
.diagram pre.mermaid:not([data-processed]) { visibility: hidden; height: 120px; overflow: hidden; }
html:not(.js) .diagram pre.mermaid { display: none; }
.diagram pre.mermaid svg { max-width: 100%; height: auto; }
.diagram figcaption { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.diagram details { margin-top: 10px; font-size: 15px; }
.diagram summary { cursor: pointer; color: var(--accent-soft); font-weight: 600; width: fit-content; }
.diagram details[open] summary { margin-bottom: 8px; }
.diagram details ul, .diagram details ol { margin-bottom: 4px; }

/* FAQ and other folds */
.qa { border-top: 1px solid var(--line); }
.qa:last-of-type { border-bottom: 1px solid var(--line); }
.qa summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; padding: 16px 4px; font: 600 17px/1.4 var(--sans); color: var(--text); }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::before { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--accent-soft); border-bottom: 2px solid var(--accent-soft); transform: translateY(-2px) rotate(-45deg); transition: transform .25s var(--ease); }
.qa[open] summary::before { transform: translateY(-4px) rotate(45deg); }
.qa summary:hover { color: var(--accent-soft); }
.qa > div { padding: 0 4px 12px 25px; }
.qa:target summary { color: var(--accent-soft); }
.qa summary .anchor { margin-left: auto; }
details > summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* Docs home */
.paths { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 0 0 8px; }
@media (max-width: 720px) { .paths { grid-template-columns: minmax(0, 1fr); } }
.path { border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px 18px; background: var(--panel-soft); }
.path.primary { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-tint), var(--panel-soft) 60%); }
.path h2 { font-size: 22px; margin: 0 0 8px; }
.path p { color: var(--body); }
.path ol { padding-left: 22px; margin: 0 0 16px; }
.path .btn { margin-top: 2px; }
.doc-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin: 0 0 16px; }
@media (max-width: 640px) { .doc-index { grid-template-columns: minmax(0, 1fr); } }
.doc-index > div { border-top: 1px solid var(--line); padding: 14px 0 16px; }
.doc-index dt { font-weight: 650; margin-bottom: 4px; }
.doc-index dt a { color: var(--text); text-decoration: none; }
.doc-index dt a:hover { color: var(--accent-soft); text-decoration: underline; }
.doc-index dd { margin: 0; color: var(--muted); font-size: 15px; }

/* Config reference */
.keys dt { font-family: var(--mono); font-size: 15px; color: var(--text); margin-top: 18px; overflow-wrap: anywhere; }
.keys dt .type { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 8px; }
.keys dd { margin: 4px 0 0; }
.keys dd p { margin: 0 0 6px; }
.keys .dflt { color: var(--muted); font-size: 15px; }

/* Previous and next */
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); max-width: calc(72ch + 0px); }
.pager a:not(.btn) { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); font-weight: 650; transition: border-color .2s, background .2s; }
.pager a:not(.btn):hover { border-color: var(--accent-line); background: var(--accent-tint); }
.pager span { font-size: 13px; font-weight: 500; color: var(--muted); }
.pager .pager-next { grid-column: 2; text-align: right; }
@media (max-width: 520px) { .pager { grid-template-columns: minmax(0, 1fr); } .pager .pager-next { grid-column: 1; } }
