/* HELP WHERE THE QUESTION ARISES — page kit, C.145 (L-COPY-19).
 *
 * Two small things that let a page stay short:
 *
 * THE "?" (`_kit_help.html` help_link): one fold of the manual, opened in a
 * new tab, standing one step after a group header or a line's label. A
 * round mark in the text's own colour; the hit area is the kit's 24 px
 * step (--s5).
 *
 * THE TERM (`service/copybudget.py` term_html): a trade term a hobbyist may
 * not know, with a dotted underline. Hover, focus or a tap shows its
 * explanation of at most 12 words as a small layer that takes no space, so
 * nothing on the page moves when it opens. On a phone the layer stands at
 * the foot of the screen, inside the gutter, so it never runs sideways. */

.kit-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--s5);
  height: var(--s5);
  margin-left: var(--s2);
  border-radius: 50%;
  vertical-align: middle;
  color: var(--ink-soft);
  font-size: var(--font-small);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
}

.kit-help::before {
  /* the drawn ring sits inside the hit area */
  content: "";
  position: absolute;
  inset: var(--s1);
  border: var(--hairline) solid var(--line-strong);
  border-radius: 50%;
}

/* ON THE PHONE FRAME (batch 42): every control a finger reaches is at
   least the --tap token (phone law P5), so the "?" grows its hit area to
   it there; the drawn ring keeps its size, and the negative block margin
   gives the line back the height the larger box would take. */
.phone-job .kit-help {
  width: var(--tap);
  height: var(--tap);
  margin-block: calc((var(--s5) - var(--tap)) / 2);
}

.phone-job .kit-help::before {
  inset: calc((var(--tap) - var(--s5)) / 2 + var(--s1));
}

.kit-help:hover,
.kit-help:focus-visible {
  color: var(--accent);
}

.kit-help:hover::before,
.kit-help:focus-visible::before {
  border-color: var(--accent);
}

.kit-term {
  position: relative;
  display: inline;
}

.kit-term-word {
  text-decoration: underline dotted;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: calc(3 * var(--hairline));
  cursor: help;
}

.kit-term-word:focus-visible {
  outline: calc(2 * var(--hairline)) solid var(--accent);
  outline-offset: calc(2 * var(--hairline));
  border-radius: var(--radius-sm);
}

.kit-term-aside {
  position: absolute;
  left: 0;
  top: calc(100% + var(--s1));
  z-index: 30;
  display: none;
  width: max-content;
  max-width: calc(18 * var(--s4));
  padding: var(--s1) var(--s2);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--font-small);
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  box-shadow: var(--shadow);
}

.kit-term-word:hover + .kit-term-aside,
.kit-term-word:focus + .kit-term-aside {
  display: block;
}

@media (max-width: 35rem) {
  .kit-term-aside {
    position: fixed;
    left: var(--s4);
    right: var(--s4);
    top: auto;
    bottom: var(--s4);
    width: auto;
    max-width: none;
  }
}
