:root {
  color-scheme: light;
  --paper: #fff;
  --panel: #f2f2f2;
  --panel-dark: #e2e2e2;
  --ink: #111;
  --muted: #555;
  --rule: #aaa;
  --rule-dark: #222;
  --blue: #0000ee;
  --blue-dark: #000080;
  --visited: #551a8b;
  --hover: #8b0000;
  --warning: #fff6bf;
  --mono: "Courier New", Courier, monospace;
  --sans: Arial, Helvetica, sans-serif;
  --shell: 72rem;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--panel-dark);
  font-size: 16px;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--panel-dark);
  font-family: var(--sans);
  line-height: 1.55;
}

::selection {
  color: #fff;
  background: var(--blue-dark);
}

a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:visited {
  color: var(--visited);
}

a:hover {
  color: var(--hover);
  background: #ffffcc;
}

a:focus-visible {
  outline: 2px dotted var(--blue-dark);
  outline-offset: 3px;
}

.skip {
  position: fixed;
  z-index: 10;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.45rem 0.65rem;
  color: #fff;
  background: var(--blue-dark);
  border: 2px solid #000;
  font: 700 0.8rem var(--mono);
  transform: translateY(-200%);
}

.skip:focus {
  color: #fff;
  transform: none;
}

.site-frame {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer main";
  width: min(100%, var(--shell));
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}

.site-header {
  grid-area: header;
  display: flex;
  align-items: center;
  min-height: 4.75rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  border-top: 6px solid var(--blue-dark);
  border-bottom: 2px solid var(--rule-dark);
}

.site-title {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  color: var(--blue-dark);
  text-decoration: none;
}

.site-title:visited,
.site-title:hover {
  color: var(--blue-dark);
}

.site-title:hover {
  background: transparent;
}

.site-title img {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
}

.site-name {
  font: 700 1.35rem/1 var(--mono);
}

.site-kind {
  margin-left: 0.2rem;
  color: var(--muted);
  font: 400 0.7rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-sidebar {
  grid-area: sidebar;
  padding: 1.35rem 1rem 1rem;
  background: var(--panel);
  border-right: 1px solid var(--rule);
}

.sidebar-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font: 700 0.7rem/1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav {
  display: grid;
  margin: 0 0 1.75rem;
  border-top: 1px solid var(--rule);
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.35rem;
  color: var(--blue-dark);
  border-bottom: 1px solid var(--rule);
  font: 700 0.82rem/1.3 var(--mono);
}

.site-nav a:visited {
  color: var(--blue-dark);
}

.site-nav a:hover {
  color: #fff;
  background: var(--blue-dark);
}

.site-tagline {
  margin: 0;
  color: #333;
  font-size: 0.82rem;
  line-height: 1.45;
}

.site-main {
  grid-area: main;
  min-width: 0;
  padding: 1.8rem clamp(1.25rem, 5vw, 4rem) 4rem;
  background: var(--paper);
}

.content-path {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin: 0 0 2rem;
  padding: 0.42rem 0.6rem;
  overflow: hidden;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--rule);
  font: 0.75rem/1.3 var(--mono);
  white-space: nowrap;
}

.content-path strong {
  overflow: hidden;
  color: var(--ink);
  font-weight: 400;
  text-overflow: ellipsis;
}

.site-footer {
  grid-area: footer;
  align-self: stretch;
  padding: 1rem;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  font: 0.7rem/1.5 var(--mono);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--blue-dark);
}

.note,
.listing,
.seed,
.stale-warning {
  width: 100%;
  max-width: 52rem;
}

h1,
h2,
h3,
h4 {
  color: #000;
  font-family: var(--sans);
  line-height: 1.2;
}

h1 {
  margin: 0 0 1.4rem;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid #000;
  font-size: clamp(1.8rem, 5vw, 2.3rem);
}

h2 {
  margin: 2.3rem 0 0.8rem;
  padding-bottom: 0.28rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.4rem;
}

h3 {
  margin: 1.8rem 0 0.65rem;
  font-size: 1.12rem;
}

h4 {
  margin: 1.5rem 0 0.5rem;
  font: 700 0.95rem/1.3 var(--mono);
}

.heading-anchor {
  margin-left: 0.3rem;
  color: var(--blue);
  font: 700 0.62em/1 var(--mono);
  text-decoration: none;
  vertical-align: 0.08em;
}

.heading-anchor:visited {
  color: var(--blue);
}

p,
ul,
ol,
dl,
blockquote,
pre,
table {
  margin-top: 0;
  margin-bottom: 1rem;
}

.note > p:first-of-type {
  color: var(--ink);
  font-size: 1rem;
}

ul,
ol {
  padding-left: 1.55rem;
}

li + li {
  margin-top: 0.22rem;
}

dt {
  font-weight: 700;
}

dd {
  margin: 0 0 0.8rem 1.25rem;
}

hr {
  height: 0;
  margin: 2rem 0;
  border: 0;
  border-top: 2px solid var(--rule-dark);
}

img,
svg {
  max-width: 100%;
}

.note > img,
.note p > img,
figure img {
  display: block;
  height: auto;
  border: 1px solid var(--rule-dark);
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  margin-top: 0.35rem;
  color: var(--muted);
  font: 0.75rem/1.4 var(--mono);
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.88em;
}

:not(pre) > code {
  padding: 0.08rem 0.25rem;
  background: var(--panel);
  border: 1px solid #ccc;
}

pre {
  max-width: 100%;
  padding: 0.85rem 1rem;
  overflow-x: auto;
  color: #000;
  background: #f7f7f7;
  border: 1px solid var(--rule-dark);
  border-left: 5px solid var(--blue-dark);
  line-height: 1.5;
  tab-size: 2;
}

pre code {
  padding: 0;
  background: transparent;
  border: 0;
}

kbd {
  padding: 0.08rem 0.3rem;
  background: var(--panel);
  border: 1px solid var(--rule-dark);
  border-bottom-width: 2px;
}

blockquote {
  margin-right: 0;
  margin-left: 0;
  padding: 0.75rem 1rem;
  background: var(--panel);
  border-left: 5px solid var(--blue-dark);
}

blockquote > :last-child {
  margin-bottom: 0;
}

table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  color: #000;
  background: var(--panel-dark);
}

tbody tr:nth-child(even) {
  background: #fafafa;
}

input[type="checkbox"] {
  margin: 0 0.35rem 0 0;
  accent-color: var(--blue-dark);
}

.task-list-item {
  list-style: none;
}

.task-list-item input {
  margin-left: -1.4rem;
}

.wikilink-seed {
  color: var(--hover);
  text-decoration-style: dashed;
}

.wikilink-seed:visited {
  color: var(--hover);
}

.backlinks,
.related,
.listing {
  max-width: 52rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule-dark);
}

.backlinks h2,
.related h2,
.listing h2 {
  margin: 0 0 1rem;
  padding: 0.4rem 0.55rem;
  color: #fff;
  background: var(--blue-dark);
  border: 0;
  font: 700 0.85rem/1.2 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.backlinks ul,
.related ul,
.note-list,
.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.backlinks ul {
  display: grid;
  gap: 0.5rem;
}

.backlinks li {
  margin: 0;
  padding: 0.6rem 0.7rem;
  background: #fafafa;
  border: 1px solid var(--rule);
}

.backlinks blockquote {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

.related ul,
.note-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.related li,
.note-list li {
  margin: 0;
}

.related a,
.note-list a {
  display: block;
  height: 100%;
  padding: 0.65rem 0.75rem;
  background: #fafafa;
  border: 1px solid var(--rule);
  font-weight: 700;
}

.related a:hover,
.note-list a:hover {
  color: #fff;
  background: var(--blue-dark);
}

.post-list {
  border-top: 1px solid var(--rule);
}

.post-list li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  margin: 0;
  padding: 0.65rem 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.post-list a {
  font-weight: 700;
}

.post-list time,
.note-meta,
.note-tags {
  color: var(--muted);
  font: 0.75rem/1.4 var(--mono);
}

.note-meta,
.note-tags {
  margin: -0.7rem 0 1.5rem;
}

.note-tags {
  padding: 0.3rem 0.45rem;
  background: var(--panel);
  border-left: 3px solid var(--rule);
}

.seed,
.stale-warning {
  padding: 1rem;
  background: var(--warning);
  border: 2px solid var(--rule-dark);
}

.stale-warning {
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.seed-notice {
  font-weight: 700;
}

.seed-mentions {
  padding-left: 1.6rem;
}

.seed-mentions > li + li {
  margin-top: 1rem;
}

.embed {
  margin: 1.25rem 0;
  padding: 1rem;
  background: #fafafa;
  border: 1px solid var(--rule);
}

.embed > :first-child {
  margin-top: 0;
}

.embed > :last-child {
  margin-bottom: 0;
}

mark {
  color: #000;
  background: #ffff66;
}

.footnotes {
  margin-top: 2.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
}

.graph-view {
  width: 100%;
  max-width: 54rem;
}

.graph-summary {
  margin: -0.6rem 0 1rem;
  color: var(--muted);
  font: 0.8rem/1.4 var(--mono);
}

.graph-canvas {
  width: 100%;
  overflow: auto;
  background: #fff;
  border: 2px solid var(--rule-dark);
}

.graph-map {
  display: block;
  width: 100%;
  min-width: 42rem;
  height: auto;
}

.graph-edges line {
  stroke: #aaa;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.graph-node circle {
  fill: var(--blue-dark);
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.graph-node text {
  fill: #111;
  font: 700 12px var(--mono);
  paint-order: stroke;
  pointer-events: none;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: bevel;
}

.graph-node:hover {
  background: transparent;
}

.graph-node:hover circle,
.graph-node:focus circle {
  fill: var(--hover);
  stroke: #000;
  stroke-width: 2.5;
}

.graph-seed circle {
  fill: #fff;
  stroke: var(--hover);
  stroke-dasharray: 3 2;
  stroke-width: 2;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0;
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 0;
  font: 0.75rem/1.3 var(--mono);
}

.graph-legend span {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
}

.graph-key {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  background: var(--blue-dark);
  border: 1px solid var(--blue-dark);
}

.graph-key-seed {
  background: #fff;
  border-color: var(--hover);
  border-style: dashed;
}

.graph-focus circle {
  fill: var(--hover);
  stroke: #000;
  stroke-width: 3;
}

.graph-scope {
  margin: 0.8rem 0;
  color: var(--muted);
  font: 0.75rem/1.4 var(--mono);
}

.graph-directory {
  margin-top: 2rem;
  border-top: 2px solid var(--rule-dark);
}

.graph-directory > h2,
.local-graph > h2 {
  margin: 0 0 1rem;
  padding: 0.4rem 0.55rem;
  color: #fff;
  background: var(--blue-dark);
  border: 0;
  font: 700 0.85rem/1.2 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.graph-group {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  border-bottom: 1px solid var(--rule);
}

.graph-group h3 {
  margin: 0;
  padding: 0.55rem 0.35rem;
  font: 700 0.9rem/1.3 var(--mono);
}

.graph-group ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0.55rem 0;
  list-style: none;
}

.graph-group li {
  min-width: 0;
  margin: 0;
}

.graph-group li span {
  margin-left: 0.35rem;
  color: var(--hover);
  font: 0.68rem/1 var(--mono);
}

.local-graph {
  max-width: 52rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule-dark);
}

.local-graph-map {
  background: #fff;
  border: 1px solid var(--rule-dark);
}

.local-graph-map .graph-map {
  min-width: 0;
}

.local-graph-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  padding: 0.8rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 0;
}

.local-graph-lists h3 {
  margin: 0 0 0.35rem;
  font: 700 0.75rem/1.3 var(--mono);
  text-transform: uppercase;
}

.local-graph-lists ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.85rem;
}

.search-view,
.not-found {
  max-width: 52rem;
}

.search-label {
  display: block;
  margin-bottom: 0.35rem;
  font: 700 0.75rem/1.3 var(--mono);
  text-transform: uppercase;
}

.search-view input {
  width: 100%;
  padding: 0.65rem 0.7rem;
  color: #000;
  background: #fff;
  border: 2px solid var(--rule-dark);
  border-left: 5px solid var(--blue-dark);
  font: 1rem/1.3 var(--sans);
}

.search-status {
  margin: 0.55rem 0 1rem;
  color: var(--muted);
  font: 0.75rem/1.3 var(--mono);
}

.search-results {
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.search-results li {
  margin: 0;
  padding: 0.7rem 0.35rem;
  border-bottom: 1px solid var(--rule);
}

.search-results a {
  font-weight: 700;
}

.search-results p {
  margin: 0.25rem 0 0;
  color: #333;
  font-size: 0.88rem;
}

.error-code {
  margin: 0;
  color: var(--blue-dark);
  font: 700 clamp(3rem, 15vw, 7rem)/1 var(--mono);
}

@media (max-width: 46rem) {
  html,
  body {
    background: var(--paper);
  }

  .site-frame {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "header"
      "sidebar"
      "main"
      "footer";
    border: 0;
  }

  .site-header {
    min-height: 4rem;
    padding: 0.65rem 1rem;
  }

  .site-kind {
    display: none;
  }

  .site-sidebar {
    padding: 0.75rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .site-sidebar .sidebar-label,
  .site-tagline {
    display: none;
  }

  .site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1rem;
    margin: 0;
    border: 0;
  }

  .site-nav a {
    padding: 0.2rem 0;
    border: 0;
  }

  .site-main {
    padding: 1.25rem 1rem 3rem;
  }

  .content-path {
    margin-bottom: 1.5rem;
  }

  .graph-map {
    width: 42rem;
  }

  .local-graph-map .graph-map {
    width: 100%;
  }

  .site-footer {
    padding: 0.8rem 1rem;
    border-right: 0;
  }
}

@media (max-width: 30rem) {
  .site-title img {
    width: 2rem;
    height: 2rem;
  }

  .site-name {
    font-size: 1.15rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .related ul,
  .note-list,
  .post-list li,
  .local-graph-lists,
  .graph-group ul {
    grid-template-columns: 1fr;
  }

  .post-list li {
    gap: 0.2rem;
  }
}

@media print {
  html,
  body,
  .site-frame {
    background: #fff;
  }

  .site-frame {
    display: block;
    border: 0;
  }

  .site-header,
  .site-sidebar,
  .site-footer,
  .content-path {
    display: none;
  }

  .site-main {
    padding: 0;
  }

  a {
    color: #000;
  }
}
