/*
 * Moonglade web foundation: design tokens, light and dark themes, base styles
 * and the components of the pages Moonglade serves (the holding page, the
 * landing, the static pages, the search page and share links; the confirm
 * pages and the dashboard later).
 *
 * Tokens are CSS custom properties prefixed --mg-. Pages use the semantic
 * --mg-color-* tokens, never the raw palette, so both themes follow from one
 * place. Text pairs meet WCAG 2.2 AA (4.5:1 for text, 3:1 for focus rings and
 * control borders); internal/webui's contrast test checks every pair named
 * there. Signal is too dark for text on Ink (3.4:1), so dark links use Sky.
 *
 * Content Security Policy: the pages allow styles from 'self' only, so no
 * page may use a style attribute or a <style> element; put the rule here.
 * url() references are relative to this file and must name files under
 * web/static; the server rewrites them to content-hashed URLs.
 */

@font-face {
  font-family: "Geist";
  src: url("/static/fonts/geist/Geist-Variable.a369fcf5628e.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/fonts/geist/GeistMono-Variable.fba8f577f38a.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Tokens, and the light theme (the default). */
:root {
  /* Palette (web/brand/BRAND.txt). */
  --mg-ink: #121820;
  --mg-chalk: #f5f5f0;
  --mg-signal: #165dff;
  --mg-sky: #44b8f1;
  --mg-ice: #91ddf4;
  --mg-moon: #ffe4a8;
  --mg-white: #ffffff;

  /* Semantic colors, light theme. */
  --mg-color-bg: var(--mg-chalk);
  --mg-color-surface: var(--mg-white);
  --mg-color-text: var(--mg-ink);
  --mg-color-text-muted: #5a6370;
  --mg-color-border: #d9deda;
  --mg-color-border-strong: #878c93;
  --mg-color-link: var(--mg-signal);
  --mg-color-focus: var(--mg-signal);
  --mg-color-accent: var(--mg-signal);
  --mg-color-on-accent: var(--mg-white);
  --mg-color-selection: var(--mg-ice);
  --mg-color-on-selection: var(--mg-ink);
  --mg-color-shadow: rgb(18 24 32 / 0.24);

  /* Type. Geist is the brand face (the wordmark is Geist 650, outlined). */
  --mg-font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --mg-font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Type scale: a major third (1.25) from 1rem; the two largest steps are fluid. */
  --mg-text-xs: 0.75rem;
  --mg-text-sm: 0.875rem;
  --mg-text-md: 1rem;
  --mg-text-lg: 1.25rem;
  --mg-text-xl: 1.5625rem;
  --mg-text-2xl: 1.953rem;
  --mg-text-3xl: clamp(1.953rem, 1.6rem + 1.6vw, 2.441rem);
  --mg-text-display: clamp(2.441rem, 1.7rem + 3.4vw, 3.815rem);

  --mg-weight-regular: 400;
  --mg-weight-medium: 500;
  --mg-weight-semibold: 600;
  --mg-weight-brand: 650;
  --mg-weight-bold: 700;

  --mg-leading-tight: 1.08;
  --mg-leading-snug: 1.3;
  --mg-leading-normal: 1.55;

  --mg-tracking-tight: -0.025em;
  --mg-tracking-normal: 0;
  --mg-tracking-caps: 0.08em;

  /* Spacing: a 4 px grid. */
  --mg-space-1: 0.25rem;
  --mg-space-2: 0.5rem;
  --mg-space-3: 0.75rem;
  --mg-space-4: 1rem;
  --mg-space-5: 1.5rem;
  --mg-space-6: 2rem;
  --mg-space-7: 3rem;
  --mg-space-8: 4rem;
  --mg-space-9: 6rem;
  --mg-space-10: 8rem;

  --mg-radius-sm: 4px;
  --mg-radius-md: 8px;
  --mg-radius-lg: 12px;
  --mg-radius-full: 9999px;

  /* Layout. */
  --mg-page-max: 72rem;
  --mg-gutter: clamp(1.25rem, 4vw, 4rem);
  --mg-measure: 65ch;

  --mg-duration: 150ms;
  --mg-ease: cubic-bezier(0.2, 0, 0, 1);

  color-scheme: light dark;
}

/* Dark theme. */
@media (prefers-color-scheme: dark) {
  :root {
    --mg-color-bg: var(--mg-ink);
    --mg-color-surface: #1b2330;
    --mg-color-text: var(--mg-chalk);
    --mg-color-text-muted: #9aa4b0;
    --mg-color-border: #2a3442;
    --mg-color-border-strong: #6b7683;
    --mg-color-link: var(--mg-sky);
    --mg-color-focus: var(--mg-sky);
    --mg-color-accent: var(--mg-signal);
    --mg-color-on-accent: var(--mg-white);
    --mg-color-selection: var(--mg-ice);
    --mg-color-on-selection: var(--mg-ink);
    --mg-color-shadow: rgb(0 0 0 / 0.6);
  }
}

/* Base. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--mg-color-bg);
  color: var(--mg-color-text);
  font-family: var(--mg-font-sans);
  font-size: var(--mg-text-md);
  font-weight: var(--mg-weight-regular);
  line-height: var(--mg-leading-normal);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

img,
svg,
picture {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--mg-color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--mg-color-focus);
  outline-offset: 2px;
  border-radius: var(--mg-radius-sm);
}

::selection {
  background: var(--mg-color-selection);
  color: var(--mg-color-on-selection);
}

/* Utilities. */
.mg-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* A small mono label in capitals, as on the identity sheet. */
.mg-eyebrow {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-xs);
  font-weight: var(--mg-weight-regular);
  letter-spacing: var(--mg-tracking-caps);
  line-height: var(--mg-leading-snug);
  text-transform: uppercase;
  color: var(--mg-color-text-muted);
}

/*
 * Logo: the Project Moonglade lockup, with its light or dark artwork chosen
 * by a <picture> source per color scheme. The primary lockup's SVG pads the
 * drawn lockup by 48 of its 1255.34 units on the left and right (44 below,
 * 38 above Project), about the quarter of the symbol's height that the brand
 * rules keep clear; the drawn lockup is 1159.35 units wide. The negative
 * margin takes the left padding back (48 / 1255.34 = 3.82% of the image), so
 * the mark lines up with the text under it; it adds no space.
 *
 * Below 180 px of drawn lockup the brand rules call for the standalone
 * symbol, so the image is never narrower than 195 px: 180 × 1255.34 /
 * 1159.35 = 194.9 px, padding included. The margin uses the same floor, so
 * the mark stays aligned at it.
 */
.mg-logo {
  margin-inline-start: calc(-0.0382 * max(195px, var(--mg-logo-width, 30rem)));
}

.mg-logo img {
  width: var(--mg-logo-width, 30rem);
  min-width: 195px;
  max-width: 100%;
}

/*
 * The primary lockup's image is its column (the viewport less two 20 px
 * gutters) plus the 3.82% the margin above takes back, so below a 387 px
 * viewport it would be under 360 px wide (359.2 px at 386 px, 360.3 px at
 * 387 px), where the brand prefers the single-line compact lockup; the
 * holding page's <picture> switches to it with this same media query. Its
 * SVG pads the drawn lockup by 24 of its 913.984 units on either side (28
 * above and below), so the margin takes back 24 / 913.984 = 2.63% instead.
 * The 195 px floor still holds 180 px of it: 195 × 865.984 / 913.984 =
 * 184.8 px.
 */
@media (max-width: 386.98px) {
  .mg-logo {
    margin-inline-start: calc(-0.0263 * max(195px, var(--mg-logo-width, 30rem)));
  }
}

/* Holding page. */
.mg-holding {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  max-width: var(--mg-page-max);
  margin-inline: auto;
  padding-inline: var(--mg-gutter);
}

.mg-holding__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--mg-space-2) var(--mg-space-5);
  padding-block: var(--mg-space-5) var(--mg-space-4);
  border-bottom: 1px solid var(--mg-color-border);
}

.mg-holding__main {
  align-self: center;
  padding-block: var(--mg-space-8) var(--mg-space-9);
  --mg-logo-width: min(30rem, 100%);
}

.mg-holding__tagline {
  margin-top: var(--mg-space-6);
  max-width: 12ch;
  font-size: var(--mg-text-display);
  font-weight: var(--mg-weight-medium);
  letter-spacing: var(--mg-tracking-tight);
  line-height: var(--mg-leading-tight);
  text-wrap: balance;
}

.mg-holding__line {
  margin-top: var(--mg-space-5);
  max-width: var(--mg-measure);
  font-size: var(--mg-text-lg);
  line-height: var(--mg-leading-snug);
  color: var(--mg-color-text-muted);
  text-wrap: pretty;
}

/* Page shell: every page but the holding page (share links, 404, and the
 * landing, search and static pages). */
.mg-page {
  max-width: var(--mg-page-max);
  margin-inline: auto;
  padding-inline: var(--mg-gutter);
}

.mg-page__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--mg-space-2) var(--mg-space-5);
  padding-block: var(--mg-space-4);
  border-bottom: 1px solid var(--mg-color-border);
}

.mg-page__home img {
  width: 12rem;
  min-width: 195px;
}

.mg-page__main {
  padding-block: var(--mg-space-7) var(--mg-space-9);
}

/* Buttons: a link or button styled as one. */
.mg-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: var(--mg-space-2) var(--mg-space-5);
  border: 1px solid var(--mg-color-accent);
  border-radius: var(--mg-radius-full);
  background: var(--mg-color-accent);
  color: var(--mg-color-on-accent);
  font: inherit;
  font-weight: var(--mg-weight-medium);
  text-decoration: none;
  cursor: pointer;
}

.mg-button--quiet {
  border-color: var(--mg-color-border-strong);
  background: transparent;
  color: var(--mg-color-text);
}

/* A quiet button as a search engine's home page has them (the landing's):
 * the surface's fill inside the control border, a smaller radius and
 * text, and on hover a firmer border and a soft shadow. It keeps
 * .mg-button's 44 px height, a comfortable tap target. */
.mg-button--soft {
  padding-inline: var(--mg-space-4);
  border-color: var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font-size: var(--mg-text-sm);
  transition: border-color var(--mg-duration) var(--mg-ease), box-shadow var(--mg-duration) var(--mg-ease);
}

.mg-button--soft:hover {
  border-color: var(--mg-color-text-muted);
  box-shadow: 0 1px 3px var(--mg-color-shadow);
}

.mg-button[hidden] {
  display: none;
}

/* Badges: tier and verified name. */
.mg-badge {
  display: inline-block;
  margin-inline-start: var(--mg-space-2);
  padding: 0 var(--mg-space-2);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-full);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text);
}

.mg-badge--quiet {
  color: var(--mg-color-text-muted);
}

.mg-notice {
  margin-top: var(--mg-space-5);
  max-width: var(--mg-measure);
  padding: var(--mg-space-4) var(--mg-space-5);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
}

/* Share links (plan 7.21): a name, a reference, a QR code and the ways to
 * open it in an agent; never content. */
.mg-share__name {
  margin-top: var(--mg-space-3);
  font-size: var(--mg-text-3xl);
  font-weight: var(--mg-weight-semibold);
  letter-spacing: var(--mg-tracking-tight);
  line-height: var(--mg-leading-tight);
  overflow-wrap: anywhere;
}

.mg-share__lead {
  margin-top: var(--mg-space-4);
  max-width: var(--mg-measure);
  color: var(--mg-color-text-muted);
}

.mg-share__ref {
  margin-top: var(--mg-space-3);
  color: var(--mg-color-text-muted);
}

.mg-share__ref code,
.mg-share__connect code {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

.mg-share__grid {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: var(--mg-space-6);
  margin-top: var(--mg-space-6);
  align-items: start;
}

@media (max-width: 40rem) {
  .mg-share__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The QR code keeps its own white square in both themes, so it scans. */
.mg-share__qr {
  width: 15rem;
  max-width: 100%;
  border-radius: var(--mg-radius-md);
}

.mg-share__heading {
  font-size: var(--mg-text-lg);
  font-weight: var(--mg-weight-semibold);
}

.mg-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-3);
  margin: var(--mg-space-4) 0 0;
  padding: 0;
  list-style: none;
}

.mg-share__label {
  display: block;
  margin-top: var(--mg-space-5);
  font-weight: var(--mg-weight-medium);
}

.mg-prompt {
  display: block;
  width: 100%;
  margin-top: var(--mg-space-2);
  padding: var(--mg-space-3);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  line-height: var(--mg-leading-snug);
  resize: vertical;
}

.mg-share__copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mg-space-3);
  margin-top: var(--mg-space-3);
}

.mg-toast {
  color: var(--mg-color-text-muted);
}

.mg-share__connect {
  margin-top: var(--mg-space-5);
  color: var(--mg-color-text-muted);
}

/* A share page's tools (design m12.md D294), above the QR code: the
 * count, each tool's name, class and who may call it, and the listing. */
.mg-share__tools {
  margin-top: var(--mg-space-6);
}

.mg-share__toollist {
  margin: var(--mg-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.mg-share__toollist li + li {
  margin-top: var(--mg-space-1);
}

.mg-share__toollist code,
.mg-share__tools a {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

.mg-candidates {
  margin: var(--mg-space-5) 0 0;
  padding: 0;
  list-style: none;
}

.mg-candidates__item {
  padding-block: var(--mg-space-4);
  border-bottom: 1px solid var(--mg-color-border);
}

.mg-candidates__name {
  font-size: var(--mg-text-lg);
  font-weight: var(--mg-weight-medium);
}

/* Header links and the footer. */
.mg-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-2) var(--mg-space-5);
}

.mg-nav a {
  color: var(--mg-color-text);
  font-weight: var(--mg-weight-medium);
  text-decoration: none;
}

.mg-nav a:hover {
  text-decoration: underline;
}

.mg-nav--quiet a {
  color: var(--mg-color-text-muted);
  font-size: var(--mg-text-sm);
  font-weight: var(--mg-weight-regular);
}

.mg-page__foot {
  padding-block: var(--mg-space-5) var(--mg-space-7);
  border-top: 1px solid var(--mg-color-border);
}

/* The search page's search box. */
.mg-search {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-3);
  margin-top: var(--mg-space-6);
}

.mg-search__input {
  flex: 1 1 16rem;
  min-height: 2.75rem;
  padding: var(--mg-space-2) var(--mg-space-4);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-full);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font: inherit;
}

/*
 * Landing (plan 8.10; design m7.md D25), and "Search opens soon", which
 * GET /search answers in the same layout while the search page is not
 * served: as plain as a search engine's home page. The page is the
 * viewport, a column of three rows: quiet links at the top right; the
 * lockup and the search pill, a little above the middle; and the footer,
 * pinned to the bottom, in one row on wide screens and in centered rows on
 * narrow ones. Nothing else.
 */
.mg-landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

.mg-landing__bar,
.mg-landing__main,
.mg-landing__foot {
  padding-inline: var(--mg-gutter);
}

.mg-landing__bar {
  display: flex;
  justify-content: flex-end;
  padding-block: var(--mg-space-1);
}

.mg-landing__bar .mg-nav {
  justify-content: flex-end;
  row-gap: 0;
  font-size: var(--mg-text-sm);
}

/* The header and footer links are 44 px tall, as the buttons are, so each
 * is a comfortable tap target (WCAG 2.5.5); the bar's and the footer's
 * padding is smaller by as much, so the text keeps its place. */
.mg-landing__bar .mg-nav a,
.mg-landing__foot .mg-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* The extra space under the column puts the lockup about a quarter of the
 * way down the viewport and the search box a little above its middle. */
.mg-landing__main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-block: var(--mg-space-6) max(var(--mg-space-8), 18vh);
  text-align: center;
}

/*
 * The landing's lockup ("landinglogo") is centered, so no margin takes its
 * padding back as .mg-logo's does: its image is the column, capped at
 * 24rem (384 px wide, 99.11 px tall). Below a 500 px viewport the column
 * is the viewport less two 20 px gutters, so below 400 px the primary
 * lockup's image would be under the 360 px the brand wants for it
 * (web/brand/BRAND.txt), and the partial's <picture> shows the compact
 * lockup there, capped at 18rem. The 195 px floor keeps 180 px of either
 * lockup drawn, as .mg-logo img does.
 */
.mg-landing__logo {
  align-self: stretch;
}

.mg-landing__logo img {
  width: min(24rem, 100%);
  min-width: 195px;
  margin-inline: auto;
}

@media (max-width: 399.98px) {
  .mg-landing__logo img {
    width: min(18rem, 100%);
  }
}

/* The search pill: one wide box, Moonglade's search field with a
 * magnifier inside, a firmer border and a soft shadow on hover and focus.
 * The box draws the input's focus ring, around the whole pill. */
.mg-landing__search {
  width: 100%;
  max-width: 36.5rem;
  margin-top: var(--mg-space-6);
}

.mg-landing__box {
  display: flex;
  align-items: center;
  gap: var(--mg-space-3);
  min-height: 3rem;
  padding-inline: var(--mg-space-4) var(--mg-space-5);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-full);
  background: var(--mg-color-surface);
  color: var(--mg-color-text-muted);
  cursor: text;
  transition: border-color var(--mg-duration) var(--mg-ease), box-shadow var(--mg-duration) var(--mg-ease);
}

.mg-landing__box:hover,
.mg-landing__box:focus-within {
  border-color: var(--mg-color-text-muted);
  box-shadow: 0 1px 6px var(--mg-color-shadow);
}

.mg-landing__box:focus-within {
  outline: 2px solid var(--mg-color-focus);
  outline-offset: 2px;
}

.mg-landing__icon {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
}

.mg-landing__input {
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mg-color-text);
  font: inherit;
  text-align: start;
  -webkit-appearance: none;
  appearance: none;
}

.mg-landing__input::placeholder {
  color: var(--mg-color-text-muted);
  opacity: 1;
}

.mg-landing__input::-webkit-search-decoration {
  -webkit-appearance: none;
}

.mg-landing__input:focus-visible {
  outline: none;
}

.mg-landing__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--mg-space-3);
  margin-top: var(--mg-space-5);
}

/* The one line under the buttons: what a result does, and the connector. */
.mg-landing__line {
  margin-top: var(--mg-space-5);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text-muted);
  text-wrap: balance;
}

.mg-landing__line code,
.mg-landing__lead code {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text);
  overflow-wrap: anywhere;
}

/* For assistants that read the landing (design m12.md D294): what
 * Moonglade is, then the URLs to start from, each written out. */
.mg-landing__agents {
  margin-top: var(--mg-space-5);
  max-width: var(--mg-measure);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text-muted);
  text-align: center;
  text-wrap: balance;
}

.mg-landing__agents p + p {
  margin-top: var(--mg-space-2);
}

.mg-landing__agents a,
.mg-landing__agents code {
  font-family: var(--mg-font-mono);
  overflow-wrap: anywhere;
}

/* "Search opens soon": the compact lockup, linking home, over a heading.
 * The link is 44 px tall around the 40 px image, a comfortable tap target. */
.mg-landing__home {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
}

.mg-landing__home img {
  width: 15rem;
  min-width: 195px;
}

.mg-landing__title {
  margin-top: var(--mg-space-6);
  font-size: var(--mg-text-2xl);
  font-weight: var(--mg-weight-semibold);
  letter-spacing: var(--mg-tracking-tight);
  line-height: var(--mg-leading-tight);
  text-wrap: balance;
}

.mg-landing__lead {
  max-width: 36.5rem;
  margin-top: var(--mg-space-4);
  color: var(--mg-color-text-muted);
  text-wrap: balance;
}

/* The footer: the links about Moonglade, the tagline and the legal links,
 * in centered rows, and from 60rem in one row with the tagline at the
 * page's center. */
.mg-landing__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-block: var(--mg-space-1) var(--mg-space-3);
  border-top: 1px solid var(--mg-color-border);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text-muted);
  text-align: center;
}

.mg-landing__foot .mg-nav {
  justify-content: center;
  gap: 0 var(--mg-space-4);
}

@media (min-width: 60rem) {
  .mg-landing__foot {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: var(--mg-space-5);
  }

  .mg-landing__foot .mg-landing__about {
    justify-content: flex-start;
  }

  .mg-landing__foot .mg-landing__legal {
    justify-content: flex-end;
  }
}

/* Static pages: prose at a readable measure. */
.mg-prose {
  max-width: var(--mg-measure);
}

.mg-prose code {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

.mg-prose h1 {
  margin-top: var(--mg-space-3);
  font-size: var(--mg-text-3xl);
  font-weight: var(--mg-weight-semibold);
  letter-spacing: var(--mg-tracking-tight);
  line-height: var(--mg-leading-tight);
}

.mg-prose h2 {
  margin-top: var(--mg-space-6);
  font-size: var(--mg-text-lg);
  font-weight: var(--mg-weight-semibold);
}

.mg-prose p,
.mg-prose ul {
  margin-top: var(--mg-space-3);
}

/* Search results (plan 8.10): a logo, the REST URL line, the name, the
 * badges, the summary and the verbs (the page shows no web results, design
 * m12.md D291). */
.mg-results {
  max-width: 48rem;
}

.mg-results__title {
  margin-top: var(--mg-space-3);
  font-size: var(--mg-text-2xl);
  font-weight: var(--mg-weight-semibold);
  overflow-wrap: anywhere;
}

.mg-results__note {
  margin-top: var(--mg-space-4);
  color: var(--mg-color-text-muted);
}

.mg-results__list {
  margin: var(--mg-space-4) 0 0;
  padding: 0;
  list-style: none;
}

.mg-result {
  display: flex;
  gap: var(--mg-space-4);
  padding-block: var(--mg-space-4);
  border-bottom: 1px solid var(--mg-color-border);
}

.mg-result__logo {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: var(--mg-radius-md);
  object-fit: contain;
}

.mg-result__body {
  min-width: 0;
}

.mg-result__url {
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-xs);
  color: var(--mg-color-text-muted);
  overflow-wrap: anywhere;
}

.mg-result__name {
  margin-top: var(--mg-space-1);
  font-size: var(--mg-text-lg);
  font-weight: var(--mg-weight-medium);
  overflow-wrap: anywhere;
}

.mg-result__summary {
  margin-top: var(--mg-space-2);
  overflow-wrap: anywhere;
}

/* The network's line on a result's tools (design m12.md D294). */
.mg-result__tools {
  margin-top: var(--mg-space-2);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

.mg-result__ask {
  margin-top: var(--mg-space-2);
  font-size: var(--mg-text-sm);
}

.mg-result__note {
  margin-top: var(--mg-space-2);
  font-size: var(--mg-text-sm);
  color: var(--mg-color-text-muted);
}

.mg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-2);
  margin: var(--mg-space-3) 0 0;
  padding: 0;
  list-style: none;
}

.mg-chips li {
  padding: 0 var(--mg-space-2);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-full);
  font-size: var(--mg-text-sm);
}

.mg-web__heading {
  font-size: var(--mg-text-lg);
  font-weight: var(--mg-weight-semibold);
}

/* The hand-off dialog. */
.mg-handoff {
  max-width: min(36rem, calc(100vw - 2 * var(--mg-space-4)));
  padding: var(--mg-space-6);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-lg);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
}

.mg-handoff::backdrop {
  background: color-mix(in srgb, var(--mg-ink) 60%, transparent);
}

.mg-handoff form {
  margin-top: var(--mg-space-4);
}

/* A button that reads as a link (the remembered choice's "Change"). */
.mg-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--mg-color-link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* The dashboard on app.ROOT (design m11.md D129): forms, tables of the
 * account's entities, keys and sessions, an entity's facts, and a new key's
 * secret. Existing tokens only. */
.mg-form {
  display: grid;
  gap: var(--mg-space-2);
  max-width: 36rem;
  margin-block: var(--mg-space-5);
}

.mg-form input:not([type="checkbox"]):not([type="radio"]),
.mg-form select {
  min-height: 2.75rem;
  padding: var(--mg-space-2) var(--mg-space-3);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font: inherit;
}

.mg-form fieldset {
  display: grid;
  gap: var(--mg-space-2);
  margin: 0;
  padding: var(--mg-space-3) var(--mg-space-4);
  border: 1px solid var(--mg-color-border);
  border-radius: var(--mg-radius-md);
}

.mg-form .mg-button {
  justify-self: start;
  margin-top: var(--mg-space-2);
}

.mg-form__error,
.mg-dash__problem {
  font-weight: var(--mg-weight-medium);
}

.mg-dash__table {
  width: 100%;
  margin-block: var(--mg-space-5);
  border-collapse: collapse;
  font-size: var(--mg-text-sm);
}

.mg-dash__table th,
.mg-dash__table td {
  padding: var(--mg-space-2) var(--mg-space-3);
  border-bottom: 1px solid var(--mg-color-border);
  text-align: start;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.mg-dash__table th {
  color: var(--mg-color-text-muted);
  font-weight: var(--mg-weight-medium);
}

.mg-dash__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--mg-space-2) var(--mg-space-5);
  margin-block: var(--mg-space-5);
}

.mg-dash__facts dt {
  color: var(--mg-color-text-muted);
}

.mg-dash__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.mg-dash__signout {
  margin: 0;
}

.mg-dash__secret {
  display: inline-block;
  padding: var(--mg-space-2) var(--mg-space-3);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-sm);
  font-family: var(--mg-font-mono);
  overflow-wrap: anywhere;
  user-select: all;
}

.mg-nav a[aria-current="page"] {
  color: var(--mg-color-text);
  font-weight: var(--mg-weight-semibold);
}

/* The dashboard's Analytics and Visibility pages (design m11.md D132,
 * C6): an entity's tabs, the range form, figures, and charts drawn as
 * inline SVG on the server, styled here alone (no style attribute, no
 * presentation attribute): one accent series, recessive axes, a 2 px line
 * whatever the chart's scale, a surface ring on the last point. */
.mg-dash__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-2) var(--mg-space-5);
  margin-block: var(--mg-space-4);
  border-bottom: 1px solid var(--mg-color-border);
}

.mg-dash__tabs a {
  padding-block: var(--mg-space-2);
  border-bottom: 2px solid transparent;
}

.mg-dash__tabs a[aria-current="page"] {
  border-bottom-color: var(--mg-color-accent);
  color: var(--mg-color-text);
  font-weight: var(--mg-weight-semibold);
}

.mg-dash__range {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--mg-space-3);
  margin-block: var(--mg-space-4);
}

.mg-dash__range input {
  display: block;
  margin-top: var(--mg-space-1);
  padding: var(--mg-space-2) var(--mg-space-3);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font: inherit;
}

.mg-dash__note,
.mg-dash__api {
  color: var(--mg-color-text-muted);
  font-size: var(--mg-text-sm);
}

.mg-dash__api {
  display: block;
}

.mg-dash__list li + li {
  margin-top: var(--mg-space-3);
}

.mg-dash__tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--mg-space-3);
  margin-block: var(--mg-space-5);
}

.mg-dash__tile {
  padding: var(--mg-space-3) var(--mg-space-4);
  border: 1px solid var(--mg-color-border);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
}

.mg-dash__tile dt {
  color: var(--mg-color-text-muted);
  font-size: var(--mg-text-sm);
}

.mg-dash__tile dd {
  margin: 0;
  font-size: var(--mg-text-xl);
  font-weight: var(--mg-weight-semibold);
}

.mg-chart {
  display: block;
  width: 100%;
  max-width: 40rem;
  height: auto;
  margin-block: var(--mg-space-3);
}

.mg-chart--spark {
  display: inline-block;
  width: 8rem;
  max-width: none;
  margin: 0 0 0 var(--mg-space-2);
  vertical-align: middle;
}

.mg-chart__bar,
.mg-chart__dot {
  fill: var(--mg-color-accent);
}

.mg-chart__mark:hover .mg-chart__bar {
  fill: var(--mg-color-link);
}

.mg-chart__hit {
  fill: transparent;
}

.mg-chart__axis {
  stroke: var(--mg-color-border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.mg-chart__line {
  fill: none;
  stroke: var(--mg-color-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.mg-chart__dot {
  stroke: var(--mg-color-surface);
  stroke-width: 2;
}

/* The dashboard's publishing pages (design m11.md D132, C2): the manifest
 * and page editors' text areas, the page editor beside its sandboxed
 * preview, the typed blocks' buttons, an upload's progress and status, and
 * a read-only notice. Existing tokens only. */
.mg-form--wide {
  max-width: none;
}

.mg-form textarea,
.mg-dash__code {
  min-height: 8rem;
  padding: var(--mg-space-2) var(--mg-space-3);
  border: 1px solid var(--mg-color-border-strong);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  color: var(--mg-color-text);
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  line-height: var(--mg-leading-normal);
  resize: vertical;
}

.mg-form fieldset:disabled {
  border-style: dashed;
}

.mg-dash__pre {
  margin-block: var(--mg-space-3);
  padding: var(--mg-space-3);
  border: 1px solid var(--mg-color-border);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
  font-family: var(--mg-font-mono);
  font-size: var(--mg-text-sm);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mg-dash__editor {
  display: grid;
  gap: var(--mg-space-5);
  margin-block: var(--mg-space-5);
}

@media (min-width: 64rem) {
  .mg-dash__editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.mg-dash__frame {
  display: block;
  width: 100%;
  min-height: 32rem;
  border: 1px solid var(--mg-color-border);
  border-radius: var(--mg-radius-md);
  background: var(--mg-color-surface);
}

.mg-dash__blocks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mg-space-2);
}

.mg-dash__progress {
  width: 100%;
  accent-color: var(--mg-color-accent);
}

.mg-dash__upload {
  margin-block: var(--mg-space-3);
}

.mg-dash__readonly {
  margin-block: var(--mg-space-4);
}

/* The operators' pages on admin.ROOT (docs/design/admin-pages.md, section
 * 4.1): the dashboard's classes, and these. References and third-party
 * text are isolated from what is around them, as <bdi> is, for browsers
 * whose stylesheet lacks it, so that their direction marks cannot reorder
 * the page (AP9). Existing tokens only. */
.mg-admin__ref,
.mg-admin__untrusted {
  unicode-bidi: isolate;
}

.mg-admin__ref code {
  font-family: var(--mg-font-mono);
  overflow-wrap: anywhere;
}

.mg-admin__actor {
  margin: 0;
  color: var(--mg-color-text-muted);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

/* The dashboard's Share tab and its poster (design m11.md D138, C7b): the
 * share answer's QR code inlined at the width of its box (its own white
 * square, so it scans in both themes), and a poster that prints alone on
 * A4 or Letter, in the light theme, without the dashboard's header. Existing
 * tokens only. */
.mg-dash__qr,
.mg-poster__qr {
  width: 15rem;
  max-width: 100%;
}

.mg-dash__qr svg,
.mg-poster__qr svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--mg-radius-md);
}

.mg-poster__sheet {
  display: grid;
  justify-items: center;
  gap: var(--mg-space-4);
  max-width: 40rem;
  margin-inline: auto;
  text-align: center;
}

.mg-poster__ref {
  font-size: var(--mg-text-display);
  font-weight: var(--mg-weight-semibold);
  letter-spacing: var(--mg-tracking-tight);
  line-height: var(--mg-leading-tight);
  overflow-wrap: anywhere;
}

.mg-poster__ask {
  font-size: var(--mg-text-xl);
  line-height: var(--mg-leading-snug);
}

.mg-poster .mg-poster__qr {
  width: min(100%, 22rem);
}

.mg-poster__link {
  color: var(--mg-color-text-muted);
  font-size: var(--mg-text-sm);
  overflow-wrap: anywhere;
}

@media print {
  :root {
    --mg-color-bg: var(--mg-white);
    --mg-color-surface: var(--mg-white);
    --mg-color-text: var(--mg-ink);
    --mg-color-text-muted: #5a6370;
    --mg-color-border: #d9deda;
    --mg-color-link: var(--mg-signal);
  }

  @page {
    margin: 15mm;
  }

  .mg-poster .mg-page__bar,
  .mg-poster__screen {
    display: none;
  }

  .mg-poster .mg-page__main {
    padding-block: 0;
  }

  .mg-poster__sheet {
    break-inside: avoid;
  }
}

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