/* Article typography and content components. */

.prose {
  max-width: 880px;
  margin: 0 auto;
  overflow-x: clip;
  color: var(--hn-text-2);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

/* Running text keeps a comfortable measure; code, tables, tab sets and cards use the full column. */
.prose > :is(p, ul, ol, dl, h1, h2, h3, h4, h5, blockquote, .kicker, .page-head) {
  max-width: var(--measure);
}

.prose > :is(.highlight, .tabbed-set, table, .table-wrap, .hn-cards, .admonition, details) {
  max-width: none;
}

/* A short fade that never starts invisible, so first paint is always readable. */
@media (prefers-reduced-motion: no-preference) {
  .js .prose {
    animation: soft-in var(--hn-dur-2) var(--hn-ease);
  }
}

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

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

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

.prose h1 {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-h1);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.prose h1 + p:not(.page-meta),
.page-head + p {
  margin: 0 0 var(--sp-6);
  color: var(--hn-text-2);
  font-size: 18px;
  line-height: 1.6;
}

.page-head {
  margin: 0 0 var(--sp-5);
}

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

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: var(--sp-3) 0 0;
  color: var(--hn-text-3);
  font: 400 13px/1.5 var(--hn-font-sans);
}

.page-meta > span + span:not(.chip)::before {
  content: "·";
  margin-right: 14px;
  color: var(--hn-text-3);
}

.page-meta > .chip + span:not(.chip)::before {
  content: none;
}

@media (max-width: 640px) {
  .page-meta > span + span:not(.chip)::before {
    content: none;
  }
}

.prose h2 {
  margin: 2.4em 0 0.6em;
  font-size: var(--fs-h2);
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.prose h3 {
  margin: 1.8em 0 0.4em;
  font-size: var(--fs-h3);
  line-height: 1.35;
}

.prose h4 {
  margin: 1.6em 0 0.4em;
  font-size: var(--fs-h4);
}

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

.headerlink {
  margin-left: var(--sp-2);
  color: var(--hn-text-3);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--hn-dur-1) 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(--flow);
}

.prose li {
  margin: 0 0 0.35em;
}

.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 var(--hn-dur-1) 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: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 var(--sp-3);
  color: var(--hn-brand);
  font: 500 13px/1.4 var(--hn-font-sans);
}

.kicker__sep {
  margin: 0 6px;
  color: var(--hn-text-3);
}

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

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

.prose :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: var(--hn-surface-2);
  color: var(--hn-text);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.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: var(--radius-code);
  background: var(--ide-bg);
  box-shadow: none;
  overflow: hidden;
}

/* Decorative brand mark in tall code blocks; no text, at most 5% alpha. */
.highlight.is-tall::after {
  position: absolute;
  right: 12px;
  bottom: 10px;
  inline-size: 28px;
  block-size: 40px;
  background: var(--hn-watermark);
  content: "";
  pointer-events: none;
  -webkit-mask: url("../favicon.svg") center / contain no-repeat;
  mask: url("../favicon.svg") center / contain no-repeat;
}

@media (max-width: 960px), print {
  .highlight.is-tall::after {
    display: none;
  }
}

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

.highlight pre code {
  font: inherit;
}

/* Header row added by hinoki.js: file name, language and copy button. */
.code-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--ide-edge);
  background: var(--ide-chrome);
  color: var(--ide-muted);
  font: 500 12px/1 var(--hn-font-mono);
}

.code-head__file {
  min-width: 0;
  overflow: hidden;
  color: var(--ide-fg);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-head__lang {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.code-head__lang:empty {
  display: none;
}

.code-head__lang:empty + .copy-btn {
  margin-left: auto;
}

.highlight .filename {
  display: block;
  padding: 8px 16px;
  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 {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ide-muted);
  font: 500 12px/1 var(--hn-font-sans);
  transition: color var(--hn-dur-1) var(--hn-ease), background var(--hn-dur-1) var(--hn-ease);
}

.copy-btn:hover {
  background: color-mix(in srgb, var(--ide-fg) 8%, transparent);
  color: var(--ide-fg);
}

.copy-btn.is-done {
  color: var(--hn-green);
}

@media (max-width: 560px) {
  .copy-btn__label {
    display: none;
  }
}

/* One-line or unlabelled blocks: no header, the copy button sits at the right edge. */
.highlight.is-compact pre {
  padding-right: 56px;
}

.highlight.is-compact > .copy-btn {
  position: absolute;
  top: 11px;
  right: 8px;
}

.highlight .hll {
  display: block;
  margin: 0 -16px;
  padding: 0 16px;
  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 {
  position: relative;
  margin: var(--sp-5) 0;
  border: 1px solid var(--hn-code-edge);
  border-radius: var(--radius-code);
  background: var(--hn-code-bg);
  overflow: hidden;
}

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

.tabbed-labels {
  display: flex;
  gap: 0;
  padding: 0 6px;
  border-bottom: 1px solid var(--hn-code-edge);
  border-radius: 0;
  background: var(--hn-code-chrome);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabbed-labels > label {
  padding: 10px 12px 8px;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--hn-text-2);
  font: 500 13px/1.4 var(--hn-font-sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--hn-dur-1) var(--hn-ease), border-color var(--hn-dur-1) var(--hn-ease);
}

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

.tabbed-block {
  display: none;
}

.tabbed-block > .highlight {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.tabbed-block > :not(.highlight) {
  margin-inline: 16px;
}

.tabbed-block > :not(.highlight):first-child {
  margin-top: 14px;
}

.tabbed-block > :not(.highlight):last-child {
  margin-bottom: 14px;
}

.tabbed-block > .highlight + .highlight {
  border-top: 1px solid var(--hn-code-edge);
}

.tabbed-set:has(> input:nth-of-type(1):checked) > .tabbed-labels > label:nth-child(1),
.tabbed-set:has(> input:nth-of-type(2):checked) > .tabbed-labels > label:nth-child(2),
.tabbed-set:has(> input:nth-of-type(3):checked) > .tabbed-labels > label:nth-child(3),
.tabbed-set:has(> input:nth-of-type(4):checked) > .tabbed-labels > label:nth-child(4),
.tabbed-set:has(> input:nth-of-type(5):checked) > .tabbed-labels > label:nth-child(5),
.tabbed-set:has(> input:nth-of-type(6):checked) > .tabbed-labels > label:nth-child(6),
.tabbed-set:has(> input:nth-of-type(7):checked) > .tabbed-labels > label:nth-child(7),
.tabbed-set:has(> input:nth-of-type(8):checked) > .tabbed-labels > label:nth-child(8) {
  border-bottom-color: var(--hn-brand);
  background: none;
  color: var(--hn-text);
}

.tabbed-set:has(> input:nth-of-type(1):focus-visible) > .tabbed-labels > label:nth-child(1),
.tabbed-set:has(> input:nth-of-type(2):focus-visible) > .tabbed-labels > label:nth-child(2),
.tabbed-set:has(> input:nth-of-type(3):focus-visible) > .tabbed-labels > label:nth-child(3),
.tabbed-set:has(> input:nth-of-type(4):focus-visible) > .tabbed-labels > label:nth-child(4),
.tabbed-set:has(> input:nth-of-type(5):focus-visible) > .tabbed-labels > label:nth-child(5),
.tabbed-set:has(> input:nth-of-type(6):focus-visible) > .tabbed-labels > label:nth-child(6),
.tabbed-set:has(> input:nth-of-type(7):focus-visible) > .tabbed-labels > label:nth-child(7),
.tabbed-set:has(> input:nth-of-type(8):focus-visible) > .tabbed-labels > label:nth-child(8) {
  outline: 2px solid var(--hn-brand);
  outline-offset: -2px;
  border-radius: 6px 6px 0 0;
}

.tabbed-set:has(> input:nth-of-type(1):checked) > .tabbed-content > .tabbed-block:nth-child(1),
.tabbed-set:has(> input:nth-of-type(2):checked) > .tabbed-content > .tabbed-block:nth-child(2),
.tabbed-set:has(> input:nth-of-type(3):checked) > .tabbed-content > .tabbed-block:nth-child(3),
.tabbed-set:has(> input:nth-of-type(4):checked) > .tabbed-content > .tabbed-block:nth-child(4),
.tabbed-set:has(> input:nth-of-type(5):checked) > .tabbed-content > .tabbed-block:nth-child(5),
.tabbed-set:has(> input:nth-of-type(6):checked) > .tabbed-content > .tabbed-block:nth-child(6),
.tabbed-set:has(> input:nth-of-type(7):checked) > .tabbed-content > .tabbed-block:nth-child(7),
.tabbed-set:has(> input:nth-of-type(8):checked) > .tabbed-content > .tabbed-block:nth-child(8) {
  display: block;
}

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

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

.admonition > :first-child,
details > :first-child {
  margin-top: 0;
}

.admonition-title,
details > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px !important;
  padding: 0;
  color: var(--callout);
  font-size: 14px;
  font-weight: 600;
  cursor: default;
}

details > summary {
  cursor: pointer;
  list-style: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::after {
  content: "";
  inline-size: 7px;
  block-size: 7px;
  margin: 0 4px 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--hn-dur-1) var(--hn-ease);
}

details[open] > summary::after {
  transform: rotate(45deg);
}

details:not([open]) > summary {
  margin-bottom: 0 !important;
}

.admonition > :last-child,
details > :last-child {
  margin-bottom: 0;
}

: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 ---------- */

.table-wrap {
  margin: var(--sp-5) 0;
  overflow-x: auto;
  border: 1px solid var(--hn-edge);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

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

.table-wrap > table {
  margin: 0;
}

/* Without the script that adds .table-wrap, the table scrolls by itself. */
html:not(.js) .prose table {
  display: block;
  overflow-x: auto;
}

.prose th {
  padding: 9px var(--sp-3);
  border-bottom: 1px solid var(--hn-edge-2);
  background: var(--hn-surface-2);
  color: var(--hn-text-2);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

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

.prose tbody tr {
  transition: background var(--hn-dur-1) var(--hn-ease);
}

.prose tbody tr:hover {
  background: var(--hn-brand-tint);
}

@media (max-width: 640px) {
  .prose td {
    min-width: 12rem;
  }

  .prose td:first-child {
    min-width: 0;
  }

  .prose td > code {
    white-space: nowrap;
  }

  /* Tables of up to three columns wrap inside the screen instead of scrolling. */
  .prose table:not(:has(th:nth-child(4))) td {
    min-width: 0;
  }

  .prose table:not(:has(th:nth-child(4))) :is(th, td) {
    padding-inline: var(--sp-2);
  }

  .prose table:not(:has(th:nth-child(4))) th {
    white-space: normal;
  }

  .prose table:not(:has(th:nth-child(4))) td > code {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* At 320 px a long word such as "Authentication" fills a column on its own. */
@media (max-width: 360px) {
  .prose table:not(:has(th:nth-child(4))) {
    font-size: var(--fs-s);
  }

  .prose table:not(:has(th:nth-child(4))) :is(th, td) {
    hyphens: auto;
  }
}

.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 var(--hn-dur-1) var(--hn-ease), color var(--hn-dur-1) var(--hn-ease);
}

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

.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: block;
  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;
}
