/* Content width */
.md-grid {
  max-width: 1440px;
}

/* Make the top theme header visually blend into the page instead of using
   the default Material primary color bar. */
.md-header,
.md-tabs {
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

.md-header {
  box-shadow: none;
}

/* Keep the compact header search field visible against the white header. */
.md-header .md-search__button,
.md-header .md-search__form {
  background-color: rgba(0, 0, 0, 0.24) !important;
  color: #fff !important;
}

.md-header .md-search__button:hover,
.md-header .md-search__button:focus,
.md-header .md-search__button:focus-visible,
.md-header .md-search__form:hover,
.md-header .md-search__form:focus-within {
  background-color: rgba(0, 0, 0, 0.34) !important;
  color: #fff !important;
}

.md-header .md-search__button *,
.md-header .md-search__input,
.md-header .md-search__input::placeholder,
.md-header .md-search__icon,
.md-header .md-search__kbd {
  color: #fff !important;
}

[data-md-color-scheme="slate"] .md-header .md-search__button,
[data-md-color-scheme="slate"] .md-header .md-search__form {
  background-color: rgba(255, 255, 255, 0.16) !important;
}

[data-md-color-scheme="slate"] .md-header .md-search__button:hover,
[data-md-color-scheme="slate"] .md-header .md-search__button:focus,
[data-md-color-scheme="slate"] .md-header .md-search__button:focus-visible,
[data-md-color-scheme="slate"] .md-header .md-search__form:hover,
[data-md-color-scheme="slate"] .md-header .md-search__form:focus-within {
  background-color: rgba(255, 255, 255, 0.24) !important;
}

@media screen and (min-width: 45em) {
  .md-header .md-search .md-search__button {
    background: rgba(0, 0, 0, 0.26) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  }

  .md-header .md-search .md-search__button:hover,
  .md-header .md-search .md-search__button:focus,
  .md-header .md-search .md-search__button:focus-visible {
    background: rgba(0, 0, 0, 0.38) !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  }

  .md-header .md-search .md-search__button::before,
  .md-header .md-search .md-search__button:hover::before,
  .md-header .md-search .md-search__button:focus::before,
  .md-header .md-search .md-search__button:focus-visible::before {
    background-color: #fff !important;
  }

  [data-md-color-scheme="slate"] .md-header .md-search .md-search__button {
    background: rgba(255, 255, 255, 0.16) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  }

  [data-md-color-scheme="slate"] .md-header .md-search .md-search__button:hover,
  [data-md-color-scheme="slate"] .md-header .md-search .md-search__button:focus,
  [data-md-color-scheme="slate"] .md-header .md-search .md-search__button:focus-visible {
    background: rgba(255, 255, 255, 0.26) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
}

/*  Table */

table {
  border-collapse: collapse;
  border-top: 1px solid black;
  border-bottom: 1px solid black;
}

table th,
table td {
  line-height: 1.1;
  padding: 2px 6px;
}

/* Separate regular nested numbered-list spacing from bullet spacing. */
:root {
  --content-nested-number-indent: 0.1em;
  --content-nested-number-offset: -1.9em;
}

/* Reset and hide default numbering at all levels */
.md-content ol {
  list-style-type: none;
  counter-reset: level1;
  padding-left: 0em;
}
.md-content ol ol {
  list-style-type: none;
  counter-reset: level2;
  position: relative;
  left: var(--content-nested-number-offset);
  padding-left: 0em;
  margin-left: 0;
}
.md-content ol ol ol {
  list-style-type: none;
  counter-reset: level3;
  position: relative;
  left: var(--content-nested-number-offset);
  padding-left: 0em;
  margin-left: 0;
}
.md-content ol ol ol ol {
  list-style-type: none;
  counter-reset: level4;
  position: relative;
  left: var(--content-nested-number-offset);
  padding-left: 0em;
  margin-left: 0;
}



/* Increment and display at each level */
.md-content ol > li {
  counter-increment: level1;
  position: relative;
  padding-left: 1.5em;
}
.md-content ol > li::before {
  content: counter(level1) ". ";
  position: absolute;
  left: 0;
  width: 1.5em;
  text-align: right;
  font-weight: bold;
}

.md-content ol ol > li {
  counter-increment: level2;
  position: relative;
  padding-left: calc(0.2em + var(--content-nested-number-indent));
}
.md-content ol ol > li::before {
  content: counter(level1) "." counter(level2) ". ";
  position: absolute;
  left: 0;
  width: 1.9em;
  text-align: right;
  font-weight: bold;
}

.md-content ol ol ol > li {
  counter-increment: level3;
  position: relative;
  padding-left: calc(2.9em + var(--content-nested-number-indent));
}
.md-content ol ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) ". ";
  position: absolute;
  left: 0;
  width: 2.3em;
  text-align: right;
  font-weight: bold;
  white-space: nowrap;
}

.md-content ol ol ol ol > li {
  counter-increment: level4;
  position: relative;
  padding-left: calc(2.7em + var(--content-nested-number-indent));
}
.md-content ol ol ol ol > li::before {
  content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) ". ";
  position: absolute;
  left: 0;
  width: 2.7em;
  text-align: right;
  font-weight: bold;
  white-space: nowrap;
}

.md-content ol > li::before,
.md-content ol ol > li::before,
.md-content ol ol ol > li::before,
.md-content ol ol ol ol > li::before {
  margin-left: 0;
}

/* Ordered lists nested under bullets should start at 1., 2., 3. instead of
   inheriting a missing parent ordered-list counter as 0.1, 0.2, ... */
.md-content ul ol {
  counter-reset: level1;
}

.md-content ul ol > li {
  counter-increment: level1;
  padding-left: calc(1.5em + var(--content-nested-number-indent));
}

.md-content ul ol > li::before {
  content: counter(level1) ". ";
  width: 1.5em;
}


/* ==========================================================================
   Heading Layout And Numbering
   ========================================================================== */

/* --- System variables --- */
:root {
  --heading-flow-nested-list-indent: 0.1em;
  --heading-flow-nested-number-indent: var(--content-nested-number-indent);
  --heading-flow-nested-number-offset: var(--content-nested-number-offset);
}

.md-typeset {
  --heading-indent-h2: 0rem;
  --heading-indent-h3: 1rem;
  --heading-indent-h4: 2rem;
  --heading-indent-h5: 3rem;
  --heading-indent-h6: 4rem;

  --heading-bullet-padding-h2: 0rem;
  --heading-bullet-padding-h3: 0rem;
  --heading-bullet-padding-h4: 0rem;
  --heading-bullet-padding-h5: 0rem;
  --heading-bullet-padding-h6: 0rem;

  --heading-number-offset-h2: 0rem;
  --heading-number-offset-h3: 0rem;
  --heading-number-offset-h4: 0rem;
  --heading-number-offset-h5: 0rem;
  --heading-number-offset-h6: 0rem;

  counter-reset: h2;
}

/* --- Heading typography --- */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: bold;
}

/* Keep deeper headings readable and consistent instead of inheriting
   the theme's smaller uppercase label treatment. */
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  color: var(--md-default-fg-color);
  font-size: 1em;
  letter-spacing: -0.01em;
  line-height: 1.5;
  margin: 1em 0;
  text-transform: none;
}

/* --- Heading placement --- */
.md-typeset h2 {
  margin-left: var(--heading-indent-h2);
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.3rem;
}

.md-typeset h3 {
  margin-left: var(--heading-indent-h3);
  margin-bottom: 0.5rem;
}

.md-typeset h4 {
  margin-left: var(--heading-indent-h4);
  margin-bottom: 0.5rem;
}

.md-typeset h5 {
  margin-left: var(--heading-indent-h5);
  margin-bottom: 0.5rem;
}

.md-typeset h6 {
  margin-left: var(--heading-indent-h6);
  margin-bottom: 0.5rem;
}

/* --- Wrapper content alignment --- */
.md-typeset img + .heading-flow--h3 {
  margin-top: 0;
}

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

/* Paragraph-led alignment: the content block defines the shared baseline,
   and list padding shifts markers/text without changing section ownership. */

   .heading-flow--h2 .heading-flow__content {
  margin-left: var(--heading-indent-h2);
}

   .heading-flow--h3 .heading-flow__content {
  margin-left: var(--heading-indent-h3);
}

.heading-flow--h4 .heading-flow__content {
  margin-left: var(--heading-indent-h4);
}

.heading-flow--h5 .heading-flow__content {
  margin-left: var(--heading-indent-h5);
}

.heading-flow--h6 .heading-flow__content {
  margin-left: var(--heading-indent-h6);
}

.heading-flow__content > p,
.heading-flow__content > ul,
.heading-flow__content > ol {
  margin-left: 0;
}

.heading-flow--h2 .heading-flow__content > ul {
  padding-left: calc(0em + var(--heading-bullet-padding-h2));
}

.heading-flow--h3 .heading-flow__content > ul {
  padding-left: calc(0em + var(--heading-bullet-padding-h3));
}

.heading-flow--h4 .heading-flow__content > ul {
  padding-left: calc(0em + var(--heading-bullet-padding-h4));
}

.heading-flow--h5 .heading-flow__content > ul {
  padding-left: calc(0em + var(--heading-bullet-padding-h5));
}

.heading-flow--h6 .heading-flow__content > ul {
  padding-left: calc(0em + var(--heading-bullet-padding-h6));
}

.heading-flow__content ul ul {
  padding-left: var(--heading-flow-nested-list-indent);
}

.heading-flow__content ul {
  list-style-position: outside;
}

.heading-flow__content li > p:first-child {
  margin-top: 0;
}

.heading-flow__content li > :last-child {
  margin-bottom: 0;
}

/* All heading-flow > ol levels: marker lives in the left padding so the ol
   content edge (= li text edge) aligns with bullet text, same as
   list-style-position:outside bullets whose text starts at the ul edge. */
.heading-flow--h2 .heading-flow__content > ol,
.heading-flow--h3 .heading-flow__content > ol,
.heading-flow--h4 .heading-flow__content > ol,
.heading-flow--h5 .heading-flow__content > ol,
.heading-flow--h6 .heading-flow__content > ol {
  padding-left: 2.3em;   /* marker(1.5em) + gap(0.4em) */
  margin-left: -1.9em;   /* pull content back to section edge */
}

/* Override global .md-content ol > li { padding-left:1.5em } — the space
   is now on the ol, not the li, so li text starts at the ol content edge. */
.heading-flow__content > ol > li {
  padding-left: 0;
}

.heading-flow__content > ol > li::before {
  display: block;
  position: absolute;
  left: -1.9em;          /* reach into the ol's padding area */
  margin-left: 0;
  width: 1.5em;
  min-width: 0;
  text-align: right;
}

.heading-flow__content li ol {
  list-style: none !important;
  counter-reset: level2;
  position: relative;
  left: var(--heading-flow-nested-number-offset);
  padding-left: calc(3.2em + var(--heading-flow-nested-number-indent));
  margin-left: -3.2em;
}

.heading-flow__content li ol > li {
  position: relative;
  padding-left: 0;       /* text at li left = ol content edge */
  list-style: none !important;
  counter-increment: level2;
}

.heading-flow__content li ol > li::marker {
  content: "";
}

.heading-flow__content li ol > li::before {
  content: counter(level1) "." counter(level2) ". ";
  display: block;
  position: absolute;
  left: calc(-3.2em - var(--heading-flow-nested-number-indent));
  width: 2.95em;
  text-align: right;
  margin-left: 0;
  min-width: 0;
  white-space: nowrap;
}

/* When a numbered list is nested under a bullet inside heading-flow content,
   there is no parent ordered-list counter to inherit, so render it as 1., 2., 3. */
.heading-flow__content ul ol {
  counter-reset: level1;
  left: -1.9em;
  padding-left: 0;
  margin-left: -1.9em;
}

.heading-flow__content ul ol > li {
  counter-increment: level1;
  padding-left: 1.9em;
}

.heading-flow__content ul ol > li::before {
  content: counter(level1) ". ";
  left: 0;
  width: 1.5em;
}

.heading-flow__content ol > li > p:first-child {
  display: inline;
  margin: 0;
}

.heading-flow__content ol > li > p:first-child + * {
  margin-top: 0.5rem;
}

/* --- Inline content defaults --- */
.md-typeset img {
  margin-bottom: 0.5rem;
}

.md-typeset p,
.md-typeset li {
  line-height: 1.5;
}

/* --- Automatic heading numbering --- */
.heading-flow--h2 {
  counter-reset: h3;
  counter-increment: h2;
}

.heading-flow--h3 {
  counter-reset: h4;
  counter-increment: h3;
}

.heading-flow--h4 {
  counter-reset: h5;
  counter-increment: h4;
}

.heading-flow--h5 {
  counter-reset: h6;
  counter-increment: h5;
}

.heading-flow--h6 {
  counter-increment: h6;
}

.md-typeset h2::before {
  content: counter(h2) ". ";
}

.md-typeset h3::before {
  content: counter(h2) "." counter(h3) ". ";
}

.md-typeset h4::before {
  content: counter(h2) "." counter(h3) "." counter(h4) ". ";
}

.md-typeset h5::before {
  content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) ". ";
}

.md-typeset h6::before {
  content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6) ". ";
}

/* The glossary page uses plain alphabetical/module headings, not numbered sections. */
#glossary-alpha h2::before,
#glossary-module h2::before {
  content: none;
}

/* Desktop layout: remove the dead gutter between the primary nav and article
   while preserving the independent right sidebar for the page graph and TOC. */
@media screen and (min-width: 76.25em) {
  .md-main__inner.md-grid {
    max-width: none;
    width: 100%;
  }

  .md-content {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .md-content__inner {
    max-width: none;
  }
}

/* Match the cleaner Zensical docs chrome by hiding the repository/source block
   in the header and removing the footer entirely. */
.md-header__source,
.md-footer {
  display: none !important;
}

/* Make the built-in code copy control visible at rest without changing its
   compact Material/Zensical styling. */
.md-code__button[data-md-type="copy"] {
  color: var(--md-default-fg-color--light);
}

.md-code__button[data-md-type="copy"].focus-visible,
.md-code__button[data-md-type="copy"]:hover {
  color: var(--md-primary-fg-color);
}

/* ==========================================================================
   Reading Card
   ========================================================================== */

.reading-card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin: 0.5rem 0;
  background: var(--md-default-bg-color);
}

.reading-card__icon {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 5px;
  background: var(--md-primary-fg-color--light, #e8f4fd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.reading-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.reading-card__pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--md-primary-fg-color--light, #e8f4fd);
  color: var(--md-primary-fg-color);
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  width: fit-content;
  margin-bottom: 0.15rem;
}

.reading-card__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  margin: 0;
  line-height: 1.4;
}

.reading-card__meta {
  font-size: 0.8rem;
  color: var(--md-default-fg-color--light);
  margin: 0;
  line-height: 1.45;
}

.grid.cards .home-grid-icon {
  width: 1.4rem;
  height: 1.4rem;
  margin: 0 0.35rem 0 0;
  vertical-align: middle;
}

/* Final override for the generated classic-theme search trigger. Keep this near
   the end so it wins over theme hover rules and page-specific styles. */
body[data-md-color-scheme="default"] .md-header [data-md-component="search"] > .md-search__button,
body[data-md-color-scheme="default"] .md-header .md-search > .md-search__button,
.md-header [data-md-component="search"] > .md-search__button,
.md-header .md-search > .md-search__button {
  background: rgba(0, 0, 0, 0.26) !important;
  background-color: rgba(0, 0, 0, 0.26) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05) !important;
}

body[data-md-color-scheme="default"] .md-header [data-md-component="search"] > .md-search__button:hover,
body[data-md-color-scheme="default"] .md-header [data-md-component="search"] > .md-search__button:focus,
body[data-md-color-scheme="default"] .md-header [data-md-component="search"] > .md-search__button:focus-visible,
body[data-md-color-scheme="default"] .md-header .md-search > .md-search__button:hover,
body[data-md-color-scheme="default"] .md-header .md-search > .md-search__button:focus,
body[data-md-color-scheme="default"] .md-header .md-search > .md-search__button:focus-visible,
.md-header [data-md-component="search"] > .md-search__button:hover,
.md-header [data-md-component="search"] > .md-search__button:focus,
.md-header [data-md-component="search"] > .md-search__button:focus-visible,
.md-header .md-search > .md-search__button:hover,
.md-header .md-search > .md-search__button:focus,
.md-header .md-search > .md-search__button:focus-visible {
  background: rgba(0, 0, 0, 0.38) !important;
  background-color: rgba(0, 0, 0, 0.38) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
}

.md-header [data-md-component="search"] > .md-search__button::before,
.md-header [data-md-component="search"] > .md-search__button:hover::before,
.md-header [data-md-component="search"] > .md-search__button:focus::before,
.md-header [data-md-component="search"] > .md-search__button:focus-visible::before,
.md-header .md-search > .md-search__button::before,
.md-header .md-search > .md-search__button:hover::before,
.md-header .md-search > .md-search__button:focus::before,
.md-header .md-search > .md-search__button:focus-visible::before {
  background-color: #fff !important;
}

body[data-md-color-scheme="slate"] .md-header [data-md-component="search"] > .md-search__button,
body[data-md-color-scheme="slate"] .md-header .md-search > .md-search__button {
  background: rgba(255, 255, 255, 0.16) !important;
  background-color: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
}

body[data-md-color-scheme="slate"] .md-header [data-md-component="search"] > .md-search__button:hover,
body[data-md-color-scheme="slate"] .md-header [data-md-component="search"] > .md-search__button:focus,
body[data-md-color-scheme="slate"] .md-header [data-md-component="search"] > .md-search__button:focus-visible,
body[data-md-color-scheme="slate"] .md-header .md-search > .md-search__button:hover,
body[data-md-color-scheme="slate"] .md-header .md-search > .md-search__button:focus,
body[data-md-color-scheme="slate"] .md-header .md-search > .md-search__button:focus-visible {
  background: rgba(255, 255, 255, 0.26) !important;
  background-color: rgba(255, 255, 255, 0.26) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

[data-md-color-scheme="slate"] .md-typeset .md-button {
  border-color: #a8baff;
  color: #dbe5ff !important;
  font-weight: 700;
  background-color: rgba(124, 156, 255, 0.12);
}

[data-md-color-scheme="slate"] .md-typeset .md-button:hover {
  background-color: rgba(124, 156, 255, 0.24);
  border-color: #dbe5ff;
  color: #ffffff !important;
}
