/* Visual language shared with the ProcessKit documentation family, adapted for
   Material for MkDocs' header, primary navigation, and content components. */

:root {
  --processkit-nav-accent: var(--md-primary-fg-color);
}

[data-md-color-scheme="default"] {
  --processkit-nav-hover-bg: rgb(63 81 181 / 10%);
  --processkit-nav-active-bg: rgb(63 81 181 / 14%);
  --processkit-nav-divider: rgb(0 0 0 / 16%);
}

[data-md-color-scheme="slate"] {
  --processkit-nav-hover-bg: rgb(159 168 218 / 13%);
  --processkit-nav-active-bg: rgb(159 168 218 / 18%);
  --processkit-nav-divider: rgb(255 255 255 / 18%);
}

/* Keep the project name prominent while Material changes the page topic. */
.md-header__title .md-header__topic:first-child .md-ellipsis {
  color: var(--md-primary-bg-color);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Keep the primary sidebar inside its track and distinguish page links from
   section labels. The transparent border prevents layout movement on hover. */
.md-sidebar--primary .md-sidebar__scrollwrap {
  overflow-x: hidden;
}

.md-sidebar--primary a.md-nav__link {
  border-left: 3px solid transparent;
  border-radius: 0 0.2rem 0.2rem 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0;
  padding: 0.38rem 0.8rem 0.38rem 0.9rem;
  transition: background-color 130ms ease, border-color 130ms ease;
}

.md-sidebar--primary a.md-nav__link:hover {
  background-color: var(--processkit-nav-hover-bg);
  border-left-color: color-mix(in srgb, var(--processkit-nav-accent) 55%, transparent);
  text-decoration: none;
}

.md-sidebar--primary a.md-nav__link--active,
.md-sidebar--primary a.md-nav__link[aria-current="page"] {
  background-color: var(--processkit-nav-active-bg);
  border-left-color: var(--processkit-nav-accent);
  font-weight: 600;
}

.md-sidebar--primary a.md-nav__link:focus-visible {
  outline: 2px solid var(--processkit-nav-accent);
  outline-offset: -2px;
}

/* Keep the Rust and .NET links visually separate from the documentation
   guides. The direct-child path is Material's primary navigation structure;
   the fourth item is Cookbook, immediately after the two secondary links. */
.md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item:nth-child(4) {
  border-top: 1px solid var(--processkit-nav-divider);
  margin-top: 0.55rem;
  padding-top: 0.55rem;
}

/* Nested primary-nav entries are Material's section headings. This rule also
   provides a durable divider whenever a future navigation group begins. */
.md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item--nested:not(:first-child) {
  border-top: 1px solid var(--processkit-nav-divider);
  margin-top: 0.55rem;
  padding-top: 0.55rem;
}

.md-sidebar--primary .md-nav__item--nested > label.md-nav__link {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Let naturally wide tables retain their columns and scroll within the
   typeset area instead of clipping at the content edge. The `:not([class])`
   clause matches Material's own base rule's specificity so `display: block`
   reliably wins over its default `inline-block` (extra.css loads after the
   theme stylesheet, so equal-specificity ties resolve in our favor). */
.md-typeset table:not([class]) {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  width: max-content;
}

/* Material already keeps link text intact inside table cells
   (`.md-typeset table:not([class]) a { word-break: normal }`); extend the
   same treatment to inline code so short identifiers (exception names, field
   names) don't break mid-word in narrow columns. */
.md-typeset table:not([class]) code {
  word-break: normal;
}
