/* Article typography and content components. */

.prose {
  max-width: 880px;
  margin: 0 auto;
  overflow-x: clip;
  counter-reset: h2 h3;
  color: var(--hn-text-2);
  font-size: var(--fs-base);
  line-height: 1.75;
  animation: rise-in 420ms var(--hn-ease) both;
}

.prose strong {
  color: var(--hn-text);
  font-weight: 650;
}

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

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  position: relative;
  color: var(--hn-text);
  font-weight: 650;
  letter-spacing: -0.015em;
}

.prose h1 {
  margin: 0 0 var(--sp-4);
  font-size: clamp(34px, 2vw + 24px, 48px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.prose h1 + p {
  margin: 0 0 var(--sp-6);
  color: var(--hn-text-2);
  font-size: 19px;
  line-height: 1.6;
}

.prose h2 {
  counter-increment: h2;
  counter-reset: h3;
  margin: var(--sp-8) 0 var(--sp-4);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--hn-edge);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.prose h2::before {
  content: var(--sheet, "") "." counter(h2);
  display: block;
  margin-bottom: 6px;
  color: var(--hn-brand);
  font: 500 12px/1 var(--hn-font-mono);
  letter-spacing: 0.02em;
}

.prose h3 {
  counter-increment: h3;
  margin: var(--sp-6) 0 var(--sp-2);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.3;
}

.prose h4 {
  margin: var(--sp-5) 0 var(--sp-2);
  color: var(--hn-text);
  font-size: var(--fs-base);
  font-weight: 650;
}

@media (min-width: 1360px) {
  .prose h2::before {
    position: absolute;
    top: calc(var(--sp-5) + 7px);
    left: -64px;
    margin: 0;
    width: 48px;
    text-align: right;
  }
}

.prose h1 code,
.prose h2 code,
.prose h3 code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.85em;
}

.headerlink {
  margin-left: var(--sp-2);
  color: var(--hn-text-3);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity 120ms var(--hn-ease);
}

:is(h1, h2, h3, h4):hover > .headerlink,
.headerlink:focus-visible {
  opacity: 1;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 var(--sp-4);
}

.prose li {
  margin: 0 0 var(--sp-1);
}

.prose a {
  color: var(--hn-brand);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 120ms var(--hn-ease);
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose hr {
  margin: var(--sp-7) 0;
  border: 0;
  border-top: 1px solid var(--hn-edge);
}

.prose blockquote {
  margin: var(--sp-5) 0;
  padding: 0 var(--sp-4);
  border-left: 2px solid var(--hn-edge-control);
  color: var(--hn-text-2);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--hn-radius-m);
}

.kicker {
  display: inline-block;
  margin: 0 0 var(--sp-4);
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--hn-tint-brand);
  color: var(--hn-brand);
  font: 500 12px/1.4 var(--hn-font-mono);
}

/* ---------- Code ---------- */

.prose code {
  font-family: var(--hn-font-mono);
}

.prose :not(pre) > code {
  padding: 0.12em 0.45em;
  border: 1px solid var(--hn-edge);
  border-radius: 8px;
  background: var(--hn-surface-2);
  font-size: 0.875em;
}

.prose a > code {
  color: var(--hn-brand);
}

.prose :where(td, th) > code {
  white-space: nowrap;
}

.highlight {
  position: relative;
  margin: var(--sp-5) 0;
  border: 1px solid var(--ide-edge);
  border-radius: 18px;
  background: var(--ide-bg);
  box-shadow: 0 14px 34px -22px rgb(20 10 40 / 0.55);
  overflow: hidden;
}

.highlight pre {
  margin: 0;
  padding: var(--sp-4) 20px;
  overflow-x: auto;
  color: var(--ide-fg);
  font: 400 13.5px/1.7 var(--hn-font-mono);
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--ide-sel) transparent;
}

.highlight pre code {
  font: inherit;
}

.highlight .filename {
  display: block;
  padding: 8px 20px;
  border-bottom: 1px solid var(--ide-edge);
  background: var(--ide-chrome);
  color: var(--ide-muted);
  font: 500 12px/1.6 var(--hn-font-mono);
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--ide-edge);
  border-radius: 999px;
  background: var(--ide-chrome);
  color: var(--ide-muted);
  font: 500 12px/1 var(--hn-font-mono);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms var(--hn-ease), transform 200ms var(--hn-ease), color 120ms, border-color 120ms;
}

.highlight:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
  transform: none;
}

.copy-btn:hover {
  border-color: var(--ide-accent);
  color: var(--ide-fg);
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
    transform: none;
  }
}

.highlight .hll {
  display: block;
  margin: 0 -20px;
  padding: 0 20px;
  background: var(--ide-line);
  box-shadow: inset 2px 0 0 var(--ide-accent);
}

/* Rule output: structured by script (location, id, status, fix). */
.dg-loc { color: var(--ide-muted); }
.dg-id { color: var(--hn-brand); font-weight: 500; }
.dg-bad { color: var(--hn-red); font-weight: 500; }
.dg-wvd { color: var(--hn-wood); font-weight: 500; }
.dg-unv { color: var(--hn-amber); font-weight: 500; }
.dg-ok { color: var(--hn-green); font-weight: 500; }
.dg-fix { color: var(--hn-wood); }

.rule-ref {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted var(--hn-brand);
  text-underline-offset: 3px;
  cursor: help;
}

.rule-ref:hover,
.rule-ref:focus-visible {
  background: var(--hn-brand-tint);
}

/* ---------- Tabs (pymdownx.tabbed, alternate style) ---------- */

.tabbed-set {
  margin: var(--sp-5) 0;
}

.tabbed-set > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tabbed-labels {
  display: inline-flex;
  max-width: 100%;
  gap: var(--sp-1);
  padding: 4px;
  border: 1px solid var(--hn-edge);
  border-radius: 999px;
  background: var(--hn-surface-1);
  overflow-x: auto;
}

.tabbed-labels > label {
  padding: 6px var(--sp-4);
  border-radius: 999px;
  color: var(--hn-text-3);
  font-size: var(--fs-m);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms var(--hn-ease);
}

.tabbed-labels > label:hover {
  color: var(--hn-text);
}

.tabbed-block {
  display: none;
}

.tabbed-block > .highlight:first-child {
  margin-top: var(--sp-4);
}

.tabbed-set:has(> input:nth-of-type(1):checked) > .tabbed-labels > label:nth-child(1) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(1):checked) > .tabbed-content > .tabbed-block:nth-child(1) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(2):checked) > .tabbed-labels > label:nth-child(2) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(2):checked) > .tabbed-content > .tabbed-block:nth-child(2) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(3):checked) > .tabbed-labels > label:nth-child(3) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(3):checked) > .tabbed-content > .tabbed-block:nth-child(3) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(4):checked) > .tabbed-labels > label:nth-child(4) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(4):checked) > .tabbed-content > .tabbed-block:nth-child(4) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(5):checked) > .tabbed-labels > label:nth-child(5) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(5):checked) > .tabbed-content > .tabbed-block:nth-child(5) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(6):checked) > .tabbed-labels > label:nth-child(6) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(6):checked) > .tabbed-content > .tabbed-block:nth-child(6) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(7):checked) > .tabbed-labels > label:nth-child(7) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(7):checked) > .tabbed-content > .tabbed-block:nth-child(7) { display: block; animation: rise-in 220ms var(--hn-ease); }
.tabbed-set:has(> input:nth-of-type(8):checked) > .tabbed-labels > label:nth-child(8) { color: var(--hn-text); background: var(--hn-tint-brand); }
.tabbed-set:has(> input:nth-of-type(8):checked) > .tabbed-content > .tabbed-block:nth-child(8) { display: block; animation: rise-in 220ms var(--hn-ease); }

/* ---------- Callouts ---------- */

.admonition,
details {
  --callout: var(--hn-info);
  --callout-tint: var(--hn-tint-info);
  margin: var(--sp-5) 0;
  padding: 0 var(--sp-4);
  border: 1px solid color-mix(in srgb, var(--callout) 28%, transparent);
  border-radius: 18px;
  background: var(--callout-tint);
  font-size: 15px;
}

.admonition-title,
details > summary {
  margin: 0 calc(var(--sp-4) * -1) !important;
  padding: 10px var(--sp-4) 4px;
  color: var(--callout);
  font-size: var(--fs-m);
  font-weight: 650;
  cursor: default;
}

details > summary {
  cursor: pointer;
}

.admonition > :last-child,
details > :last-child {
  margin-bottom: var(--sp-3);
}

:is(.admonition, details):is(.tip, .success, .hint) { --callout: var(--hn-green); --callout-tint: var(--hn-tint-success); }
:is(.admonition, details):is(.warning, .caution, .attention) { --callout: var(--hn-amber); --callout-tint: var(--hn-tint-warning); }
:is(.admonition, details):is(.danger, .failure, .bug, .error) { --callout: var(--hn-red); --callout-tint: var(--hn-tint-error); }
:is(.admonition, details):is(.example, .quote) { --callout: var(--hn-wood); --callout-tint: var(--hn-tint-wood); }
:is(.admonition, details):is(.abstract, .question) { --callout: var(--hn-brand); --callout-tint: var(--hn-tint-brand); }

/* ---------- Tables ---------- */

.prose table {
  display: block;
  width: 100%;
  margin: var(--sp-5) 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--fs-m);
}

.prose th {
  padding: 10px var(--sp-3);
  border-bottom: 1px solid var(--hn-edge-2);
  color: var(--hn-text-3);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
}

.prose td {
  padding: 10px var(--sp-3);
  border-top: 1px solid var(--hn-edge);
  vertical-align: top;
}

@media (max-width: 640px) {
  .prose table {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .prose th,
  .prose td {
    white-space: nowrap;
  }
}

.prose tr:first-child td {
  border-top: 0;
}

.prose td:first-child code {
  color: var(--hn-brand);
}

/* ---------- Related and misc ---------- */

.related {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--hn-edge);
}

.related__label {
  margin: 0 0 var(--sp-2);
  color: var(--hn-text-3);
  font: 500 12px/1.4 var(--hn-font-mono);
}

.related ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.related a {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid var(--hn-edge);
  border-radius: 999px;
  color: var(--hn-text-2);
  font-size: var(--fs-m);
  text-decoration: none;
  transition: border-color 140ms var(--hn-ease), color 140ms var(--hn-ease), transform 200ms var(--hn-spring);
}

.related a:hover {
  border-color: var(--hn-brand);
  color: var(--hn-text);
  transform: translateY(-2px);
}

.footnote {
  color: var(--hn-text-2);
  font-size: var(--fs-m);
}

/* ---------- API reference (mkdocstrings) ---------- */

.doc-heading {
  margin-top: var(--sp-7);
}

.doc-object.doc-attribute > .doc-heading {
  margin: var(--sp-4) 0 var(--sp-1);
  font-size: 16px;
}

.doc-contents {
  margin-left: var(--sp-3);
  padding-left: var(--sp-4);
  border-left: 1px solid var(--hn-edge);
}

.doc-signature,
.doc code.doc-symbol {
  font-family: var(--hn-font-mono);
}

.doc-object.doc-attribute > .doc-signature.highlight {
  display: inline-block;
  max-width: 100%;
  margin: var(--sp-1) 0 var(--sp-3);
  border-color: var(--hn-edge);
  border-radius: 12px;
  background: var(--hn-surface-2);
  box-shadow: none;
}

.doc-object.doc-attribute > .doc-signature.highlight pre {
  padding: 9px 14px;
  color: var(--hn-text-2);
  font-size: 12px;
  line-height: 1.55;
}

.doc-object.doc-attribute > .doc-signature.highlight code * {
  color: #cfc6ea !important;
  font-style: normal;
  font-weight: 400;
}

html[data-theme="light"] .doc-object.doc-attribute > .doc-signature.highlight code * {
  color: #4d4859 !important;
}

.doc-label,
.doc-symbol {
  display: inline-block;
  margin-left: var(--sp-2);
  padding: 0 8px;
  border-radius: 999px;
  background: var(--hn-tint-brand);
  color: var(--hn-brand);
  font: 500 11px/1.7 var(--hn-font-mono);
}

.doc-section-title,
.doc-class-bases {
  color: var(--hn-text-3);
}

.doc dl,
.field-list {
  margin: var(--sp-3) 0;
}

.doc dd {
  margin-left: var(--sp-4);
}

.prose .doc .highlight {
  margin: var(--sp-3) 0;
}

.md-typeset__table,
.doc-md-description {
  min-width: 0;
}

.tabbed-labels {
  position: relative;
  --thumb-bg: var(--hn-tint-brand);
  --thumb-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hn-brand) 40%, transparent);
}
