/* Metric-matched fallbacks (measured against the web fonts): while the web fonts load, local Arial and
   Courier New take the same space, so the swap does not move the page (CLS). Used in every font stack. */
@font-face { font-family: "Space Grotesk Fallback"; src: local("Arial"), local("Helvetica"), local("Liberation Sans"); size-adjust: 98.27%; ascent-override: 99.73%; descent-override: 29.51%; line-gap-override: 0%; }
@font-face { font-family: "Inter Fallback"; src: local("Arial"), local("Helvetica"), local("Liberation Sans"); size-adjust: 104.55%; ascent-override: 92.78%; descent-override: 22.96%; line-gap-override: 0%; }
@font-face { font-family: "JetBrains Mono Fallback"; src: local("Courier New"), local("Courier"), local("Liberation Mono"); size-adjust: 99.98%; ascent-override: 102.02%; descent-override: 30%; line-gap-override: 0%; }

/* Account slot in the header (sign in / avatar menu). Tokens only: every page defines them in :root. */
.account { position: relative; display: flex; align-items: center; }
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 4px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text);
  font: 500 14px/1 "Inter", "Inter Fallback", sans-serif;
  cursor: pointer;
}
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--panel); border-color: var(--text-3); }
.account-btn .icon { width: 14px; height: 14px; color: var(--text-3); }
.account-initials {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--accent-2);
  font: 600 11px "Inter", "Inter Fallback", sans-serif;
}
.account-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: var(--panel-2); flex: none; }
.account-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  z-index: 30;
}
.account-menu[hidden] { display: none; }
.account-who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 13px; color: var(--text-3); }
.account-who b { display: block; color: var(--text); font-weight: 500; font-size: 14px; overflow-wrap: anywhere; }
.account-menu button, .account-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font: 500 14px/1.2 "Inter", "Inter Fallback", sans-serif;
  text-align: left;
  cursor: pointer;
}
.account-menu button:hover, .account-menu a:hover { background: var(--panel-2); color: var(--text); }
.account-menu .icon { width: 16px; height: 16px; }

@media (max-width: 560px) {
  .account-name, .account-btn .icon { display: none; }
  .account-btn { padding: 0 4px; }
}

/* Phone header: logo and the menu button (in the HTML, wired by js/nav.js) only; the rest opens full
   screen. Not tied to JavaScript, so the header has its final height from the first paint (CLS); a
   <noscript> style in each page shows the links again without JavaScript. */
.nav-toggle { display: none; }
.site-menu[hidden] { display: none; }
.site-menu {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow-y: auto;
  padding: 0 16px 32px;
  background: var(--bg);
}
.site-menu-top { display: flex; align-items: center; justify-content: space-between; height: 60px; border-bottom: 1px solid var(--line); }
.site-menu-close,
.nav-toggle {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.site-menu-close { display: inline-flex; }
.site-menu-close svg, .nav-toggle svg { width: 24px; height: 24px; }
.site-menu-close:hover, .nav-toggle:hover { background: var(--panel); }
.site-menu-links { display: grid; padding: 12px 0; border-bottom: 1px solid var(--line); }
.site-menu-actions { display: grid; gap: 12px; padding-top: 20px; }
.site-menu a,
.site-menu button { display: flex; align-items: center; min-height: 48px; font: 500 17px/1.2 "Inter", "Inter Fallback", sans-serif; }
.site-menu-links a { padding: 0 4px; color: var(--text-2); }
.site-menu-links a[aria-current="page"] { color: var(--text); }
.site-menu-actions .btn { justify-content: center; width: 100%; }
.site-menu-account { display: grid; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.site-menu-who { margin: 0 0 4px; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.site-menu-account a,
.site-menu-account button { padding: 0 4px; border: 0; background: transparent; color: var(--text-2); text-align: left; cursor: pointer; }
.site-menu-account a:hover, .site-menu-account button:hover, .site-menu-links a:hover { color: var(--text); }
body.menu-open { overflow: hidden; }

@media (max-width: 768px) {
  html .nav .wrap { flex-wrap: nowrap; height: 60px; padding-top: 0; padding-bottom: 0; }
  html .nav .tools,
  html .nav .nav-right { display: none; }
  html .nav-toggle { display: inline-flex; margin-left: auto; }
}
