/* Shared site shell. Page styles must not control this persistent navigation. */
:root {
  --site-header-top: env(safe-area-inset-top, 0px);
  --site-header-height: 52px;
  --site-header-bottom: calc(var(--site-header-top) + var(--site-header-height));
  --site-font: "KMR Waldenburg", "Helvetica Neue", "Arial Nova", Arial, sans-serif;
}
html { scroll-padding-top: calc(var(--site-header-bottom) + 16px); }
body[data-site-page] { margin: 0; padding-top: var(--site-header-bottom); min-width: 320px; overflow-x: clip; }
#site-page { display: flow-root; min-height: calc(100svh - var(--site-header-bottom)); outline: none; }
[data-site-header], [data-site-footer], [data-site-header] *, [data-site-footer] * { box-sizing: border-box; }
[data-site-header], [data-site-footer] {
  --ink: #0b0b0b;
  --muted: #616161;
  --blue: #278eff;
  --line: #e8e8e8;
  --display: var(--site-font);
  font-family: var(--site-font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color-scheme: light;
}
[data-site-header] {
  direction: ltr;
  position: fixed;
  inset: var(--site-header-top) 0 auto;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(960px, calc(100% - 32px));
  height: var(--site-header-height);
  min-height: var(--site-header-height);
  margin: 0 auto;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  color: #0b0b0b;
  background: #fafafa;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  isolation: auto;
  mix-blend-mode: normal;
  transform: none;
  transition: none;
}
[data-site-header]::before {
  content: "";
  position: absolute;
  inset: calc(-1 * var(--site-header-top)) auto 0 50%;
  width: 100vw;
  z-index: -1;
  translate: -50% 0;
  background: #fafafa;
}
[data-site-header] .brand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: inherit;
  font-family: var(--site-font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.4px;
  text-decoration: none;
}
[data-site-header] .brand img { display: block; width: 16px; height: 16px; filter: none; }
[data-site-header] .site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 0;
  font-family: var(--site-font);
  font-size: 15px;
  font-weight: 400;
  line-height: 24px;
}
[data-site-header] .site-nav a {
  display: inline-block;
  margin: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  font: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 160ms ease;
}
[data-site-header] .site-nav a:hover, [data-site-header] .site-nav a:focus-visible { color: inherit; background: transparent; opacity: .66; }
[data-site-header] .site-nav > a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
[data-site-header] .nav-download-wrap { position: relative; }
[data-site-header] .nav-download {
  appearance: none;
  display: inline-block;
  padding: 4px 16px;
  color: #fff;
  background: #000;
  border: 0;
  border-radius: 30px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transform: none;
  transition: none;
}
[data-site-header] .nav-download:focus-visible { outline: 2px solid rgba(39, 142, 255, .35); outline-offset: 3px; }
[data-site-header] .nav-download-menu {
  position: absolute;
  inset: calc(100% + 8px) 0 auto auto;
  z-index: 110;
  display: grid;
  gap: 2px;
  min-width: 132px;
  margin: 0;
  padding: 6px;
  color: #0b0b0b;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,.08);
  list-style: none;
}
[data-site-header] .nav-download-menu[hidden] { display: none; }
[data-site-header] .nav-download-menu a { display: block; padding: 8px 12px; color: #0b0b0b; border-radius: 10px; font-weight: 500; }
[data-site-header] .nav-download-menu a:hover, [data-site-header] .nav-download-menu a:focus-visible { opacity: 1; color: #0b0b0b; background: #f4f4f4; }
/* Difference is a route state: only the 3g(s) tab changes the header blend. */
body[data-site-page="3gs"] [data-site-header] { color: #fff; background: transparent; mix-blend-mode: difference; }
body[data-site-page="3gs"] [data-site-header]::before { display: none; }
body[data-site-page="3gs"] [data-site-header] .brand img { filter: invert(1); }
/* Fixed-header clearance is owned by the shell, not article page CSS. */
#site-page .docs-layout { padding-top: 0; }
#site-page :is(.topic-page, .api-page, .session-page) { padding-top: 44px; }
@media (max-width: 760px) {
  [data-site-header] { width: min(620px, calc(100% - 28px)); }
  [data-site-header] .site-nav { gap: 11px; font-size: 13px; }
  [data-site-header] .nav-download { padding: 3px 11px; }
}
@media (max-width: 540px) {
  [data-site-header] .brand span { display: none; }
  [data-site-header] .site-nav { gap: 9px; font-size: 12px; }
}

/* Shared homepage footer, including language controls. */
[data-site-footer] { --ink: #0b0b0b; --muted: #616161; --blue: #278eff; --line: #e8e8e8; --display: "KMR Waldenburg", "Helvetica Neue", "Arial Nova", Arial, sans-serif; width: min(960px, calc(100% - 32px)); margin-inline: auto; font-family: var(--display); font-weight: 400; }
[data-site-footer] {
  margin-top: 80px;
  padding-block: 48px 40px;
  color: #8a8a8a;
  border-top: 1px solid var(--line, #ededed);
}

[data-site-footer] .footer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 32px 28px;
}

[data-site-footer] .footer-col h2 {
  margin: 0 0 14px;
  color: #939393;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-site-footer] .footer-col ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

[data-site-footer] .footer-section {
  margin-top: 32px;
}

[data-site-footer] .footer-col a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  line-height: 20px;
  text-decoration: none;
}

[data-site-footer] .footer-social-icon {
  display: block;
  flex: none;
  width: 14px;
  height: 14px;
}

[data-site-footer] .footer-col a:hover,
[data-site-footer] .footer-col a:focus-visible {
  opacity: 0.66;
}

[data-site-footer] .footer-sub {
  gap: 8px;
  margin: 8px 0 2px 12px;
}

[data-site-footer] .footer-sub a {
  color: var(--ink);
  font-size: 15px;
  line-height: 20px;
  opacity: 0.7;
}

[data-site-footer] .footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line, #ededed);
}

[data-site-footer] .footer-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

[data-site-footer] .footer-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 16px 4px 12px;
  color: var(--footer-discord-text, #fff);
  background: var(--footer-discord-bg, #000);
  border-radius: 30px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  line-height: 24px;
  text-decoration: none;
  white-space: nowrap;
}

[data-site-footer] .footer-discord-icon {
  display: block;
  width: 16px;
  height: 16px;
}

[data-site-footer] .footer-discord:hover,
[data-site-footer] .footer-discord:focus-visible {
  opacity: 0.92;
}

[data-site-footer] .language-switch {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

[data-site-footer] .language-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding-inline: 10px;
  border: 0;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

[data-site-footer] .language-button > svg {
  width: 17px;
  height: 17px;
}

[data-site-footer] .language-button > .language-chevron {
  width: 10px;
  height: 10px;
  color: var(--muted);
}

[data-site-footer] .language-button[aria-expanded="true"] .language-chevron {
  transform: rotate(180deg);
}

[data-site-footer] .language-button:hover,
[data-site-footer] .language-button[aria-expanded="true"] {
  background: var(--footer-hover, rgba(0, 0, 0, 0.04));
}

[data-site-footer] .language-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

[data-site-footer] .language-menu {
  direction: ltr;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 200px;
  max-width: calc(100vw - 48px);
  max-height: min(332px, calc(100dvh - 100px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 4px;
  background: var(--footer-control, #fff);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

[data-site-footer] .language-menu[hidden] {
  display: none;
}

[data-site-footer] .language-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 28px;
  padding: 3px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 12px;
  line-height: 22px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

[data-site-footer] .language-menu button:hover,
[data-site-footer] .language-menu button:focus-visible {
  background: var(--footer-hover, #f4f4f4);
}

[data-site-footer] .language-menu button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

[data-site-footer] .language-menu button[aria-checked="true"] {
  color: var(--blue);
}

[data-site-footer] .language-ai-caption {
  order: 2;
  text-align: right;
  color: #8a8a8a;
  font-size: 10px;
  font-weight: 400;
}

[data-site-footer] .language-menu button > svg {
  order: 1;
  margin-left: auto;
  flex: none;
  width: 16px;
  height: 16px;
  visibility: hidden;
}

[data-site-footer] .language-menu button[aria-checked="true"] > svg {
  visibility: visible;
}


@media (max-width: 760px) {
  [data-site-footer] { width: min(620px, calc(100% - 28px)); }
  [data-site-footer] .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
}
@media (max-width: 540px) {
  [data-site-footer] .footer-grid { gap: 28px 20px; }
}

/* Shared interactive footer scene. */
[data-site-footer].footer-hands {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: none;
  min-height: 960px;
  margin-inline: 0;
  padding: 80px max(28px, calc((100% - 960px) / 2)) 32px;
  display: flex;
  flex-direction: column;
  background: var(--footer-surface, #fafafa);
}
.footer-hands-scene {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  --hands-mask: linear-gradient(to bottom, #000 0%, #000 calc(100% - 280px), #0009 calc(100% - 190px), #0001 calc(100% - 95px), transparent 100%);
  -webkit-mask-image: var(--hands-mask);
  mask-image: var(--hands-mask);
}
.footer-hands-scene canvas { display: block; width: 100%; height: 100%; }
.footer-hands .footer-grid {
  mix-blend-mode: difference;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.footer-hands .footer-grid a { pointer-events: auto; color: #fff; }
.footer-hands .footer-grid h2 { color: var(--footer-heading, #676767); }
.footer-hands-controls {
  margin-top: auto;
  -webkit-user-select: none;
  user-select: none;
  padding-top: 300px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
}
.footer-hands-controls p { margin: 0; }
#footer-hands-status { color: var(--footer-control-text, #555); }
#footer-camera-privacy { margin-top: 6px; font-size: 11px; color: #888; }
#footer-camera-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 16px 4px 12px;
  border: 0;
  border-radius: 30px;
  background: var(--footer-control, #fff);
  color: var(--footer-control-text, #666);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
  cursor: pointer;
}
#footer-camera-button svg { display: block; width: 16px; height: 16px; flex-shrink: 0; }
#footer-camera-button,
.footer-discord {
  -webkit-user-select: none;
  user-select: none;
}
#footer-camera-description { flex: 1 1 240px; max-width: 46ch; color: var(--footer-camera-hint, #666); line-height: 1.5; }
#footer-camera-button:hover { background: var(--footer-hover, #f2f2f4); }
#footer-camera-button:focus-visible { outline: 3px solid #258aff; outline-offset: 4px; }
.footer-camera-control { position: relative; min-width: min(224px, calc(100vw - 48px)); }
.footer-camera-preview {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 4;
  width: min(224px, calc(100vw - 48px));
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(180, 195, 212, .22);
  border-radius: 12px;
  background: #080b0f;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .2);
  color: #e3ebf4;
  transform-origin: left bottom;
}
.footer-camera-preview[hidden], .footer-camera-preview-status[hidden] { display: none; }
.footer-camera-preview canvas { display: block; width: 100%; height: 100%; }
.footer-camera-preview-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 36px 24px; text-align: center; font-size: 12px; line-height: 1.5; color: #aebaca; pointer-events: none; }
#footer-camera-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid rgba(220, 232, 245, .2); border-radius: 50%; background: rgba(8, 11, 15, .9); color: #e3ebf4; cursor: pointer; }
#footer-camera-close:hover { background: #25303c; }
#footer-camera-close:focus-visible { outline: 2px solid #79afff; outline-offset: 2px; }
.footer-hands .footer-bar { margin-top: 24px; }
.footer-hands-controls,
.footer-hands .footer-bar { position: relative; z-index: 1; }
@media (max-width: 600px) {
  [data-site-footer].footer-hands { min-height: 1120px; padding: 48px 24px 28px; }
  .footer-hands-controls { padding-top: 340px; }
  .footer-hands-scene {
    --hands-mask: linear-gradient(to bottom, #000 0%, #000 calc(100% - 380px), #0006 calc(100% - 280px), #0001 calc(100% - 190px), transparent 100%);
  }
}

.footer-press-cue {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  transform: translate(-50%, 28px);
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--footer-control, rgba(255,255,255,.86));
  color: #777;
  font-size: 11px;
  white-space: nowrap;
}
.footer-press-cue::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -28px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(80,140,210,.35);
  border-radius: 50%;
  background: rgba(160,205,255,.12);
  transform: translate(-50%, -50%);
}
.footer-press-cue.is-held::before { animation: footer-press-pulse 1.2s ease-out infinite; }
@keyframes footer-press-pulse {
  from { transform: translate(-50%, -50%) scale(.55); opacity: .9; }
  to { transform: translate(-50%, -50%) scale(1.8); opacity: .15; }
}
@media (prefers-reduced-motion: reduce) {
  .footer-press-cue.is-held::before { animation: none; }
}

.footer-press-cue:not(.is-held) { animation: footer-press-fade .9s ease-out forwards; }
@keyframes footer-press-fade { 0%, 45% { opacity: 1; } to { opacity: 0; } }

[data-site-footer] { direction: ltr; }

/* The same footer follows the 3gs route, or can opt into dark explicitly. */
:is(body[data-site-page="3gs"] [data-site-footer], [data-site-footer][data-theme="dark"]) {
  --ink: #f4f4f4;
  --muted: #aaa;
  --line: #292929;
  --footer-surface: #000;
  --footer-heading: #999;
  --footer-control: #1c1c1e;
  --footer-control-text: #e5e5e5;
  --footer-camera-hint: #b7bcc4;
  --footer-hover: #2b2b2e;
  --footer-discord-bg: #f4f4f4;
  --footer-discord-text: #0b0b0b;
  color-scheme: dark;
  background: var(--footer-surface);
  border-color: var(--line);
}
