/* =============================================================================
   AMERICON HELP
   =============================================================================

   Two things live here: the "?" trigger that sits beside controls all over the
   site, and the manual page at /help.

   ON THE TOKENS
   -------------
   Everything reads the theme's semantic tokens (--am-surface, --am-text, ...)
   with a hard fallback in each var(). The fallbacks are not defensive
   decoration: tools/build-manual.php renders this same markup into a
   standalone HTML file that carries no theme stylesheet at all, and its own
   token block is a subset. Anything without a fallback would render as
   inherited-black-on-transparent there.

   ON THE TRIGGER BEING SMALL
   --------------------------
   It is a 14px glyph in a 24px hit area. The glyph has to be quiet -- one
   sits next to a dozen labels on the project editor and a row of loud ones
   would compete with the form itself -- but the target has to be pressable
   with a thumb, which is what the padding is for. They are separate problems
   and this solves both rather than splitting the difference.
   ========================================================================== */


/* =============================================================================
   Ink tokens
   -----------------------------------------------------------------------------
   WHY THE THEME'S --am-accent IS NOT USED DIRECTLY FOR TEXT AND ICONS

   --am-accent resolves to #272E7E in light and #5964D3 in dark. The light
   value is ink: 9.9:1 on white. The dark value is a FILL -- it measures
   3.15:1 against --am-surface, which clears the 3:1 floor for a large
   graphic and fails the 4.5:1 one for anything anybody has to read.

   Used for both, as it was, the manual rendered accent-coloured labels,
   chips, card titles and icon tiles at around 3:1 in dark mode. The contents
   list was the visible symptom -- tiles you could not make out -- but eight
   other pairs were failing alongside it, and none of them were noticeable on
   a machine running in light mode, where the identical CSS measures 10:1.

   So: --am-accent keeps meaning "the accent fill", and these mean "the accent
   as something to read". They part company only in dark mode.

   Every value here is measured by tests/test-contrast.php, which resolves
   both schemes and fails the build under threshold. Change one and run it.
   ========================================================================== */

:root {
  /*
   * Accent and danger AS INK.
   *
   * These began life here, as the manual's own fix for accent-coloured text
   * measuring ~3:1 in dark mode. The same defect turned out to run through the
   * whole site -- every link, every active filter -- so the tokens moved to
   * themes/americon-bid/style.css and these are now aliases.
   *
   * They stay as aliases rather than being deleted for one reason: the
   * standalone manual built by tools/build-manual.php carries no theme
   * stylesheet at all. Its own token block defines --am-accent-ink and
   * --am-danger-ink, and the var() fallbacks below are the last line of
   * defence if it ever forgets to.
   */
  --am-help-ink-accent: var(--am-accent-ink, #272E7E);
  --am-help-ink-danger: var(--am-danger-ink, #C0101D);

  /* Tip's ink. --am-teal already ships as text in this file (the staff
     audience badge), and it carries its own light-dark() pair in the theme, so
     it needs no separate correction the way accent and danger did. */
  --am-help-ink-tip: var(--am-teal, #0F7A57);

  /* The icon tiles in the contents list and the section bands.
     A flat pair rather than a percentage tint of the accent: a tint is a
     different colour in each scheme AND a different contrast against each
     surface, which is exactly how the dark one ended up at 2.9:1.
     Manual-only, so it stays here. */
  --am-help-tile-ink: #272E7E;
  --am-help-tile-ink: light-dark(#272E7E, #AEB5F7);
  --am-help-tile-bg:  #E6E9FA;
  --am-help-tile-bg:  light-dark(#E6E9FA, #2A3150);

  /* Small uppercase labels -- section numbers, eyebrows, "See also".
     Now identical to --am-text-subtle, which was darkened site-wide for the
     same reason this existed. Kept as an alias so the manual's labels can be
     tuned without touching every label on the site. */
  --am-help-label: var(--am-text-subtle, #646D79);

  /*
   * The "?" trigger's own ink.
   *
   * It used to take --am-text-subtle -- the site's quietest grey -- on the
   * reasoning at the head of this file: a glyph that repeats a dozen times
   * down the project editor must not compete with the labels it annotates.
   * That reasoning is still right, and it was worked out entirely on white.
   *
   * The token itself flips correctly, and the trigger measured 4.8:1 light
   * and 5.6:1 dark. Both clear AA, and the dark one still read as an empty
   * ring you had to go looking for, because the ratio is not the whole story
   * for this particular mark: it is a HAIRLINE OUTLINE, and a hairline loses
   * far more apparent weight light-on-dark than dark-on-light does. Beside a
   * bold near-white heading it vanished. So the token adjusted and the design
   * did not -- one intent applied twice is not the same as a value per scheme.
   *
   * Hence its own pair rather than another --am-text-subtle call site. Light
   * is the value it already had and nobody complained about. Dark steps up to
   * 8.2:1 on the page and 7.4:1 on a card -- present at a glance, and still
   * clearly quieter than body text at ~12:1, which is the half of the
   * original intent worth keeping.
   *
   * Not applied to --am-text-subtle itself: that token backs twenty-odd
   * uppercase labels and eyebrows, which are SOLID text and were never the
   * thing that was hard to see. Lifting it would have brightened all of them
   * to fix one glyph.
   *
   * Measured by tests/test-contrast.php against all four surfaces, like every
   * other ink here. Change it and run that.
   */
  --am-help-trigger: #646D79;
  --am-help-trigger: light-dark(#646D79, #A9B2C1);
}


/* =============================================================================
   Icons
   -----------------------------------------------------------------------------
   Bootstrap Icons, inlined from help/icons.php. All 16x16, all currentColor,
   all decorative -- see the note at the head of help/render.php for why they
   never carry meaning on their own.

   Sized in em rather than px so an icon scales with the text it sits beside;
   the type scale here is fluid, and a fixed 16px glyph next to a clamp()ed
   heading is right at exactly one viewport width.
   ========================================================================== */

.am-help-i {
  inline-size: 1em;
  block-size: 1em;
  flex: none;
  /* Optical centring against lowercase text. Icons sit on the text baseline
     otherwise and read as if they are falling off the line. */
  vertical-align: -.125em;
}


/* =============================================================================
   The "?" trigger
   ========================================================================== */

.am-help {
  /* inline-flex, not inline-block: it usually follows a <label>, and baseline
     alignment of a glyph against label text is never quite right. */
  display: inline-flex;
  align-items: center;
  justify-content: center;

  inline-size: 1.5rem;
  block-size: 1.5rem;
  margin-inline-start: .25rem;
  vertical-align: middle;

  border-radius: var(--am-radius-pill, 999px);
  color: var(--am-help-trigger, #646D79);
  text-decoration: none;

  /* The link is decoration-free but must not read as body text; the colour
     shift on hover is the whole affordance. */
  transition: color var(--am-speed, 160ms) var(--am-ease, ease),
              background-color var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help:hover,
.am-help:focus-visible {
  color: var(--am-help-ink-accent, #272E7E);
  background-color: color-mix(in srgb, currentColor 12%, transparent);
}

.am-help:focus-visible {
  outline: 2px solid var(--am-accent, #272E7E);
  outline-offset: 1px;
}

.am-help-ico {
  display: block;
  /* Slightly under the 1.5rem hit area, so the glyph has room to breathe
     inside the hover disc rather than filling it edge to edge. */
  inline-size: .95rem;
  block-size: .95rem;
  vertical-align: baseline;
}

/* A heading with a "?" after it should not have the glyph inherit the
   heading's weight and size -- it is an annotation on the heading, not part
   of it. */
h1 > .am-help,
h2 > .am-help,
h3 > .am-help,
h4 > .am-help,
h5 > .am-help,
legend > .am-help,
.am-section-title > .am-help {
  font-weight: 400;
}

/* A "?" with visible words beside it, for the places where there is no label
   for it to annotate -- the project editor's section rail, which has no
   heading of its own. */
.am-editor-railhelp {
  display: flex;
  align-items: center;
  gap: .1rem;
  margin: .5rem 0 0;
  font-size: var(--am-text-xs, .75rem);
  color: var(--am-help-label, #646D79);
}

.am-editor-railhelp .am-help,
.am-notify-help .am-help {
  margin-inline-start: 0;
}

.am-notify-help {
  display: flex;
  align-items: center;
  gap: .1rem;
  margin: .5rem 0 0;
  font-size: var(--am-text-xs, .75rem);
  color: var(--am-help-label, #646D79);
}

/* Printed pages: the glyph means nothing on paper. */
@media print {
  .am-help { display: none; }
}


/* =============================================================================
   The popover
   -----------------------------------------------------------------------------
   Bootstrap draws the box; these rules re-skin it in Americon's tokens, since
   Bootstrap's own popover variables are mapped to its defaults rather than to
   this theme. Scoped to .am-help-pop so no other popover on the site is
   affected.
   ========================================================================== */

.popover.am-help-pop {
  --bs-popover-max-width: 22rem;
  --bs-popover-bg: var(--am-surface, #FFFFFF);
  --bs-popover-border-color: var(--am-border, #E2E5EA);
  --bs-popover-border-radius: var(--am-radius, .625rem);
  --bs-popover-inner-border-radius: var(--am-radius, .625rem);
  --bs-popover-header-bg: var(--am-surface, #FFFFFF);
  --bs-popover-header-color: var(--am-text, #1F2530);
  --bs-popover-body-color: var(--am-text, #1F2530);
  --bs-popover-font-size: var(--am-text-sm, .875rem);

  box-shadow: var(--am-shadow, 0 1px 3px rgb(16 24 40 / .08), 0 8px 24px rgb(16 24 40 / .06));
}

.popover.am-help-pop .popover-header {
  font-size: var(--am-text-sm, .875rem);
  font-weight: 600;
  border-bottom: 1px solid var(--am-border, #E2E5EA);
}

.popover.am-help-pop .popover-body {
  padding-block-end: .5rem;
}

.popover.am-help-pop .popover-body p {
  margin-block-end: .5rem;
}

.popover.am-help-pop code {
  font-size: .9em;
  padding: .05em .3em;
  border-radius: var(--am-radius-sm, .375rem);
  background-color: var(--am-surface-sunk, #F7F8FA);
  color: inherit;
}

.am-help-pop-more {
  display: inline-block;
  margin-block-start: .25rem;
  font-weight: 600;
  font-size: var(--am-text-xs, .75rem);
  text-decoration: none;
  color: var(--am-help-ink-accent, #272E7E);
}

.am-help-pop-more:hover,
.am-help-pop-more:focus-visible {
  text-decoration: underline;
}

.am-help-pop-more::after {
  content: " \2192";        /* → */
}


/* =============================================================================
   The manual
   ========================================================================== */

.am-help-manual {
  /* Prose measure. A manual read at 1180px full-bleed is a manual nobody
     finishes a paragraph of. */
  max-inline-size: 62rem;
  margin-inline: auto;
}

.am-help-header {
  padding-block-end: var(--am-gap-lg, 1.5rem);
  margin-block-end: var(--am-gap-lg, 1.5rem);
  border-block-end: 1px solid var(--am-border, #E2E5EA);
}

.am-help-eyebrow {
  margin: 0;
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--am-help-label, #646D79);
}

.am-help-title {
  margin: .25rem 0 0;
  font-size: var(--am-text-2xl, 2.125rem);
  font-weight: 700;
}

.am-help-lede {
  margin: .5rem 0 0;
  max-inline-size: 46rem;
  color: var(--am-text-muted, #5E6673);
}

.am-help-search {
  margin-block-start: var(--am-gap, 1rem);
  max-inline-size: 26rem;
}

/* The magnifier sits inside the field. Positioned rather than made a flex
   sibling so the input keeps its full width and its own focus ring. */
.am-help-searchbox {
  position: relative;
}

.am-help-searchico {
  position: absolute;
  inset-inline-start: .7rem;
  inset-block-start: 50%;
  translate: 0 -50%;
  color: var(--am-text-subtle, #646D79);
  pointer-events: none;
}

.am-help-searchbox .form-control {
  padding-inline-start: 2.1rem;
}


/* --- New here? ------------------------------------------------------------ */

.am-help-start {
  padding: var(--am-gap-lg, 1.5rem);
  margin-block-end: var(--am-gap-xl, 2.5rem);
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius, .625rem);
  background-color: var(--am-surface, #FFFFFF);
}

.am-help-start-h {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 var(--am-gap, 1rem);
  font-size: var(--am-text-lg, 1.1875rem);
  font-weight: 700;
}

.am-help-start-h .am-help-i {
  color: var(--am-help-ink-accent, #272E7E);
}

.am-help-startgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: var(--am-gap-sm, .625rem);
}

.am-help-startcard {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .8rem .9rem;
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius-sm, .375rem);
  background-color: var(--am-surface-sunk, #F7F8FA);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--am-speed, 160ms) var(--am-ease, ease),
              transform var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help-startcard:hover,
.am-help-startcard:focus-visible {
  border-color: var(--am-accent, #272E7E);
  /* One pixel. Enough to register as a response, small enough that a grid of
     eight does not feel like it is twitching. */
  transform: translateY(-1px);
}

.am-help-startcard-title {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-weight: 600;
  font-size: var(--am-text-sm, .875rem);
  color: var(--am-help-ink-accent, #272E7E);
}

.am-help-startcard-go {
  transition: translate var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help-startcard:hover .am-help-startcard-go {
  translate: .15rem 0;
}

.am-help-startcard-tip {
  font-size: var(--am-text-xs, .75rem);
  line-height: 1.45;
  color: var(--am-text-muted, #5E6673);
}

.am-help-searchcount {
  margin: .35rem 0 0;
  min-block-size: 1.2em;      /* reserve the line so results do not shift the page */
  font-size: var(--am-text-xs, .75rem);
  color: var(--am-text-muted, #5E6673);
}


/* --- The downloadable copy ------------------------------------------------ */

.am-help-getcopy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  margin: var(--am-gap, 1rem) 0 0;
}

.am-help-download {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .8rem;
  font-size: var(--am-text-sm, .875rem);
  font-weight: 600;
  text-decoration: none;
  color: var(--am-help-ink-accent, #272E7E);
  background-color: var(--am-surface, #FFFFFF);
  border: 1px solid var(--am-border-strong, #C9CED7);
  border-radius: var(--am-radius-pill, 999px);
  transition: border-color var(--am-speed, .15s) var(--am-ease, ease);
}

.am-help-download:hover,
.am-help-download:focus-visible {
  border-color: var(--am-help-ink-accent, #272E7E);
  text-decoration: underline;
}

.am-help-getcopy-note {
  font-size: var(--am-text-xs, .75rem);
  color: var(--am-text-muted, #5E6673);
}

@media print {
  /* On paper it is the download. */
  .am-help-getcopy { display: none; }
}


/* --- Contents ------------------------------------------------------------ */

.am-help-toc {
  padding: var(--am-gap, 1rem) var(--am-gap-lg, 1.5rem);
  margin-block-end: var(--am-gap-xl, 2.5rem);
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius, .625rem);
  background-color: var(--am-surface, #FFFFFF);
}

.am-help-toc-head {
  margin: 0 0 var(--am-gap, 1rem);
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--am-text-subtle, #646D79);
}

.am-help-toc-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--am-gap, 1rem) var(--am-gap-lg, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.am-help-toc-section {
  break-inside: avoid;
}

.am-help-toc-sectionlink {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--am-text, #1F2530);
}

/* The icon in a tinted tile, matching the section band it points at. The
   two together are what make a section recognisable before its title is
   read. */
.am-help-toc-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.75rem;
  block-size: 1.75rem;
  flex: none;
  border-radius: var(--am-radius-sm, .375rem);
  color: var(--am-help-tile-ink, #272E7E);
  background-color: var(--am-help-tile-bg, #E6E9FA);
}

.am-help-toc-sectiontext {
  display: flex;
  align-items: baseline;
  gap: .35rem;
}

.am-help-toc-num {
  font-variant-numeric: tabular-nums;
  color: var(--am-help-label, #646D79);
}

.am-help-toc-num::after {
  content: ".";
}

.am-help-toc-sectionlink:hover,
.am-help-toc-sectionlink:focus-visible {
  color: var(--am-help-ink-accent, #272E7E);
}

.am-help-toc-topics {
  margin: .35rem 0 0 2.25rem;   /* aligns under the title, clear of the tile */
  padding: 0;
  list-style: none;
  font-size: var(--am-text-sm, .875rem);
}

.am-help-toc-topics li {
  margin-block-start: .15rem;
}

.am-help-toc-topics a {
  color: var(--am-text-muted, #5E6673);
  text-decoration: none;
}

.am-help-toc-topics a:hover,
.am-help-toc-topics a:focus-visible {
  color: var(--am-help-ink-accent, #272E7E);
  text-decoration: underline;
}


/* --- Sections and topics ------------------------------------------------- */

.am-help-section {
  margin-block-start: var(--am-gap-xl, 2.5rem);
  scroll-margin-block-start: 2rem;
}

/*
 * The section band.
 *
 * A heading with a rule under it was doing nothing for a document this long:
 * scrolled past at speed, every screen looked like the last one. The band is
 * a real edge to land on, and it repeats the brand's structural device --
 * a red left rule, the same one the calendar dashboard header carries -- so
 * the manual reads as part of the portal rather than as a document about it.
 */
.am-help-section-head {
  display: flex;
  align-items: flex-start;
  gap: var(--am-gap, 1rem);
  padding: var(--am-gap, 1rem) var(--am-gap-lg, 1.5rem);
  border: 1px solid var(--am-border, #E2E5EA);
  border-inline-start: 3px solid var(--am-rule, #ED1C24);
  border-radius: var(--am-radius, .625rem);
  background-color: var(--am-surface, #FFFFFF);
}

.am-help-section-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  flex: none;
  font-size: 1.25rem;
  border-radius: var(--am-radius-sm, .375rem);
  color: var(--am-help-tile-ink, #272E7E);
  background-color: var(--am-help-tile-bg, #E6E9FA);
}

.am-help-section-headtext {
  min-inline-size: 0;   /* lets long words wrap instead of widening the flex item */
}

.am-help-section-num {
  margin: 0;
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--am-help-label, #646D79);
}

.am-help-section-title {
  margin: .1rem 0 0;
  font-size: var(--am-text-xl, 1.5rem);
  font-weight: 700;
}

.am-help-section-intro {
  margin-block-start: .4rem;
  margin-block-end: 0;
  max-inline-size: 46rem;
  color: var(--am-text-muted, #5E6673);
}

@media (max-width: 30rem) {
  .am-help-section-head {
    flex-direction: column;
    gap: .6rem;
  }
}

.am-help-topic {
  padding: var(--am-gap-lg, 1.5rem);
  margin-block-start: var(--am-gap, 1rem);
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius, .625rem);
  background-color: var(--am-surface, #FFFFFF);

  /* Anchored jumps land under the sticky site header otherwise. */
  scroll-margin-block-start: 5rem;
}

/* The topic a "?" link just jumped to. Fades rather than persists: it answers
   "which of these did I ask for" and then gets out of the way. */
.am-help-topic:target {
  border-color: var(--am-accent, #272E7E);
  box-shadow: var(--am-ring, 0 0 0 2px #FFFFFF, 0 0 0 4px #272E7E);
}

.am-help-topic-title {
  margin: 0;
  font-size: var(--am-text-lg, 1.1875rem);
  font-weight: 700;
}

/* Revealed on hover of the card, or whenever it is focused. Hidden by
   opacity rather than display so it stays in the tab order and keyboard
   users can reach it at all. */
.am-help-anchor {
  display: inline-block;
  margin-inline-start: .25rem;
  color: var(--am-text-subtle, #646D79);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help-topic:hover .am-help-anchor,
.am-help-anchor:focus-visible {
  opacity: 1;
}

.am-help-anchor:hover {
  color: var(--am-help-ink-accent, #272E7E);
}

/* Touch has no hover, so the link would never appear. Showing it faintly is
   better than a control that exists only for mouse users. */
@media (hover: none) {
  .am-help-anchor { opacity: .45; }
}

.am-help-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: .35rem 0 0;
  font-size: var(--am-text-xs, .75rem);
}

.am-help-where {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: var(--am-help-label, #646D79);
}

.am-help-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .1rem .5rem;
  border-radius: var(--am-radius-pill, 999px);
  font-weight: 600;
  border: 1px solid currentColor;
}

.am-help-badge--staff      { color: var(--am-teal, #0F7A57); }
.am-help-badge--contractor { color: var(--am-help-ink-accent, #272E7E); }

/* The summary sentence. Set apart from the detail below it because it is the
   same sentence the reader saw in the tooltip -- recognising it is what tells
   them they landed on the right entry. */
.am-help-tip {
  margin: .75rem 0 0;
  padding-inline-start: .875rem;
  border-inline-start: 3px solid var(--am-border-strong, #C9CED7);
  font-size: var(--am-text-md, 1rem);
  color: var(--am-text, #1F2530);
}

.am-help-topic > p,
.am-help-list {
  margin-block-start: .75rem;
  margin-block-end: 0;
}

.am-help-list {
  padding-inline-start: 1.35rem;
}

.am-help-list li + li {
  margin-block-start: .35rem;
}

.am-help-topic code {
  font-size: .9em;
  padding: .05em .35em;
  border-radius: var(--am-radius-sm, .375rem);
  background-color: var(--am-surface-sunk, #F7F8FA);
  border: 1px solid var(--am-border, #E2E5EA);
}


/* --- Callouts ------------------------------------------------------------ */

.am-help-callout {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-block-start: .75rem;
  padding: .7rem .9rem;
  border-radius: var(--am-radius-sm, .375rem);
  border-inline-start: 3px solid;
  font-size: var(--am-text-sm, .875rem);
}

.am-help-callout > div {
  min-inline-size: 0;
}

.am-help-callout-ico {
  /* Aligned to the label's cap height rather than centred on the block: a
     three-line warning would otherwise put its icon halfway down the text. */
  margin-block-start: .12rem;
  font-size: 1rem;
}

.am-help-note {
  border-color: var(--am-accent, #272E7E);
  background-color: color-mix(in srgb, var(--am-accent, #272E7E) 7%, transparent);
}

.am-help-warn {
  border-color: var(--am-danger, #ED1C24);
  background-color: color-mix(in srgb, var(--am-danger, #ED1C24) 8%, transparent);
}

/* The word stays, now beside the icon rather than replaced by it. Colour and
   glyph both fail for some readers; the word fails for none. */
.am-help-callout-label {
  display: block;
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-block-end: .15rem;
}

.am-help-tipbox {
  border-color: var(--am-teal, #0F7A57);
  background-color: color-mix(in srgb, var(--am-teal, #0F7A57) 8%, transparent);
}

.am-help-note .am-help-callout-label,
.am-help-note .am-help-callout-ico { color: var(--am-help-ink-accent, #272E7E); }
.am-help-warn .am-help-callout-label,
.am-help-warn .am-help-callout-ico { color: var(--am-help-ink-danger, #C0101D); }
.am-help-tipbox .am-help-callout-label,
.am-help-tipbox .am-help-callout-ico { color: var(--am-help-ink-tip, #0F7A57); }


/* --- Figures -------------------------------------------------------------- */

/*
 * Screenshots of the real screens.
 *
 * SIZED IN THE MARKUP, NOT JUST HERE
 * ----------------------------------
 * Every figure carries width and height attributes. With `height: auto` below
 * they give the browser the aspect ratio before the bytes arrive, so a topic
 * does not reflow under the reader's cursor as its picture loads -- which on a
 * page this long means losing your place in a document you are reading BECAUSE
 * you were lost.
 */
.am-help-figure {
  margin: 1rem 0 0;
}

.am-help-figure img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius-sm, .375rem);
  /* The screenshots are of a white-ish interface. On the dark theme that is a
     bright rectangle against a dark page, so it gets a rim rather than being
     dimmed: dimming a screenshot makes the thing it is pointing at harder to
     see, which defeats the picture. */
  background-color: #FFFFFF;
}

.am-help-figure figcaption {
  margin-block-start: .5rem;
  font-size: var(--am-text-sm, .875rem);
  color: var(--am-text-muted, #5E6673);
  text-wrap: pretty;
}

@media print {
  /* A screenshot broken across a page break is unreadable, and this document
     is printed for onboarding packets more than it is scrolled. */
  .am-help-figure { break-inside: avoid; }
}


/* --- Steps ---------------------------------------------------------------- */

/* Procedures, and only procedures. See the note in help/render.php on why
   ordered lists are the one thing here that gets numbered. */
.am-help-steps {
  counter-reset: am-help-step;
  list-style: none;
  margin-block-start: .75rem;
  margin-block-end: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.am-help-steps > li {
  counter-increment: am-help-step;
  display: flex;
  align-items: flex-start;
  gap: .65rem;
}

.am-help-steps > li::before {
  content: counter(am-help-step);
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  flex: none;
  border-radius: var(--am-radius-pill, 999px);
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  /*
   * White, not --am-surface.
   *
   * The marker is a filled accent disc in BOTH schemes, so the numeral on it
   * is a light-on-dark problem in both -- and taking the numeral from
   * --am-surface made it #1E232B in dark mode, i.e. near-black text on a
   * mid-blue disc at 3.15:1. The disc does not flip, so the numeral must not
   * either. 11.8:1 light, 5.0:1 dark.
   */
  color: #FFFFFF;
  background-color: var(--am-accent, #272E7E);
}

.am-help-step-body {
  min-inline-size: 0;
  padding-block-start: .1rem;
}


/* --- Block icon (keyboard) ------------------------------------------------ */

.am-help-blockico {
  display: block;
  margin-block-start: .75rem;
  font-size: 1.1rem;
  color: var(--am-text-subtle, #646D79);
}


/* --- Tables -------------------------------------------------------------- */

/* Wrapped so a wide comparison table scrolls inside its own box instead of
   pushing the page sideways on a phone. */
.am-help-tablewrap {
  margin-block-start: .75rem;
  overflow-x: auto;
  border: 1px solid var(--am-border, #E2E5EA);
  border-radius: var(--am-radius-sm, .375rem);
}

.am-help-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: var(--am-text-sm, .875rem);
}

.am-help-table th,
.am-help-table td {
  padding: .55rem .75rem;
  text-align: start;
  vertical-align: top;
  border-block-end: 1px solid var(--am-border, #E2E5EA);
}

.am-help-table thead th {
  background-color: var(--am-surface-sunk, #F7F8FA);
  font-weight: 700;
  white-space: nowrap;
}

.am-help-table tbody th {
  font-weight: 600;
}

/* Zebra striping. These are comparison tables read across the row -- "is the
   audit history kept: suspend yes, delete no" -- and losing your row halfway
   is the failure mode striping exists to prevent. */
.am-help-table tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, var(--am-text, #1F2530) 3%, transparent);
}

.am-help-table tr:last-child th,
.am-help-table tr:last-child td {
  border-block-end: 0;
}


/* --- Keyboard shortcut list ---------------------------------------------- */

.am-help-keys {
  margin-block-start: .75rem;
  margin-block-end: 0;
}

.am-help-keyrow {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: .5rem;
  align-items: baseline;
  padding-block: .3rem;
  border-block-end: 1px solid var(--am-border, #E2E5EA);
}

.am-help-keyrow:last-child {
  border-block-end: 0;
}

.am-help-keyrow dt,
.am-help-keyrow dd {
  margin: 0;
}

.am-help-keys kbd {
  display: inline-block;
  min-inline-size: 1.5rem;
  padding: .1rem .4rem;
  margin-inline-end: .25rem;
  text-align: center;
  font-family: inherit;
  font-size: var(--am-text-xs, .75rem);
  font-weight: 600;
  color: var(--am-text, #1F2530);
  background-color: var(--am-surface-sunk, #F7F8FA);
  border: 1px solid var(--am-border-strong, #C9CED7);
  border-block-end-width: 2px;
  border-radius: var(--am-radius-sm, .375rem);
}


/* --- See also ------------------------------------------------------------ */

.am-help-related {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .5rem;
  margin-block-start: 1rem;
  padding-block-start: .75rem;
  border-block-start: 1px solid var(--am-border, #E2E5EA);
  font-size: var(--am-text-sm, .875rem);
}

.am-help-related-label {
  font-size: var(--am-text-xs, .75rem);
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--am-help-label, #646D79);
}

.am-help-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.am-help-chip {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
  padding: .15rem .4rem .15rem .6rem;
  border-radius: var(--am-radius-pill, 999px);
  border: 1px solid var(--am-border, #E2E5EA);
  background-color: var(--am-surface-sunk, #F7F8FA);
  font-size: var(--am-text-xs, .75rem);
  text-decoration: none;
  color: var(--am-text-muted, #5E6673);
  transition: border-color var(--am-speed, 160ms) var(--am-ease, ease),
              color var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help-chip:hover,
.am-help-chip:focus-visible {
  border-color: var(--am-accent, #272E7E);
  color: var(--am-help-ink-accent, #272E7E);
}


/* --- Foot ---------------------------------------------------------------- */

.am-help-empty {
  padding: var(--am-gap-lg, 1.5rem);
  text-align: center;
  color: var(--am-text-muted, #5E6673);
}

.am-help-footer {
  margin-block-start: var(--am-gap-xl, 2.5rem);
  padding-block-start: var(--am-gap, 1rem);
  border-block-start: 1px solid var(--am-border, #E2E5EA);
  font-size: var(--am-text-sm, .875rem);
  color: var(--am-text-muted, #5E6673);
}

.am-help-footer p {
  margin: 0 0 .35rem;
}


/* --- Back to top ---------------------------------------------------------- */

/*
 * Added by script once the reader is far enough down to have lost the
 * contents list. It is not rendered server-side because a button that scrolls
 * the page is meaningless without script, and shipping it disabled would be a
 * dead control on a printed page and in a text browser.
 */
.am-help-totop {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline-end: 1.25rem;

  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .5rem .8rem;

  font-size: var(--am-text-xs, .75rem);
  font-weight: 600;
  text-decoration: none;
  color: var(--am-text, #1F2530);

  border: 1px solid var(--am-border-strong, #C9CED7);
  border-radius: var(--am-radius-pill, 999px);
  background-color: var(--am-surface, #FFFFFF);
  box-shadow: var(--am-shadow, 0 8px 24px rgb(16 24 40 / .06));

  /* Off until earned. Both properties transition so it fades AND lifts in,
     and pointer-events keeps it unclickable while invisible. */
  opacity: 0;
  translate: 0 .5rem;
  pointer-events: none;
  transition: opacity var(--am-speed, 160ms) var(--am-ease, ease),
              translate var(--am-speed, 160ms) var(--am-ease, ease);
}

.am-help-totop.is-on {
  opacity: 1;
  translate: 0 0;
  pointer-events: auto;
}

.am-help-totop:hover,
.am-help-totop:focus-visible {
  border-color: var(--am-accent, #272E7E);
  color: var(--am-help-ink-accent, #272E7E);
}


/* --- Search filtering ---------------------------------------------------- */

/* Set by script. A plain [hidden] would be overridden by the display rules
   above, which is the usual reason a filter appears to do nothing. */
.am-help-topic[data-am-hidden],
.am-help-section[data-am-hidden] {
  display: none;
}


/* --- Print --------------------------------------------------------------- */

@media print {
  .am-help-search,
  .am-help-totop,
  .am-help-anchor { display: none; }

  /* The contents list keeps its page numbers nowhere, but it is still the map
     of a printed manual -- and the "start here" panel is the first thing a
     new starter should meet on paper too. Both stay. */
  .am-help-toc,
  .am-help-start {
    break-inside: avoid;
  }

  .am-help-topic {
    border: 0;
    padding: 0;
    margin-block-start: 1.25rem;
    break-inside: avoid;
  }

  .am-help-section-head {
    break-after: avoid;
    break-inside: avoid;
  }

  /* Backgrounds are commonly dropped by print settings, which would leave the
     step numbers as white-on-white. An outlined marker survives either way. */
  .am-help-steps > li::before {
    color: var(--am-text, #1F2530);
    background: transparent;
    border: 1px solid var(--am-text, #1F2530);
  }
}
