/* Vertical dividers between the left navigation, the page content and the right
   table of contents, mirroring the panelled layout of the MATVIS dashboard.
   Only on wide screens, where both sidebars are shown (below this breakpoint
   Material renders them as slide-in drawers). */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary {
    border-right: 1px solid var(--md-default-fg-color--lightest);
  }
  .md-sidebar--secondary {
    border-left: 1px solid var(--md-default-fg-color--lightest);
  }
}

/* The page's headings, listed under the page in the left navigation (toc.integrate): no guide
   line, only the heading in view gets a light tint, lighter than the page's own pill. Material
   draws its own line beside the integrated list; it is turned off too. */
.md-sidebar--primary .md-nav--integrated > .md-nav__list > .md-nav__item--active .md-nav--secondary {
  border-left: none;
}
.md-nav--primary .md-nav--secondary .md-nav__link--active {
  font-weight: 600;
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 6%, transparent);
}
[data-md-color-scheme="slate"] .md-nav--primary .md-nav--secondary .md-nav__link--active {
  background-color: color-mix(in srgb, var(--mx-strong) 5%, transparent);
}

/* Left-nav group labels (Account, Analytics, Configuration, ...) as small
   uppercase headers, mirroring the dashboard sidebar's section labels. */
.md-nav--primary .md-nav__item--nested > .md-nav__link {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--md-default-fg-color--light);
}

/* Left-nav items get uniform padding + rounded corners so the active/hover pill
   has room and the label never touches the pill edge or the accent bar. */
.md-nav--primary .md-nav__link {
  padding: 0.2em 0.5em;
  border-radius: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
/* Selected item: a soft accent-tinted pill with bold accent text. */
.md-nav--primary .md-nav__link--active {
  color: var(--md-primary-fg-color);
  font-weight: 700;
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 12%, transparent);
}
.md-nav--primary .md-nav__link:hover {
  color: var(--md-primary-fg-color);
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 7%, transparent);
}
/* In dark mode the neon accent is too bright as a fill, so the pill uses a
   neutral light tint and lets the text do the highlighting. */
[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link--active {
  background-color: color-mix(in srgb, var(--mx-strong) 10%, transparent);
  color: var(--mx-muted);
}
[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link:hover {
  background-color: color-mix(in srgb, var(--mx-strong) 6%, transparent);
  color: var(--mx-muted);
}

/* Mobile drawer title bar: force its background/text PER SCHEME so the wordmark
   stays legible in the narrow view. Material tints this bar with the primary
   colour, which left it dark in light mode, hiding the dark-ink wordmark on it.
   Light mode -> white bar; dark mode -> dark-green bar. This is the ONLY logo
   change kept vs. the committed version; the wordmark rules above are unchanged
   from git so the header keeps its original two-tone look. */
[data-md-color-scheme="default"] .md-nav--primary .md-nav__title[for="__drawer"] {
  background-color: var(--mx-page) !important;
  color: var(--mx-bg) !important;
}
[data-md-color-scheme="slate"] .md-nav--primary .md-nav__title[for="__drawer"] {
  background-color: var(--mx-bg) !important;
  color: var(--mx-strong);
}

/* The drawer's top level has no back arrow, so nothing shows how to leave it. Put a close
   cross on the title bar; the bar is the label of the drawer toggle, so a tap closes the drawer. */
@media screen and (max-width: 76.234375em) {
  .md-nav--primary > .md-nav__title[for="__drawer"] {
    position: relative;
  }
  .md-nav--primary > .md-nav__title[for="__drawer"]::after {
    content: "";
    position: absolute;
    right: 0.8rem;
    bottom: 0.6rem;
    width: 1.2rem;
    height: 1.2rem;
    background-color: currentcolor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center / contain no-repeat;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/></svg>") center / contain no-repeat;
    cursor: pointer;
  }
}

/* The drawer's groups unfold in place instead of sliding in as a new page, so the whole tree stays
   in view and the open group shows where you are. The group labels toggle as before; the back bar
   inside a group is not needed any more. */
@media screen and (max-width: 76.234375em) {
  .md-nav--primary .md-nav__item--nested > .md-nav {
    position: static;
    display: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .md-nav--primary .md-nav__item--nested > .md-nav__toggle:checked ~ .md-nav {
    display: flex;
  }
  .md-nav--primary .md-nav__item--nested > .md-nav > .md-nav__title {
    display: none;
  }
  .md-nav--primary .md-nav__item--nested > .md-nav > .md-nav__list {
    padding-left: 0.6rem;
  }
  .md-nav--primary .md-nav__item--nested > .md-nav__link .md-nav__icon {
    transition: transform 0.15s ease;
  }
  .md-nav--primary
    .md-nav__item--nested
    > .md-nav__toggle:checked
    ~ .md-nav__link
    .md-nav__icon {
    transform: rotate(90deg);
  }
}

/* Keyboard focus ring in the brand accent. */
.md-typeset a:focus-visible,
.md-nav__link:focus-visible,
.md-tabs__link:focus-visible,
.md-header__button:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Links: no underline on hover (kept clean); the colour shift signals hover. */
.md-typeset a:not(.md-button):not(.md-nav__link):hover {
  text-decoration: none;
}
