/* Help site navigation: the category cards, the tree sidebar and its mobile offcanvas.
 *
 * Colour comes in as --help-cat, a per-category --oncr-* token set inline by the template, and is
 * used only for an icon, an accent bar and the current-item marker. It never carries text and is
 * never paired as text-on-background: --oncr-auriu, --oncr-gri and --oncr-lime do not reach 4.5:1
 * on white, so a title tinted with them would fail WCAG AA. Titles keep the body colour.
 */

/* ---------- layout ---------- */

.help-container {
  max-width: 1600px;
}

.help-sidebar-inner {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-right: .5rem;
  padding-bottom: 1rem;
}

.help-mobile-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: .5rem 0;
  margin-bottom: .5rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
}

.help-mobile-search {
  flex: 1 1 auto;
  margin: 0;
}

/* The article measure: a long line of body text is hard to read however wide the window is. */
.help-prose {
  max-width: 75ch;
}

/* ---------- the tree ---------- */

.help-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 0;
}

.help-tree a {
  display: flex;
  gap: .4rem;
  align-items: baseline;
  padding: .2rem .4rem;
  border-radius: var(--bs-border-radius-sm);
  color: var(--bs-body-color);
  text-decoration: none;
  font-size: .875rem;
}

.help-tree a:hover,
.help-tree a:focus-visible {
  background: var(--bs-tertiary-bg);
  color: var(--bs-link-hover-color);
}

.help-tree summary {
  display: flex;
  gap: .4rem;
  align-items: center;
  padding: .3rem .4rem;
  border-radius: var(--bs-border-radius-sm);
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
  list-style: none; /* Firefox */
}

.help-tree summary::-webkit-details-marker {
  display: none; /* Safari/Chrome */
}

.help-tree summary:hover,
.help-tree summary:focus-visible {
  background: var(--bs-tertiary-bg);
}

.help-tree-label {
  flex: 1 1 auto;
}

.help-tree-count {
  flex: 0 0 auto;
  color: var(--bs-secondary-color);
  font-size: .75rem;
  font-weight: 400;
}

.help-tree-caret {
  flex: 0 0 auto;
  font-size: .7rem;
  color: var(--bs-secondary-color);
  transition: transform .15s ease-in-out;
}

.help-tree details[open] > summary .help-tree-caret {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  .help-tree-caret { transition: none; }
}

/* The category's colour: on its own icon, and as the rule down its list of sections. */
.help-tree-category > details > summary .help-tree-icon {
  color: var(--help-cat, var(--bs-secondary-color));
}

.help-tree-sections {
  margin: .1rem 0 .4rem;
  padding-left: .75rem;
  border-left: 2px solid var(--help-cat, var(--bs-border-color));
}

.help-tree-sections .help-tree-icon {
  color: var(--bs-secondary-color);
  font-size: .8rem;
}

.help-tree-overview > a {
  color: var(--bs-secondary-color);
  font-size: .8125rem;
}

.help-tree-sections > li.is-current > a {
  font-weight: 600;
}

.help-tree-articles {
  margin: .1rem 0 .3rem;
  padding-left: 1.4rem;
  border-left: 1px solid var(--bs-border-color);
}

.help-tree-group-label {
  color: var(--bs-secondary-color) !important;
  font-size: .75rem !important;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.help-tree a.is-current,
.help-tree a[aria-current="page"] {
  background: var(--bs-tertiary-bg);
  font-weight: 600;
  box-shadow: inset 3px 0 0 0 var(--help-cat, var(--bs-primary));
}

.help-tree-footer {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--bs-border-color);
  font-size: .8125rem;
}

/* ---------- the root's category cards ---------- */

.help-search-hero .form-control,
.help-search-hero .btn {
  padding-top: .75rem;
  padding-bottom: .75rem;
}

.help-cat-card {
  display: block;
  height: 100%;
  padding: 1rem 1rem 1rem calc(1rem - 2px);
  border: 1px solid var(--bs-border-color);
  border-left: 6px solid var(--help-cat, var(--bs-primary));
  border-radius: var(--bs-border-radius);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none;
  transition: box-shadow .15s ease-in-out, transform .15s ease-in-out;
}

.help-cat-card:hover,
.help-cat-card:focus-visible {
  box-shadow: var(--bs-box-shadow);
  transform: translateY(-2px);
  color: var(--bs-body-color);
}

@media (prefers-reduced-motion: reduce) {
  .help-cat-card { transition: none; }
  .help-cat-card:hover, .help-cat-card:focus-visible { transform: none; }
}

.help-cat-card .help-cat-icon {
  font-size: 1.75rem;
  line-height: 1;
  color: var(--help-cat, var(--bs-primary));
}

.help-cat-card .help-cat-title {
  margin: .5rem 0 .25rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.help-cat-card .help-cat-blurb {
  margin: 0 0 .5rem;
  color: var(--bs-secondary-color);
  font-size: .875rem;
}

.help-cat-card .help-cat-meta {
  color: var(--bs-secondary-color);
  font-size: .8125rem;
}

/* ---------- the category page's section list ---------- */

.help-section-card {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  height: 100%;
  padding: .85rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  text-decoration: none;
}

.help-section-card:hover,
.help-section-card:focus-visible {
  border-color: var(--help-cat, var(--bs-primary));
  color: var(--bs-body-color);
}

.help-section-card .help-section-icon {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--help-cat, var(--bs-primary));
}
