/* devpage's built-in light and dark themes. Every color comes from these tokens,
   diagrams included, so a theme is a set of token values. */
:root {
  --background: #ffffff;
  --surface: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #d2d2d7;
  --accent: #0066cc;
  --code: #f5f5f7;
  --syntax-keyword: #9b2393;
  --syntax-string: #c41a16;
  --syntax-number: #1c00cf;
  --syntax-comment: #5d6c79;
  --syntax-type: #0b4f79;
  --syntax-function: #326d74;
  --syntax-attribute: #815f03;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

/* Dark: chosen with the theme selector (data-theme, set before the page
   paints), or — with no choice made and no script — by the system setting. */
:root[data-theme="dark"] {
    --background: #000000;
    --surface: #1d1d1f;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --border: #424245;
    --accent: #2997ff;
    --code: #1d1d1f;
    --syntax-keyword: #ff7ab2;
    --syntax-string: #ff8170;
    --syntax-number: #d9c97c;
    --syntax-comment: #7f8c98;
    --syntax-type: #dabaff;
    --syntax-function: #67b7a4;
    --syntax-attribute: #fd8f3f;
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --background: #000000;
    --surface: #1d1d1f;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --border: #424245;
    --accent: #2997ff;
    --code: #1d1d1f;
    --syntax-keyword: #ff7ab2;
    --syntax-string: #ff8170;
    --syntax-number: #d9c97c;
    --syntax-comment: #7f8c98;
    --syntax-type: #dabaff;
    --syntax-function: #67b7a4;
    --syntax-attribute: #fd8f3f;
  }
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }


* { box-sizing: border-box; }

body {
  margin: 0;
  display: flex;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Navigation */

#devpage-nav {
  position: sticky;
  top: 0;
  align-self: flex-start;
  width: 280px;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  padding: 28px 16px 40px 24px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  line-height: 1.4;
}

#devpage-nav .document-title {
  display: block;
  margin-bottom: 18px;
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

#devpage-nav ul { list-style: none; margin: 0; padding: 0; }
#devpage-nav ul ul { padding-left: 14px; border-left: 1px solid var(--border); margin: 2px 0 6px 6px; }
#devpage-nav li { margin: 0; }
#devpage-nav a { display: block; padding: 4px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
#devpage-nav a:hover { background: var(--border); }
#devpage-nav a.current { background: var(--accent); color: #fff; }

/* Content */

main { flex: 1; min-width: 0; padding: 56px 48px 120px; }
article { max-width: 780px; margin: 0 auto; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; }
h1 { font-size: 40px; font-weight: 700; margin: 0 0 24px; }
h2 { font-size: 28px; font-weight: 600; margin: 48px 0 16px; }
h3 { font-size: 21px; font-weight: 600; margin: 32px 0 12px; }
p, ul, ol, table, pre, blockquote, .diagram { margin: 0 0 20px; }
li { margin: 4px 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

blockquote {
  margin-left: 0;
  padding: 4px 20px;
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}

code { font: 0.88em var(--font-mono); background: var(--code); padding: 2px 5px; border-radius: 5px; }
pre { background: var(--code); padding: 16px 20px; border-radius: 10px; overflow-x: auto; line-height: 1.5; }
pre code { background: none; padding: 0; font-size: 14px; }

table { border-collapse: collapse; width: 100%; font-size: 15px; }
/* A wide table scrolls inside its own box, never the page. */
.table-scroll { overflow-x: auto; margin: 0 0 20px; }
.table-scroll > table { margin: 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; }

/* Diagrams: pele draws with its own variables, mapped to the theme tokens. */

.diagram {
  --pele-bg: var(--background);
  --pele-fg: var(--text);
  --pele-muted: var(--muted);
  --pele-line: var(--muted);
  --pele-surface: var(--surface);
  --pele-surface-alt: var(--border);
  --pele-border: var(--border);
  --pele-accent: var(--accent);
  --pele-font: var(--font);
  --pele-font-mono: var(--font-mono);
  --pele-radius: 8px;
  padding: 8px 0;
  text-align: center;
}

.diagram svg { max-width: 100%; height: auto; }

.diagram-error { color: #d70015; text-align: left; white-space: pre-wrap; font: 13px var(--font-mono); }

@media (max-width: 860px) {
  body { display: block; }
  #devpage-nav { position: static; width: auto; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  main { padding: 32px 20px 80px; }
}

/* Sidebar groups: the ### headings of a Topics section. */
#devpage-nav li.group { margin: 14px 0 4px; padding: 0 8px; }
#devpage-nav li.group:first-child { margin-top: 0; }
#devpage-nav li.group span { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* Syntax highlighting: classes name syntax scopes (see src/highlight.rs); colors
   come from the --syntax-* tokens, Xcode's default palettes. */
pre code { color: var(--text); }
.hl-comment { color: var(--syntax-comment); font-style: italic; }
.hl-string { color: var(--syntax-string); }
.hl-constant.hl-numeric, .hl-constant.hl-language { color: var(--syntax-number); }
.hl-keyword, .hl-storage { color: var(--syntax-keyword); font-weight: 600; }
.hl-storage.hl-type.hl-primitive, .hl-support.hl-type, .hl-entity.hl-name.hl-type, .hl-entity.hl-name.hl-class,
.hl-entity.hl-name.hl-struct, .hl-entity.hl-name.hl-enum, .hl-entity.hl-other.hl-inherited-class { color: var(--syntax-type); font-weight: 400; }
.hl-entity.hl-name.hl-function, .hl-support.hl-function, .hl-variable.hl-function { color: var(--syntax-function); }
.hl-entity.hl-name.hl-tag, .hl-entity.hl-other.hl-attribute-name, .hl-meta.hl-attribute, .hl-support.hl-other.hl-macro { color: var(--syntax-attribute); }

/* Diagram nodes with a `click … href` line are links: no underline; on hover the
   node's border takes the accent color. */
.diagram a { cursor: pointer; text-decoration: none; }
.diagram a:hover rect, .diagram a:hover polygon, .diagram a:hover circle,
.diagram a:hover ellipse, .diagram a:hover path { stroke: var(--accent); stroke-width: 2.5px; }

/* A doc: one long page, its outline beside it. */

.outline li.h2 { padding-left: 14px; font-size: 14px; }
.doc .chapter + .chapter { margin-top: 48px; }

/* Print mode, and the browser's own print: the page alone, in the light theme. */

@media print {
  :root { color-scheme: light; }
  #devpage-nav { display: none; }
  body { display: block; }
}
.print #devpage-nav { display: none; }

.doc-title { color: var(--muted); font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 8px; }

/* Slides: each slide a 1920 × 1080 stage, scaled whole to the window. */

body.slides { display: block; background: var(--background); overflow: hidden; }
.deck .slide {
  position: absolute; top: 0; left: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  background: var(--background);
  display: none;
  overflow: hidden;
}
.deck .slide.shown { display: block; }
.slide-body { padding: 96px 128px; font-size: 48px; line-height: 1.4; }
.slide-body h1 { font-size: 104px; }
.slide-body h2 { font-size: 72px; }
.slide-body h3 { font-size: 56px; }
.slide-body pre code { font-size: 30px; }
.slide-body table { font-size: 34px; }
.slide-body .diagram { font-size: 28px; }
/* Widgets on a slide look as they do on a page, magnified for the stage. */
.slide-body :is(.callout, .tabs, .example, .filetree, .terminal, .kind-cards, .steps, .cards) { font-size: 16px; line-height: 1.5; zoom: 2.2; }
.slide-body :is(.callout, .tabs, .example, .filetree, .terminal, .kind-cards, .steps, .cards) :is(table, pre code) { font-size: 14px; }
.slide-body :is(.callout, .tabs, .example, .filetree, .terminal, .kind-cards, .steps, .cards) :is(.callout, .tabs, .example, .filetree, .terminal, .kind-cards, .steps, .cards) { zoom: 1; font-size: 16px; }
.slide-body .kind-cards { zoom: 1.7; margin: 0; }
.slide-body .example { zoom: 2; margin: 0; }
.slide-body .example .example-source code { font-size: 19px; }
/* A diagram fills the room it is given. */
.slide-body .diagram svg { width: 100%; height: auto; max-height: 760px; }
.slide-body .diagram { margin: 0; padding: 0; }

@media print {
  body.slides { background: none; overflow: visible; }
  .deck .slide {
    display: block; position: relative; transform: none !important;
  }
  .deck .slide:not(:last-child) { break-after: page; }
  body.slides, .deck { margin: 0; padding: 0; }
}

/* Comments: highlighted anchors, and threads beside the text on a wide page
   (each card level with its anchor) or, on narrow screens and decks, in a
   panel the reader opens. Never printed. */

mark.comment { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; cursor: pointer; border-radius: 2px; }
#devpage-comments { flex-shrink: 0; font-size: 14px; line-height: 1.45; }
#devpage-comments:empty { display: none; }
#devpage-comments.beside { position: relative; width: 300px; margin: 56px 16px 0 0; }
#devpage-comments.beside > * { position: absolute; left: 0; right: 0; }
#devpage-comments:not(.beside) {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 100vw);
  overflow: auto; padding: 16px; z-index: 5; display: none;
  background: var(--background); border-left: 1px solid var(--border);
}
body.show-comments #devpage-comments:not(.beside):not(:empty) { display: block; }
#devpage-comments-toggle { position: fixed; right: 16px; bottom: 16px; z-index: 6; display: none; }
#devpage-comments-toggle.shown { display: block; }
:fullscreen #devpage-comments-toggle { display: none; }
#devpage-comments .thread { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; background: var(--surface); }
#devpage-comments .composer { border-color: var(--accent); }
#devpage-comments blockquote { margin: 0 0 6px; padding: 0 0 0 8px; background: none; border-left: 3px solid var(--accent); color: var(--muted); max-height: 4.4em; overflow: hidden; }
#devpage-comments p { margin: 4px 0; overflow-wrap: anywhere; }
#devpage-comments time { color: var(--muted); font-size: 12px; }
#devpage-comments h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.comment-editor textarea { width: 100%; margin: 6px 0 2px; font: inherit; color: inherit; background: var(--background); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; resize: vertical; }
.comment-editor button { margin: 4px 6px 0 0; }
.comment-error { color: #d70015; font-size: 13px; }
.comment-error:empty { display: none; }
.comment-button, #devpage-comments-toggle, .comment-editor button { font: 13px var(--font); border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 3px 9px; cursor: pointer; z-index: 4; }
.comment-button { display: inline-flex; align-items: center; gap: 6px; }
.comment-button.comment-icon { width: 28px; height: 28px; padding: 0; justify-content: center; border-radius: 50%; color: var(--muted); background: var(--background); box-shadow: 0 2px 8px -4px color-mix(in srgb, var(--text) 35%, transparent); transition: color 0.15s, border-color 0.15s; }
.comment-button.comment-icon:hover { color: var(--accent); border-color: var(--accent); }
@media print { #devpage-comments, #devpage-comments-toggle, .comment-button { display: none !important; } mark.comment { background: none; } }

/* Problems: broken links found while the page is previewed. */

.problems { max-width: 780px; margin: 0 auto 24px; border: 1px solid #d70015; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: #d70015; }
.problems ul { margin: 4px 0 0; padding-left: 18px; }
a.broken { color: #d70015; text-decoration: underline wavy #d70015; }
img.broken { outline: 2px dashed #d70015; }
.diagram a.broken rect, .diagram a.broken polygon, .diagram a.broken circle, .diagram a.broken ellipse, .diagram a.broken path { stroke: #d70015; stroke-dasharray: 6 4; }
body.slides .problems { position: fixed; top: 8px; left: 8px; right: 8px; z-index: 3; background: var(--background); }
@media print { .problems { display: none; } }
/* Soft shadows are left out on paper: PDF viewers draw Chrome's blurred
   shadows as grey boxes. */
@media print { * { box-shadow: none !important; } }
@media print { h1, h2, h3 { break-after: avoid; } pre, .diagram, table { break-inside: avoid; } }

/* Designs: the canvas page fills the window; an embedded design sits at its
   own size, centred on a backdrop, with a link to its canvas page; an overlay
   sits over the design it dims; problems sit over the last valid drawing. */
body.design-page { margin: 0; height: 100vh; overflow: hidden; background: var(--surface); }
body.design-page > canvas.design { position: fixed; inset: 0; width: 100vw; height: 100vh; touch-action: none; }
.design-embed { display: flex; justify-content: center; align-items: center; position: relative; margin: 24px 0; padding: 40px 24px; min-height: 120px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.design-embed > canvas.design { display: block; flex: none; border-radius: 2px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 28px rgb(0 0 0 / 0.08); }
.design-embed > a.design-open { position: absolute; top: 10px; right: 12px; z-index: 1; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--background); color: var(--muted); font: 500 12px/1.5 var(--font); text-decoration: none; opacity: 0.85; transition: opacity 0.15s, color 0.15s; }
.design-embed > a.design-open::after { content: " ↗"; }
.design-embed > a.design-open:hover, .design-embed > a.design-open:focus-visible { opacity: 1; color: var(--accent); }
@media print { .design-embed { padding: 16px; border-radius: 8px; } .design-embed > canvas.design { box-shadow: none; } .design-embed > a.design-open { display: none; } }
.design-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(15 23 42 / 0.4); }
.design-overlay.design-overlay-page { position: fixed; z-index: 2; }
.design-problems { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 3; margin: 0; padding: 10px 14px 10px 32px; border: 1px solid #d70015; border-radius: 10px; background: var(--background); color: #d70015; font: 13px var(--font-mono); }
/* On the canvas page the light/dark switch holds the top-right corner; the
   bars stop short of it. */
body.design-page > .design-problems { position: fixed; right: 60px; }
.design-failed { margin: 0; padding: 10px 14px; border: 1px solid #d70015; border-radius: 10px; background: var(--background); color: #d70015; font: 13px var(--font-mono); }
body.design-page > .design-failed { position: fixed; top: 8px; left: 8px; right: 60px; z-index: 3; }

/* ---- Widgets ---------------------------------------------------------- */
.callout { display: block; margin: 1rem 0; padding: 0.75rem 1rem; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 6px; }
.callout-warning { border-left-color: #d29922; }
.callout-danger { border-left-color: #cf222e; }
.callout-tip { border-left-color: #1a7f37; }
.callout-head { display: flex; gap: 0.5rem; align-items: center; }
.callout-icon { font-weight: bold; }
.callout-body > :first-child { margin-top: 0.25rem; }
.callout-body > :last-child { margin-bottom: 0; }
.tabs { margin: 1rem 0 20px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tabs-bar { display: flex; border-bottom: 1px solid var(--border); }
.tabs-bar button { background: none; border: 0; padding: 0.5rem 1rem; color: inherit; font: inherit; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs-bar button.current { border-bottom-color: var(--accent); font-weight: 600; }
.tabs-panel { padding: 16px; }
.tabs-panel > .tab > :first-child, .tabs-panel > :first-child { margin-top: 0; }
.tabs-panel > .tab > :last-child, .tabs-panel > :last-child { margin-bottom: 0; }
.example { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; margin: 1rem 0; }
/* Grid items may shrink below their content, so a long source line scrolls
   inside its box instead of widening the page. */
.example > * { min-width: 0; }
.example figcaption { grid-column: 1 / -1; font-weight: 600; }
.example-source { margin: 0; }
.example-result { border: 1px solid var(--border); border-radius: 6px; padding: 0 1rem; }
@media (max-width: 800px) { .example { grid-template-columns: minmax(0, 1fr); } }
.filetree ul { list-style: none; padding-left: 1.25rem; margin: 0; }
.filetree > ul { padding-left: 0; }
.filetree { font-family: var(--font-mono); margin: 1rem 0; }
.filetree-icon { display: inline-block; width: 1rem; color: var(--muted); }
.filetree-note { margin-left: 0.75rem; color: var(--muted); font-family: var(--font); }
.terminal { margin: 1rem 0; border-radius: 8px; overflow: hidden; background: #1e1e1e; color: #e6e6e6; }
.terminal figcaption { padding: 0.35rem 0.75rem; background: #333; font-size: 0.8rem; }
.terminal pre { margin: 0; background: none; color: inherit; overflow-x: auto; }
.terminal pre > div { min-height: 1.5em; }
@media print {
  /* Paper can't scroll: long lines wrap. */
  .terminal pre, .example-source { white-space: pre-wrap; overflow-wrap: anywhere; }
}
/* A task list item shows its checkbox, not a bullet as well. */
li:has(> input[type="checkbox"]), li:has(> p > input[type="checkbox"]) { list-style: none; }
li > input[type="checkbox"], li > p > input[type="checkbox"] { margin: 0 0.4em 0 -1.3em; }
.terminal-prompt { color: #7ee787; }
kbd { display: inline-block; min-width: 1.4em; padding: 0 0.35em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; font: inherit; font-size: 0.85em; text-align: center; }
.keys kbd + kbd { margin-left: 0.2em; }
.widget-error { color: #cf222e; white-space: pre-wrap; }
div.widget-error { margin: 0 0 20px; }

/* Navbar: a site's bar across the top — its title, then its links, dropdowns
   and icons, then the theme selector. Translucent, like the page under it. */

body.with-navbar { flex-wrap: wrap; align-content: flex-start; }
#devpage-navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  flex: 0 0 100%;
  height: 52px;
  background: color-mix(in srgb, var(--background) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.navbar-inner { height: 100%; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 24px; }
.navbar-title { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; color: var(--text); white-space: nowrap; }
.navbar-title:hover { text-decoration: none; opacity: 0.8; }
/* A document's logo, before its title: sized to the title's line and centred on it. */
.navbar-title { display: inline-flex; align-items: center; gap: 9px; }
#devpage-nav .document-title { display: flex; align-items: center; gap: 9px; }
.navbar-title .logo { width: 22px; height: 22px; flex: none; }
#devpage-nav .document-title .logo { width: 20px; height: 20px; flex: none; }
.navbar-links { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.navbar-link, .navbar-entry {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  color: var(--muted); font: 500 14px/1.2 var(--font); white-space: nowrap;
  background: none; border: 0; cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.navbar-link:hover, .navbar-entry:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.navbar-link.current, .navbar-menu.current > .navbar-link { color: var(--text); font-weight: 600; }
.navbar-link.icon-only { padding: 6px; }
.icon { width: 16px; height: 16px; flex: none; }
.navbar-link .icon:last-child:not(:first-child) { width: 13px; height: 13px; opacity: 0.6; transition: transform 0.2s; }
.navbar-menu { position: relative; }
.navbar-menu.open > .navbar-link .icon:last-child:not(:first-child) { transform: rotate(180deg); }
.navbar-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; padding: 6px;
  background: var(--background); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 40px -12px color-mix(in srgb, var(--text) 30%, transparent);
}
.navbar-menu.open .navbar-dropdown { display: grid; gap: 2px; }
.navbar-entry { color: var(--text); padding: 8px 10px; }
.navbar-entry .icon { color: var(--muted); }
.navbar-entry.current { background: var(--surface); font-weight: 600; }
.navbar-end { display: flex; align-items: center; gap: 8px; padding-left: 12px; margin-left: 4px; border-left: 1px solid var(--border); height: 24px; }
.navbar-toggle { display: none; background: none; border: 0; color: var(--text); padding: 6px; border-radius: 8px; cursor: pointer; }
.navbar-toggle:hover { background: var(--surface); }

body.with-navbar #devpage-nav { top: 52px; height: calc(100vh - 52px); }

@media (max-width: 760px) {
  .navbar-inner { padding: 0 8px 0 20px; }
  .navbar-end { margin-left: auto; border-left: 0; padding-left: 0; }
  .navbar-toggle { display: inline-flex; }
  .navbar-links {
    display: none; position: absolute; top: 52px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 12px 14px;
    background: var(--background); border-bottom: 1px solid var(--border);
    box-shadow: 0 16px 30px -20px color-mix(in srgb, var(--text) 40%, transparent);
  }
  #devpage-navbar.open .navbar-links { display: flex; }
  .navbar-link, .navbar-entry { font-size: 16px; padding: 10px 12px; }
  .navbar-link.icon-only::after { content: attr(title); }
  .navbar-menu > .navbar-link { width: 100%; }
  .navbar-dropdown { display: grid; position: static; box-shadow: none; border: 0; padding: 0 0 0 14px; min-width: 0; }
  .navbar-menu > .navbar-link .icon:last-child:not(:first-child) { display: none; }
}

/* The theme selector: one quiet icon button, the size of the navbar's icons,
   showing the theme a click switches to — a moon in light, a sun in dark. In
   the navbar when a site has one, else in the top-right corner. Never printed;
   a deck hides it in fullscreen. */

.theme-toggle, .comment-mode {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px;
  background: none; color: var(--muted); cursor: pointer; transition: color 0.15s, background 0.15s;
}
.theme-toggle:hover, .comment-mode:hover { color: var(--text); background: var(--surface); }
/* Comment mode, pressed: the accent, on a tint of it. */
.comment-mode[aria-pressed="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#devpage-corner { display: flex; gap: 4px; }
.theme-toggle span { display: inline-flex; }
.theme-toggle .to-light, :root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .to-light { display: inline-flex; }
#devpage-corner { position: fixed; top: 14px; right: 16px; z-index: 15; }
:root:fullscreen #devpage-corner, .print #devpage-corner { display: none; }
@media print { #devpage-navbar, #devpage-corner { display: none !important; } body.with-navbar #devpage-nav { top: 0; } }

/* Steps: numbered steps joined by a line, each a title, a body and commands. */
.steps { list-style: none; margin: 1.5rem 0 20px; padding: 0; }
.step { position: relative; display: grid; grid-template-columns: 2rem minmax(0, 1fr); column-gap: 1rem; padding-bottom: 1.75rem; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: calc(1rem - 1px); top: 2.5rem; bottom: 0.5rem; width: 2px; border-radius: 1px; background: var(--border); }
.step:last-child::before { display: none; }
.step-number { width: 2rem; height: 2rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--background)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.step-content { min-width: 0; padding-top: 0.2rem; }
.step-title { font-weight: 600; font-size: 1.05rem; line-height: 1.6; }
.step-content > p { margin: 0.2rem 0 0; }
.step-block > :first-child { margin-top: 0.6rem; }
.step-block > :last-child { margin-bottom: 0; }
.step-commands { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; margin-top: 0.6rem; max-width: 100%; }
.step-command { display: block; max-width: 100%; overflow-x: auto; white-space: pre; font: 0.85rem/1.5 var(--font-mono); padding: 0.4rem 0.8rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.step-prompt { color: var(--muted); margin-right: 0.6rem; user-select: none; }

/* Cards: a grid of link cards, each an optional icon, a title and a summary. */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1.5rem 0 20px; }
@media (max-width: 700px) { .cards.cards-fixed { grid-template-columns: minmax(0, 1fr) !important; } }
.card { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; padding: 1.1rem 1.25rem 1.2rem; border: 1px solid var(--border); border-radius: 14px; background: var(--background); color: inherit; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
a.card:hover { text-decoration: none; transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 12px 28px -16px color-mix(in srgb, var(--text) 40%, transparent); }
.card-icon { display: flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; margin-bottom: 0.45rem; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--background)); }
.card-icon .icon { width: 1.2rem; height: 1.2rem; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; font-size: 1.05rem; font-weight: 600; color: var(--text); }
.card-arrow { color: var(--accent); opacity: 0; transform: translateX(-4px); transition: opacity 0.2s ease, transform 0.2s ease; }
a.card:hover .card-arrow { opacity: 1; transform: none; }
.card-summary { font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
@media print { .card, .step { break-inside: avoid; } .card-arrow { display: none; } a.card { transform: none; box-shadow: none; } }
