/* SPDX-License-Identifier: AGPL-3.0-only */
/* The frame of the standalone pages (site-chrome.ts): the top bar, the docs' side column, the footer, and the layouts of the landing
   page, /install, the docs hub and the 404 pages (site-build.ts). Type and layout tokens come from docs.css; theme colours come from
   docs-theme.css. Mobile-first: one column, a 44 px target
   for every link row on touch, safe areas respected. Corner radii and durations read the tokens; no literal number of milliseconds. */

/* ---- Top bar --------------------------------------------------------------------------------------------------------------------
   The app's capsule in miniature: three tracks (name, capsule, links), floating over the page with the app's overlay material. The bar sticks,
   so the page scrolls under it. The pills here repeat the app's `.ui-pill` rules (packages/ui/styles.css) because the standalone pages
   load no app stylesheet: that file is 138 KB of canvas and window rules a reader never needs. */
.bar { position: sticky; top: 0; z-index: 10; padding: calc(env(safe-area-inset-top) + 0.625rem) var(--gutter) 0; pointer-events: none; }
.bar-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 0.625rem; max-width: 100rem; margin: 0 auto; }
.pill { --pill-fg: var(--docs-glass-fg, var(--fg)); --pill-fg-2: var(--docs-glass-fg-2, var(--fg-2)); box-sizing: border-box; display: inline-flex; align-items: center; height: var(--pill-h); border: 1px solid var(--overlay-line); border-radius: var(--r-pill); background: var(--overlay); box-shadow: var(--shadow); -webkit-backdrop-filter: blur(var(--ui-overlay-blur)) saturate(var(--ui-overlay-saturation)); backdrop-filter: blur(var(--ui-overlay-blur)) saturate(var(--ui-overlay-saturation)); color: var(--pill-fg); font-size: var(--ui-size-label); font-weight: var(--fw-label); line-height: normal; pointer-events: auto; }
@media (pointer: coarse) { .pill { font-size: 0.9375rem; } }
.bar-brand { justify-self: start; padding: 0 1rem; color: var(--pill-fg); text-decoration: none; letter-spacing: -0.01em; transition: transform var(--t-press) var(--ease-out); }
.bar-brand:active { transform: scale(0.97); }
.bar-capsule { justify-self: center; justify-content: space-between; gap: 0.75rem; min-width: min(22rem, 100%); max-width: 100%; padding: 0 0.5rem 0 1rem; }
.bar-here { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The search button: the whole right end of the capsule is the target, so a phone taps the magnifier and a desktop clicks the key hint. */
.bar-kbd { display: inline-flex; flex: none; align-items: center; gap: 0.375rem; align-self: stretch; margin: 0 -0.5rem 0 0; padding: 0 0.5rem 0 0.25rem; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--pill-fg-2); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: color var(--t-press) ease; }
@media (hover: hover) and (pointer: fine) { .bar-kbd:hover { color: var(--pill-fg); } }
.bar-kbd svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.bar-kbd kbd { padding: 0.25rem 0.375rem; border-radius: var(--r-xs); background: var(--hover); font: inherit; font-family: "Maple Mono NF", ui-monospace, monospace; font-size: var(--ui-size-eyebrow); line-height: 1; }
.bar-end { justify-self: end; display: flex; }
.bar-links { gap: 0.125rem; padding: 0 0.375rem; }
.bar-links a, .bar-sheet a { display: inline-flex; align-items: center; box-sizing: border-box; height: calc(var(--pill-h) - 0.5rem); padding: 0 0.75rem; border-radius: var(--r-pill); color: var(--pill-fg-2); text-decoration: none; transition: background-color var(--t-press) ease, color var(--t-press) ease; }
@media (hover: hover) and (pointer: fine) { .bar-links a:hover, .bar-sheet a:hover { background: var(--hover); color: var(--pill-fg); } }
.bar-links a[aria-current="page"], .bar-sheet a[aria-current="page"] { color: var(--pill-fg); background: var(--hover); }
.bar-menu { display: none; position: relative; }
.bar-menu summary { justify-content: center; width: var(--pill-h); cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.bar-menu summary::-webkit-details-marker { display: none; }
.bar-menu summary svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.bar-sheet { --pill-fg: var(--fg); --pill-fg-2: var(--fg-2); position: absolute; top: calc(var(--pill-h) + 0.5rem); right: 0; flex-direction: column; align-items: stretch; height: auto; min-width: 11rem; padding: 0.375rem; border-radius: var(--r-lg); background: var(--overlay-solid); }
.bar-sheet a { height: var(--row); padding: 0 0.875rem; border-radius: var(--r-md); }
/* Under 80rem the three tracks no longer fit side by side: the links pill is about 25rem and the capsule's 22rem minimum is centred between two equal side tracks, so it ran under the pill and hid the search button: the links fold into the menu button and the capsule takes its own row. */
@media (max-width: 80rem) {
  /* Two rows: the name and the menu above, the capsule full width below, so a page title fits. The bar scrolls away on a phone, where height is dear. */
  .bar-in { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.5rem; }
  .bar-capsule { grid-row: 2; grid-column: 1 / -1; min-width: 0; width: 100%; }
  .bar-links { display: none; }
  .bar-menu { display: block; }
}
/* A phone: the bar scrolls away (height is dear), there is no key hint, and the section name is dropped from the place name. */
@media (max-width: 40rem) { .bar { position: static; } .bar-kbd kbd { display: none; } .bar-area { display: none; } }
/* The bar that scrolls away covers nothing, so a heading reached by a link needs no room for it: it lands 1 rem from the top, as doc.css says
   (#482; docs.css reserved the sticky bar's height, which left a 66 px gap on a phone). */
@media (max-width: 40rem) { :root { scroll-padding-top: 0; } }
/* On a docs page the capsule's outer edge is the text's left edge, as on a phone: the page's side padding is 2 rem from 64 rem up (below),
   so the bar takes the same padding and the same 96 rem of content instead of sitting 1 rem in from it (#482). */
@media (min-width: 64rem) { body:has(main.docs) .bar { padding-inline: 2rem; } body:has(main.docs) .bar-in { max-width: 96rem; } }
@media (prefers-reduced-motion: reduce) { .bar-brand, .bar-links a, .bar-sheet a { transition: none; } .bar-brand:active { transform: none; } }

/* ---- The search palette (site-search.ts) -------------------------------------------------------------------------------------------
   A modal <dialog>, centred like the app's palette and sized by its results. It opens and closes with no motion: it is usually opened from the
   keyboard (TASTE: nothing animates on a shortcut). The rows are links; the chosen row is `aria-selected`, as in the app. */
.search { box-sizing: border-box; width: min(40rem, calc(100% - 2rem)); max-height: min(34rem, 70dvh); padding: 0; flex-direction: column; border: 1px solid var(--overlay-line); border-radius: var(--r-lg); background: var(--overlay-solid); box-shadow: var(--shadow); color: var(--fg); overflow: hidden; }
.search[open] { display: flex; }
.search::backdrop { background: rgb(0 0 0 / 0.4); }
.search-field { display: flex; flex: none; align-items: center; gap: 0.75rem; padding: 0 1rem; border-bottom: 1px solid var(--line); }
.search-field svg { flex: none; width: 1rem; height: 1rem; fill: none; stroke: var(--fg-2); stroke-width: 1.6; stroke-linecap: round; }
.search-field input { box-sizing: border-box; width: 100%; height: 3.5rem; border: 0; outline: 0; background: transparent; color: var(--fg); font: var(--fw-body) max(1rem, var(--ui-size-body))/1.3 var(--font-read); /* ui-literal: D372, iOS zooms the page on focus below 16 px, which shifted the dialog off-screen */ -webkit-appearance: none; appearance: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input::placeholder { color: var(--fg-3); opacity: 1; }
.search-results { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0.5rem; }
.search-row { display: flex; flex-direction: column; gap: 0.125rem; box-sizing: border-box; min-height: var(--row); padding: 0.5rem 0.75rem; border-radius: var(--r-sm); color: var(--fg); text-decoration: none; }
.search-row[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.search-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 0.75rem; min-width: 0; }
.search-title { flex: 0 1 auto; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--ui-size-body); font-weight: var(--fw-label); }
.search-where { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-3); font-size: var(--ui-size-eyebrow); }
.search-snippet { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--fg-2); font-size: var(--ui-size-eyebrow); line-height: 1.4; overflow-wrap: anywhere; }
.search-snippet mark { border-radius: var(--r-xs); padding: 0 0.125rem; background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--fg); }
.search-note { margin: 1rem 0.75rem; color: var(--fg-2); font-size: var(--ui-size-body); }
.search-foot { display: flex; flex: none; align-items: center; gap: 0.25rem; margin: 0; padding: 0.625rem 0.875rem; border-top: 1px solid var(--line); color: var(--fg-3); font-size: var(--ui-size-eyebrow); }
.search-foot kbd { padding: 0.25rem; border-radius: var(--r-xs); background: var(--hover); font: inherit; line-height: 1; }
/* A phone sees phone things: no key hints, and the dialog sits under the top of the screen with the keyboard in mind. */
@media (hover: none), (pointer: coarse), (max-width: 40rem) { .search-foot { display: none; } .search { margin-top: calc(env(safe-area-inset-top) + 0.75rem); max-height: 60dvh; } }

/* ---- Docs layout: side column, text, contents ----------------------------------------------------------------------------------
   Wide: the audience's pages on the left (sticky), the text in the middle, the contents on the right (doc.css, sticky). The column that
   holds the text is the query container, so the contents fold when the column is too narrow for text and rail together. */
/* The page is a column that is at least as tall as the window, and the text takes the spare height, so the footer rests at the bottom of a
   short page (the 404) instead of floating mid-screen. `width: 100%` because auto side margins would otherwise shrink a flex item to its content. */
body { display: flex; flex-direction: column; min-height: 100dvh; }
main { display: block; flex: 1 0 auto; width: 100%; }
main.docs { box-sizing: border-box; max-width: 100rem; margin: 0 auto; padding: 1.5rem var(--gutter) 4rem; }
main.docs .docs-grid { display: block; }
.docs-col { container-type: inline-size; min-width: 0; }
/* An instance's own flat docs have no side column and so no `.docs-col`; the page itself is then the query container that doc.css asks
   whether the contents fit beside the text. Without it the contents stayed folded on a wide screen (#482). The sticky contents sit under
   the bar, whose height docs.css holds in `--bar-h`, not behind its pills. */
main.docs { container-type: inline-size; }
main.docs .doc .toc { top: calc(var(--bar-h) + 0.5rem); max-height: calc(100dvh - var(--bar-h) - 1.5rem); }
.side-rail { display: none; }
@media (min-width: 64rem) {
  main.docs { padding-top: 2.5rem; padding-inline: 2rem; }
  main.docs .docs-grid { display: grid; grid-template-columns: 15rem minmax(0, 1fr); column-gap: 3rem; align-items: start; }
  .side-fold { display: none; }
  .side-rail { display: block; }
}
.side-rail { position: sticky; top: calc(var(--bar-h) + 0.5rem); max-height: calc(100dvh - var(--bar-h) - 1.5rem); overflow-y: auto; overscroll-behavior: contain; font-size: var(--text-secondary); }
.side-fold { margin: 0 0 1.5rem; border-block: 1px solid var(--line); }
.side-fold summary { display: flex; align-items: center; justify-content: space-between; box-sizing: border-box; min-height: var(--row); padding: 0.25rem 0; color: var(--fg); font-weight: var(--fw-label); cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent; }
.side-fold summary::-webkit-details-marker { display: none; }
.side-fold summary::after { content: ""; width: 0.4em; height: 0.4em; margin-right: 0.2em; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-0.12em) rotate(45deg); transition: transform var(--t-pop) var(--ease-out); }
.side-fold[open] summary::after { transform: translateY(0.1em) rotate(-135deg); }
.side-fold > ul { padding-bottom: 0.5rem; }
.side-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1rem; padding: 0.1875rem; border-radius: var(--r-pill); background: var(--hover); }
.side-fold .side-tabs { margin-top: 0.25rem; }
.side-tabs a { flex: 1 1 auto; box-sizing: border-box; min-height: calc(var(--row) - 0.125rem); display: inline-flex; align-items: center; justify-content: center; padding: 0 0.625rem; border-radius: var(--r-pill); color: var(--fg-2); font-weight: var(--fw-label); text-align: center; text-decoration: none; white-space: nowrap; transition: background-color var(--t-press) ease, color var(--t-press) ease; }
.side-tabs a[aria-current="true"] { background: var(--bg); color: var(--fg); box-shadow: 0 0 0 1px var(--line); }
.side ul { margin: 0; padding: 0; list-style: none; }
.side li { margin: 0; }
.side li li { padding-left: 0.875rem; }
.side ul a { display: flex; align-items: center; box-sizing: border-box; min-height: var(--row); padding: 0.1875rem 0.625rem; border-radius: var(--r-sm); color: var(--fg-2); text-decoration: none; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) { .side ul a:hover { background: var(--hover); color: var(--fg); } }
.side ul a[aria-current="page"] { background: var(--hover); color: var(--fg); font-weight: var(--fw-label); }
@media (prefers-reduced-motion: reduce) { .side-fold summary::after, .side-tabs a, .side ul a { transition: none; } }

/* ---- Footer ---------------------------------------------------------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--line); color: var(--fg-2); font-size: var(--text-secondary); }
.foot-in { box-sizing: border-box; display: flex; flex-direction: column; gap: 0.75rem; max-width: 100rem; margin: 0 auto; padding: 1.5rem var(--gutter) calc(2rem + env(safe-area-inset-bottom)); }
.foot nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.foot a { display: inline-flex; align-items: center; min-height: var(--row); color: var(--fg-2); text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot p { max-width: 68ch; margin: 0; line-height: 1.5; }
@media (min-width: 64rem) { .foot-in { padding-inline: 2rem; } }

/* ---- Landing page, /install, docs hub, 404 -------------------------------------------------------------------------------------- */
main.site { box-sizing: border-box; max-width: 100rem; margin: 0 auto; padding: 2.5rem var(--gutter) 4rem; }
@media (min-width: 64rem) { main.site { padding: 4.5rem 2rem 6rem; } }
.hero { max-width: 52rem; }
.eyebrow { margin: 0 0 1rem; color: var(--fg-2); font-size: var(--ui-size-label); font-weight: var(--fw-label); letter-spacing: 0.02em; }
.hero h1 { margin: 0 0 1.25rem; font-size: clamp(2.25rem, 7.4vw, 4rem); font-weight: var(--fw-title); line-height: 1.05; letter-spacing: -0.04em; text-wrap: balance; }
.hero .lede { max-width: 38em; margin: 0 0 2rem; color: var(--fg-2); font-size: 1.2em; line-height: 1.55; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 2.5rem; }
.button { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; height: 2.5rem; padding: 0 1.25rem; border: 1px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--fg); font-size: var(--ui-size-label); font-weight: var(--fw-label); text-decoration: none; transition: transform var(--t-press) var(--ease-out), background-color var(--t-press) ease; }
.button.primary { border-color: transparent; background: var(--fg); color: var(--bg); }
.button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .button:not(.primary):hover { background: var(--hover); } }
@media (pointer: coarse) { .button { height: 2.75rem; font-size: 0.9375rem; } }
@media (prefers-reduced-motion: reduce) { .button { transition: none; } .button:active { transform: none; } }
/* The install command and the screenshot share the reading styles of a docs page (doc.css: copy on click, in-place "Copied", figure frame). */
.hero .doc { display: block; }
.hero .doc-code { max-width: 38em; margin: 0 0 0.5rem; }
.hero .doc pre { font-size: 0.9em; }
.hint { margin: 0 0 2rem; color: var(--fg-3); font-size: var(--text-secondary); }
.shot { margin: 3rem 0 0; }
.shot .doc { display: block; }
.shot .figure { margin: 0; }

.band { margin: 5rem 0 0; }
.band h2 { margin: 0 0 1.5rem; font-size: 1.5em; font-weight: var(--fw-title); letter-spacing: -0.02em; }
.cards { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 52rem) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; } }
.card { box-sizing: border-box; display: flex; flex-direction: column; height: 100%; margin: 0; padding: 1.5rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--wash); }
.card h3 { margin: 0 0 0.625rem; font-size: 1.2em; font-weight: var(--fw-title); letter-spacing: -0.01em; line-height: 1.3; }
.card p { margin: 0 0 1.25rem; color: var(--fg-2); line-height: 1.55; }
.card a { margin-top: auto; color: var(--fg); font-weight: var(--fw-label); }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; margin: 5rem 0 0; padding: 1.25rem 0 0; border-top: 1px solid var(--line); color: var(--fg-2); list-style: none; }
.facts li { margin: 0; }

/* Plain pages: install, releases, changelog, the docs hub and the 404 pages share one narrow reading column. */
.plain { max-width: 52rem; }
.plain h1 { margin: 0 0 0.75rem; font-size: 2.05em; font-weight: var(--fw-title); line-height: 1.15; letter-spacing: -0.03em; }
.plain .lede { max-width: 38em; margin: 0 0 2.5rem; color: var(--fg-2); font-size: 1.18em; line-height: 1.5; }
.plain h2 { margin: 3rem 0 0.875rem; font-size: 1.5em; font-weight: var(--fw-title); line-height: 1.25; letter-spacing: -0.02em; }
.plain p { max-width: 68ch; }
.plain .doc { display: block; }
.plain .doc-code { max-width: 68ch; margin: 0 0 1.25rem; }
.downloads { max-width: 68ch; margin: 0 0 1.5rem; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-md); }
.downloads li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; margin: 0; padding: 0.875rem 1rem; border-bottom: 1px solid var(--line); }
.downloads li:last-child { border-bottom: 0; }
.downloads strong { font-weight: var(--fw-label); }
.downloads span { color: var(--fg-2); font-size: var(--text-secondary); }
.downloads a { min-height: var(--row); display: inline-flex; align-items: center; font-weight: var(--fw-label); }
.note { max-width: 68ch; padding: 0.875rem 1.125rem; border: 1px solid color-mix(in oklab, var(--warn) 30%, transparent); border-radius: var(--r-md); background: color-mix(in oklab, var(--warn) 9%, transparent); }
.note > :first-child { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.install-status { margin: -0.75rem 0 1.5rem; color: var(--fg-2); font-size: var(--text-secondary); overflow-wrap: anywhere; }
.install-status:empty { display: none; }
.install-status[data-state="error"] { color: var(--warn); }
.audiences { display: grid; gap: 1rem; margin: 0 0 2rem; padding: 0; list-style: none; }
@media (min-width: 52rem) { .audiences { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.audiences li { margin: 0; }
.audiences a { box-sizing: border-box; display: flex; flex-direction: column; gap: 0.5rem; height: 100%; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--wash); color: var(--fg); text-decoration: none; transition: transform var(--t-press) var(--ease-out); }
.audiences a:active { transform: scale(0.98); }
.audiences strong { font-size: 1.1em; font-weight: var(--fw-title); }
.audiences span { color: var(--fg-2); line-height: 1.5; }
.audiences small { margin-top: auto; padding-top: 0.5rem; color: var(--fg-3); font-size: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { .audiences a { transition: none; } .audiences a:active { transform: none; } }
.empty { max-width: 38em; }
.code404 { margin: 0 0 1rem; color: var(--fg-3); font-size: var(--ui-size-label); font-weight: var(--fw-label); letter-spacing: 0.02em; }

/* An install command wraps instead of scrolling sideways, so all of it is visible at 375 px. */
.hero pre, .plain pre, .hero pre code, .plain pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Hint on hover (desktop only): a faint "Click to copy" in the block's top-right corner. It gives way to the in-place "Copied". */
.doc-code::after { content: "Click to copy"; position: absolute; top: 0.5rem; right: 0.75rem; color: var(--fg-2); font-size: var(--ui-size-eyebrow); line-height: 1; opacity: 0; pointer-events: none; transition: opacity var(--t-pop) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .doc-code:hover::after { opacity: 1; } .doc-code[data-copied]::after { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .doc-code::after { transition: none; } }
