/* Site chrome (js/site-chrome.js): the top bar, the theme menu and the phone tab bar.
   One file for every page. Theme tokens only (themes.css). Class prefix pc- keeps it apart
   from page styles. */

/* Before site-chrome.js draws the bar, the page's bare header (a link to /) already takes the
   bar's exact height, with the link where the logo goes, and the phone tab bar's space is held
   at the bottom: nothing moves when the chrome appears (captain's "flash on load", 2026-11-22). */
/* The one content width, for the bar and every section of every page (captain, 2026-11-24): at most
   --content wide, with at least --gutter on each side. */
:root { --content: 1136px; --gutter: 40px; }
@media (max-width: 640px) { :root { --gutter: 16px; } }
header[data-site-chrome]:not(.pc-bar) { display: block; height: 76px; overflow: hidden; background: var(--bg); font-family: var(--font-ui); }
header[data-site-chrome]:not(.pc-bar) > a { display: block; width: min(100% - 2 * var(--gutter), var(--content)); margin: 0 auto; padding: 16px 0; line-height: 44px; font-size: 26px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); color: var(--text); text-decoration: none; }
.pc-inner { min-height: 76px; }
.pc-bar { position: relative; z-index: 50; background: var(--bg); font-family: var(--font-ui); color: var(--text); line-height: 1.4; }
.pc-inner { width: min(100% - 2 * var(--gutter), var(--content)); margin: 0 auto; padding: 16px 0; display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; }
.pc-brand { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; }
.pc-logo { text-decoration: none; color: var(--text); font-weight: var(--display-weight); font-size: 26px; letter-spacing: var(--display-tracking); display: inline-flex; align-items: center; min-height: 44px; flex: none; }
.pc-tagline { color: var(--text-muted); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-logo:hover { color: var(--text); }
.pc-tick { color: var(--gold); }
.pc-nav { display: flex; flex-wrap: wrap; gap: 0 20px; font-size: 15px; font-weight: 500; }
.pc-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; }
.pc-nav a:hover { color: var(--link-hover); text-decoration: underline; }
.pc-nav a[aria-current="page"] { color: var(--gold); text-decoration: underline; text-underline-offset: 6px; }

/* Theme button and its menu. */
.pc-theme { position: relative; margin-right: -12px; } /* the icon, not its round button, ends on the content edge */
.pc-theme-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pc-theme-btn:hover, .pc-theme-btn[aria-expanded="true"] { background: var(--surface); color: var(--gold); }
.pc-theme-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.pc-theme-menu { position: absolute; right: 0; top: calc(100% + 8px); width: max-content; max-width: calc(100vw - 32px); background: var(--surface); color: var(--text); border-radius: var(--r-md); box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px var(--line, rgba(127, 127, 127, .25)); padding: 6px; }
.pc-theme-menu[hidden] { display: none; }
.pc-fb-btn { flex: none; margin-right: -20px; } /* the Feedback button (js/feedback.js) sits close to the theme button */
.pc-theme-list { display: flex; flex-direction: column; gap: 2px; }

/* Swatches (theme.js mountThemePicker). */
.swatch { border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; width: 32px; height: 32px; font: inherit; }
.swatch:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.swatch-dot { display: block; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--bg) 0 34%, var(--surface-3) 34% 72%, var(--accent) 72%); /* what the page becomes: its background, its cards, a touch of accent */ border: 1px solid color-mix(in srgb, var(--text) 60%, transparent); box-shadow: 0 0 0 2px var(--bg), 0 0 0 0 var(--text); flex: none; }
.swatch[aria-checked="true"] .swatch-dot { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.pc-theme-list .swatch { width: 100%; height: 44px; justify-content: flex-start; gap: 12px; padding: 0 12px 0 10px; border-radius: var(--r-sm); font-size: 15px; text-align: left; }
.pc-theme-list .swatch:hover { background: var(--btn-hover, rgba(127, 127, 127, .15)); }
.pc-theme-list .swatch[aria-checked="true"] { font-weight: 700; }
.pc-theme-list .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 0 var(--text); }
.pc-theme-list .swatch[aria-checked="true"] .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }

/* One row at every width, so the bar is always 76 px and the reserve above holds: between the
   phone and wide layouts the tagline steps aside and the links scroll sideways instead of wrapping. */
.pc-inner { flex-wrap: nowrap; }
.pc-nav { flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.pc-nav::-webkit-scrollbar { display: none; }
.pc-nav a:focus-visible { outline-offset: -3px; } /* inside the link: the scrolling nav clips anything outside */
@media (max-width: 1099px) { .pc-tagline { display: none; } .pc-nav { gap: 0 14px; } }


/* Phone tab bar: hidden on wide screens. */
.pc-tabs { display: none; }

@media (max-width: 640px) {
  .pc-bar { position: sticky; top: 0; transition: transform .22s ease; box-shadow: 0 1px 0 var(--line, rgba(127, 127, 127, .2)); }
  .pc-bar.pc-hidden { transform: translateY(-100%); }
  .pc-inner { padding: 6px 0; flex-wrap: nowrap; }
  .pc-nav { display: none; }
  .pc-logo { font-size: 24px; }
  .pc-tagline { font-size: 14px; }
  .pc-tabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--surface); box-shadow: 0 -1px 0 var(--line, rgba(127, 127, 127, .25)); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); font-family: var(--font-ui); }
  .pc-tab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--text-muted); text-decoration: none; font-size: 11px; font-weight: 600; border-radius: var(--r-sm); -webkit-tap-highlight-color: transparent; }
  .pc-tab[aria-current="page"] { color: var(--gold); }
  .pc-tab:active { background: var(--btn-hover, rgba(127, 127, 127, .15)); }
  body.pc-has-tabs, body:has(header[data-site-chrome]) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  header[data-site-chrome]:not(.pc-bar) { height: 56px; position: sticky; top: 0; z-index: 50; }
  header[data-site-chrome]:not(.pc-bar) > a { padding: 6px 0; font-size: 24px; }
  .pc-inner { min-height: 56px; }
}

/* The pages' skip links must paint above the bar when focused. */
.skip, .skip-link { z-index: 100; }

@media (prefers-reduced-motion: reduce) {
  .pc-bar { transition: none; }
}

/* The Lisp motif (captain, 2026-11-24). Section headers stand in parens, plain words inside; a screen
   reader hears the words alone. A hover on the header lights the pair. */
.paren::before, .paren::after { color: var(--gold); font-weight: 400; transition: color 140ms ease, text-shadow 140ms ease; }
.paren::before { content: "("; content: "(" / ""; margin-right: 0.06em; }
.paren::after { content: ")"; content: ")" / ""; margin-left: 0.06em; }
.paren:hover::before, .paren:hover::after { color: var(--accent); }

/* Every footer closes what the page opened. */
.site-footer::after, .doc-footer::after { content: "))))))"; content: "))))))" / ""; display: block; flex: 1 1 100%; text-align: right; font: 500 16px/1 var(--font-mono); letter-spacing: 4px; color: transparent; background: linear-gradient(to left, transparent, var(--gold) 64px) right / 64px 100% no-repeat; -webkit-background-clip: text; background-clip: text; }
.site-footer::after { width: min(100% - 2 * var(--gutter), var(--content)); margin: 14px auto 0; }

/* A paren in a code sample lights up with its match (js/parens.js). */
.pr { border-radius: 3px; transition: background-color 120ms ease, color 120ms ease; }
.pr.is-lit { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
.cap.is-lit { background: color-mix(in srgb, var(--accent) 35%, var(--surface-3)); box-shadow: 0 3px 0 var(--accent-shadow); }
@media (prefers-reduced-motion: reduce) { .paren::before, .paren::after, .pr { transition: none; } }

/* A calculator's face is a thing, not text: nothing on one is selected (captain, 2026-11-24). */
.rally-svg, .sim, .embed-dev, .hw-device, .app-device, .rx-screen, .app-screen, .feat-lcd, .shot { -webkit-user-select: none; user-select: none; }

/* The page scrolls (js/scroll-owner.js): a simulator under a still pointer lets the wheel through. Not on
   touch screens, where a frame takes a touch, not a pointer that was there before. */
@media (hover: hover) and (pointer: fine) { html.page-scrolls :is(iframe, .rx-text) { pointer-events: none !important; } }
@media (max-width: 345px) { .pc-tab { font-size: 10px; } } /* five of them */
