/* Sidebar sub-category labels, one step dimmer than the theme's default.
 *
 * The nav groups pages by what the reader came to do, so the group labels are
 * signposts rather than destinations. mkdocs-material already treats the
 * top-level section that way (--md-default-fg-color--light) but leaves a
 * nested sub-section at the ordinary link weight, which made the sub-sections
 * the brightest thing in the sidebar once the nav grew a third level. That is
 * the one level this file changes:
 *
 *   level                    selector                        before -> after
 *   top-level section        .md-nav__item--section > label   .54/.56 (theme)
 *   nested sub-section       .md-nav__item--nested > label    .87/.82 -> .58/.60
 *   page links (untouched)   .md-nav__link                    .87/.82
 *
 * The top level is deliberately NOT overridden here, and an earlier revision
 * of this file that took it to .46/.48 was reverted. Measured against both
 * palettes: WCAG AA for text this size (under 18.66px bold / 24px) wants
 * 4.5:1, which needs alpha >= 0.535, and .46/.48 gives 3.47:1 light and
 * 3.72:1 dark. The theme's own .54/.56 sits just above that line at 4.59:1 and
 * 4.91:1 — it is tuned to the threshold, not chosen loosely, so moving it down
 * "a little" leaves compliance. The exception in WCAG 1.4.3 for inactive user
 * interface components does not rescue it: that covers disabled controls, not
 * a static heading that carries structure, even though these labels do carry
 * pointer-events: none. Reading the value from the theme rather than pinning a
 * compliant number of our own also means a future palette change carries this
 * along instead of silently stranding it.
 *
 * The sub-section value that remains is checked the same way: .58 is 5.32:1 on
 * white and .60 is 5.16:1 on the slate ground, both clear of the line.
 *
 * The two schemes carry separate values because the palettes are not mirror
 * images — light lays black over white, slate lays a near-white hue over dark,
 * and an alpha that reads as "one step back" on one is not the same number on
 * the other. `[data-md-color-scheme="slate"]` matches the attribute the theme
 * puts on <body>, so the toggle keeps working without a media query.
 */

:root {
  --cp-nav-subcategory-color: rgba(0, 0, 0, 0.58);
}

[data-md-color-scheme="slate"] {
  --cp-nav-subcategory-color: hsla(var(--md-hue), 15%, 90%, 0.60);
}

/* Scoped to the primary sidebar: the table of contents on the right is built
 * from the same md-nav classes, and dimming a heading the reader is actively
 * tracking is a different question from dimming a static signpost. */
.md-nav--primary .md-nav__item--nested:not(.md-nav__item--section) > .md-nav__link[for] {
  color: var(--cp-nav-subcategory-color);
}

/* Version selector, rendered into the header by
 * overrides/partials/alternate.html on md-select -- the same component the
 * language selector is built on, so both open the same way, in the same place,
 * with the same arrow pointing back at their button.
 *
 * md-select places its panel at `top: calc(100% - .2rem)` of the control, so
 * the two controls have to be the same height or the shorter one opens its
 * panel inside the header. That is not tuned here to a number that looked
 * right: the button is given the theme's own button box and a line box of
 * exactly the height the theme gives an icon, so the two are the same by
 * construction and stay so if the theme changes either.
 *
 * Note what is NOT set on the wrapper: font-size. The line box of an
 * inline-block is measured against its parent's strut, so sizing the wrapper
 * would make this control's box differ from the language one's again, in a way
 * no rule here would name.
 *
 * Every rule below overrides one the theme sets, at equal specificity, and wins
 * on order -- extra_css is emitted after the theme stylesheet. */
.cp-version__current {
  font-size: 0.8rem;
  /* .md-icon gives its svg height: 1.2rem. This is that, for a word. */
  line-height: 1.2rem;
}

/* The theme's margins for this label assume it sits just after the site title,
 * on the left. Replaced by the margin every button in this corner carries. */
.cp-version .md-version__current {
  margin: 0.2rem;
  /* The .05rem nudge that lines the label up against a site title, which is not
   * what it is lined up against here. */
  top: 0;
}

/* The line being read. Marked by weight alone: the row is still a link, because
 * from a subpage it is the way back to that line's root. Scoped to the version
 * list, though no language row carries the attribute today -- an unscoped rule
 * would quietly start styling one that did. */
.cp-version .md-select__link[aria-current="true"] {
  font-weight: 700;
}
