.article {
  --code-background: #0d1117;
  --code-foreground: #e6edf3;
  --code-border: #515d62;
  max-width: 48rem;
}

.article-header {
  margin-bottom: 0.55rem;
}

.article-header .entry-meta { margin-top: 0; }
.article-tools { margin: 0.5rem 0 0; color: var(--secondary); }

.article-contents {
  margin: 0 0 1.15rem;
  font-size: 0.875rem;
}

.article-contents summary {
  width: fit-content;
  color: var(--secondary);
  font-weight: 650;
  cursor: pointer;
}

.article-contents nav {
  padding-inline-start: 0.65rem;
  border-inline-start: 2px solid var(--rule);
  overflow-wrap: anywhere;
}

.article-contents ul { padding-left: 1.15rem; margin: 0.45rem 0 0; }
.article-contents li { margin: 0.2rem 0; }

.prose {
  min-width: 0;
  overflow-wrap: anywhere;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.3em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-top: 0.22em; }

.prose h2, .prose h3, .prose h4 {
  margin: 1.7em 0 0.6em;
  scroll-margin-top: 1rem;
}

.prose h2 {
  padding-bottom: 0.42em;
  border-bottom: 1px solid var(--rule);
  font-size: clamp(1.23rem, 3vw, 1.42rem);
}
.prose h3 { font-size: 1.18rem; }
.prose h4 { font-size: 1.06rem; }

.heading-link {
  display: inline-block;
  margin-inline-start: 0.35em;
  color: var(--link);
  font-size: 0.8em;
  font-weight: 500;
  text-decoration: none;
}

@media (hover: hover) {
  .heading-link { opacity: 0; }
  .prose :is(h1, h2, h3, h4, h5, h6):hover .heading-link,
  .heading-link:focus-visible { opacity: 1; }
}

.article-footer {
  margin-top: 2.25rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

.prose hr {
  margin-block: 2rem;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose blockquote, .prose .callout {
  margin: 1.25em 0;
  padding: 0.7em 1em;
  border-left: 3px solid var(--note-border);
  background: var(--note-background);
}

.prose blockquote > :last-child, .prose .callout > :last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--mono);
  font-size: 0.87em;
}

.prose :not(pre) > code {
  padding: 0.1em 0.25em;
  background: var(--panel);
}

.prose pre {
  margin: 1em 0;
  padding: 0.8rem 1rem;
  overflow: auto;
  border: 1px solid var(--code-border);
  background: var(--code-background);
  color: var(--code-foreground);
  font: 0.9rem/1.55 var(--mono);
  overflow-wrap: normal;
}

.prose pre code { font-size: inherit; }

.code-sample {
  margin-block: 1em;
  overflow: hidden;
  border: 1px solid var(--code-border);
  border-radius: 0.2rem;
  background: var(--code-background);
}

.code-sample .highlight { overflow-x: auto; }
.code-sample .highlight, .code-sample pre { margin: 0; }
.code-sample pre { border: 0; }

.code-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.65rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid var(--code-border);
  background: #323a3e;
  color: #e1e6e8;
  font-size: 0.875rem;
}

.code-language { margin-inline-end: auto; font-weight: 600; }

.code-toolbar button, .figure-dialog button {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 0.15rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.code-toolbar button {
  border-color: #78858c;
  background: var(--code-background);
  color: #edf0f2;
}

.code-toolbar button:hover { background: #41494d; }
.code-sample :focus-visible { outline-color: #b9d5dd; outline-offset: -2px; }

.prose img {
  max-width: 100%;
  height: auto;
}

.article-figure { margin: 1.3em 0; }
.article-figure a { display: inline-block; max-width: 100%; }
.article-figure img { display: block; border: 1px solid var(--rule); }
.article-figure figcaption { margin-top: 0.4rem; color: var(--secondary); font-size: 0.93rem; }

.figure-dialog {
  width: max-content;
  max-width: min(96vw, 90rem);
  max-height: 92vh;
  padding: 0.9rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
}

.figure-dialog::backdrop { background: rgb(25 31 35 / 76%); }

.figure-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}

.figure-dialog img { display: block; max-width: 100%; max-height: 75vh; object-fit: contain; }

.table-scroll {
  max-width: 100%;
  margin: 1.15em 0;
  overflow-x: auto;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  line-height: 1.55;
}

.table-scroll th, .table-scroll td {
  padding: 0.52rem 0.7rem;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
}

.table-scroll th { background: var(--panel); }
.table-scroll td a, .table-scroll td code { overflow-wrap: anywhere; }
.table-scroll .align-center { text-align: center; }
.table-scroll .align-right { text-align: right; }

