/**
 * Copyright 2024 PsiQuantum, Corp. — Apache License 2.0
 */

:root {
    --md-primary-fg-color: #000000;
    --md-accent-fg-color: #7030A0;
}

.md-typeset a { color: #7030A0; }
.md-typeset a:hover { color: #6D677D; }

.md-nav__link--active {
  background-color: #6E32C9;
  color: #fff !important;
  padding: 0.2rem 0.5rem;
  position: relative;
  z-index: 1;
}

/* Iframe-friendly chrome: hide top header + duplicate site-title above the nav. */
.md-header { display: none !important; }
.md-main, .md-container { padding-top: 0 !important; }
.md-sidebar { top: 0 !important; }
.md-sidebar--primary > .md-sidebar__scrollwrap > .md-sidebar__inner > .md-nav--primary > .md-nav__title { display: none !important; }

/* Pagefind UI hosted at the top of the left sidebar, separated from the
 * nav tree by a divider. */
.psidocs-search {
  padding: 0 0.4rem 1rem;
  margin: 0.4rem 0 1rem;
  border-bottom: 1px solid var(--md-default-fg-color--lighter);
}
.md-sidebar--primary .md-nav--primary {
  margin-top: 0.4rem;
}

/* Pagefind variables (light theme) — match supertree palette. */
.psidocs-search {
  --pagefind-ui-primary: #7030A0;
  --pagefind-ui-text: var(--md-default-fg-color);
  --pagefind-ui-background: var(--md-default-bg-color);
  --pagefind-ui-border: var(--md-default-fg-color--lightest);
  --pagefind-ui-tag: var(--md-default-fg-color--lightest);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 0.25rem;
  --pagefind-ui-image-border-radius: 0.25rem;
  --pagefind-ui-image-box-ratio: 3 / 2;
  --pagefind-ui-font: inherit;
}

/* Pagefind's default UI sizes are large for a sidebar; trim down. */
.psidocs-search .pagefind-ui__form { font-size: 0.7rem; }
.psidocs-search .pagefind-ui__search-input { font-size: 0.7rem; padding: 0.45rem 0.6rem 0.45rem 2rem; }
.psidocs-search .pagefind-ui__search-clear { font-size: 0.65rem; }
.psidocs-search .pagefind-ui__filter-panel { font-size: 0.65rem; }
.psidocs-search .pagefind-ui__filter-name { font-weight: 600; }
.psidocs-search .pagefind-ui__filter-value { font-size: 0.65rem; }
.psidocs-search .pagefind-ui__results-area { font-size: 0.7rem; }

/* The drawer stays in the DOM (preserves Pagefind's own styling cascade)
 * but is repositioned via position: fixed so it isn't clipped by the
 * sidebar's overflow/stacking context. */
.pagefind-ui__drawer.psidocs-pagefind-drawer-fixed {
  position: fixed !important;
  z-index: 1000;
  width: min(640px, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.25rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  padding: 0.6rem 0.8rem;
}
.pagefind-ui__drawer.psidocs-pagefind-drawer-fixed:empty,
.pagefind-ui__drawer.psidocs-pagefind-drawer-fixed.pagefind-ui__hidden,
.pagefind-ui__drawer.psidocs-hidden { display: none !important; }

/* On wide viewports, mkdocs-material only auto-expands the active page's
 * immediate parent. For the supertree we want QDK and Construct's product
 * lists always visible, regardless of which page you're on. */
@media screen and (min-width: 76.25em) {
  .md-sidebar--primary .md-nav--primary > .md-nav__list
    > .md-nav__item > nav.md-nav:not(.md-nav--secondary) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  /* Active section's section-header label gets shrunk to 0 width by mkdocs-material's
   * drill-down logic; force it back so QDK / Construct headers stay readable. */
  .md-sidebar--primary .md-nav--primary > .md-nav__list
    > .md-nav__item--active > .md-nav__link {
    width: 100% !important;
    min-width: 0 !important;
  }
  /* QDK / Construct are always expanded; hide the no-op collapse chevron. */
  .md-sidebar--primary .md-nav--primary > .md-nav__list
    > .md-nav__item--nested > .md-nav__link > .md-nav__icon {
    display: none !important;
  }
  /* mkdocs-material auto-injects the active page's H2 anchors as a sub-nav
   * under the active item. Hide it; the right-side TOC is canonical. */
  .md-sidebar--primary .md-nav--primary .md-nav__link[for="__toc"],
  .md-sidebar--primary .md-nav--primary .md-nav__link[for="__toc"] ~ nav {
    display: none !important;
  }
}
