/* Long-document layout. Existing asiri paper, ink, camwood and Ioskeley Mono. */
:root {
  --docs-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --docs-fast: 160ms;
  --docs-reveal: 240ms;
  --docs-shadow: 0 16px 64px color-mix(in srgb, var(--ink) 16%, transparent);
}
[hidden] { display: none !important; }
html:has(.docs) { scroll-padding-top: 32px; }
.docs { padding: 0 40px 80px; }
.docs-header { max-width: 1376px; margin: auto; height: 88px; border-bottom: 1px solid var(--line); gap: 24px; }
.docs-label { padding-left: 24px; border-left: 1px solid var(--line); color: var(--mute); font-size: 13px; }
.docs-header nav { margin-left: auto; }
.docs-layout { max-width: 1376px; margin: 64px auto 0; display: grid; grid-template-columns: 196px minmax(0, 672px) minmax(180px, 224px); gap: 48px; justify-content: space-between; align-items: start; }
.docs main { width: 100%; max-width: none; min-width: 0; margin: 0; outline: none; }
.docs button { font-weight: 400; }
.skip { position: fixed; top: 12px; left: 16px; transform: translateY(-180%); background: var(--paper); color: var(--ink); padding: 8px 16px; z-index: 10; }
.skip:focus { transform: none; }

/* Native disclosures keep both trees usable without JavaScript. */
.tree { font-size: 12px; line-height: 22px; }
.tree summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; list-style: none; color: var(--ink); min-height: 32px; padding: 4px 0; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary:hover, .tree a:hover { color: var(--accent); }
.chevron { display: inline-block; flex: 0 0 8px; font-size: 18px; line-height: 16px; transform-origin: center; transition: transform var(--docs-fast) var(--docs-ease); }
details[open] > summary > .chevron { transform: rotate(90deg); }
.tree details[open] > :not(summary) { animation: branch-in var(--docs-reveal) var(--docs-ease); }
.tree ul { list-style: none; }
.branches { border-left: 1px solid var(--line); margin: 4px 0 12px 4px; padding-left: 16px; }
.branches > li { position: relative; }
.branches > li::before { content: ""; position: absolute; left: -17px; top: 16px; width: 8px; border-top: 1px solid var(--line); }
.branches a { display: block; padding: 5px 8px; margin-left: -4px; color: var(--mute); border-radius: 2px; }
.branches a[aria-current] { color: var(--accent); background: var(--tint); }
.count { margin-left: auto; color: var(--mute); font-size: 10px; }
.docs-nav { position: sticky; top: 32px; display: block; max-height: calc(100svh - 64px); overflow-y: auto; padding-right: 8px; }
.nav-root > summary { margin-bottom: 24px; }
.nav-group { margin-bottom: 20px; }
.nav-note { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--mute); }
.skill-link { display: inline-block; margin-top: 16px; color: var(--accent); }
.reading-guide { position: sticky; top: 32px; max-height: calc(100svh - 64px); overflow-y: auto; max-width: 240px; }
.reading-guide .branches { margin-top: 12px; }
.reading-guide summary { white-space: normal; }
.reading-guide .branches summary { font-size: 11px; }
.reading-guide .branches a { font-size: 11px; line-height: 20px; }
.reading-guide .branches .branches { padding-left: 12px; }
.reading-guide .branches .branches > li::before { left: -13px; }
.guide-note { color: var(--mute); font-size: 10px; line-height: 18px; margin-top: 28px; }

.page-meta { display: flex; justify-content: space-between; gap: 16px; font-size: 11px; line-height: 20px; color: var(--mute); padding: 4px 0 20px; border-bottom: 1px solid var(--line); }
.page-meta > :last-child { white-space: nowrap; }
.page-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; margin-top: 20px; font-size: 11px; }
.page-actions button { padding: 6px 10px; background: transparent; border: 1px solid var(--line); color: var(--ink); }
.page-actions button:hover { border-color: var(--accent); color: var(--accent); }
.page-actions a { color: var(--mute); text-decoration: underline; text-underline-offset: 4px; }
.page-actions button:disabled { cursor: wait; opacity: 0.6; }
.copy-status { color: var(--accent); font-size: 11px; min-height: 24px; padding-top: 4px; }
.prose { font-size: 14px; line-height: 26px; overflow-wrap: anywhere; }
.prose h1 { margin: 24px 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.25; letter-spacing: -0.04em; max-width: 22ch; text-wrap: balance; }
.prose h1 + p { font-size: 16px; line-height: 28px; color: var(--ink); margin-bottom: 24px; }
.prose h2 { margin: 52px 0 16px; padding: 20px 0 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 26px; font-weight: 400; color: var(--ink); }
.prose h3 { font-size: 14px; margin: 28px 0 12px; font-weight: 700; color: var(--ink); }
.prose h2, .prose h3 { scroll-margin-top: 24px; }
.prose p, .prose li { color: var(--mute); }
.prose p + p { margin-top: 16px; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line); }
.prose a:hover { text-decoration-color: currentColor; }
.prose code { color: var(--ink); font-size: 0.92em; }
.prose pre { margin: 20px 0; padding: 16px 20px; border-left: 2px solid var(--accent); background: var(--tint); overflow: auto; font: inherit; line-height: 23px; overflow-wrap: normal; }
.prose pre code { font-size: 12px; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 20px 0; font-size: 12px; line-height: 22px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 12px 20px 12px 0; border-bottom: 1px solid var(--line); }
.prose th { font-weight: 400; color: var(--ink); }
.prose td { color: var(--mute); }
.prose ul, .prose ol { padding-left: 24px; margin: 16px 0; }
.page-turn { display: flex; justify-content: space-between; gap: 24px; border-top: 1px solid var(--line); padding-top: 24px; margin-top: 64px; color: var(--ink); font-size: 13px; }
.page-turn a:last-child { text-align: right; }
.page-turn span { display: block; color: var(--mute); font-size: 10px; margin-bottom: 12px; }
.docs-footer { margin-top: 64px; font-size: 10px; line-height: 20px; flex-wrap: wrap; }

/* A which-key style panel, anchored to the command button, not the viewport center. */
.command-trigger { position: fixed; bottom: 24px; right: 32px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); padding: 10px 14px; font-size: 12px; box-shadow: var(--docs-shadow); z-index: 4; }
.command-trigger:hover { background: var(--paper); border-color: var(--accent); color: var(--accent); }
.command-trigger > span { color: var(--accent); }
kbd { font: inherit; font-size: 10px; color: var(--mute); border: 1px solid var(--line); padding: 0 5px; border-radius: 2px; }
#commands { position: fixed; inset: auto 248px 72px auto; margin: 0; width: min(340px, calc(100vw - 32px)); max-height: min(420px, calc(100svh - 104px)); overflow-y: auto; padding: 0; border: 1px solid var(--line); color: var(--ink); background-color: #F3EFE6; box-shadow: var(--docs-shadow); font: inherit; z-index: 3; }
#commands:not([hidden]) { animation: panel-in var(--docs-reveal) var(--docs-ease); }
.command-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#command-title { color: var(--accent); font-size: 13px; }
#command-close { background: transparent; color: var(--mute); padding: 4px 0 4px 12px; font-size: 11px; text-transform: lowercase; }
#command-close:hover { color: var(--accent); }
.command-help { font-size: 11px; color: var(--mute); padding: 14px 16px 6px; }
.search-label { font-size: 11px; display: block; margin: 8px 16px; color: var(--mute); }
#command-search { width: calc(100% - 32px); margin: 0 16px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font: inherit; font-size: 13px; }
#command-list { padding: 8px; max-height: 320px; overflow-y: auto; }
#command-list button { display: flex; align-items: baseline; width: 100%; gap: 16px; text-align: left; background: transparent; color: var(--ink); padding: 10px 8px; font-size: 12px; line-height: 20px; }
#command-list button:hover, #command-list button:focus-visible { background: var(--tint); color: var(--accent); }
#command-list kbd { min-width: 24px; text-align: center; color: var(--accent); flex-shrink: 0; }
.command-foot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 10px 16px; font-size: 10px; color: var(--mute); }
#command-path { color: var(--accent); }
#command-empty { padding: 12px 16px 24px; color: var(--mute); font-size: 12px; }
@keyframes panel-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes branch-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@view-transition { navigation: auto; }
.docs main { view-transition-name: article; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-old(article) { animation: none; opacity: 0; }
::view-transition-new(article) { animation: branch-in var(--docs-fast) var(--docs-ease); }
@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: 176px minmax(0, 1fr); gap: 32px; }
  .reading-guide { grid-column: 2; grid-row: 1; position: static; max-height: none; margin-bottom: 8px; }
  .docs main { grid-column: 2; grid-row: 2; }
  .docs-nav { grid-row: 1 / 3; }
  .guide-note { display: none; }
}
@media (max-width: 760px) {
  .docs { padding: 0 20px 100px; }
  .docs-header { height: 72px; gap: 16px; }
  .docs-label { padding-left: 16px; font-size: 11px; }
  .docs-header nav { font-size: 11px; gap: 16px; }
  .docs-header nav a:first-child { display: none; }
  .docs-layout { display: flex; flex-direction: column; gap: 0; margin-top: 24px; }
  .docs-nav { width: 100%; position: static; max-height: none; padding: 0; border-bottom: 1px solid var(--line); }
  .nav-root > summary { margin-bottom: 0; padding: 8px 0; }
  .nav-groups { padding: 16px 0 8px; }
  .nav-note, .skill-link { display: none; }
  .reading-guide { order: 0; width: 100%; border-bottom: 1px solid var(--line); margin: 0 0 32px; }
  .reading-guide > details > summary { padding: 8px 0; }
  .reading-guide > details > .branches { columns: 1; }
  .docs main { order: 1; }
  .prose h1 { font-size: 30px; }
  .prose pre { padding: 14px; }
  .page-meta { font-size: 10px; }
  .page-actions { gap: 12px; }
  .command-trigger { bottom: 16px; right: 16px; }
  #commands { right: 12px; left: auto; bottom: 64px; width: min(280px, calc(100vw - 24px)); max-height: min(280px, calc(100svh - 180px)); }
}
@media (prefers-color-scheme: dark) {
  #commands { background-color: #14120F; }
}
@media (prefers-reduced-motion: reduce) {
  .docs *, ::view-transition-new(article) { animation: none !important; transition: none !important; }
}
