/* docs.hewn.tools, on top of Hewn's ui.css (synced into /_hewn/). Layout only: every colour, radius and
   shadow is a token or a ui.css class. Pages come from src/docs.ts. */

body.docs { position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
.docs summary { list-style: none; }
.docs summary::-webkit-details-marker { display: none; }
.docs .spacer { flex: 1; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: absolute; left: var(--s4); top: var(--s2); z-index: 60; padding: var(--s2) var(--s3); background: var(--surface-solid); border-radius: var(--radius-sm); }
@keyframes docs-in { from { opacity: 0; transform: scale(.97); } }

/* ---------- header ---------- */
.docs-header { position: relative; z-index: 5; display: flex; align-items: center; gap: var(--s5); padding: 14px 32px; border-bottom: 1px solid var(--border); }
.lockup { display: inline-flex; align-items: center; gap: 10px; font-size: var(--fs-lg); color: var(--text); text-decoration: none; }
.lockup:hover { color: var(--text); }
.lockup img { display: block; border-radius: 28%; box-shadow: var(--glow); }
.lockup b { font-weight: 650; letter-spacing: -0.02em; }
.lockup span { color: var(--text-2); }
.docs-header .search-btn { width: 360px; margin-left: var(--s5); justify-content: space-between; color: var(--text-3); font-weight: 450; }
.docs-links { margin-left: auto; display: flex; gap: var(--s5); font-size: var(--fs-sm); }
.docs-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); text-decoration: none; transition: color var(--dur) var(--ease); }
.docs-links a:hover { color: var(--text); }
.gh-logo { width: 16px; height: 16px; background: currentColor; -webkit-mask: url(/logos/github.svg) center / contain no-repeat; mask: url(/logos/github.svg) center / contain no-repeat; }

/* version switcher: a <details>, so it opens without JavaScript; the menu is solid, not glass */
.ver { position: relative; }
.ver > summary { gap: 6px; }
.ver-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 260px; max-height: 360px; overflow: auto; padding: 6px; border-radius: var(--radius-lg); background: var(--surface-solid); border-color: var(--border-strong); -webkit-backdrop-filter: none; backdrop-filter: none; }
.ver[open] > .ver-menu, .nav-menu[open] > .nav-panel { animation: docs-in 400ms var(--ease); }
.ver-menu .menu-item { display: flex; align-items: center; gap: var(--s3); min-height: 36px; color: var(--text); text-decoration: none; border-radius: var(--radius-sm); }
.ver-menu .menu-item i { width: 8px; height: 8px; flex: none; border-radius: var(--radius-xs); }
.ver-menu .menu-item[aria-current] { background: var(--surface-2); }
.ver-menu .menu-item[aria-current] i { background: var(--accent); }
.ver-menu .menu-item .mono { font-size: var(--fs-sm); }
.ver-menu .menu-item .faint { margin-left: auto; }
.ver-all { display: block; margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--border); text-decoration: none; }

/* older versions and next */
.banner { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s3); padding: 10px 32px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); background: var(--warn-soft); }
.banner.info { background: var(--info-soft); }
.banner .dot.info { background: var(--info); }
.banner a { font-weight: 550; text-decoration: none; }

/* ---------- article: sidebar · column · on this page ---------- */
.article-grid { flex: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px; gap: 56px; width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 32px; }
.sidebar { padding: 32px var(--s4) 32px 0; border-right: 1px solid var(--border); }
.sidebar > nav { position: sticky; top: var(--s5); max-height: calc(100vh - var(--s7)); overflow: auto; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: var(--s5); }
.nav-group .label { padding: 0 10px; margin-bottom: 6px; }
.nav-group a { display: block; padding: 6px 10px; border-radius: var(--radius-sm); font-size: var(--fs-sm); color: var(--text-2); text-decoration: none; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.nav-group a:hover { background: var(--surface-2); color: var(--text); }
.nav-group a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 550; }

.article { min-width: 0; max-width: 680px; padding: 48px 0 72px; }
.article > .section { display: block; margin-bottom: var(--s4); }
.article h1 { margin: 0 0 var(--s4); font-size: var(--fs-3xl); letter-spacing: -0.03em; }

.rail { padding: 48px 0; }
.toc { position: sticky; top: var(--s5); display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - var(--s7)); overflow: auto; }
.toc .label { margin-bottom: var(--s2); }
.toc a { display: block; padding: 5px 0 5px 12px; border-left: 2px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); text-decoration: none; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.toc a.toc-h3 { padding-left: 24px; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); border-left-color: var(--accent); }

/* ---------- the markdown ---------- */
.prose { color: var(--text-2); line-height: 1.65; }
.prose > * { margin: 0 0 var(--s4); }
.prose > :last-child { margin-bottom: 0; }
.prose .lead { font-size: var(--fs-lg); line-height: 1.55; }
.prose h2, .prose h3, .prose h4 { color: var(--text); scroll-margin-top: var(--s5); }
.prose h2 { margin: var(--s7) 0 var(--s4); font-size: var(--fs-2xl); letter-spacing: -0.02em; }
.prose h3 { margin: var(--s6) 0 var(--s3); font-size: var(--fs-lg); letter-spacing: -0.01em; }
.prose h4 { margin: var(--s5) 0 var(--s2); font-size: var(--fs); }
.prose .anchor { margin-left: var(--s2); font-size: var(--fs-lg); font-weight: 450; color: var(--text-3); text-decoration: none; opacity: 0; transition: opacity var(--dur) var(--ease); }
.prose .anchor::after { content: "#"; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose .anchor:focus-visible { opacity: 1; }
.prose strong { color: var(--text); font-weight: 550; }
.prose :not(pre) > code { padding: 0.1em 0.35em; border-radius: var(--radius-xs); background: var(--surface-2); color: var(--text); font-size: 0.88em; overflow-wrap: anywhere; }
.prose ul, .prose ol { padding: 0; }
.prose ul { list-style: none; }
.prose ol { padding-left: 1.5em; }
.prose ol > li::marker { font: var(--fs-sm) var(--mono); color: var(--text-3); }
.prose ul > li { position: relative; padding-left: 22px; }
.prose ul > li::before { content: ""; position: absolute; left: 4px; top: calc(0.825em - 3px); width: 6px; height: 6px; border-radius: 1px; background: var(--text-3); }
.prose li + li, .prose li > ul, .prose li > ol { margin-top: var(--s2); }
.prose li > p { margin: 0 0 var(--s2); }
.prose blockquote { padding: 2px 0 2px var(--s4); border-left: 2px solid var(--border-strong); }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: var(--s6) 0; }
.prose img { max-width: 100%; height: auto; }
.prose figure { display: flex; flex-direction: column; gap: var(--s2); margin: var(--s5) 0; }
.prose figure img { display: block; width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); }
.prose figcaption { font-size: var(--fs-sm); color: var(--text-3); }
.prose .table-wrap { margin-bottom: var(--s4); }
.prose td { color: var(--text-2); }

/* callouts: > [!NOTE] and friends */
.prose .notice { line-height: 1.6; }
.notice > .label { flex: none; padding-top: 3px; color: var(--info); }
.notice.warn > .label { color: var(--warn); }
.notice.ok > .label { color: var(--ok); }
.notice.danger > .label { color: var(--danger); }
.notice-body { flex: 1; min-width: 0; }
.notice-body > * { margin: 0 0 var(--s2); }
.notice-body > :last-child { margin-bottom: 0; }

/* code: always on the dark log surface (data-theme="dark"), highlighted at build time */
.code { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--log-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 38px; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--border); }
.code-lang { font: var(--fs-2xs) var(--mono); color: var(--text-3); }
.code pre { margin: 0; padding: 14px; overflow: auto; font: var(--fs-sm)/1.7 var(--mono); color: var(--log-text); background: none; }
.code pre code { font: inherit; }
.code {
  --shiki-foreground: var(--log-text);
  --shiki-token-comment: var(--text-3);
  --shiki-token-keyword: var(--c2);
  --shiki-token-string: var(--c5);
  --shiki-token-string-expression: var(--c5);
  --shiki-token-constant: var(--c5);
  --shiki-token-function: var(--log-text);
  --shiki-token-parameter: var(--log-text);
  --shiki-token-punctuation: var(--log-text);
  --shiki-token-link: var(--accent-ink);
}
/* in a shell, every word is a "string": commands stay plain, only keywords and comments take a colour */
.code[data-lang="sh"], .code[data-lang="bash"], .code[data-lang="shell"], .code[data-lang="zsh"] { --shiki-token-string: var(--log-text); }
.t-comment { color: var(--shiki-token-comment); }
.t-keyword { color: var(--shiki-token-keyword); }
.t-string { color: var(--shiki-token-string); }
.t-string-expression { color: var(--shiki-token-string-expression); }
.t-constant { color: var(--shiki-token-constant); }
.t-function { color: var(--shiki-token-function); }
.t-parameter { color: var(--shiki-token-parameter); }
.t-punctuation { color: var(--shiki-token-punctuation); }
.t-link { color: var(--shiki-token-link); }
.t-ok { color: var(--ok); }
.t-fail { color: var(--danger); }

/* previous / next, and the foot row */
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s7); }
.prevnext .card { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: var(--s4); color: var(--text); text-decoration: none; transition: background var(--dur) var(--ease); }
.prevnext .card:hover { background: var(--surface-2); }
.prevnext .card b { font-weight: 550; }
.prevnext .next { grid-column: 2; text-align: right; }
.page-foot { display: flex; flex-wrap: wrap; gap: var(--s5); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
.page-foot a { text-decoration: none; }

.docs-footer { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s5); padding: var(--s5) 32px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-3); }
.docs-footer a { color: var(--text-2); text-decoration: none; }
.docs-footer a:hover { color: var(--text); }

/* ---------- home ---------- */
.wp-1 { --x: -140px; --y: 60px; --w: 480px; --h: 125; }
.wp-2 { --x: calc(100% - 360px); --y: 200px; --w: 460px; --h: 245; }
.wp-3 { --x: -120px; --y: 180px; --w: 360px; --h: 260; }
.home { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; gap: var(--s6); width: 100%; max-width: 1104px; margin: 0 auto; padding: 80px 32px 96px; }
.home-hero { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); }
.home-hero .display { margin: 0; }
.home-intro { margin: 0; font-size: var(--fs-lg); color: var(--text-2); }
.search-big { width: min(520px, 100%); min-height: 52px; justify-content: space-between; font-size: var(--fs-lg); font-weight: 450; color: var(--text-3); }
.home-group { display: flex; flex-direction: column; gap: var(--s3); }
.home-group > h2.label { margin: 0; }
.home-group > p { margin: 0; max-width: 680px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.cards .card { margin: 0; display: flex; flex-direction: column; gap: 6px; padding: var(--s4) var(--s5); color: var(--text); text-decoration: none; transition: background var(--dur) var(--ease); }
.cards .card:hover { background: var(--surface-2); }
.cards .card b { font-size: var(--fs-lg); font-weight: 550; }
.cards .card span { line-height: 1.5; }

/* ---------- 404 ---------- */
.hue-260 { --hue: 260; }
.notfound { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: var(--s4); min-height: 60vh; padding: var(--s7) 96px; }
.notfound h1 { margin: 0; font-size: var(--fs-2xl); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.notfound p { margin: 0; }

/* ---------- search ---------- */
dialog.search { width: min(640px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 128px); margin: 96px auto auto; padding: 0; overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-xl); background: var(--surface-overlay); -webkit-backdrop-filter: var(--blur-strong); backdrop-filter: var(--blur-strong); box-shadow: var(--hl), var(--shadow-lg); }
dialog.search[open] { display: flex; flex-direction: column; animation: docs-in 400ms var(--ease); }
dialog.search::backdrop { background: var(--scrim); }
.search-top { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.search-top input[type=search], .search-top input[type=search]:focus { flex: 1; height: 48px; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: var(--fs-xl); }
.search-top input::-webkit-search-cancel-button { display: none; }
.search-results { flex: 1; min-height: 0; max-height: 460px; overflow: auto; padding: var(--s2); }
.search-results:empty { display: none; }
.result { display: flex; flex-direction: column; gap: 4px; padding: var(--s3); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.result:hover { color: var(--text); }
.result[aria-selected="true"] { background: var(--surface-2); }
.result-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.result-title b { font-weight: 550; }
.result-excerpt { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-2); }
.result mark { padding: 0 2px; border-radius: var(--radius-xs); background: var(--accent-soft); color: var(--text); }
.search-empty { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s6); text-align: center; }
.search-foot { display: flex; gap: var(--s4); padding: 10px var(--s4); border-top: 1px solid var(--border); font: var(--fs-2xs) var(--mono); color: var(--text-3); }

/* ---------- narrower ---------- */
@media (min-width: 861px) { .docs .narrow { display: none; } }
@media (max-width: 1180px) {
  .article-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; }
  .rail { display: none; }
}
@media (max-width: 860px) {
  .docs .wide { display: none; }
  .docs-header { gap: var(--s2); padding: 12px 16px; }
  .docs-header .lockup { margin-right: auto; font-size: var(--fs); }
  .docs-header .lockup img { width: 26px; height: 26px; }
  .nav-panel { position: absolute; top: calc(100% + 4px); left: var(--s2); right: var(--s2); z-index: 30; max-height: 70vh; overflow: auto; padding: var(--s3); border-radius: var(--radius-lg); background: var(--surface-solid); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .docs-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 8px 16px; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
  .crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); }
  .crumb b { font-weight: 450; color: var(--text); }
  .docs-bar .ver-menu { left: auto; right: 0; }
  .banner { padding: 10px 16px; }
  .article-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .sidebar { display: none; }
  .article { padding: 28px 0 40px; }
  .article > .section { display: none; }
  .article h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; }
  .prose .lead { font-size: var(--fs); }
  .prose h2 { margin-top: var(--s6); font-size: var(--fs-xl); }
  .code pre { padding: 12px; font-size: var(--fs-xs); }
  .prevnext { gap: var(--s2); }
  .prevnext .card { padding: var(--s3); }
  .page-foot { gap: var(--s3) var(--s4); }
  .docs-footer { padding: var(--s5) 16px; gap: var(--s3) var(--s4); }
  .home { padding: 48px 16px 64px; }
  .cards { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .cards .card { gap: 2px; padding: var(--s3) var(--s4); }
  .cards .card b { font-size: var(--fs); }
  .notfound { padding: var(--s7) 16px; }
}
.docs-footer a.with-dot { display: inline-flex; align-items: center; gap: 6px; }

/* Working labels (On this page, Note, a nav group): sentence case, not eyebrows (no caps or tracking). */
.label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
