/* Site chrome on every page: the header, install popover, narrow-screen menu and footer (5b canvas header). */
.logo{flex:none}
.logo-tile{fill:var(--logo-tile)}
.logo-eye{fill:var(--logo-eye)}
.logo-glyph{fill:none;stroke:var(--logo-glyph);stroke-width:48;stroke-linecap:round;stroke-linejoin:round}

.site-h{--text:var(--head-text);--text-2:var(--head-text-2);position:sticky;top:0;z-index:40;height:var(--story-header-height);display:flex;align-items:center;gap:28px;padding:0 var(--story-gutter);background:color-mix(in srgb,var(--bg) 86%,transparent);backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);border-bottom:1px solid color-mix(in srgb,var(--line) 70%,transparent);font-family:var(--font-mono);font-size:14px;color:var(--text)}
.brand{display:flex;gap:10px;align-items:center;font-weight:600;text-decoration:none;white-space:nowrap}
.site-nav{display:flex;gap:20px;margin-left:8px}
.site-nav a{text-decoration:none;color:var(--text-2);white-space:nowrap}
.site-nav a:hover,.site-nav a[aria-current]{color:var(--text)}
.site-nav a[aria-current]{text-decoration:underline;text-underline-offset:4px}
.h-r{margin-left:auto;display:flex;align-items:center;gap:10px}

.themes{position:relative}
.theme-b{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:8px;padding:8px 10px;border-radius:8px;color:var(--text-2)}
.pop.theme-pop{width:min(484px,calc(100vw - 32px));max-height:calc(100vh - var(--story-header-height) - 24px);overflow:auto;scroll-padding:8px} /* room for a focus ring when the keyboard scrolls it */
.tcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px}

/* The app's theme card (Settings › Appearance): page colours by default, app colours inside the window. */
.tcard{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:var(--a-space-8);padding:var(--a-space-6);border-radius:var(--a-radius-popover);border:2px solid var(--tc-line,var(--line));font:var(--a-text-row) var(--font-ui);color:var(--tc-text,var(--text));min-width:0}
.tcard[aria-pressed="true"]{border-color:var(--tc-accent,var(--amber));font-weight:500}
.tcard-pv{height:74px;display:flex;border-radius:var(--a-radius-row);overflow:hidden;background:var(--sw-ground);border:1px solid var(--sw-edge)}
.tcard-side{width:34px;background:var(--sw-panel);display:flex;flex-direction:column;gap:4px;padding:8px 4px}
.tcard-bar{display:block;height:4px;border-radius:2px;background:var(--sw-line-strong)}
.tcard-bar.a{width:70%;background:var(--sw-accent)}
.tcard-bar.s{width:80%}
.tcard-panes{flex:1;display:flex;gap:2px;padding:4px}
.tcard-panes>span{flex:1;display:flex;flex-direction:column;gap:2px}
.tcard-pane{display:block;flex:1;border-radius:2px;background:var(--sw-surface)}
.tcard-pane.f{border:1px solid var(--sw-focus)}
.tcard-nm{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:0 2px}
.tcard-nm>span{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.tcard-check{flex:none;width:14px;height:14px;color:var(--tc-accent,var(--amber));visibility:hidden}
.tcard[aria-pressed="true"] .tcard-check{visibility:visible}

.menu-b{all:unset;cursor:pointer;display:none;padding:8px 10px;border-radius:8px;color:var(--text-2)}
.inst{position:relative}
.ibtn{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:9px 16px;border-radius:var(--story-radius-pill);background:var(--amber);color:var(--ink);font:600 14px var(--font-sans);white-space:nowrap}
.pop{position:absolute;right:0;top:50px;width:min(460px,calc(100vw - 32px));background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:18px;box-shadow:0 30px 80px var(--story-shadow);display:flex;flex-direction:column;gap:12px;font-family:var(--font-sans);color:var(--text)}
.pop-h{display:flex;align-items:center;justify-content:space-between;font-family:var(--font-mono);font-size:12px;letter-spacing:.06em;color:var(--eyebrow)}
.x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:8px;display:flex;align-items:center;justify-content:center;color:var(--muted)}
.cmd{display:flex;align-items:center;gap:10px;background:var(--field);border:1px solid var(--line);border-radius:10px;padding:8px 8px 8px 14px;font-family:var(--font-term);font-size:12.5px;color:var(--text)}
.cmd code{flex:1;min-width:0;overflow-x:auto;white-space:nowrap;font:inherit}
.cbtn{all:unset;cursor:pointer;flex:none;min-height:36px;padding:0 14px;border-radius:8px;background:var(--amber);color:var(--ink);font:600 13px var(--font-sans);display:inline-flex;align-items:center}
.note{margin:0;font-size:13px;color:var(--muted);line-height:1.5}
:is(.ibtn,.cbtn,.x,.menu-b,.theme-b,.tcard,.site-nav a,.brand,.f-cols a):focus-visible{outline:2px solid var(--ring);outline-offset:3px}

.site-f{border-top:1px solid var(--line);padding:56px var(--story-gutter) 40px;font-size:14px;color:var(--text)}
.f-cols{max-width:var(--story-content-max);margin:0 auto;display:grid;grid-template-columns:2fr 1fr 1fr 1fr 1fr;gap:28px}
.f-h{display:block;margin:0 0 12px;font-family:var(--font-mono);font-size:12.5px;font-weight:500;color:var(--muted);letter-spacing:.06em}
.f-cols a{display:block;text-decoration:none;color:var(--text-2);padding:4px 0}
.f-cols .brand{display:flex;padding:0}
.f-cols .brand .logo{width:26px;height:26px}
.f-cols p{margin:12px 0 0;color:var(--text-2);max-width:300px;line-height:1.5}
.f-b{max-width:var(--story-content-max);margin:40px auto 0;display:flex;justify-content:space-between;gap:16px;flex-wrap:wrap;font-family:var(--font-mono);font-size:13px;color:var(--muted)}

/* Narrow screens: with scripts the links fold into [menu]; without them they wrap under the header.
   The one-row header needs about 1200px, so it folds below 1240px. */
@media(max-width:1240px){
  .site-h{flex-wrap:wrap;height:auto;min-height:var(--story-header-height);row-gap:0}
  .site-nav{order:3;flex-basis:100%;flex-wrap:wrap;gap:6px 16px;margin:0;padding:0 0 12px}
  /* Without scripts the wrapped header has no fixed height, so it scrolls away instead of sticking. */
  :root:not([data-js]) .site-h{position:relative;padding-top:8px}
  :root[data-js] .site-h{flex-wrap:nowrap;height:var(--story-header-height)}
  :root[data-js] .site-nav{display:none;position:absolute;left:0;right:0;top:var(--story-header-height);flex-direction:column;gap:0;padding:8px 16px 16px;background:var(--surface);border-bottom:1px solid var(--line)}
  :root[data-js] .site-nav.open{display:flex}
  :root[data-js] .menu-b{display:inline-flex}
  :root[data-js] .site-nav a{padding:12px 4px;border-bottom:1px solid var(--line)}
}
@media(max-width:900px){
  .site-h{padding:0 var(--story-gutter-narrow);gap:12px}
  .ibtn .long,.theme-b .long{display:none}
  .f-cols{grid-template-columns:1fr 1fr}
  .site-f{padding:44px var(--story-gutter-narrow) 32px}
  /* Popovers span the screen under the header (the header is their containing block). */
  .pop,.pop.theme-pop{position:fixed;left:16px;right:16px;top:calc(var(--story-header-height) + 8px);width:auto}
}
@media(max-width:520px){.site-h .brand{font-size:0;gap:0}}
