/* Compact navigation uses a dialog; desktop keeps the same controls in a sidebar. */
:root { --site-header-height: 76px; }
.rail.site-header {
  position: sticky; inset: 0 0 auto; z-index: 60;
  display: block; width: 100%; height: var(--site-header-height);
  padding: 0; overflow: visible; border: 0; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; height: 100%; max-width: 1600px; margin-inline: auto; padding-inline: 42px;
}
.site-header .brand { margin: 0; gap: 13px; font-size: 14px; white-space: nowrap; }
.site-header .brand img { display: block; width: 38px; height: 38px; }
.site-header .brand b { margin-left: 5px; font-size: 13px; }
.site-header .navigation-toggle,
#navigationClose {
  display: grid; place-items: center; flex: 0 0 48px;
  width: 48px; height: 48px; padding: 8px; min-height: 48px;
  color: var(--text); background: transparent; border: 0; border-radius: 6px;
  transition: background-color 140ms, scale 120ms;
}
.site-header .navigation-toggle svg { width: 32px; height: 32px; }
#navigationClose svg { width: 26px; height: 26px; }
.site-header .navigation-toggle:focus-visible,
#navigationClose:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.workspace { margin-left: 0; }
.desktop-navigation { display: none; }
.workspace > main { min-height: calc(100svh - var(--site-header-height)); width: 100%; }
.site-menu-open { overflow: hidden; }
#navigationPanel {
  inset: 0 0 0 auto; margin: 0; width: min(540px, 100%); max-width: 100%;
  height: 100%; height: 100dvh; max-height: none; padding: 24px 30px;
  color: var(--text); background: var(--bg); border: 0; border-radius: 0;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  box-shadow: -16px 0 60px #0004;
}
#navigationPanel::backdrop { background: #03060385; backdrop-filter: blur(5px); }
.site-menu-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.site-menu-heading h2 { font-size: 24px; letter-spacing: -.035em; }
.site-navigation-contents #globalSearch { display: flex; align-items: center; width: 100%; margin: 0 0 24px; }
.site-navigation-contents #globalSearch > svg { position: absolute; left: 15px; width: 20px; height: 20px; color: var(--muted); pointer-events: none; }
.site-navigation-contents #searchInput { width: 100%; height: 48px; padding: 12px 42px; font-size: 16px; }
.site-navigation-contents #globalSearch kbd { position: absolute; right: 15px; color: var(--muted); font: 13px var(--mono); }
.site-navigation-contents .global-search-suggestions { width: 100%; max-height: min(480px, 60dvh); }
.rail.site-header #researchNavigation {
  display: grid; grid-template-columns: minmax(0,1fr); gap: 20px;
  padding: 0 0 22px; max-height: none; overflow: visible;
}
.site-header .nav-group h2 { margin: 0 12px 7px; font-size: 13px; }
.site-header #researchNavigation .nav-item { display: block; width: 100%; }
.site-header #researchNavigation .nav-item::part(button) { width: 100%; min-height: 44px; padding: 10px 12px; font-size: 14px; }
.site-header #researchNavigation .nav-item::part(label) { white-space: normal; }
.site-header .nav-research { margin: 0; padding: 12px 0 0; }
.site-header .nav-research summary { font-size: 14px; }
.site-header .site-menu-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px; padding-block: 20px; border-top: 1px solid var(--line);
}
.site-menu-actions :is(#helpButton, #donateButton) { display: block; width: 100%; min-width: 0; }
.site-menu-actions :is(#helpButton, #donateButton)::part(button) {
  box-sizing: border-box; width: 100%; min-height: 48px;
  align-items: center; justify-content: center; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.25;
}
.site-menu-actions wa-button::part(start) { margin-inline-end: 8px; }
.site-menu-actions wa-button::part(label) { padding: 0; white-space: nowrap; }
.site-menu-actions :is(#helpButton, #donateButton) svg {
  display: block; flex: 0 0 18px; width: 18px; height: 18px;
  margin: 0; fill: none; color: var(--muted);
}
.site-menu-actions #donateButton svg { color: #d52236; fill: currentColor; }
.site-menu-actions :is(#helpButton, #donateButton):active::part(button) { background: var(--raised); border-color: #607649; }
.site-header .rail-bottom { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 15px 0 0; margin: 0; border-top: 1px solid var(--line); }
.site-header .rail-bottom p { margin: 0; font: 13px/1.7 var(--mono); letter-spacing: .025em; }
.site-header .rail-bottom > a { display: inline-flex; align-items: center; min-height: 44px; margin: 0; font-size: 14px; white-space: nowrap; }

/* The original artwork, rendered in black on its own Ribbit Hole lime. */
.workspace > .site-footer { display: block; padding: 48px 42px; border: 0; background: #c3ff00; color: #000; }
.site-footer-inner { display: flex; align-items: center; gap: 50px; max-width: 1336px; margin-inline: auto; }
.site-footer-brand { display: block; flex-shrink: 0; }
.site-footer-brand img { display: block; width: 144px; height: auto; filter: brightness(0); outline: none; }
.site-footer-copy p { margin: 0; }
.site-footer-copy .site-footer-name { margin-bottom: 12px; font: 13px/1.5 var(--mono); letter-spacing: .15em; }
.site-footer-copy > p:not(.site-footer-name) { font-size: 23px; line-height: 1.35; letter-spacing: -.025em; }
.site-footer-copy small { display: block; margin-top: 16px; color: #9aa68c; font-size: 14px; }
.site-footer a:focus-visible { outline-color: #000; }
@media (hover: hover) and (pointer: fine) {
  .site-header .navigation-toggle:hover, #navigationClose:hover { background: var(--raised); }
  .site-menu-actions :is(#helpButton, #donateButton):hover::part(button) { background: var(--raised); border-color: #607649; }
}
@media (max-width: 850px) {
  :root { --site-header-height: 68px; }
  .site-header-inner { padding-inline: 22px; }
  .workspace > .site-footer { padding: 38px 22px; }
}
@media (max-width: 600px) {
  .site-header-inner { padding-inline: 16px; }
  .site-header .brand { gap: 11px; font-size: 14px; }
  .site-header .brand img { width: 32px; height: 32px; }
  .site-header .brand b { font-size: 13px; margin-left: 3px; }
  #navigationPanel { padding: 14px 20px 24px; }
  .site-menu-heading { margin-bottom: 20px; }
  .site-menu-heading h2 { font-size: 23px; }
  .site-footer-inner { align-items: flex-start; gap: 24px; flex-direction: column; }
  .site-footer-brand img { width: 118px; }
  .workspace > .site-footer { padding: 34px 22px; }
  .site-footer-copy > p:not(.site-footer-name) { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  .site-header .navigation-toggle, #navigationClose { transition: none; }
  .site-header button:active, .site-header wa-button:active { scale: 1; }
}

/* Keep this breakpoint aligned with compactNavigationQuery in navigation.js. */
@media (min-width: 1025px) {
  :root { --site-header-height: 0px; --site-sidebar-width: 260px; }
  .rail.site-header {
    position: fixed; inset: 0 auto 0 0;
    display: flex; flex-direction: column;
    width: var(--site-sidebar-width); height: 100dvh;
    border-right: 1px solid var(--line); border-bottom: 0;
    background: #151815; overflow: visible;
  }
  .site-header-inner {
    flex: 0 0 auto; width: 100%; height: auto;
    padding: 24px 20px 22px;
  }
  .site-header .navigation-toggle { display: none; }
  .workspace { margin-left: var(--site-sidebar-width); }
  .desktop-navigation { display: flex; flex: 1 1 auto; min-height: 0; }
  .desktop-navigation .site-navigation-contents {
    display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0;
    padding: 0 12px 14px;
  }
  .desktop-navigation #globalSearch { flex: 0 0 auto; margin-bottom: 14px; }
  .desktop-navigation #searchInput { height: 44px; font-size: 16px; }
  .desktop-navigation .global-search-suggestions {
    left: 0; right: auto; width: min(540px, calc(100vw - 48px));
  }
  .rail.site-header #desktopNavigation #researchNavigation {
    display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0;
    overflow-y: auto; gap: 14px; padding-bottom: 12px;
  }
  .site-header #desktopNavigation .nav-group { flex-shrink: 0; }
  .site-header #desktopNavigation .nav-item::part(button) {
    min-height: 44px; padding: 9px 12px; font-size: 15px;
  }
  .site-header #desktopNavigation .site-menu-actions {
    flex: 0 0 auto; padding-block: 12px; gap: 8px;
  }
  #desktopNavigation .site-menu-actions :is(#helpButton, #donateButton)::part(button) {
    min-height: 44px; padding: 9px 12px; font-size: 15px;
  }
  .site-header #desktopNavigation .rail-bottom {
    flex: 0 0 auto; align-items: flex-start; flex-direction: column; gap: 0; padding-top: 8px;
  }
  #desktopNavigation .rail-bottom p { font-size: 13px; }
  #desktopNavigation .rail-bottom > a { min-height: 44px; font-size: 14px; }
}

/* Accessibility floor: slotted nav labels inherit from the wa-button host, so size the host too */
.site-header .nav-item, .site-header .site-menu-actions wa-button { font-size: 15px; }
.site-header .brand { min-height: 44px; }
