@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("https://fonts.gstatic.com/s/hankengrotesk/v12/ieVn2YZDLWuGJpnzaiwFXS9tYtpd59CxCis4.woff2") format("woff2");
}

:root {
  --bg: #f2f4ee;
  --surface: #fbfcf8;
  --surface-soft: #e9eee8;
  --panel: #17231c;
  --panel-raised: #223128;
  --text: #18231c;
  --muted: #566259;
  --text-on-dark: #edf2eb;
  --muted-on-dark: #bac7bc;
  --accent: #457d58;
  --accent-hover: #356647;
  --accent-soft: #deede0;
  --accent-detail: #96bfa1;
  --control: #839086;
  --rule: #d0d7cf;
  --focus: #4e8c62;
  --error: #b42318;
  --warning: #8a5a00;
  --shadow: 0 24px 70px rgb(28 48 35 / 0.12);
  --shadow-small: 0 10px 30px rgb(28 48 35 / 0.1);
  --radius-sm: 0.625rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --header-height: 4.75rem;
  --sidebar-width: 17.5rem;
  --toc-width: 15rem;
  --content-width: 47rem;
  --motion-fast: 160ms;
  --motion-base: 220ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 2rem); }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Hanken Grotesk", "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif; font-size: 1rem; line-height: 1.65; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
a { color: var(--accent-hover); text-underline-offset: 0.2em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--panel); }
img { display: block; max-width: 100%; height: auto; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 0.25rem; }

.skip-link { position: fixed; inset-block-start: 0.5rem; inset-inline-start: 0.5rem; z-index: 100; transform: translateY(-160%); border-radius: var(--radius-sm); background: var(--surface); padding: 0.75rem 1rem; box-shadow: var(--shadow-small); font-weight: 700; }
.skip-link:focus { transform: translateY(0); }
.reading-progress { position: fixed; inset: 0 0 auto; z-index: 70; height: 3px; background: transparent; }
.reading-progress span { display: block; width: 100%; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

.site-header { position: sticky; inset-block-start: 0; z-index: 60; min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.75rem clamp(1rem, 3vw, 2.5rem); background: color-mix(in srgb, var(--bg) 94%, transparent); box-shadow: 0 1px 0 var(--rule); backdrop-filter: blur(14px); }
.wordmark { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--text); text-decoration: none; }
.wordmark img { flex: 0 0 auto; }
.wordmark strong, .wordmark small { display: block; line-height: 1.15; }
.wordmark strong { font-size: 1.125rem; letter-spacing: -0.025em; }
.wordmark strong span { color: var(--accent); }
.wordmark small { margin-top: 0.25rem; color: var(--muted); font-size: 0.8125rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.search-trigger, .site-link { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; gap: 1.25rem; border-radius: var(--radius-sm); padding: 0.625rem 0.875rem; font-size: 0.9375rem; font-weight: 650; text-decoration: none; transition: transform var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease); }
.search-trigger { min-width: 13rem; justify-content: space-between; border: 1px solid var(--control); background: var(--surface); color: var(--muted); }
.search-trigger kbd { border-radius: 0.35rem; background: var(--surface-soft); padding: 0.1rem 0.4rem; color: var(--muted); font-size: 0.8125rem; }
.site-link { background: var(--panel); color: var(--text-on-dark); box-shadow: var(--shadow-small); }
.site-link:hover { background: var(--panel-raised); color: var(--text-on-dark); transform: translateY(-1px); }
.search-trigger:hover { background: var(--accent-soft); color: var(--text); }
.search-trigger:active, .site-link:active { transform: translateY(1px) scale(0.985); box-shadow: none; }

.docs-shell { display: grid; grid-template-columns: minmax(14rem, var(--sidebar-width)) minmax(0, 1fr) minmax(12rem, var(--toc-width)); max-width: 100rem; min-height: calc(100svh - var(--header-height)); margin-inline: auto; }
.sidebar, .toc { position: sticky; inset-block-start: var(--header-height); align-self: start; max-height: calc(100svh - var(--header-height)); overflow-y: auto; scrollbar-width: thin; }
.sidebar { padding: 2rem 1.5rem 3rem clamp(1rem, 3vw, 2.5rem); box-shadow: 1px 0 0 var(--rule); }
.nav-section + .nav-section { margin-top: 1.5rem; }
.nav-section h2 { margin: 0 0 0.45rem; color: var(--muted); font-size: 0.8125rem; line-height: 1.4; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-section ul { margin: 0; padding: 0; list-style: none; }
.nav-section a { display: block; margin-inline: -0.65rem; border-radius: 0.55rem; padding: 0.42rem 0.65rem; color: var(--muted); font-size: 0.9375rem; line-height: 1.4; text-decoration: none; transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease); }
.nav-section a:hover { background: var(--surface-soft); color: var(--text); transform: translateX(2px); }
.nav-section a:active { transform: translateX(1px) scale(0.99); }
.nav-section a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-hover); font-weight: 700; }

.article-wrap { min-width: 0; padding: clamp(1.75rem, 4vw, 4.5rem) clamp(1.25rem, 4vw, 4rem) 3rem; }
.breadcrumbs { max-width: var(--content-width); margin: 0 auto 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.875rem; }
.breadcrumbs a { color: var(--accent-hover); font-weight: 650; }
.prose { max-width: var(--content-width); margin-inline: auto; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3 { color: var(--text); text-wrap: balance; letter-spacing: -0.035em; }
.prose h1 { max-width: 18ch; margin-bottom: 1.25rem; font-size: clamp(2.25rem, 5vw, 3.7rem); line-height: 1.02; font-weight: 700; }
.prose h2 { margin: 3.5rem 0 1rem; padding-top: 0.35rem; font-size: clamp(1.55rem, 2.8vw, 2rem); line-height: 1.2; }
.prose h3 { margin: 2.4rem 0 0.8rem; font-size: 1.25rem; line-height: 1.3; }
.heading-link { margin-inline-start: 0.5rem; color: var(--control); font-size: 0.75em; font-weight: 500; opacity: 0; text-decoration: none; transition: opacity var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease); }
.prose h2:hover .heading-link, .prose h3:hover .heading-link, .heading-link:focus-visible { opacity: 1; }
.prose p, .prose li { max-width: 70ch; color: var(--text); }
.prose p { margin: 1rem 0; }
.prose li + li { margin-top: 0.45rem; }
.prose strong { font-weight: 700; }
.prose hr { margin: 3rem 0; border: 0; height: 1px; background: var(--rule); }
.prose blockquote { margin: 1.75rem 0; border-radius: var(--radius-md); background: var(--accent-soft); padding: 1rem 1.25rem; box-shadow: inset 4px 0 0 var(--accent); }
.prose blockquote p { margin: 0; }
.prose code:not(pre code) { border-radius: 0.35rem; background: var(--surface-soft); padding: 0.12rem 0.35rem; color: var(--panel); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 0.9em; }
.source-only { color: var(--muted); text-decoration: underline dotted; text-underline-offset: 0.2em; }

.screenshot { margin: 2rem 0 2.5rem; border-radius: var(--radius-lg); background: var(--surface); padding: clamp(0.55rem, 1vw, 0.8rem); box-shadow: var(--shadow); }
.screenshot a { display: block; overflow: hidden; border-radius: calc(var(--radius-lg) - 0.45rem); }
.screenshot img { width: 100%; border-radius: inherit; background: var(--surface-soft); transition: transform var(--motion-base) var(--ease), opacity var(--motion-base) var(--ease); }
.screenshot a:hover img { transform: scale(1.008); opacity: 0.96; }
.screenshot a:active img { transform: scale(0.997); }
.screenshot figcaption { padding: 0.8rem 0.55rem 0.3rem; color: var(--muted); font-size: 0.9375rem; font-weight: 600; line-height: 1.5; }

.prose table { display: block; width: 100%; margin: 1.75rem 0; overflow-x: auto; overflow-y: hidden; border-collapse: collapse; scrollbar-width: thin; box-shadow: 0 1px 0 var(--rule), 0 -1px 0 var(--rule); }
.prose th, .prose td { min-width: 9rem; padding: 0.8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
.prose th { background: var(--surface-soft); color: var(--text); font-size: 0.875rem; }
.prose tr:last-child td { border-bottom: 0; }

.code-block { position: relative; margin: 1.75rem 0; border-radius: var(--radius-md); overflow: hidden; background: var(--panel); color: var(--text-on-dark); box-shadow: var(--shadow-small); }
.code-block figcaption { min-height: 2.65rem; display: flex; align-items: center; padding: 0.55rem 5rem 0.55rem 1rem; background: var(--panel-raised); color: var(--muted-on-dark); font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.copy-code { position: absolute; inset: 0.45rem 0.55rem auto auto; border: 0; border-radius: 0.45rem; background: var(--accent-soft); padding: 0.32rem 0.65rem; color: var(--accent-hover); font-size: 0.8125rem; font-weight: 700; transition: transform var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease); }
.copy-code:hover { background: var(--accent-detail); }
.copy-code:active { transform: scale(0.96); }
.code-block pre { margin: 0; padding: 1.1rem 1.2rem 1.25rem; overflow-x: auto; scrollbar-width: none; }
.code-block pre::-webkit-scrollbar { display: none; }
.code-block code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 0.9rem; line-height: 1.65; }
.hljs { color: #edf2eb; background: transparent; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal { color: #c7e7ce; }
.hljs-string, .hljs-attr { color: #f1d89a; }
.hljs-number, .hljs-variable { color: #d4b7e7; }
.hljs-comment { color: #bac7bc; font-style: italic; }

.toc { padding: 2.25rem clamp(1rem, 2.5vw, 2rem) 3rem 1.25rem; }
.toc > strong { display: block; margin-bottom: 0.7rem; color: var(--text); font-size: 0.875rem; }
.toc ol { margin: 0; padding: 0; list-style: none; }
.toc li + li { margin-top: 0.45rem; }
.toc .toc-level-3 { padding-inline-start: 0.8rem; }
.toc a { display: block; color: var(--muted); font-size: 0.875rem; line-height: 1.4; text-decoration: none; transition: color var(--motion-fast) var(--ease), transform var(--motion-fast) var(--ease); }
.toc a:hover, .toc a[aria-current="location"] { color: var(--accent-hover); transform: translateX(2px); }
.toc a[aria-current="location"] { font-weight: 700; }
.toc-empty { color: var(--muted); font-size: 0.875rem; }

.pager { max-width: var(--content-width); margin: 4rem auto 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.pager a { min-height: 6rem; display: flex; flex-direction: column; justify-content: center; border-radius: var(--radius-md); background: var(--surface); padding: 1rem 1.2rem; color: var(--text); text-decoration: none; box-shadow: var(--shadow-small); transition: transform var(--motion-fast) var(--ease), background var(--motion-fast) var(--ease); }
.pager a:hover { background: var(--accent-soft); transform: translateY(-2px); }
.pager a:active { transform: translateY(1px) scale(0.99); }
.pager a span { color: var(--muted); font-size: 0.8125rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.pager a strong { margin-top: 0.25rem; }
.pager-next { text-align: right; }
.article-footer { max-width: var(--content-width); margin: 2.5rem auto 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9375rem; }
.article-footer p { margin: 0; }

.mobile-nav { display: none; }
.search-dialog, .image-dialog { border: 0; padding: 0; color: var(--text); box-shadow: var(--shadow); }
.search-dialog::backdrop, .image-dialog::backdrop { background: rgb(23 35 28 / 0.72); backdrop-filter: blur(4px); }
.search-dialog { width: min(42rem, calc(100vw - 2rem)); border-radius: var(--radius-lg); background: var(--surface); }
.search-dialog form { padding: 1rem; }
.search-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.search-head label { font-size: 1.125rem; font-weight: 700; }
.search-head button, .image-dialog button { border: 0; border-radius: 0.45rem; background: var(--surface-soft); padding: 0.4rem 0.65rem; color: var(--text); font-size: 0.875rem; font-weight: 700; }
#docs-search { width: 100%; min-height: 3.25rem; border: 1px solid var(--control); border-radius: var(--radius-sm); background: var(--bg); padding: 0.7rem 0.9rem; color: var(--text); }
.search-hint { margin: 0.55rem 0; color: var(--muted); font-size: 0.8125rem; }
.search-results { max-height: min(28rem, 55vh); overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.search-results a { display: block; border-radius: var(--radius-sm); padding: 0.75rem 0.8rem; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--accent-soft); }
.search-results span, .search-results small { display: block; }
.search-results span { font-weight: 700; }
.search-results small { margin-top: 0.1rem; color: var(--muted); }
.search-empty { padding: 1rem; color: var(--muted); }
.image-dialog { width: min(92vw, 90rem); max-height: 92vh; border-radius: var(--radius-lg); background: var(--panel); }
.image-dialog form { position: absolute; inset: 0.75rem 0.75rem auto auto; z-index: 2; }
.image-dialog img { width: 100%; max-height: 80vh; aspect-ratio: 16 / 10; object-fit: contain; background: var(--panel); }
.image-dialog p { margin: 0; padding: 0.85rem 1rem 1rem; color: var(--text-on-dark); }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: minmax(14rem, var(--sidebar-width)) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 780px) {
  :root { --header-height: 4.25rem; }
  .site-header { min-height: var(--header-height); padding: 0.6rem 1rem; }
  .wordmark small, .site-link, .search-trigger kbd { display: none; }
  .search-trigger { min-width: auto; gap: 0; }
  .mobile-nav { display: block; padding: 0.75rem 1rem 0; }
  .mobile-nav details { border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-small); }
  .mobile-nav summary { padding: 0.8rem 1rem; font-weight: 700; }
  .mobile-nav nav { max-height: 65vh; overflow-y: auto; padding: 0 1rem 1rem; }
  .sidebar { display: none; }
  .docs-shell { display: block; min-height: 0; }
  .article-wrap { padding: 1.5rem 1rem 2.5rem; }
  .prose h1 { font-size: clamp(2rem, 11vw, 3rem); }
  .prose h2 { margin-top: 2.75rem; }
  .screenshot { margin-inline: -0.35rem; border-radius: var(--radius-md); }
  .pager { grid-template-columns: 1fr; }
  .pager > span:empty { display: none; }
  .pager-next { text-align: left; }
  .article-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (forced-colors: active) {
  :focus-visible { outline-color: Highlight; }
  .nav-section a[aria-current="page"], .toc a[aria-current="location"] { outline: 2px solid Highlight; }
}

@media print {
  .site-header, .sidebar, .toc, .mobile-nav, .pager, .article-footer, .reading-progress, .heading-link, .copy-code { display: none !important; }
  .docs-shell { display: block; }
  .article-wrap { padding: 0; }
  .prose { max-width: none; }
  .screenshot, .code-block { box-shadow: none; break-inside: avoid; }
}
