/* Departure Mono (SIL OFL, fonts/DepartureMono-OFL.txt) — a pixel font, crisp at
   multiples of 11px, hence the --fs-* scale. The few symbols it lacks (the viewer's
   lane markers) fall back to JetBrains Mono inside a fixed 1ch cell (.fb). */
@font-face {
  font-family: "Departure Mono";
  src: url("fonts/DepartureMono-Regular.woff2") format("woff2");
  font-display: swap;
}

/* Sigil site. Every colour is a theme variable (theme.css, then site.js loads
   themes/<name>.yaml into :root), so a theme change moves the whole page —
   prose, code, logo and the 3D background — together. Page-level derived values
   live here as variables too, built from the theme's. */

:root {
  --font-mono: "Departure Mono", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-s: 11px;
  --fs-m: 16.5px;
  --fs-l: 22px;
  --fs-xl: 33px;
  --bg: var(--palette-bg);
  --surface: var(--palette-surface);
  --raised: var(--palette-raised);
  --line: var(--palette-line);
  --text: var(--ui-text);
  --strong: var(--ui-strong);
  --muted: var(--ui-muted);
  --dim: var(--ui-dim);
  --accent: var(--site-accent);
  --link: var(--site-link);
  --glass: color-mix(in srgb, var(--surface) 82%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface) 94%, transparent);
  --hairline: color-mix(in srgb, var(--line) 80%, transparent);
  --glow: color-mix(in srgb, var(--site-glow) 35%, transparent);
  --nav-bg: color-mix(in srgb, var(--bg) 70%, transparent);
  --editor-bg: color-mix(in srgb, var(--bg) 32%, transparent);
  --shadow: color-mix(in srgb, var(--bg) 80%, transparent);
  --accent-ring: color-mix(in srgb, var(--accent) 12%, transparent);
  --row-now: color-mix(in srgb, var(--accent) 7%, transparent);
  --warn-wash: color-mix(in srgb, var(--ui-warn) 8%, transparent);
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 72ch;
  --code-rows: 22;
  --code-lh: 1.45;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-m)/1.6 var(--font-mono);
  font-variant-ligatures: none;      /* -> stays two characters: it is notation */
  font-synthesis: none;              /* the pixel font has no italic or bold: no fakes */
  /* So the font-weight / font-style rules below (syntax roles, logo shades,
     frame styles) change nothing in Departure Mono; they are kept for the
     fallback font and for a locally installed monospace that has the styles. */
  overflow-x: hidden;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, pre { font-family: var(--font-mono); }
code { color: var(--strong); white-space: nowrap; }
.fb { display: inline-block; width: 1ch; text-align: center; font-family: "JetBrains Mono", monospace; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 0.35em;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--raised);
  color: var(--strong);
  font-size: var(--fs-s);
  text-align: center;
}

h1, h2, h3 { color: var(--strong); font-weight: 400; line-height: 1.25; }
h1 { font-size: var(--fs-xl); margin: 0.4em 0 0.3em; }
h2 { font-size: var(--fs-l); margin: 0 0 0.8em; }
h3 { font-size: var(--fs-m); margin: 0 0 0.6em; color: var(--syntax-name); }

/* ---------------------------------------------------------------- scene */

#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  perspective: 1100px;
  perspective-origin: 50% 42%;
  overflow: hidden;
  transition: opacity 0.3s linear;   /* site.js sets opacity as the page scrolls */
}

.stage {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 1.8s cubic-bezier(0.2, 0.7, 0.2, 1);   /* site.js tilts it every 2 s */
}

.plane {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  white-space: pre;
  font: var(--fs-s)/1.22 var(--font-mono);
  /* site.js places each plane (--x … --rx), scales it to fit (--s) and sets
     its blur depth (--d) and opacity (--o); the transitions move it there */
  transform: translate(-50%, -50%) translate3d(var(--x, 0), var(--y, 0), var(--z, 0))
             rotateY(var(--ry, 0deg)) rotateX(var(--rx, 0deg)) scale(var(--s, 1));
  filter: blur(calc(var(--site-scene-blur) * var(--d, 1) * var(--focus-k, 1)));
  opacity: var(--o, 0.85);
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.8s ease, opacity 0.8s ease;
  will-change: transform, filter;
}

/* the viewer's own frames: one plane per view, out of focus until it leads */
.plane.view { font-size: var(--fs-m); }
.plane.view .frame { transition: opacity 0.25s ease; }
.plane.view.swap .frame { opacity: 0.25; }
.plane.view .label {
  display: block;
  margin-bottom: 0.6em;
  color: var(--dim);
  font-size: var(--fs-s);
  letter-spacing: 0.12em;
  transition: color 0.8s ease;
}
.plane.view.lead .label { color: var(--muted); }

body.focused { --focus-k: 0.08; }
body.focused .plane.view { opacity: max(var(--o, 0.85), 0.9); }

/* ---------------------------------------------------------------- view strip */
/* A short section per view below the editor: text in a left column, its plane
   (site.js initViewStrip) brought forward to the right; on a phone the plane
   holds the top half and the text comes up under it. */

.vsecs {
  position: relative;
  z-index: 1;
  padding: 10vh var(--gutter) 30vh;
}
.vsecs-intro { max-width: 40ch; margin: 0 0 4vh; }
.vsec {
  min-height: 46vh;
  display: flex;
  align-items: center;
}
.vsec-text {
  width: min(38ch, 30vw);
  padding: 1.1rem 1.2rem;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  opacity: 0.38;
  transition: opacity 0.6s ease, border-color 0.6s ease;
}
.vsec.current .vsec-text { opacity: 1; border-color: var(--accent); }
.vsec h2 { margin-bottom: 0.4em; }
.vsec-n { color: var(--dim); margin-right: 0.4ch; }
.vsec.current .vsec-n { color: var(--accent); }
.vsec-what { color: var(--text); margin: 0 0 0.7em; }
.vsec .snippet { margin-top: 0.4em; font-size: var(--fs-s); }

/* the run's narration under the section's sentence: the viewer's words */
.say {
  min-height: 3.2em;
  margin: 0 0 0.7em;
  color: var(--muted);
  font-size: var(--fs-s);
}
.say:empty { display: none; }
.say b { color: var(--strong); font-weight: 400; }
.run-name {
  display: inline-block;
  padding: 0 0.5em;
  margin-right: 0.3em;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
}

@media (max-width: 700px) {
  .vsecs { padding: 6vh var(--gutter) 40vh; }
  .vsec { min-height: 58vh; align-items: flex-end; }
  /* the text stays at the screen's foot while its section is read; the lead
     plane is fitted into the room above it (site.js phoneRoom) */
  .vsec-text { width: 100%; position: sticky; bottom: var(--gutter); }
  /* only the current text shows: the others pass through the planes' room, so
     they (and the intro, while a plane leads) are hidden, not drawn over a plane */
  .vsec:not(.current) .vsec-text, .vsecs.on .vsecs-intro { opacity: 0; }
  .vsecs-intro { transition: opacity 0.6s ease; }
}

/* ---------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.6rem var(--gutter);
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
/* The brand keeps its compact width in the layout; the expanded name (site.js
   initBrand) overlays the nav on an opaque backing instead of pushing it around. */
.brand {
  position: relative;
  display: inline-block;
  width: 15ch;
  height: 1.6em;
  color: var(--strong);
  letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.brand-text {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  white-space: nowrap;
  color: var(--text);
}
.brand.open .brand-text {
  padding-right: 0.8ch;
  background: var(--bg);
  box-shadow: 0 0 0 0.35em var(--bg), 0.6ch 0 1.2em var(--bg);
}
.brand-initial { color: var(--strong); }
.brand-scramble { opacity: 0.75; }
@media (max-width: 560px) {
  .brand.open .brand-text { font-size: var(--fs-s); top: 0.3em; }
}
.nav nav { display: flex; gap: 1rem; flex-wrap: wrap; margin-left: auto; }
.nav nav a { color: var(--muted); }
.nav nav a:hover { color: var(--accent); text-decoration: none; }
.theme-pick { color: var(--dim); font-size: var(--fs-s); display: flex; gap: 0.5em; align-items: center; }
select {
  font: inherit;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.15em 0.4em;
}

/* glyph colours, shared by the brand, the logo and the highlighter */
.g-service { color: var(--kinds-service); }
.g-data { color: var(--kinds-data); }
.g-event { color: var(--kinds-event); }
.g-actor { color: var(--kinds-actor); }
.g-store { color: var(--kinds-store); }

/* ---------------------------------------------------------------- layout */

main { position: relative; z-index: 1; }

.hero {
  min-height: 100vh;
  padding: 2rem var(--gutter) 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3.5rem);
  margin-bottom: 1.6rem;
  text-align: left;
}
.hero-text { max-width: 46ch; }
.lede { color: var(--muted); margin: 0; }
.lede + .lede { margin-top: 0.6em; }
@media (max-width: 860px) {
  .hero-head { flex-direction: column; text-align: center; }
}
.hint { max-width: 64ch; color: var(--dim); font-size: var(--fs-s); margin-top: 1.2rem; }

.panel {
  max-width: 1080px;
  margin: 0 auto 4rem;
  padding: clamp(1.2rem, 3vw, 2.2rem);
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}
.panel > p { max-width: var(--measure); }
@media (max-width: 1140px) { .panel { margin-left: var(--gutter); margin-right: var(--gutter); } }

.sec-rail { color: var(--syntax-rails); font-weight: 400; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 1rem;
  margin: 1.4rem 0;
}
#skill .cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.cards:not(#skill .cards) > .card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.card {
  padding: 1rem 1.1rem;
  background: var(--glass-strong);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.card p { margin: 0.4em 0 0; }
/* the first example read line by line: one card on its own, scrolling sideways
   rather than wrapping a line of Sigil */
.card.reading { margin: 1.4rem 0; overflow-x: auto; }
.small { font-size: var(--fs-s); color: var(--muted); }

table.ref { border-collapse: collapse; width: 100%; }
table.ref td { padding: 0.25em 0; vertical-align: top; }
table.ref td:first-child { padding-right: 1em; white-space: nowrap; }
table.ref td:last-child { color: var(--muted); }

.snippet {
  margin: 0.6em 0 0;
  padding: 0.7em 0.9em;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow-x: auto;
}
.cmd { color: var(--strong); }
.keys { color: var(--muted); line-height: 2; }

/* ---------------------------------------------------------------- logo */

.logo {
  margin: 0;
  flex: none;
  font-size: var(--fs-s);
  line-height: 1.1;
  color: var(--syntax-rails);
}
.logo[data-logo^="coin"] { line-height: 1.15; }
@media (min-width: 1100px) { .logo[data-logo^="coin"] { font-size: var(--fs-m); } }
.logo .dot { color: var(--dim); }
.logo .mark { color: var(--accent); text-shadow: 0 0 14px var(--glow); }
.logo .via { color: var(--syntax-operator); }

/* logo masks: one colour code per cell (site/logos/*.mask). The coin shades
   its thread, rim and face from three theme colours. */
.logo .k-a { color: var(--accent); text-shadow: 0 0 14px var(--glow); }
.logo .k-1 { color: color-mix(in srgb, var(--site-coin-thread) 50%, var(--bg)); }
.logo .k-2 { color: color-mix(in srgb, var(--site-coin-thread) 62%, var(--bg)); }
.logo .k-3 { color: color-mix(in srgb, var(--site-coin-thread) 86%, var(--bg)); font-weight: 700; }
.logo .k-4 { color: var(--site-coin-thread); font-weight: 700; }
.logo .k-5 { color: color-mix(in srgb, var(--site-coin-thread) 50%, var(--strong)); font-weight: 700; }
.logo .k-r { color: color-mix(in srgb, var(--site-coin-metal) 34%, var(--bg)); }
.logo .k-s { color: color-mix(in srgb, var(--site-coin-metal) 58%, var(--bg)); }
.logo .k-t { color: var(--site-coin-metal); font-weight: 700; }
.logo .k-u { color: color-mix(in srgb, var(--site-coin-metal) 50%, var(--strong)); font-weight: 700; }
.logo .k-f { color: color-mix(in srgb, var(--site-coin-field) 18%, var(--bg)); }
.logo .k-g { color: color-mix(in srgb, var(--site-coin-field) 30%, var(--bg)); }
.logo .k-z { color: color-mix(in srgb, var(--site-coin-field) 8%, var(--bg)); }
.logo .star { color: var(--syntax-shebang); }
.logo .arrow { color: var(--syntax-operator); }
.logo .letter { color: var(--strong); font-weight: 700; }

/* ---------------------------------------------------------------- editor */

.editor {
  width: min(1000px, 100%);
  text-align: left;
  background: var(--editor-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px var(--shadow), 0 0 0 1px var(--accent-ring);
  overflow: hidden;
}
.editor-bar {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
}
.tabs { display: flex; flex-wrap: wrap; }
.controls button:disabled { opacity: 0.4; cursor: default; }
.tabs button, .controls button {
  font: inherit;
  font-size: var(--fs-s);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0.55em 0.95em;
  cursor: pointer;
}
.tabs button[aria-selected="true"] {
  color: var(--strong);
  background: var(--glass-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tabs button:hover, .controls button:hover { color: var(--accent); }
.controls { margin-left: auto; display: flex; }
.controls button[aria-pressed="true"] { color: var(--accent); }

.code {
  margin: 0;
  padding: 0.9rem 1.1rem;
  height: calc(var(--code-rows) * var(--code-lh) * 1em + 1.8rem);
  font-size: var(--fs-m);
  line-height: var(--code-lh);
  overflow: auto;
  color: var(--syntax-tag);
}
.code .ln { display: inline-block; width: 2.6em; color: var(--syntax-punct); user-select: none; }
.code .row.now { background: var(--row-now); }
.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.editor-status {
  display: flex;
  gap: 1.4em;
  padding: 0.35em 1.1em;
  border-top: 1px solid var(--line);
  background: var(--raised);
  color: var(--dim);
  font-size: var(--fs-s);
}
.editor-status .ok { color: var(--ui-ok); }
.editor-status .bad { color: var(--ui-warn); }
#st-line { margin-left: auto; }

/* syntax roles — the scopes of highlight/sigil.tmTheme */
.t-glyph { color: var(--syntax-glyph); }
.t-name { color: var(--syntax-name); font-style: italic; }
.t-hole { color: var(--syntax-comment); font-style: italic; }
.t-keyword { color: var(--syntax-keyword); font-weight: 700; }
.t-modifier { color: var(--syntax-modifier); }
.t-operator { color: var(--syntax-operator); }
.t-cardinality { color: var(--syntax-cardinality); }
.t-branch { color: var(--syntax-branch); }
.t-shebang { color: var(--syntax-shebang); font-weight: 700; }
.t-rails { color: var(--syntax-rails); }
.t-section { color: var(--syntax-section); font-weight: 700; }
.t-ref { color: var(--syntax-ref); font-style: italic; }
.t-string { color: var(--syntax-string); }
.t-number { color: var(--syntax-number); }
.t-comment { color: var(--syntax-comment); font-style: italic; }
.t-punct { color: var(--syntax-punct); }
.t-tag { color: var(--syntax-tag); }

/* ---------------------------------------------------------------- playground */

.pg { margin-top: 1.2rem; }
.pg-start { display: flex; flex-wrap: wrap; gap: 0.6em 1.2em; align-items: center; }
.pg[data-state="ready"] .pg-start { display: none; }
.pg-go {
  font: inherit;
  color: var(--strong);
  background: var(--raised);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.45em 1.1em;
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.pg-go:hover:not(:disabled) { color: var(--accent); }
.pg-go:disabled { opacity: 0.6; cursor: progress; }
.pg-msg { color: var(--dim); font-size: var(--fs-s); }
.pg-msg.bad { color: var(--ui-error); }
.pg-app {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}
.pg-bar, .pg-sim {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5em 1em;
  padding: 0.45em 0.8em;
  background: var(--raised);
  color: var(--muted);
  font-size: var(--fs-s);
}
.pg-bar { border-bottom: 1px solid var(--line); }
.pg-sim { border-top: 1px solid var(--line); }
.pg-bar label, .pg-sim label { display: flex; gap: 0.5em; align-items: center; min-width: 0; }
.pg-bar select, .pg-sim select { font-size: var(--fs-s); max-width: 100%; min-width: 0; }
.pg-sim label { flex: 1 1 16rem; }
.pg-sim select { flex: 1; text-overflow: ellipsis; }
.pg button:not(.pg-go):not(.pg-diags button) {
  font: inherit;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.2em 0.7em;
  cursor: pointer;
}
.pg button:not(.pg-go):hover:not(:disabled) { color: var(--accent); }
.pg button:disabled { opacity: 0.4; cursor: default; }
.seg { display: flex; }
.seg button { border-radius: 0 !important; }
.seg button:first-child { border-radius: 5px 0 0 5px !important; }
.seg button:last-child { border-radius: 0 5px 5px 0 !important; border-left: 0 !important; }
.seg button[aria-pressed="true"] { color: var(--strong) !important; box-shadow: inset 0 -2px 0 var(--accent); }
#pg-share { margin-left: auto; }
.pg-transport { display: flex; gap: 0.3em; }
.pg-sim .pg-speed { flex: 0 0 auto; }
.pg-sim .pg-speed select { flex: none; }
.pg-sim input[type="range"] { flex: 1 1 8rem; min-width: 6rem; accent-color: var(--accent); }
.pg-tick { color: var(--text); white-space: nowrap; }
.pg.running .pg-tick { color: var(--accent); }

.pg-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
@media (max-width: 900px) { .pg-panes { grid-template-columns: minmax(0, 1fr); } }
.pg-edit { display: grid; border-right: 1px solid var(--line); min-width: 0; }
@media (max-width: 900px) { .pg-edit { border-right: 0; border-bottom: 1px solid var(--line); } }
.pg-edit > * {
  grid-area: 1 / 1;
  margin: 0;
  padding: 0.8rem 1rem;
  border: 0;
  font: var(--fs-s)/1.5 var(--font-mono);
  font-variant-ligatures: none;
  letter-spacing: normal;
  white-space: pre;
  tab-size: 2;
  min-height: 24rem;
  max-height: 36rem;
  overflow: auto;
}
.pg-hl { color: var(--syntax-tag); overflow: hidden; pointer-events: none; }
.pg-edit textarea {
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  resize: none;
  outline: none;
}
.pg-edit textarea::selection { background: var(--accent-ring); color: transparent; }
.pg-edit:focus-within { box-shadow: inset 0 0 0 1px var(--accent-ring); }
.pg-out { min-width: 0; display: flex; flex-direction: column; }
.pg-draw, .pg-legend, .pg-story, .pg-log {
  margin: 0;
  padding: 0.8rem 1rem;
  font: var(--fs-s)/1.22 var(--font-mono);
  white-space: pre;
  overflow: auto;
}
.pg-draw { flex: 1; min-height: 16rem; max-height: 36rem; color: var(--text); }
.pg-legend { border-top: 1px solid var(--hairline); color: var(--dim); }
.pg-legend:empty { display: none; }
/* the run's story: the trail and earlier beats dim, the narration line bright */
.pg-story { border-top: 1px solid var(--hairline); color: var(--muted); }
.pg-story .pg-dim { color: var(--dim); }
.pg-story .pg-now { color: var(--strong); font-weight: 700; }
/* read out, not shown: the run's narration line for a screen reader (#pg-say) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.pg-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3em 1.4em;
  padding: 0.35em 0.8em;
  border-top: 1px solid var(--line);
  background: var(--raised);
  color: var(--dim);
  font-size: var(--fs-s);
}
.pg-status .ok { color: var(--ui-ok); }
.pg-status .bad { color: var(--ui-warn); }
.pg-diags {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-s);
  max-height: 9rem;
  overflow: auto;
  color: var(--muted);
}
.pg-diags li { padding: 0.25em 0.8em; border-top: 1px solid var(--hairline); }
.pg-diags button { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ui-warn); }
.pg-diags li.error button { color: var(--ui-error); }
.pg-diags li.info button { color: var(--dim); }
/* lint and the composition findings side by side; stacked when narrow. The 1px
   column gap shows the line colour between them; an empty list takes no column. */
.pg-reports {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0 1px;
  background: var(--line);
}
.pg-reports .pg-diags { background: var(--bg); }
.pg-reports .pg-diags:empty { display: none; }
.pg-findings { max-height: 14rem; transition: opacity 0.2s; }
.pg-findings.stale { opacity: 0.55; }
.pg-diags li.accepted { color: var(--dim); }
.pg-diags li.accepted button { color: var(--dim); }
.pg-why { display: block; color: var(--dim); }
.pg-mode { display: flex; gap: 0.5em; align-items: center; margin-left: auto; }
.pg-mode select { font-size: var(--fs-s); }
.pg-log { max-height: 9rem; border-top: 1px solid var(--line); color: var(--muted); }

/* ---------------------------------------------------------------- install */

.pending {
  padding: 0.6em 0.9em;
  border-left: 3px solid var(--ui-warn);
  background: var(--warn-wash);
  color: var(--text);
}
body[data-released="true"] .pending { display: none; }
.install .tabs { border-bottom: 1px solid var(--line); margin-bottom: 0.8rem; }
.install .tabs button[aria-selected="true"] { background: none; }
.pane pre { position: relative; }
.copy-btn {
  position: absolute;
  top: 0.4em;
  right: 0.4em;
  font: inherit;
  font-size: var(--fs-s);
  color: var(--muted);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.6em;
  cursor: pointer;
}
.copy-btn:hover { color: var(--accent); }
.install pre.cmd {
  padding: 0.8em 4.5em 0.8em 1em;
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow-x: auto;
  font-size: var(--fs-s);
}

/* ---------------------------------------------------------------- footer */

.foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem var(--gutter) 3rem;
  color: var(--dim);
  font-size: var(--fs-s);
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 640px) {
  /* phones: a smaller body size (1.25 × the 11px pixel grid) and less nesting
     padding, so prose and tables get the width */
  :root { --fs-m: 13.75px; --gutter: 12px; }
  h1 { font-size: var(--fs-l); }
  h2 { font-size: var(--fs-m); }
  .hero { padding-top: 1.2rem; }
  .nav { gap: 0.4rem 0.6rem; flex-wrap: wrap; padding-top: 0.6rem; padding-bottom: 0.6rem; }
  .nav nav { order: 3; width: 100%; margin: 0; gap: 0.3rem 0.9rem; font-size: var(--fs-s); }
  .theme-pick { margin-left: auto; }
  .editor-bar { flex-wrap: wrap; }
  .editor-bar .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .editor-bar .tabs button { white-space: nowrap; }
  .controls { margin-left: auto; }
  .code { font-size: var(--fs-s); --code-rows: 18; padding: 0.7rem 0.6rem; }
  .code .ln { width: 2em; }
  .controls button, .tabs button { padding: 0.5em 0.6em; }
  .editor-status { flex-wrap: wrap; gap: 0.2em 0.8em; padding: 0.35em 0.7em; }
  .editor-status span { white-space: nowrap; }
  .hero-text { text-shadow: 0 0 12px var(--bg), 0 0 4px var(--bg); }
  .panel { padding: 1rem 0.8rem; margin-bottom: 2.5rem; }
  .card { padding: 0.8rem 0.75rem; }
  .cards { gap: 0.7rem; margin: 1rem 0; }
  /* reference tables: the notation on its own line, the meaning under it */
  table.ref, table.ref tbody, table.ref tr, table.ref td { display: block; }
  table.ref tr { padding: 0.3em 0; }
  table.ref tr + tr { border-top: 1px solid var(--hairline); }
  table.ref td { padding: 0; }
  table.ref td:first-child { white-space: normal; padding: 0; }
  table.ref td:last-child { font-size: var(--fs-s); padding-left: 1.5ch; }
  .snippet { font-size: var(--fs-s); }
  .install pre.cmd { padding-right: 1em; padding-top: 2.2em; }
  .keys { line-height: 1.9; font-size: var(--fs-s); }
  .pg-edit > * { min-height: 16rem; max-height: 22rem; padding: 0.7rem 0.6rem; }
  .pg-draw { min-height: 12rem; max-height: 28rem; padding: 0.7rem 0.6rem; }
  .pg-sim label { flex-basis: 100%; }
  .pg-sim .pg-speed { flex-basis: auto; }
  .pg-mode { margin-left: 0; }
  .pg-diags li { padding: 0.35em 0.6em; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #scene, .stage, .plane, .plane.view .frame, .plane.view .label, .vsec-text, .vsecs-intro,
  .pg-findings { transition: none; }
  .caret { animation: none; }
}
