:root {
  color-scheme: dark;
  --ink: #020303;
  --panel: rgba(11, 10, 12, 0.88);
  --panel-solid: #0d0b0f;
  --line: rgba(210, 255, 44, 0.24);
  --line-cool: rgba(114, 31, 203, 0.34);
  --text: #f4eadb;
  --muted: #c9c0ae;
  --dim: #8b8174;
  --brass: #d0a549;
  --olive: #d7ff2f;
  --rune: #d9ff2d;
  --radius: 8px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 86% 10%, rgba(93, 23, 189, 0.18), transparent 34rem),
    radial-gradient(circle at 13% 18%, rgba(217, 255, 45, 0.055), transparent 26rem),
    linear-gradient(180deg, #020303 0%, #070607 42%, #030303 100%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, black, transparent 78%);
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-150%);
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 64px;
  min-height: 64px;
  padding: 0 3.4rem;
  border-bottom: 1px solid rgba(210, 255, 44, 0.2);
  background: rgba(2, 3, 3, 0.88);
  backdrop-filter: blur(18px);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 1.7rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.primary-nav a {
  position: relative;
  padding: 0.6rem 0;
}

.primary-nav a::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.2rem;
  height: 1px;
  content: "";
  background: var(--rune);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.primary-nav a:hover::after,
.primary-nav a:focus-visible::after,
.primary-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.home-link {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--rune);
  box-shadow: inset 0 0 14px rgba(217, 255, 45, 0.08);
}

.primary-nav .home-link {
  padding: 0;
}

.primary-nav .home-link::after {
  display: none;
}

.home-link svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.6;
}

.reader-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 980px);
  gap: clamp(1.2rem, 3vw, 2.4rem);
  width: min(1390px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2.4rem) 0 4rem;
}

.reader-sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100dvh - 104px);
  overflow: auto;
  border: 1px solid rgba(217, 255, 45, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(13, 11, 16, 0.96), rgba(3, 3, 4, 0.92)),
    radial-gradient(circle at top right, rgba(217, 255, 45, 0.08), transparent 14rem);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  scrollbar-color: rgba(217, 255, 45, 0.36) rgba(255, 255, 255, 0.035);
}

.sidebar-head {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid rgba(217, 255, 45, 0.18);
}

.sidebar-mark {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-head p {
  margin: 0;
  color: var(--olive);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.sidebar-search {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.2rem;
  padding: 0.55rem 0.62rem;
  border: 1px solid var(--line-cool);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.28);
  color: var(--rune);
  font-family: var(--mono);
}

.sidebar-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.sidebar-search input::placeholder {
  color: rgba(201, 192, 174, 0.58);
}

.doc-nav {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
}

.doc-group {
  display: grid;
  gap: 0.4rem;
}

.doc-group[hidden],
.doc-link[hidden] {
  display: none !important;
}

.doc-group h2 {
  margin: 0;
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.doc-link {
  display: grid;
  gap: 0.16rem;
  padding: 0.54rem 0.62rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
}

.doc-link:hover,
.doc-link:focus-visible,
.doc-link.is-active {
  border-color: rgba(217, 255, 45, 0.28);
  background: rgba(217, 255, 45, 0.055);
  color: var(--text);
}

.doc-link strong {
  font-size: 0.82rem;
  line-height: 1.3;
}

.doc-link span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.doc-article {
  min-width: 0;
  border: 1px solid rgba(217, 255, 45, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(13, 11, 16, 0.94), rgba(5, 5, 6, 0.96)),
    radial-gradient(circle at 80% 0%, rgba(93, 23, 189, 0.16), transparent 26rem);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.article-head {
  display: grid;
  gap: 0.85rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(217, 255, 45, 0.16);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.article-meta .source-path {
  overflow-wrap: anywhere;
  text-transform: none;
}

.article-head h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.article-summary {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.article-actions a {
  padding: 0.44rem 0.66rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(217, 255, 45, 0.07);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.markdown-body {
  padding: clamp(1.2rem, 3vw, 2rem);
  color: var(--text);
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--text);
  line-height: 1.18;
}

.markdown-body h1 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.markdown-body h2 {
  margin: 2.2rem 0 0.8rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(217, 255, 45, 0.14);
  font-family: var(--mono);
  font-size: 1.08rem;
  text-transform: uppercase;
}

.markdown-body h3 {
  margin: 1.7rem 0 0.6rem;
  color: var(--brass);
  font-family: var(--serif);
  font-size: 1.35rem;
}

.markdown-body h4 {
  margin: 1.4rem 0 0.5rem;
  color: var(--olive);
  font-family: var(--mono);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.markdown-body p,
.markdown-body li {
  color: var(--muted);
}

.markdown-body p {
  margin: 0.85rem 0;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0.8rem 0 1rem;
  padding-left: 1.35rem;
}

.markdown-body li + li {
  margin-top: 0.38rem;
}

.markdown-body strong {
  color: var(--text);
}

.markdown-body a {
  color: var(--olive);
  text-decoration: underline;
  text-decoration-color: rgba(217, 255, 45, 0.38);
  text-underline-offset: 0.18em;
}

.markdown-body code {
  padding: 0.08rem 0.24rem;
  border: 1px solid rgba(217, 255, 45, 0.16);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}

.markdown-body pre {
  overflow: auto;
  margin: 1rem 0;
  padding: 1rem;
  border: 1px solid var(--line-cool);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.4);
}

.markdown-body pre code {
  padding: 0;
  border: 0;
  background: transparent;
}

.markdown-body blockquote {
  margin: 1rem 0;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  margin: 1.1rem 0;
  border: 1px solid rgba(217, 255, 45, 0.16);
  border-radius: var(--radius);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.markdown-body th,
.markdown-body td {
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid rgba(217, 255, 45, 0.12);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  color: var(--brass);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.markdown-body td {
  color: var(--muted);
}

.empty-filter {
  display: none;
  padding: 0.7rem 1rem 1rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.reader-sidebar.is-empty .empty-filter {
  display: block;
}

@media (max-width: 980px) {
  .site-header {
    padding: 0 1.2rem;
  }

  .primary-nav {
    gap: 1rem;
    overflow-x: auto;
    font-size: 0.72rem;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .reader-shell {
    grid-template-columns: 1fr;
    width: min(100% - 1.4rem, 780px);
  }

  .reader-sidebar {
    position: relative;
    top: auto;
    max-height: 42dvh;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 56px;
    min-height: 56px;
    padding: 0 0.75rem;
  }

  .home-link {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
  }

  .reader-shell {
    width: min(100% - 1rem, 780px);
    padding-top: 0.8rem;
  }

  .article-head,
  .markdown-body {
    padding: 1rem;
  }

  .article-head h1 {
    font-size: 2rem;
  }
}
