@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

:root {
  --bg: #fff;
  --fg: #050505;
  --muted: #767676;
  --soft: #f7f7f3;
  --line: 1px solid var(--fg);
  --soft-line: 1px dotted rgba(5, 5, 5, 0.28);
  --mono: 'JetBrains Mono', monospace;
  --pad: clamp(12px, 2vw, 24px);
  --max: 920px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, transparent 50%, rgba(0,0,0,0.018) 50%, rgba(0,0,0,0.018));
  background-size: 100% 4px;
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a:focus-visible,
button:focus-visible {
  outline: var(--line);
  outline-offset: 2px;
}

.shell {
  width: min(100%, var(--max));
  min-height: 100dvh;
  margin: 0 auto;
  border-left: var(--line);
  border-right: var(--line);
  background: var(--bg);
}

.topbar,
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px var(--pad);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar {
  min-height: 38px;
  border-bottom: var(--line);
}

.footer {
  color: var(--muted);
  border-top: var(--line);
}

.nav,
.actions,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.nav a,
.nav span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  font-size: 11px;
}

.nav a + a,
.nav a + span {
  padding-left: 10px;
  border-left: var(--soft-line);
}

.nav a:hover,
.button:hover {
  background: var(--fg);
  color: var(--bg);
}

.article-header {
  display: grid;
  gap: 14px;
  padding: 22px var(--pad) 18px;
  border-bottom: var(--line);
}

.eyebrow,
.meta,
.tag,
.copy-status {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  font-size: clamp(26px, 3.8vw, 38px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dek {
  max-width: 760px;
  color: var(--muted);
  font-size: 13px;
}

.button {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: var(--line);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.article-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
}

.article-menu {
  position: sticky;
  top: 0;
  min-height: calc(100vh - 38px);
  padding: 14px var(--pad);
  border-right: var(--line);
  background: var(--soft);
}

.menu-heading {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.menu-label {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.menu-heading .menu-label {
  margin-bottom: 0;
}

.menu-toggle {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  border: var(--soft-line);
  padding: 1px 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.menu-toggle:hover {
  color: var(--fg);
}

.article-menu-list {
  max-height: 240px;
  overflow: hidden;
  opacity: 1;
  transition: max-height 160ms ease, opacity 160ms ease, margin-bottom 160ms ease;
}

.article-menu.is-compact .article-menu-list {
  display: none;
  max-height: 0;
  margin-bottom: 8px;
  opacity: 0;
  pointer-events: none;
}

.article-menu-list,
.menu-label + .menu-list {
  margin-bottom: 18px;
}

.menu-list {
  display: grid;
  border-top: var(--soft-line);
}

.menu-list a {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-bottom: var(--soft-line);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-transform: uppercase;
}

.menu-list a:hover,
.menu-list a.is-current {
  color: var(--muted);
}

.menu-list small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.section-list a {
  font-size: 10px;
}

.section-list .depth-3 {
  padding-left: 12px;
  color: var(--muted);
}

.submenu {
  margin-top: 10px;
  border: 0;
  background: transparent;
}

.submenu summary {
  min-height: 24px;
  padding: 4px 0;
  border-top: var(--soft-line);
  border-bottom: var(--soft-line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.subsection-list {
  margin-top: 6px;
}

.subsection-list a {
  font-size: 9px;
}

.article-content {
  min-width: 0;
}

.article-body {
  padding: 24px var(--pad);
}

.article-body > * + * {
  margin-top: 14px;
}

.article-body h2 {
  margin-top: 24px;
  font-size: 15px;
  line-height: 1.35;
  text-transform: uppercase;
}

.article-body h4 {
  margin-top: 20px;
  font-size: 13px;
  line-height: 1.35;
  text-transform: uppercase;
}

.article-subsection {
  max-width: 820px;
  border-top: var(--soft-line);
  border-bottom: var(--soft-line);
  background: transparent;
}

.article-subsection summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 0;
  cursor: pointer;
  list-style: none;
}

.article-subsection summary::-webkit-details-marker {
  display: none;
}

.article-subsection summary::before {
  content: "+";
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.article-subsection[open] summary::before {
  content: "-";
}

.article-subsection h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  text-transform: uppercase;
}

.article-subsection-body {
  padding: 0 0 13px 22px;
}

.article-subsection-body > * + * {
  margin-top: 14px;
}

.article-body p,
.article-body li {
  max-width: 760px;
}

.article-body ul,
.article-body ol {
  padding-left: 18px;
}

.article-body a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.article-body blockquote {
  max-width: 760px;
  padding-left: 12px;
  border-left: var(--line);
  color: var(--muted);
}

.article-body code {
  padding: 1px 4px;
  background: var(--soft);
  border: var(--soft-line);
  font: 12px/1.4 var(--mono);
}

.article-body pre {
  max-width: 100%;
  overflow: auto;
  padding: 10px;
  border: var(--line);
  background: var(--soft);
}

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

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: var(--line);
}

.article-body table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 11px;
  line-height: 1.45;
}

.article-body th,
.article-body td {
  padding: 7px 8px;
  border-right: var(--soft-line);
  border-bottom: var(--soft-line);
  text-align: left;
  vertical-align: top;
}

.article-body th {
  background: var(--soft);
  text-transform: uppercase;
}

.tag-row {
  gap: 5px;
}

.tag {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 2px 5px;
  border: var(--soft-line);
}

.copy-panel {
  padding: 16px var(--pad) 20px;
  border-top: var(--line);
  background: var(--soft);
}

details {
  border: var(--line);
  background: var(--bg);
}

summary {
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-bottom: var(--line);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  min-height: 220px;
  display: block;
  border: 0;
  resize: vertical;
  padding: 10px;
  background: var(--bg);
  color: var(--fg);
  font: 12px/1.5 var(--mono);
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .shell {
    border-left: 0;
    border-right: 0;
  }

  .article-layout {
    grid-template-columns: 1fr;
  }

  .article-menu {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: var(--line);
  }

  .topbar,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
