/* The sidebar's navigation, shared by the docs pages and the API reference's (extensions/dokka.js). */

/* ---------------------------------------------------------------------------------------------------------------
 * Sidebar navigation
 * ------------------------------------------------------------------------------------------------------------- */

/* as the docs UI sets for the whole page, so the panel's padding is within its height on an API page too */
.nav-container,
.nav-container *,
.nav-container *::before,
.nav-container *::after {
  box-sizing: border-box;
}

.nav-container {
  flex: none;
  width: var(--nav-width);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  border-right: 1px solid var(--border);
}

.nav,
.nav .panels,
.nav-panel-menu {
  height: 100%;
}

.nav-panel-menu {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 16px 48px;
  scrollbar-width: thin;
}

.nav-panel-menu:not(.is-active),
.nav-panel-explore,
.nav-menu > .title,
.nav-menu-toggle {
  display: none !important;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-item > .nav-list {
  display: none;
}

.nav-item.is-active > .nav-list,
.nav-item[data-depth="0"] > .nav-list {
  display: block;
}

/* a group: a heading, always open */
.nav-item[data-depth="0"] {
  margin-bottom: 18px;
}

.nav-item[data-depth="0"] > .nav-item-toggle {
  display: none;
}

.nav-item[data-depth="0"] > .nav-text,
.nav-item[data-depth="0"] > .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: default !important;
  text-decoration: none;
}

.nav-item[data-depth="0"] > .nav-text::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  background: var(--accent);
  -webkit-mask: var(--group-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='m3 13 9 5 9-5'/%3E%3C/svg%3E")) center / contain no-repeat;
  mask: var(--group-icon, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 3 8l9 5 9-5-9-5Z'/%3E%3Cpath d='m3 13 9 5 9-5'/%3E%3C/svg%3E")) center / contain no-repeat;
}

/* an icon per group, by its position in the nav (docs/antora.yml): Get started, Functions, and API reference; the
   others, Concepts, Examples, and Comparison, have the default */
.nav-menu > .nav-list > .nav-item:nth-child(1) {
  --group-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 16.5c-1.5 1.3-2 5-2 5s3.7-.5 5-2c.7-.8.7-2.1-.1-2.9a2.2 2.2 0 0 0-2.9-.1Z'/%3E%3Cpath d='m12 15-3-3a22 22 0 0 1 2-3.9A12.9 12.9 0 0 1 22 2c0 2.7-.8 7.5-6 11a22.4 22.4 0 0 1-4 2Z'/%3E%3Cpath d='M9 12H4s.6-3 2-4c1.6-1.1 5 0 5 0'/%3E%3Cpath d='M12 15v5s3-.6 4-2c1.1-1.6 0-5 0-5'/%3E%3C/svg%3E");
}

.nav-menu > .nav-list > .nav-item:nth-child(3) {
  --group-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1.5'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1.5'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1.5'/%3E%3C/svg%3E");
}

.nav-menu > .nav-list > .nav-item:nth-child(5) {
  --group-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 18 6-6-6-6'/%3E%3Cpath d='m8 6-6 6 6 6'/%3E%3C/svg%3E");
}

.nav-item[data-depth="1"] > .nav-link,
.nav-item[data-depth="1"] > .nav-text,
.nav-item[data-depth="2"] > .nav-link,
.nav-item[data-depth="2"] > .nav-text,
.nav-item[data-depth="3"] > .nav-link {
  display: block;
  padding: 5px 30px 5px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.45;
  text-decoration: none;
  transition: background-color 100ms, color 100ms;
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text) !important;
}

.nav-item.is-current-page > .nav-link {
  background: var(--accent-subtle);
  color: var(--accent-strong) !important;
  font-weight: 550;
}

.nav-item.is-current-path:not(.is-current-page) > .nav-link {
  color: var(--text);
}

/* nested pages: indented, along a guide line */
.nav-item[data-depth="1"] > .nav-list {
  margin: 2px 0 4px 14px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.nav-item-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.nav-item-toggle::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 150ms;
}

.nav-item.is-active > .nav-item-toggle::before {
  transform: rotate(90deg);
}

.nav-item-toggle:hover {
  background: var(--bg-hover);
}

.nav-toggle {
  display: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E") no-repeat center;
  cursor: pointer;
}

@media (max-width: 960px) {
  .nav-toggle {
    display: inline-block;
  }

  .nav-container {
    display: none;
    position: fixed;
    z-index: 25;
    top: var(--header-height);
    left: 0;
    width: min(320px, 85vw);
    background: var(--bg);
    box-shadow: 8px 0 24px rgb(0 0 0 / 0.12);
  }

  .nav-container.is-active {
    display: block;
  }
}
