/* The sidebar shell below Bootstrap's lg breakpoint (#901, #960): the sidebar becomes an offcanvas drawer, opened from
   the bottom nav's More. components.css switches to the bottom nav at the artboards' 960px; the app uses 992px, where
   offcanvas-lg turns the sidebar into a drawer, so no width shows neither the column nor the bottom nav. */
.ms-sidebar {
  --bs-offcanvas-width: var(--sidebar-width);
  --bs-offcanvas-bg: var(--surface);
  --bs-offcanvas-color: var(--ink);
  --bs-offcanvas-border-color: var(--line);
}

@media (min-width: 992px) {
  /* Bootstrap blanks .offcanvas-lg once it is a static column (transparent !important); the column is a surface. */
  .ms-sidebar.offcanvas-lg {
    background-color: var(--surface) !important;
  }

  .ms-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
  }
}

/* styles.css flattens every transition to 0.01ms, which still lets the sidebar's children inherit visibility a frame
   late, so Show could not focus Hide in the same tick. None at all keeps the focus handoff immediate. */
@media (prefers-reduced-motion: reduce) {
  .ms-sidebar * {
    transition: none !important;
  }
}

@media (max-width: 991.98px) {
  .ms-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .ms-sidebar {
    display: flex;
    overflow-y: auto;
  }

  .ms-topbar {
    padding: 0 var(--space-4);
  }

  .ms-main {
    padding-bottom: calc(var(--touch) + var(--space-3));
  }

  .ms-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-nav);
    display: flex;
    justify-content: space-around;
    padding: 0 var(--space-2) env(safe-area-inset-bottom, 0);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
}

/* More is a button; components.css dresses only the bottom nav's links. */
.ms-bottomnav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--space-1) * 0.5);
  min-height: calc(var(--touch) + var(--space-3));
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font: 500 var(--label-size) / var(--label-line) var(--font-sans);
}

.ms-bottomnav button .ms-icon {
  font-size: var(--space-5);
}

/* The account menu is a Bootstrap dropdown dressed as the design system's Menu: every state reads tokens, so
   Night and Day stay legible on hover, focus and for the header (Bootstrap's header grey is 3.9:1 on slate). */
.dropdown-menu.ms-menu {
  --bs-dropdown-bg: var(--surface);
  --bs-dropdown-color: var(--ink);
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-link-color: var(--ink);
  --bs-dropdown-link-hover-color: var(--ink);
  --bs-dropdown-link-hover-bg: var(--surface-2);
  --bs-dropdown-link-active-color: var(--ink);
  --bs-dropdown-link-active-bg: var(--surface-2);
  --bs-dropdown-header-color: var(--ink-3);
}
