/* docs.gehlvora.com — same two inks as the site (gehlvora.com docs/dev/info/design.md). */
:root {
  --paper: #d8d8d8; --ink: #222222; --alert: #c81e1e;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --dither: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%) 0 0 / 2px 2px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --pad: clamp(16px, 3vw, 32px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #222222; --ink: #d8d8d8; --alert: #ff5a4f; color-scheme: dark; }
}
:root[data-theme="dark"] { --paper: #222222; --ink: #d8d8d8; --alert: #ff5a4f; color-scheme: dark; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 72px; }
body { background: var(--paper); color: var(--ink); font: 15px/1.6 var(--sans); -webkit-font-smoothing: antialiased; transition: background .12s, color .12s; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { display: block; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.label { font: 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Top bar ---------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--ink); transition: background .12s; }
.top-in { max-width: 1320px; margin: 0 auto; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 var(--pad); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }
.brand .logo { width: 22px; height: 20px; flex: none; }
.brand b { font-weight: 400; border: 1px solid var(--ink); padding: 2px 5px; margin-left: 4px; vertical-align: 2px; }
.top .sep { opacity: 1; font-family: var(--mono); }
.top .app { text-decoration: none; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .app:hover, .home:hover { text-decoration: underline; text-underline-offset: 3px; }
.home { margin-left: auto; text-decoration: none; white-space: nowrap; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--ink); border-radius: 50%; display: grid; place-items: center; flex: none; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--ink); color: var(--paper); }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1; stroke-linecap: square; stroke-linejoin: miter; }
.ico * { vector-effect: non-scaling-stroke; }

/* ---------- Three columns: contents, page, on this page ---------- */
.frame { max-width: 1320px; margin: 0 auto; display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; border-inline: 1px solid var(--ink); min-height: calc(100vh - 56px); }
.side { position: sticky; top: 56px; align-self: start; }
.side > nav { max-height: calc(100vh - 56px - 52px); overflow-y: auto; }
.frame > .doc { border-left: 1px solid var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Search: field on top of the contents, results drop down below it. */
.search { position: relative; padding: 20px var(--pad) 0; }
.search input { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--ink); border-radius: 0; background: var(--paper); color: var(--ink); font: 13px var(--sans); -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: var(--ink); opacity: 1; }
.search input:focus { outline: 1px solid var(--ink); outline-offset: 2px; }
.results { position: absolute; z-index: 5; left: var(--pad); top: calc(100% + 6px); width: min(420px, calc(100vw - 2 * var(--pad))); max-height: 60vh; overflow-y: auto; list-style: none; background: var(--paper); border: 1px solid var(--ink); }
.results[hidden] { display: none; }
.results li + li { border-top: 1px solid var(--ink); }
.search .results a { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; text-decoration: none; font-size: 13px; line-height: 1.4; }
.search .results a b { font-weight: 600; font-size: 14px; }
.search .results a:hover, .search .results a.on { background: var(--ink); color: var(--paper); }
.search .results mark { background: var(--ink); color: var(--paper); padding: 0 1px; }
.search .results a:hover mark, .search .results a.on mark { background: var(--paper); color: var(--ink); }
.results .none { padding: 10px 12px; }
.side summary { display: none; }
.side-in { padding: 24px var(--pad) 40px; }
.nav-app { display: block; font-weight: 600; text-decoration: none; margin-bottom: 18px; }
.nav-sec { margin: 22px 0 6px; }
.nav-sec a { text-decoration: none; }
.side ul { list-style: none; border-left: 1px solid var(--ink); }
.side li a { display: block; padding: 4px 10px; text-decoration: none; font-size: 14px; line-height: 1.4; transition: background .12s, color .12s; }
.side li a:hover { text-decoration: underline; text-underline-offset: 3px; }
.side [aria-current="page"] { background: var(--ink); color: var(--paper); }
.side .nav-sec [aria-current="page"], .nav-app[aria-current="page"] { padding: 1px 4px; margin-left: -4px; }

.doc { padding: 40px clamp(20px, 4vw, 56px) 64px; min-width: 0; }
.crumbs { margin-bottom: 18px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.doc h1, .hub h1 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; letter-spacing: -.025em; font-weight: 600; max-width: 22ch; }
.doc h1::after { content: ""; display: block; width: 64px; border-top: 1px solid var(--ink); margin-top: 18px; transform-origin: 0 0; animation: draw .7s var(--ease) .1s both; }
.lead { font-size: 17px; line-height: 1.5; margin-top: 18px; max-width: 60ch; }

.toc { border-left: 1px solid var(--ink); }
.toc[aria-label] { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 40px 20px; }
.toc ul { list-style: none; margin-top: 12px; }
.toc li a { display: block; padding: 3px 0 3px 10px; border-left: 1px solid transparent; text-decoration: none; font-size: 13px; line-height: 1.4; }
.toc li.l3 a { padding-left: 22px; }
.toc li a:hover { text-decoration: underline; text-underline-offset: 3px; }
.toc li a.on { border-left-color: var(--ink); font-weight: 600; }

/* ---------- Page text ---------- */
.prose { margin-top: 32px; max-width: 72ch; }
.prose > * + * { margin-top: 16px; }
.prose h2 { font-size: 21px; line-height: 1.25; letter-spacing: -.01em; font-weight: 600; margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--ink); position: relative; }
.prose h3 { font-size: 17px; font-weight: 600; margin-top: 30px; position: relative; }
.prose h2 + *, .prose h3 + * { margin-top: 10px; }
.anchor { position: absolute; left: -1.1em; text-decoration: none; font-family: var(--mono); font-weight: 400; visibility: hidden; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { visibility: visible; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 6px; }
.prose li > * + * { margin-top: 10px; }
.prose ol { list-style: none; counter-reset: n; padding-left: 2.2em; }
.prose ol > li { counter-increment: n; position: relative; }
.prose ol > li::before { content: counter(n); position: absolute; left: -2.2em; top: .15em; min-width: 1.6em; height: 1.6em; border: 1px solid var(--ink); font: 11px/1.6em var(--mono); text-align: center; }
.prose ol[start] { counter-reset: n calc(attr(start integer, 1) - 1); }
.prose ul { list-style: square; }
.prose a { text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.prose strong { font-weight: 600; }
.prose code { font: .88em var(--mono); border: 1px solid var(--ink); padding: 0 4px; }
.prose pre { border: 1px solid var(--ink); padding: 14px 16px; overflow-x: auto; font: 13px/1.55 var(--mono); }
.prose pre code { border: 0; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px dashed var(--ink); margin: 32px 0; }
.prose blockquote { border-left: 1px solid var(--ink); padding-left: 16px; }
.prose img { max-width: 100%; height: auto; border: 1px solid var(--ink); image-rendering: pixelated; }
.table { overflow-x: auto; border: 1px solid var(--ink); }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.45; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 8px 12px; }
.prose th { font: 11px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; background: var(--ink); color: var(--paper); }
.prose td + td, .prose th + th { border-left: 1px solid var(--ink); }
.prose tr + tr td { border-top: 1px solid var(--ink); }
.prose tbody tr:first-child td { border-top: 0; }

/* Callouts: note = plain frame, tip = dashed, warning/caution = red label. */
.callout { border: 1px solid var(--ink); padding: 12px 16px 14px; }
.callout > .label { display: inline-block; background: var(--ink); color: var(--paper); padding: 2px 6px; margin-bottom: 8px; }
.callout > * + * { margin-top: 8px; }
.callout-tip { border-style: dashed; }
.callout-warning, .callout-caution { border-width: 1px 1px 1px 5px; }
.callout-warning > .label, .callout-caution > .label { background: none; color: var(--alert); border: 1px solid var(--alert); }

.updated { margin-top: 48px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; max-width: 72ch; }
.pager a { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--ink); padding: 12px 14px; text-decoration: none; font-weight: 500; transition: background .12s, color .12s; }
.pager a.next { text-align: right; grid-column: 2; }
.pager a:hover { background: var(--ink); color: var(--paper); }

/* ---------- Lists of pages (hub, app and section starts) ---------- */
.hub { max-width: 1320px; margin: 0 auto; border-inline: 1px solid var(--ink); min-height: calc(100vh - 56px); padding: clamp(40px, 7vw, 96px) var(--pad); }
.group { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--ink); }
.group h2 { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.group h2 a { text-decoration: none; }
.group h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.group > p { margin-top: 6px; max-width: 60ch; }
.cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 20px; }
.hub .cards { margin-top: 40px; }
.cards a { display: flex; flex-direction: column; gap: 6px; height: 100%; border: 1px solid var(--ink); padding: 14px 16px; text-decoration: none; transition: background .12s, color .12s; }
.cards a b { font-weight: 600; }
.cards a span { font-size: 14px; line-height: 1.45; }
.cards a:hover { background: var(--ink); color: var(--paper); }
.cards li { animation: build .5s var(--ease) both; }
.cards li:nth-child(2) { animation-delay: .06s; } .cards li:nth-child(3) { animation-delay: .12s; }
.cards li:nth-child(4) { animation-delay: .18s; } .cards li:nth-child(n+5) { animation-delay: .24s; }

.foot { max-width: 1320px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 20px; padding: 18px var(--pad); border: 1px solid var(--ink); border-bottom: 0; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

@keyframes draw { from { transform: scaleX(0); } }
@keyframes build { from { clip-path: inset(0 0 100% 0); transform: translateY(8px); } to { clip-path: inset(-2px); transform: none; } }

/* ---------- Narrower ---------- */
@media (max-width: 1080px) {
  .frame { grid-template-columns: 230px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 760px) {
  .frame { display: block; border-inline: 0; }
  .hub { border-inline: 0; }
  .side > nav { max-height: none; }
  .side { position: static; border-bottom: 1px solid var(--ink); }
  .frame > .doc { border-left: 0; }
  .search { padding: 14px var(--pad) 2px; }
  .side summary { display: flex; justify-content: space-between; align-items: center; padding: 14px var(--pad); cursor: pointer; list-style: none; }
  .side summary::-webkit-details-marker { display: none; }
  .side summary::after { content: "+"; font-size: 16px; }
  .side details[open] summary::after { content: "\2212"; }
  .side details[open] summary { border-bottom: 1px dashed var(--ink); }
  .side-in { padding-top: 16px; }
  .doc { padding: 28px var(--pad) 48px; }
  .home { display: none; }
  .top-in > [data-swap] { margin-left: auto; }
  .brand b { display: none; }
  .anchor { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager a.next { grid-column: 1; }
  .foot { border-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
