/* Palette and type dealt by the design kit (start.mjs css): keep in sync with public/index.html. */
:root {
  --p-bg: #18191b; --p-surface: #222427; --p-ink: #eff0f1; --p-muted: #9c9ea3;
  --p-accent: #ff4a1f; --p-accent-ink: #18191b; --p-action: #ff4a1f; --p-action-ink: #18191b;
  --p-inv-bg: #eff0f1; --p-inv-surface: #dedfe0; --p-inv-ink: #18191b; --p-inv-muted: #5b5c5e;
  --p-inv-accent: #18191b; --p-inv-accent-ink: #eff0f1; --p-inv-action: #18191b; --p-inv-action-ink: #eff0f1;
  --font-display: "Host Grotesk", system-ui, sans-serif;
  --font-text: "Host Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --display-weight: 500;
  --display-tracking: -0.035em;
  --display-tracking-xl: -0.04em;
}

/* Inner pages (docs, changelog) are long reading pages, not one-screen sections: the kit's
   screen-height rules for main > section and footer.closing would make long content run
   under the footer, so these pages grow with their content. */
main > :is(section, .section), footer.closing { height: auto; min-height: 0; }
main > :is(section, .section) > :is(.wrap, .container), footer.closing > .wrap { height: auto; }
footer.closing { padding-top: var(--s-9); padding-bottom: var(--s-8); }

.page { padding-top: calc(var(--nav) + var(--s-8)); padding-bottom: var(--s-9); }
.page__head { max-width: 62ch; margin-bottom: var(--s-8); }
.page__head p { color: var(--muted); margin-top: var(--s-4); font-size: var(--t-lead); }

/* Changelog */
.log { list-style: none; margin: 0; padding: 0; }
.log__entry { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: var(--s-6); padding: var(--s-7) 0; border-top: 1px solid var(--line); }
.log__meta { color: var(--muted); font-size: var(--t-small); display: flex; flex-direction: column; gap: var(--s-2); }
.log__tag { align-self: start; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px 8px; font-size: 13px; color: var(--ink); }
.log__entry h2 { font-size: var(--t-h3); margin: 0 0 var(--s-4); }
.log__entry ul { list-style: disc; margin: 0; padding-left: 1.1em; display: grid; gap: var(--s-2); overflow-wrap: anywhere; }
aside .rows__name small { display: block; }
@media (max-width: 1023px) { .page .grid > aside { grid-column: 1 / -1; margin-top: var(--s-8); } .page .grid > .span-8 { grid-column: 1 / -1; } }
@media (max-width: 639px) { .log__entry { grid-template-columns: minmax(0, 1fr); gap: var(--s-3); } }

/* Docs: sidebar with search and groups, the article with breadcrumbs, the table of contents. */
.docs-page { padding-top: var(--nav); }
.wrap.docs-layout {
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 200px; gap: var(--s-8);
  align-items: start; padding-block: var(--s-8) var(--s-9);
}
.docs-layout__side, .docs-layout__toc { position: sticky; top: calc(var(--nav) + var(--s-6)); max-height: calc(100vh - var(--nav) - var(--s-8)); overflow-y: auto; }
.docs-layout__main { min-width: 0; }
.docs-mobile-nav { display: none; }

.docs-side { display: flex; flex-direction: column; gap: var(--s-5); }
.docs-search { display: flex; align-items: center; gap: var(--s-2); height: 40px; padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.docs-search svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.docs-search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; outline: none; }
.docs-search:focus-within { border-color: var(--action); }
.docs-group { margin: 0; }
.docs-group summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 500; color: var(--ink); padding: var(--s-2) 0; }
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: 4px; }
.docs-group:not([open]) summary::after { transform: rotate(-45deg); }
.docs-group ul { list-style: none; margin: 0 0 var(--s-3); padding: 0 0 0 var(--s-3); border-left: 1px solid var(--line); display: grid; }
.docs-group a { display: flex; align-items: center; min-height: 36px; padding: 0 var(--s-3); margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 15px; }
.docs-group a:hover { color: var(--ink); }
.docs-group a[aria-current="page"] { color: var(--ink); border-left-color: var(--action); font-weight: 500; }
.docs-empty { color: var(--muted); font-size: 14px; }

.docs-crumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: 14px; color: var(--muted); margin-bottom: var(--s-4); }
.docs-crumbs a { color: var(--muted); text-decoration: none; }
.docs-crumbs a:hover { color: var(--ink); }
.docs-crumbs [aria-current] { color: var(--ink); }
.docs-title { font-size: var(--t-h2); margin: 0 0 var(--s-6); overflow-wrap: anywhere; }
.docs-lead { font-size: var(--t-lead); color: var(--muted); max-width: 62ch; margin: 0 0 var(--s-7); }
.docs-note { color: var(--muted); margin-top: var(--s-7); }

.docs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.docs-card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); text-decoration: none; transition: transform .15s, border-color .15s; }
.docs-card:hover { transform: translateY(-2px); border-color: color-mix(in oklab, var(--ink) 30%, transparent); }
.docs-card__group { font-size: 13px; color: var(--action); }
.docs-card__title { font-size: var(--t-card); font-weight: 500; }
.docs-card__text { color: var(--muted); font-size: 15px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-9); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.docs-pager__link { display: flex; flex-direction: column; gap: var(--s-1); padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink); text-decoration: none; font-weight: 500; }
.docs-pager__link span { font-size: 13px; color: var(--muted); font-weight: 400; }
.docs-pager__link--next { text-align: right; grid-column: 2; }
.docs-pager__link:hover { border-color: color-mix(in oklab, var(--ink) 30%, transparent); }

.docs-toc__title { font-size: 13px; font-weight: 500; margin: 0 0 var(--s-3); }
.docs-toc { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.docs-toc a { color: var(--muted); text-decoration: none; font-size: 14px; line-height: 1.4; display: block; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc .is-sub { padding-left: var(--s-4); }

.prose { max-width: 72ch; font-size: 17px; line-height: 1.7; overflow-wrap: break-word; }
.prose h2 { font-size: var(--t-h3); margin: var(--s-8) 0 var(--s-4); scroll-margin-top: calc(var(--nav) + var(--s-5)); position: relative; }
.prose h3 { font-size: var(--t-card); margin: var(--s-7) 0 var(--s-3); scroll-margin-top: calc(var(--nav) + var(--s-5)); position: relative; }
.prose .anchor { position: absolute; left: -1.1em; color: var(--muted); text-decoration: none; opacity: 0; }
.prose :is(h2, h3):hover .anchor { opacity: 1; }
.prose p, .prose ul, .prose ol, .prose pre, .prose .table-scroll { margin: 0 0 var(--s-5); }
.prose ul { list-style: disc; padding-left: 1.3em; }
.prose ol { list-style: decimal; padding-left: 1.4em; }
.prose li + li { margin-top: var(--s-2); }
.prose a { color: var(--action); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface); padding: 0.1em 0.35em; border-radius: var(--r-sm); overflow-wrap: anywhere; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-5); overflow-x: auto; max-width: 100%; }
.prose pre code { background: none; padding: 0; font-size: 14px; line-height: 1.6; overflow-wrap: normal; }
.prose .table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r-md); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td { text-align: left; border-bottom: 1px solid var(--line); padding: var(--s-3) var(--s-4); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { background: var(--surface); font-weight: 500; }
.prose blockquote { margin: 0 0 var(--s-5); padding-left: var(--s-5); border-left: 2px solid var(--line); color: var(--muted); }

@media (max-width: 1279px) {
  .wrap.docs-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .docs-layout__toc { display: none; }
}
@media (max-width: 1023px) {
  .wrap.docs-layout { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); padding-top: var(--s-5); }
  .docs-layout__side { position: static; max-height: none; overflow: visible; }
  .docs-desktop-nav { display: none; }
  .docs-mobile-nav { display: block; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .docs-mobile-nav > summary { cursor: pointer; list-style: none; padding: 0 var(--s-4); min-height: 48px; display: flex; align-items: center; font-weight: 500; }
  .docs-mobile-nav > summary::-webkit-details-marker { display: none; }
  .docs-mobile-nav[open] > .docs-side { padding: 0 var(--s-4) var(--s-4); }
  .docs-cards { grid-template-columns: minmax(0, 1fr); }
  .prose .anchor { display: none; }
}
@media (max-width: 639px) {
  .docs-pager { grid-template-columns: minmax(0, 1fr); }
  .docs-pager__link--next { grid-column: 1; }
  .prose { font-size: 16px; }
}

/* Tables keep code on one line and scroll sideways inside their box on small screens. */
.prose td code, .prose th code { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 1023px) { .prose table { min-width: 640px; } }
