/* The standalone Wiki has its own document styles. Scope the shared header to it. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/wp-content/mu-plugins/dm-layout-assets/fonts/JetBrainsMono-Thin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100;
  font-display: swap;
}

body[data-chapter]:has(.dm-wiki-shell) {
  --nav-h: 64px;
  --fm: "JetBrains Mono", "Courier New", monospace;
  --fw-u: 100;
  --dm-space-page-start: 16px;
  --ease: ease;
  --paper: #fcf1f7;
  background: var(--paper);
  overflow-x: clip;
}
body[data-chapter] .dm-wiki-shell {
  display: grid;
  grid-template-columns: minmax(216px, 3fr) minmax(0, 9fr);
  column-gap: var(--gutter, 20px);
  align-items: start;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding: calc(var(--nav-h) + var(--dm-space-page-start)) var(--margin) 0;
}
body[data-chapter] .dm-wiki-shell > #sidebar {
  position: sticky;
  inset: auto;
  top: calc(var(--nav-h) + 16px);
  width: auto;
  height: auto;
  max-height: calc(100dvh - var(--nav-h) - 24px);
  margin: 0;
  padding: 16px;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  background: transparent;
}
body[data-chapter] .dm-wiki-shell > #main-content {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0 0 45px;
}
body[data-chapter] .dm-wiki-shell #main-content [id] {
  scroll-margin-top: calc(var(--nav-h) + 8px);
}
@media (max-width: 899px) {
  body[data-chapter] .dm-wiki-shell { display: block; }
  body[data-chapter] .dm-wiki-shell > #sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin: 0 0 16px;
    padding: 0;
  }
}
body[data-chapter] .dm-skip-link {
  position: fixed;
  top: -100px;
  left: var(--margin,16px);
  z-index: 102;
  background: white;
  color: #0a0909;
  padding: 8px 12px;
}
body[data-chapter] .dm-skip-link:focus { top: 8px; }

body[data-chapter] #hd,
body[data-chapter] #n-mobile-nav {
  font: 100 17px/24px var(--fm);
  letter-spacing: .3px;
  color: #0a0909;
}
body[data-chapter] #hd {
  position: fixed;
  inset: 0 0 auto;
  height: var(--nav-h);
  z-index: 100;
  background: transparent;
}
body[data-chapter] #hd.on {
  background: rgb(252 241 247 / 92%);
}
body[data-chapter] #hd > .nav-inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter,20px);
  align-items: center;
  height: 100%;
}
body[data-chapter] #hd .n-logo {
  grid-column: 1 / 4;
  grid-row: 1;
  white-space: nowrap;
}
body[data-chapter] #hd :is(.n-logo,.n-item),
body[data-chapter] #n-mobile-nav a {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}
body[data-chapter] #hd .n-logo,
body[data-chapter] #hd a.nav-active { text-decoration: none; }
body[data-chapter] #hd a.n-item:not(.nav-active) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}
body[data-chapter] #hd .n-hamburger {
  display: none;
  font: inherit;
  letter-spacing: inherit;
  background: transparent;
  color: inherit;
  border: 0;
  padding: 0;
  min-height: 48px;
  cursor: pointer;
}
body[data-chapter] #n-mobile-nav {
  display: none;
  z-index: 99;
}
@media (max-width: 1280px) {
  body[data-chapter] #hd .n-logo { grid-column: 1 / 9; }
  body[data-chapter] #hd .n-hamburger {
    display: inline-flex;
    grid-column: 9 / -1;
    grid-row: 1;
    align-items: center;
    justify-self: end;
    width: max-content;
    gap: 4px;
  }
  body[data-chapter] #n-mobile-nav {
    display: block;
    position: fixed;
    inset: var(--nav-h) 0 0;
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px var(--margin);
    background: white;
    transform: translateY(-100%) translateY(-8px);
    opacity: 0;
    pointer-events: none;
  }
  body[data-chapter] #n-mobile-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  body[data-chapter] #n-mobile-nav .sub-menu a::after {
    content: "→" / "";
    flex: none;
    margin-left: .5em;
    color: currentColor;
  }
}
body[data-chapter] #hd :is(a,button):focus-visible {
  outline: 2px solid #6e17c7;
  outline-offset: 3px;
}
