/* Shared chrome of the project site, the documentation and the API reference:
   design tokens, header, menu, theme switch and footer. Single source; the
   markup is in chrome/header.html and chrome/footer.html. */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --font-record: ui-monospace, 'SF Mono', 'Cascadia Code', 'JetBrains Mono', Menlo, Consolas, monospace;

  --paper: #f6f5f1;
  --sheet: #fdfcf9;
  --sheet-raised: #ffffff;
  --well: #efede7;
  --ink: #1b2230;
  --ink-2: #444d5e;
  --ink-3: #6b7383;
  --rule: rgba(27, 34, 48, 0.1);
  --rule-soft: rgba(27, 34, 48, 0.06);
  --rule-strong: rgba(27, 34, 48, 0.2);

  --seal-ink: #24406b;
  --seal-ink-wash: rgba(36, 64, 107, 0.08);
  --on-seal: #fdfcf9;
  --gate-bg: #24406b;
  --gate-ink: #fdfcf9;
  --wax: #b4372f;
  --brass: #9a6a12;
  --stamp: #2c7451;
  --pencil: #8a8f99;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --page: 1360px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #111419;
    --sheet: #161a21;
    --sheet-raised: #1b2029;
    --well: #0d1014;
    --ink: #e6e8ec;
    --ink-2: #b3b9c4;
    --ink-3: #868d9a;
    --rule: rgba(255, 255, 255, 0.08);
    --rule-soft: rgba(255, 255, 255, 0.05);
    --rule-strong: rgba(255, 255, 255, 0.16);
    --seal-ink: #8fb0e6;
    --seal-ink-wash: rgba(143, 176, 230, 0.1);
    --on-seal: #111419;
    --gate-bg: #1c2a42;
    --gate-ink: #e6e8ec;
    --wax: #e0786e;
    --brass: #d6a54c;
    --stamp: #6cc095;
    --pencil: #7c828d;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
    --paper: #111419;
    --sheet: #161a21;
    --sheet-raised: #1b2029;
    --well: #0d1014;
    --ink: #e6e8ec;
    --ink-2: #b3b9c4;
    --ink-3: #868d9a;
    --rule: rgba(255, 255, 255, 0.08);
    --rule-soft: rgba(255, 255, 255, 0.05);
    --rule-strong: rgba(255, 255, 255, 0.16);
    --seal-ink: #8fb0e6;
    --seal-ink-wash: rgba(143, 176, 230, 0.1);
    --on-seal: #111419;
    --gate-bg: #1c2a42;
    --gate-ink: #e6e8ec;
    --wax: #e0786e;
    --brass: #d6a54c;
    --stamp: #6cc095;
    --pencil: #7c828d;
    color-scheme: dark;
}

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--font-ui);
}
.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.top a { text-underline-offset: 3px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.brand svg { color: var(--seal-ink); flex: none; }
.ver {
  font-family: var(--font-record); font-size: 12px; line-height: 1; color: var(--ink-2); text-decoration: none;
  padding: 4px 7px; border: 1px solid var(--rule); border-radius: 999px;
}
.ver:hover { color: var(--ink); border-color: var(--rule-strong); }
.nav { display: flex; align-items: center; gap: 20px; margin-left: auto; font-size: 14px; }
.nav a { color: var(--ink-2); text-decoration: none; padding: 6px 0; }
.nav a:hover, .nav a[aria-current='page'] { color: var(--ink); }
.nav a[aria-current='page'] { box-shadow: inset 0 -2px 0 var(--seal-ink); }
.nav .gh { color: var(--ink); font-weight: 500; }
.top-search { margin-left: 24px; display: flex; align-items: center; }
.top-tools { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--r-md); background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { color: var(--ink); background: var(--seal-ink-wash); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-switch .moon { display: none; }
:root[data-theme='dark'] .theme-switch .sun { display: none; }
:root[data-theme='dark'] .theme-switch .moon { display: block; }

.menu { position: relative; display: none; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; padding: 8px;
  display: grid; background: var(--sheet-raised); border: 1px solid var(--rule); border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.menu-panel a { color: var(--ink); text-decoration: none; padding: 10px 12px; border-radius: var(--r-sm); font-size: 15px; }
.menu-panel a:hover, .menu-panel a[aria-current='page'] { background: var(--seal-ink-wash); }
@media (max-width: 760px) {
  .nav { display: none; }
  .menu { display: block; }
  .top-search { margin-left: auto; }
  .top-tools { margin-left: auto; }
  .top-search + .nav + .top-tools { margin-left: 0; }
}

:where(.top, .foot-bar) :focus-visible { outline: 2px solid var(--seal-ink); outline-offset: 2px; border-radius: var(--r-sm); }

/* footer: a slim bar fixed at the bottom of the viewport on every page */
:root { --foot-h: 38px; }
body { padding-bottom: var(--foot-h); }
.foot-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--foot-h);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
  font-family: var(--font-ui); font-size: 13px; line-height: 1; color: var(--ink-3);
}
.foot-bar .wrap { display: flex; align-items: center; gap: 16px; height: 100%; }
.foot-bar nav { display: flex; align-items: center; gap: 18px; min-width: 0; }
.foot-bar a { color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.foot-bar a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.foot-bar svg { width: 15px; height: 15px; flex: none; }
.foot-bar .ver { font-family: var(--font-record); font-size: 12px; }
.foot-bar .by { margin-left: auto; white-space: nowrap; }
@media (max-width: 760px) {
  .foot-bar .wrap { padding: 0 16px; gap: 12px; }
  .foot-bar nav { gap: 14px; }
  .foot-bar .wide { display: none; }
  .foot-bar .by-text { display: none; }
}
