:root {
  color-scheme: light dark;
  --bg: #f5f5f5;
  --panel: #fafafa;
  --text: #171717;
  --muted: #737373;
  --line: #d4d4d4;
  --link: #262626;
  --code: #e5e5e5;
  --active: #e5e5e5;
  --edge: #a3a3a3;
  font:
    16px / 1.7 system-ui,
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: var(--link);
  text-underline-offset: 0.2em;
}
a:hover {
  text-decoration-thickness: 2px;
}
a:focus-visible,
summary:focus-visible,
input:focus-visible,
.graph-scroll:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}
h1,
h2,
h3 {
  line-height: 1.25;
  scroll-margin-top: 5rem;
}
h1 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
}
p,
li,
.brand,
.project-title {
  overflow-wrap: anywhere;
}
.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  max-width: 1440px;
  margin: auto;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: auto;
  padding: 2rem 1.25rem;
  border-right: 1px solid var(--line);
}
.brand {
  display: block;
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0 0 2rem;
  text-decoration: none;
}
.sidebar ul,
.mobile-navigation ul,
.toc ul,
.inline-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar :where(ul ul),
.mobile-navigation :where(ul ul) {
  padding-left: 0.8rem;
  margin-left: 0.6rem;
  border-left: 1px solid var(--line);
}
.sidebar li,
.mobile-navigation li {
  margin: 0.25rem 0;
}
.sidebar :where(nav a),
.mobile-navigation :where(nav a) {
  text-decoration: none;
  display: block;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.9rem;
}
.sidebar :where(nav a):hover,
.mobile-navigation :where(nav a):hover {
  background: var(--active);
}
.sidebar [aria-current="page"],
.mobile-navigation [aria-current="page"] {
  background: var(--active);
  font-weight: 650;
}
.group {
  display: block;
  padding: 0.6rem 0.65rem 0.3rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}
.graph-link {
  display: block;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.layout main {
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem);
  min-width: 0;
}
article {
  max-width: 75ch;
}
article > :first-child {
  margin-top: 1.25rem;
}
.toc {
  position: sticky;
  top: 0;
  max-height: 100dvh;
  overflow: auto;
  padding: 3rem 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.toc h2 {
  font-size: 0.8rem;
  font-weight: 650;
  margin: 0 0 1rem;
}
.toc li,
.inline-toc li {
  margin: 0.5rem 0;
}
.toc a {
  color: var(--muted);
  text-decoration: none;
}
.toc a:hover {
  color: var(--text);
}
.toc .level-3,
.toc .level-4,
.inline-toc .level-3,
.inline-toc .level-4 {
  padding-left: 0.8rem;
}
.metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0;
}
.metadata:empty {
  display: none;
}
.metadata span {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
}
pre {
  max-width: 100%;
  background: var(--code);
  padding: 1rem 1.2rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
}
code {
  font-family: ui-monospace, monospace;
}
p code,
li code {
  background: var(--code);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  overflow-wrap: anywhere;
}
blockquote {
  margin: 1.5rem 0;
  padding: 0.1rem 1.2rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
table {
  display: block;
  max-width: 100%;
  overflow: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}
td,
th {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
}
img {
  max-width: 100%;
  height: auto;
}
.backlinks,
footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.backlinks h2 {
  font-size: 1.05rem;
  margin-top: 0.5rem;
}
footer {
  font-size: 0.75rem;
  color: var(--muted);
}
.skip {
  position: absolute;
  top: -100px;
  background: var(--panel);
  padding: 1rem;
  z-index: 20;
}
.skip:focus {
  top: 0;
}
.mobile-navigation,
.inline-toc {
  display: none;
}
summary {
  cursor: pointer;
}
.graph-page {
  max-width: 1200px;
  margin: auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
.graph-header h1 {
  margin: 1.25rem 0 0.5rem;
}
.graph-header > a {
  font-size: 0.85rem;
}
.graph-header p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.graph-view {
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
}
.graph-hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
}
.graph-toggle {
  accent-color: var(--text);
  vertical-align: middle;
  margin: 0 0.4rem 0 0;
  width: 1rem;
  height: 1rem;
}
.graph-control {
  font-size: 0.8rem;
  cursor: pointer;
}
.graph-scroll {
  overflow: auto;
  margin-top: 0.75rem;
  border-radius: 6px;
}
.graph {
  display: block;
  width: min(100%, 75dvh);
  max-width: var(--graph-size);
  height: auto;
  margin: auto;
}
.graph-toggle:checked ~ .graph-scroll {
  max-height: 75dvh;
}
.graph-toggle:checked ~ .graph-scroll .graph {
  width: var(--graph-size);
  max-width: none;
  margin: 0;
}
.node {
  fill: var(--bg);
  stroke: var(--text);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.node-dot {
  fill: var(--muted);
}
.node-label {
  fill: var(--text);
  font:
    var(--label-size, 22px) system-ui,
    sans-serif;
  font-weight: 550;
  stroke: var(--panel);
  stroke-width: 5px;
  stroke-linejoin: round;
  paint-order: stroke;
}
.graph-node:hover .node,
.graph-node:focus-visible .node {
  fill: var(--active);
  stroke-width: 3;
}
.graph-node:focus-visible {
  outline: none;
}
.edge {
  fill: none;
  stroke: var(--edge);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}
marker path {
  fill: var(--edge);
}
.graph-index {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.graph-index details {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.graph-index summary {
  font-size: 0.9rem;
  font-weight: 600;
}
.graph-index ul {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  max-height: 30rem;
  overflow: auto;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171717;
    --panel: #1f1f1f;
    --text: #e5e5e5;
    --muted: #a3a3a3;
    --line: #404040;
    --link: #f5f5f5;
    --code: #262626;
    --active: #303030;
    --edge: #737373;
  }
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .toc {
    display: none;
  }
  .inline-toc {
    display: block;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0 0 1.25rem;
    font-size: 0.8rem;
  }
  .inline-toc nav {
    padding: 0.5rem 0;
  }
}
@media (max-width: 760px) {
  .layout {
    display: block;
    min-height: calc(100dvh - 57px);
  }
  .sidebar {
    display: none;
  }
  .mobile-navigation {
    display: block;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .mobile-navigation > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    min-height: 57px;
    list-style: none;
  }
  .mobile-navigation > summary::-webkit-details-marker {
    display: none;
  }
  .project-title {
    font-weight: 650;
    font-size: 0.95rem;
  }
  .menu-label {
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.8rem;
  }
  .menu-label::after {
    content: " +";
  }
  .mobile-navigation[open] .menu-label::after {
    content: " −";
  }
  .mobile-navigation nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 70dvh;
    overflow: auto;
    padding: 0.75rem 1.25rem 1.25rem;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 20px #00000012;
  }
  .layout main {
    padding: 1.5rem 1.25rem;
  }
  .graph-page {
    padding: 1.25rem;
  }
  .graph-view {
    padding: 0.75rem;
  }
  .graph-index {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  h2 {
    font-size: 1.3rem;
  }
}
