/* Reserve the same space on short and scrolling pages so the header stays put. */
html { scrollbar-gutter: stable; scrollbar-width: thin; }

/* One outer width for the header and page content, including wide screens. */
:root {
  --site-max-width: 1100px;
  --site-gutter: 32px;
  --max-w: var(--site-max-width);
}
html[data-site-page]:not([data-site-page="book"]) body > main,
html[data-site-page="talks"] body > section,
html[data-site-page="new"] body > section {
  box-sizing: border-box;
  width: 100%; max-width: var(--site-max-width); margin-inline: auto;
}
@media (min-width: 641px) {
  html[data-site-page]:not([data-site-page="book"]) body > main,
  html[data-site-page="talks"] body > section,
  html[data-site-page="new"] body > section {
    padding-inline: var(--site-gutter);
  }
}

/* Shared navigation owns its dimensions and palette, independently of page CSS. */
.site-nav {
  --bg: #0a0a0a;
  --text-muted: #8a8a8a;
  --text-dim: #555555;
  --accent: #00a1ff;
  --accent-dim: #00a1ff20;
  --border: #222222;
  --nav-bg: rgba(10, 10, 10, .2);
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 60px; margin: 0; padding: 0; box-sizing: border-box;
  border: 0; border-bottom: 1px solid var(--border);
  background: var(--nav-bg); color: var(--text-muted);
  font-family: 'Berkeley Mono', 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 15px; font-weight: 400; line-height: 1.75;
  backdrop-filter: blur(40px) saturate(1.6);
  -webkit-backdrop-filter: blur(40px) saturate(1.6);
}
[data-theme="light"] .site-nav {
  --bg: #f5f4f0;
  --text-muted: #3f3a30;
  --text-dim: #6f6a5f;
  --accent: #d66820;
  --accent-dim: #d6682022;
  --border: #c6beae;
  --nav-bg: rgba(245, 244, 240, .55);
}
.site-nav *, .site-nav *::before, .site-nav *::after { box-sizing: border-box; }
.site-nav .nav-inner { width: 100%; max-width: var(--site-max-width); height: 100%; margin: 0 auto; padding: 0 var(--site-gutter); display: flex; align-items: center; justify-content: space-between; }
.site-nav .nav-left { display: flex; align-items: center; gap: 12px; }
.site-nav .nav-right { display: flex; align-items: center; gap: 0; }
.site-nav .nav-links { display: flex; position: static; flex-direction: row; align-items: center; gap: 20px; list-style: none; margin: 0; padding: 0; border: 0; background: none; }
.site-nav .nav-links li { display: flex; align-items: center; margin: 0; padding: 0; }
.site-nav .nav-links a { font-family: inherit; font-size: 11.2px; font-weight: 400; line-height: 1.75; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); text-decoration: none; border: 0; transition: color .2s; }
.site-nav .nav-links a:hover, .site-nav .nav-links a[aria-current="page"] { color: var(--accent); }
.site-nav .nav-links .nav-home { display: flex; align-items: center; justify-content: center; min-width: 24px; min-height: 32px; }
.site-nav .nav-home svg { display: block; width: 18px; height: 18px; }
.site-nav .nav-home-label { display: none; }
.site-nav .nav-social { display: flex; align-items: center; gap: 2px; }
.site-nav .nav-social a { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; color: var(--text-dim); text-decoration: none; transition: color .2s, background .2s; }
.site-nav .nav-social a svg { width: 14px; height: 14px; }
.site-nav .nav-divider { width: 1px; height: 16px; margin: 0 4px; background: var(--border); }
.site-nav .theme-toggle, .site-nav .site-language-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--text-dim); text-decoration: none; cursor: pointer; transition: color .2s, background .2s; }
.site-nav .theme-toggle svg { width: 14px; height: 14px; }
.site-nav .site-language-toggle svg { width: 16px; height: 16px; }
.site-nav .theme-toggle .icon-sun { display: block; }
.site-nav .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .site-nav .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .site-nav .theme-toggle .icon-moon { display: block; }
.site-nav .nav-social a:hover, .site-nav .theme-toggle:hover, .site-nav .site-language-toggle:hover { color: var(--accent); background: var(--accent-dim); }
.site-nav .hamburger { display: none; flex-direction: column; gap: 5px; margin: 0; padding: 4px; border: 0; background: none; cursor: pointer; }
.site-nav .hamburger span { display: block; width: 22px; height: 1.5px; background: var(--text-muted); }
.site-nav a:focus-visible, .site-nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* Identical menu layout and breakpoint on every page, in both languages. */
@media (max-width: 1000px) {
  .site-nav .nav-home svg { display: none; }
  .site-nav .nav-home-label { display: inline; text-transform: uppercase; }
  .site-nav .nav-links .nav-home { min-height: auto; }
  .site-nav .nav-links {
    display: none; position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 16px; padding: 24px 32px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: calc(100dvh - 60px); overflow-y: auto;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  }
  .site-nav .nav-links.open { display: flex; }
  .site-nav .hamburger { display: flex; }
}
@media (max-width: 400px) {
  .site-nav .nav-inner { padding-left: 16px; padding-right: 16px; }
  .site-nav .nav-social { gap: 0; }
  .site-nav .nav-social a, .site-nav .theme-toggle, .site-nav .site-language-toggle { width: 28px; }
}
