:root {
  --md-primary-fg-color: #061827;
  --md-accent-fg-color: #ff4b72;

  --mm-bg: #061827;
  --mm-bg2: #09243a;
  --mm-blue: #56b7ff;
  --mm-red: #ff4b72;
  --mm-text: #13243a;
  --mm-line: #dbe5ef;

  /* combined header + hidden tabs height */
  --mm-header-total-height: 92px;
}

/* GLOBAL */
html,
body {
  background: #061827;
}

/* REMOVE MATERIAL WIDTH LIMITS */
.md-grid {
  max-width: none;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 22px;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  scroll-margin-top: 22px;
}

.md-typeset h2::before,
.md-typeset h3::before {
  content: "";
  display: block;
  height: 30px;
  margin-top: -30px;
  visibility: hidden;
  pointer-events: none;
}

/* =========================
   HEADER
========================= */

.md-header {
  height: 92px;
  background: linear-gradient(90deg, #061827, #09243a);
  border-bottom: 1px solid rgba(86, 183, 255, 0.35);
  box-shadow: none;
}

.md-header__inner {
  height: 92px;
  padding-left: 1rem;
  padding-right: 1rem;

  display: flex;
  align-items: center;
}

/* LOGO */

.md-header__button.md-logo {
  margin: 0;
  padding: 0;
}

.md-header__button.md-logo img {
  width: 58px !important;
  height: 58px !important;
}

/* WORDMARK IMAGE */

.md-header__title {
  flex: 0 1 360px;

  min-width: 160px;
  height: 70px;

  margin-left: 0.7rem;
  margin-right: 1rem;

  background-image: url("../assets/mm_wordmark.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left center;
}

/* HIDE DEFAULT TEXT */

.md-header__title .md-ellipsis,
.md-header__topic,
.md-header__source {
  display: none;
}

/* SEARCH */

.md-search {
  margin-left: auto;
  margin-right: 0;

  flex: 0 1 330px;
  min-width: 180px;
}

.md-search input {
  color: black !important;
}

.md-search__form {
  width: 100%;
  height: 48px;

  background: rgba(255, 255, 255, 0.06);

  border: 1px solid rgba(86, 183, 255, 0.45);

  border-radius: 8px;
}

.md-search__input {
  color: #000000 !important;
}

.md-search__input::placeholder {
  color: rgba(255,255,255,0.7) !important;
}

.md-search__input + .md-search__icon {
  color: rgba(255,255,255,0.7);
}

/* =========================
   TABS BAR
========================= */

.md-tabs {
  background: #061827;

  border-bottom: 1px solid rgba(86, 183, 255, 0.15);
  display: none;
}

.md-tabs__list {
  gap: 0.4rem;
}

.md-tabs__link {
  color: #e8f4ff;

  opacity: 1;

  font-weight: 700;

  font-size: 0.92rem;
}

.md-tabs__link:hover,
.md-tabs__link--active {
  color: var(--mm-red);
}

.md-tabs__item--active {
  border-bottom: 3px solid var(--mm-red);
}

/* =========================
   MAIN BACKGROUND
========================= */

.md-main {
  background:
    linear-gradient(
      90deg,
      #061827 0,
      #061827 17%,
      #f8fbff 17%,
      #f8fbff 100%
    );
}

.md-main__inner {
  margin-top: 0;
}

/* =========================
   LEFT SIDEBAR - DESKTOP ONLY
   Do not apply these rules to the mobile drawer.
========================= */

/* Add breathing room at bottom of left sidebar */
.md-sidebar--primary .md-sidebar__scrollwrap {
  padding-bottom: 4rem !important;
}

@media screen and (min-width: 76.25em) {

  /* hide sticky white title box on desktop only */
  .md-nav--primary > .md-nav__title {
    display: none;
  }

  .md-sidebar--primary {
    width: 280px;
    min-height: calc(100vh - var(--mm-header-total-height));
    background: #061827 !important;
  }

  .md-sidebar--primary,
  .md-sidebar--primary .md-sidebar__scrollwrap,
  .md-sidebar--primary .md-sidebar__inner,
  .md-sidebar--primary .md-nav--primary {
    background: #061827 !important;
  }

  /* desktop custom scrollbar only */
  .md-sidebar--primary .md-sidebar__scrollwrap {
    padding-top: 0.75rem;
    margin-right: 0 !important;
    border-right: 1px solid rgba(86, 183, 255, 0.25);
    scrollbar-width: thin;
    scrollbar-color: #56b7ff #061827;
    min-height: calc(100vh - var(--mm-header-total-height));
    background: #061827 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar {
    width: 12px;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-track {
    background: #061827;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    background: #56b7ff;
    border-radius: 8px;
    border: 3px solid #061827;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
    background: #ff4b72;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::after {
    background: #061827 !important;
  }

  /* category links */
  .md-nav--primary .md-nav__link {
    color: #e8f4ff;
    border-radius: 4px;
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
  }

  /* top-level categories */
  .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__link {
    color: var(--mm-blue);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.85rem;
  }

  .md-nav--primary .md-nav__link:hover {
    background: rgba(255,255,255,0.05);
  }

  .md-nav--primary .md-nav__link--active,
  .md-nav--primary .md-nav__link--active:hover {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
    font-weight: 800;
  }

  .md-nav--primary .md-nav__icon {
    color: #8ccfff;
  }

  .md-nav--primary .md-nav__item .md-nav__list {
    margin-left: 0.35rem;
  }

  .md-nav--primary .md-nav__item .md-nav__item .md-nav__link {
    color: #e8f4ff;
    border-radius: 4px;
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
  }

  .md-nav--primary .md-nav__item .md-nav__item .md-nav__link:hover {
    background: rgba(255,255,255,0.05);
  }

  .md-nav--primary .md-nav__item .md-nav__item .md-nav__link--active,
  .md-nav--primary .md-nav__item .md-nav__item .md-nav__link--active:hover {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
    font-weight: 800;
  }
}

/* =========================
   MOBILE / TABLET DRAWER NAV
   Keep Material's drawer mechanics intact.
========================= */

@media screen and (max-width: 76.1875em) {

  /* Remove the desktop split background so no dark/sidebar strip bleeds into content. */
  .md-main {
    background: #f8fbff !important;
  }

  /* Let Material handle drawer width, position, transforms, and back navigation. */
  .md-sidebar--primary {
    background: #061827 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap,
  .md-sidebar--primary .md-sidebar__inner,
  .md-sidebar--primary .md-nav--primary,
  .md-sidebar--primary .md-nav {
    background: #061827 !important;
  }

  /* Restore the Material mobile title/back button, but recolor it. */
  .md-sidebar--primary .md-nav__title {
    display: block !important;
    background: #061827 !important;
    color: #e8f4ff !important;
    box-shadow: none !important;
    border-bottom: 1px solid rgba(86, 183, 255, 0.25);
  }

  .md-sidebar--primary .md-nav__title .md-nav__button,
  .md-sidebar--primary .md-nav__title .md-nav__icon,
  .md-sidebar--primary .md-nav__title::before {
    color: #56b7ff !important;
  }

  /* Mobile drawer links, including nested pages. */
  .md-sidebar--primary .md-nav__link {
    color: #e8f4ff !important;
    border-radius: 4px;
    padding: 0.55rem 0.7rem;
    font-size: 0.86rem;
    font-weight: 600;
  }

  .md-sidebar--primary .md-nav__link:hover {
    background: rgba(255,255,255,0.06) !important;
  }

  .md-sidebar--primary .md-nav__link--active,
  .md-sidebar--primary .md-nav__link--active:hover {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
    font-weight: 800;
  }

  .md-sidebar--primary .md-nav__icon {
    color: #8ccfff !important;
  }

  /* Kill custom desktop scrollbars on the mobile drawer only. */
  .md-sidebar--primary .md-sidebar__scrollwrap {
    border-right: none !important;
    margin-right: 0 !important;
    padding-top: 0 !important;
    scrollbar-width: auto !important;
    scrollbar-color: auto !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar,
  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-track,
  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
    all: unset !important;
  }

  .md-content {
    background: #ffffff;
  }

  .md-content__inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* =========================
   CONTENT AREA
========================= */

.md-content {
  background: white;
}

.md-content__inner {
  max-width: 920px;

  margin: 0 auto;

  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* PAGE TITLE */

.md-typeset h1 {
  font-size: 3rem;

  line-height: 1.05;

  font-weight: 900;

  color: #081a33;

  margin-bottom: 1rem;

  border-bottom: 2px solid var(--mm-red);

  padding-bottom: 0.7rem;

  letter-spacing: -0.03em;
}

.md-typeset h2 {
  color: #081a33;

  border-bottom: 1px solid var(--mm-line);

  padding-bottom: 0.35rem;

  margin-top: 2.5rem;
}

.md-typeset h3 {
  color: #0068c9;

  font-weight: 800;
}

/* BODY TEXT */

.md-typeset {
  font-size: 0.96rem;

  line-height: 1.8;

  color: var(--mm-text);
}

.md-typeset p {
  color: var(--mm-text);
}

/* material markdown icons */

.md-typeset .twemoji {
  color: #1d7fe2;
}

.md-typeset .twemoji svg {
  fill: #1d7fe2 !important;
}

/* LINKS */

.md-typeset a {
  color: #0068c9;

  font-weight: 600;
}

.md-typeset a:hover {
  color: var(--mm-red);
}

/* BLOCKQUOTE / LORE QUOTE BOX */

.md-typeset blockquote {
  margin: 1.5rem 0;

  padding: 0.9rem 1.15rem;

  background: #f8fbff;

  border: 1px solid #d6e3f1;
  border-left: 4px solid #ff4b72 !important;

  border-radius: 0 6px 6px 0;

  color: #23354d;

  box-shadow: none;
}

.md-typeset blockquote p {
  margin: 0.2rem 0;

  color: #23354d;

  font-size: 0.92rem;
  line-height: 1.5;
}

.md-typeset blockquote em {
  color: #081a33;

  font-size: 0.98rem;
  font-style: italic;
}

.md-typeset blockquote p:last-child {
  color: #ff4b72;

  font-size: 0.88rem;
  font-weight: 500;
}

/* TABLES */

.md-typeset table:not([class]) {
  border: 1px solid var(--mm-line);
}

.md-typeset table:not([class]) th {
  background: #edf6ff;

  color: #081a33;

  font-weight: 800;
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: var(--mm-line);
}

/* =========================
   RIGHT ON THIS PAGE NAV
========================= */

.md-sidebar--secondary {
  width: 260px;
  margin-top: 0;
  margin-bottom: 2rem;
  background: #ffffff !important;
}

/* Let Material handle the sticky/footers naturally.
   This avoids the right sidebar making its own scrollbar. */
.md-sidebar--secondary .md-sidebar__scrollwrap {
  background: #ffffff !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
  padding-top: 0.75rem;
}

.md-sidebar--secondary .md-sidebar__inner {
  background: #ffffff !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Main right nav container */
.md-nav--secondary {
  background: #ffffff !important;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--mm-header-total-height) - 3rem);
}

/* Title */
.md-nav--secondary .md-nav__title {
  color: #0068c9;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* Grey vertical TOC line */
.md-nav--secondary .md-nav__list {
  position: relative;
  margin-left: 0.35rem;
  padding-left: 1rem;
  border-left: 2px solid #d6e3f1;
}

/* TOC links */
.md-nav--secondary .md-nav__link {
  color: #23354d;
  font-size: 0.82rem;
  padding: 0.35rem 0;
  position: relative;
}

/* Active text */
.md-nav--secondary .md-nav__link--active {
  color: #ff4b72;
  font-weight: 800;
}

/* Active pink segment directly over grey line */
.md-nav--secondary .md-nav__link--active::before {
  content: "";
  position: absolute;
  left: calc(-1rem + 5px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff4b72;
  border-radius: 0;
}

/* Side info cards */
.mm-side-card {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #c9d8e8;
  border-radius: 6px;
  background: #f8fbff;
}

.mm-side-card-red {
  border-color: #ffb8c8;
  background: #fff7fa;
}

.mm-side-card-title {
  color: #0068c9;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.mm-side-card-red .mm-side-card-title {
  color: #ff4b72;
}

.mm-side-card p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #23354d;
}

.mm-related-link {
  display: block;
  color: #0068c9;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0;
  text-decoration: none;
}

/* Push first custom card toward bottom of right sidebar */
.mm-side-card:first-of-type {
  margin-top: auto;
}

/* =========================
   FOOTER
========================= */

.md-footer,
.md-footer-meta {
  display: none;
}

.mm-footer {
  position: relative;
  z-index: 5;

  min-height: 100px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 1.5rem 2.5rem;

  background:
    linear-gradient(
      90deg,
      #04111d,
      #061827,
      #061827,
      #04111d
    );

  border-top: 1px solid rgba(86,183,255,0.18);

  color: #c8d8e8;

  overflow: hidden;
}

.mm-footer-title {
  color: #56b7ff;
  font-size: 0.85rem;
  font-weight: 700;
}

.mm-footer-subtitle {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #a8b8c8;
}

.mm-footer-right {
  text-align: right;
  font-size: 0.75rem;
  color: #a8b8c8;
}

.mm-footer-right a {
  color: #56b7ff;
  text-decoration: none;
}

.mm-footer-right a:hover {
  color: #ff4b72;
}

.mm-footer-mech {
  position: absolute;

  left: 50%;
  bottom: -6px;

  transform: translateX(-50%);

  height: 115px;

  opacity: 0.38;

  pointer-events: none;
}

/* =========================
   RESPONSIVE LAYOUT
========================= */

@media screen and (max-width: 1100px) {

  .md-search {
    flex-basis: 220px;
  }

  .md-header__title {
    flex-basis: 240px;
  }

  .md-typeset h1 {
    font-size: 2.6rem;
  }

  .md-sidebar--secondary {
    display: none;
  }

  .md-main {
    background: #f8fbff;
  }
}

@media screen and (max-width: 700px) {

  .md-header {
    height: 76px;
  }

  .md-header__inner {
    height: 76px;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .md-header__button.md-logo img {
    width: 46px !important;
    height: 46px !important;
  }

  .md-header__title {
    height: 54px;
    min-width: 110px;
    flex-basis: 190px;
    margin-left: 0.35rem;
    margin-right: 0.35rem;
  }

  .md-search {
    flex: 0 1 170px;
    min-width: 120px;
  }

  .md-search__form {
    height: 40px;
  }

  .md-typeset h1 {
    font-size: 2.15rem;
  }

  .mm-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }

  .mm-footer-right {
    text-align: center;
  }
}

@media screen and (max-width: 76.1875em) {

  /* Mobile drawer background */
  .md-nav--primary,
  .md-nav--primary .md-nav__list,
  .md-nav--primary .md-nav__item,
  .md-nav--primary .md-nav__source,
  .md-nav--primary .md-nav__title,
  .md-nav--primary .md-nav__link,
  .md-sidebar--primary,
  .md-sidebar--primary .md-sidebar__scrollwrap,
  .md-sidebar--primary .md-sidebar__inner {
    background: #061827 !important;
  }

  /* Keep mobile text readable */
  .md-nav--primary .md-nav__title,
  .md-nav--primary .md-nav__link {
    color: #e8f4ff !important;
  }

  /* Active page */
  .md-nav--primary .md-nav__link--active {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
  }

}

@media screen and (max-width: 76.1875em) {

  .md-sidebar--primary .md-sidebar__scrollwrap,
  .md-sidebar--primary .md-nav--primary,
  .md-sidebar--primary .md-nav__list {
    scrollbar-width: thin !important;
    scrollbar-color: #56b7ff #061827 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar,
  .md-sidebar--primary .md-nav--primary::-webkit-scrollbar,
  .md-sidebar--primary .md-nav__list::-webkit-scrollbar {
    width: 12px !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-track,
  .md-sidebar--primary .md-nav--primary::-webkit-scrollbar-track,
  .md-sidebar--primary .md-nav__list::-webkit-scrollbar-track {
    background: #061827 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb,
  .md-sidebar--primary .md-nav--primary::-webkit-scrollbar-thumb,
  .md-sidebar--primary .md-nav__list::-webkit-scrollbar-thumb {
    background: #56b7ff !important;
    border-radius: 8px !important;
    border: 3px solid #061827 !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover,
  .md-sidebar--primary .md-nav--primary::-webkit-scrollbar-thumb:hover,
  .md-sidebar--primary .md-nav__list::-webkit-scrollbar-thumb:hover {
    background: #ff4b72 !important;
  }
}

/* =========================================================
   CLEAN FIX: navigation.indexes rows
   Material renders clickable section-index entries as:
   .md-nav__container > a.md-nav__link--index + label.md-nav__link
   This keeps the text and chevron aligned without turning the whole
   subsection into one giant active block.
========================================================= */

@media screen and (min-width: 76.25em) {

  /* Make section-index rows act like one clean row */
  .md-sidebar--primary .md-nav--primary .md-nav__container {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;

    background: transparent !important;
    border-radius: 4px !important;
  }

  /* Only top-level section-index rows get the category spacing */
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container {
    margin-top: 0.85rem !important;
  }

  /* The clickable section-index text link */
  .md-sidebar--primary .md-nav--primary .md-nav__container > .md-nav__link--index {
    flex: 1 1 auto !important;
    min-width: 0 !important;

    margin: 0 !important;
    padding: 0.45rem 0.7rem !important;

    background: transparent !important;
    border-radius: 4px 0 0 4px !important;

    color: #e8f4ff !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;

    text-transform: none !important;
    letter-spacing: normal !important;

    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  /* Top-level section-index text should match Core / Great Houses / Mercenaries */
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > .md-nav__link--index {
    color: var(--mm-blue) !important;
    font-size: 0.78rem !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > .md-nav__link--index .md-ellipsis {
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    text-transform: inherit !important;
    letter-spacing: inherit !important;

    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
  }

  /* The chevron half of a section-index row */
  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link {
    flex: 0 0 2.15rem !important;
    width: 2.15rem !important;
    min-width: 2.15rem !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 0.45rem 0.35rem !important;

    background: transparent !important;
    border-radius: 0 4px 4px 0 !important;

    color: #8ccfff !important;
    font-size: 0.82rem !important;
    line-height: 1.25 !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link .md-nav__icon,
  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link svg {
    color: #8ccfff !important;
    fill: #8ccfff !important;
    width: 1rem !important;
    height: 1rem !important;
  }

  /* Hover as one continuous row */
  .md-sidebar--primary .md-nav--primary .md-nav__container:hover {
    background: rgba(255,255,255,0.05) !important;
  }

  /* IMPORTANT:
     Do not let the chevron label create its own active pink box.
     The chevron can be "active" simply because the section is open. */
  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link--active {
    background: transparent !important;
    color: #8ccfff !important;
  }

  /* If the actual index page is selected, make ONE continuous pink row */
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) > .md-nav__link--index,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) > label.md-nav__link,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) > label.md-nav__link--active,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) .md-ellipsis,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) .md-nav__icon,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) svg {
    background: transparent !important;
    color: white !important;
    fill: white !important;
    font-weight: 800 !important;
  }

  /* Keep ordinary active links working, including Home */
  .md-sidebar--primary .md-nav--primary a.md-nav__link--active:not(.md-nav__link--index),
  .md-sidebar--primary .md-nav--primary a.md-nav__link--active:not(.md-nav__link--index):hover {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
    font-weight: 800 !important;
  }

  /* Avoid parent containers or list items becoming giant pink blocks */
  .md-sidebar--primary .md-nav--primary .md-nav__item,
  .md-sidebar--primary .md-nav--primary .md-nav__list,
  .md-sidebar--primary .md-nav--primary .md-nav {
    background-color: #061827 !important;
  }
}

@media screen and (max-width: 76.1875em) {

  .md-sidebar--primary .md-nav--primary .md-nav__container {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0 !important;

    background: transparent !important;
    border-radius: 4px !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > .md-nav__link--index {
    flex: 1 1 auto !important;
    min-width: 0 !important;

    margin: 0 !important;
    padding: 0.55rem 0.7rem !important;

    background: transparent !important;
    color: #e8f4ff !important;

    font-size: 0.86rem !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > .md-nav__link--index {
    color: var(--mm-blue) !important;
    font-size: 0.78rem !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link {
    flex: 0 0 2.15rem !important;
    width: 2.15rem !important;
    min-width: 2.15rem !important;

    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    margin: 0 !important;
    padding: 0.55rem 0.35rem !important;

    background: transparent !important;
    color: #8ccfff !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link .md-nav__icon,
  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link svg {
    color: #8ccfff !important;
    fill: #8ccfff !important;
    width: 1rem !important;
    height: 1rem !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container > label.md-nav__link--active {
    background: transparent !important;
    color: #8ccfff !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
  }

  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) > .md-nav__link--index,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) > label.md-nav__link,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) .md-ellipsis,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) .md-nav__icon,
  .md-sidebar--primary .md-nav--primary .md-nav__container:has(> .md-nav__link--index.md-nav__link--active) svg {
    background: transparent !important;
    color: white !important;
    fill: white !important;
  }
}

/* =========================================================
   FINAL navigation.indexes polish - stronger matching
   Fixes unselected Technology/Mechs color and chevron position.
========================================================= */

@media screen and (min-width: 76.25em) {

  /*
    Material's navigation.indexes can render the section index link
    without md-nav__link--index in some cases, so target the first
    direct link inside a top-level md-nav__container.
  */
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link,
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link .md-ellipsis {
    color: var(--mm-blue) !important;
    font-size: 0.78rem !important;
    font-weight: 900 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
  }

  /*
    Keep the selected/index link pink/white only when the link itself is active.
    This preserves the nice selected Technology row without painting the chevron.
  */
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link--active,
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link--active .md-ellipsis {
    background: linear-gradient(90deg, #ff4b72, #ff6b8c) !important;
    color: white !important;
    font-weight: 800 !important;
  }

  /*
    Pull the section chevron back left by making its hitbox narrower
    and removing the extra left-side padding.
  */
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > label.md-nav__link {
    flex-basis: 1.65rem !important;
    width: 1.65rem !important;
    min-width: 1.65rem !important;
    max-width: 1.65rem !important;

    padding-left: 0 !important;
    padding-right: 0.25rem !important;
    margin-left: -0.25rem !important;
    margin-right: 0 !important;

    justify-content: center !important;
    background: transparent !important;
    color: #8ccfff !important;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > label.md-nav__link .md-nav__icon,
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > label.md-nav__link svg {
    width: 1rem !important;
    height: 1rem !important;
    color: #8ccfff !important;
    fill: #8ccfff !important;
  }
}

@media screen and (max-width: 76.1875em) {

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link,
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link .md-ellipsis {
    color: var(--mm-blue) !important;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link--active,
  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > a.md-nav__link--active .md-ellipsis {
    color: white !important;
  }

  .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item > .md-nav__container > label.md-nav__link {
    flex-basis: 1.65rem !important;
    width: 1.65rem !important;
    min-width: 1.65rem !important;
    max-width: 1.65rem !important;

    padding-left: 0 !important;
    padding-right: 0.25rem !important;
    margin-left: -0.25rem !important;
    margin-right: 0 !important;
  }
}

/* Align ordinary first-level chevrons with navigation.indexes chevrons */
.md-sidebar--primary
.md-nav--primary
> .md-nav__list
> .md-nav__item
> label.md-nav__link {
  padding-right: 0.0rem !important;
}

/* Prevent separate pink hover box on Technology/Mechs chevrons */
.md-sidebar--primary
.md-nav--primary
.md-nav__container
> label.md-nav__link:hover {

  background: transparent !important;
  box-shadow: none !important;
}

@media screen and (max-width: 76.1875em) {

  /* Fix mobile navigation.indexes section alignment */
  .md-sidebar--primary
  .md-nav--primary
  > .md-nav__list
  > .md-nav__item
  > .md-nav__container
  > a.md-nav__link {
    padding-left: 0.7rem !important;
    margin-left: 0 !important;
  }

}

@media screen and (max-width: 76.1875em) {

  /* Fix nested navigation.indexes rows like MECHS */
  .md-sidebar--primary
  .md-nav--primary
  .md-nav__item
  > .md-nav__container
  > a.md-nav__link {
    padding-left: 0.7rem !important;
    margin-left: 0 !important;
  }

}
