/* Help (ux-design 2.7) and its "Contact iGage" form. Page rules, prefixed .help-; everything
 * else comes from app.css components. Colours are --a-* roles only. */

/* ---------------------------------------------------------------- reaching the form */

/* Narrow screens and the signed-out card: a small link that rides the bottom edge while the
 * sections scroll past, then settles just above the contact section it points at. */
.help-jump {
  position: sticky;
  bottom: calc(var(--a-s-4) + env(safe-area-inset-bottom, 0px));
  z-index: 2;
  align-self: flex-end;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  height: var(--a-ctl-h-sm);
  padding: 0 var(--a-s-3);
  border: 1px solid var(--a-border);
  border-radius: 999px;
  background: var(--a-panel);
  color: var(--a-accent);
  font-size: var(--a-fs-13);
  font-weight: 600;
  box-shadow: 0 1px 4px rgb(0 0 0 / .12);
  text-decoration: none;
}
.help-jump:hover { background: var(--a-selected); text-decoration: none; }
/* While the link rides, keep the end of the scrollport clear of it: a link reached with Tab, or
 * an anchor jumped to, scrolls to sit above the link rather than under it. */
html:has(.help-jump) {
  scroll-padding-bottom: calc(var(--a-ctl-h-sm) + 2 * var(--a-s-4) + env(safe-area-inset-bottom, 0px));
}
/* Signed in on a phone the tab bar is pinned along the bottom (app.css): ride above it, and keep
 * that much more clear. */
@media (max-width: 767px) {
  body.app .help-jump { bottom: calc(var(--a-topbar-h) + var(--a-s-4) + env(safe-area-inset-bottom, 0px)); }
  html:has(body.app .help-jump) {
    scroll-padding-bottom: calc(var(--a-topbar-h) + var(--a-ctl-h-sm) + 2 * var(--a-s-4) + env(safe-area-inset-bottom, 0px));
  }
}

/* Wide signed-in screens: the sections keep their reading width and a contact panel holds the
 * space to their right, sticky under the top bar. */
.help-aside { display: none; }
@media (min-width: 1280px) {
  .help-layout {
    display: grid;
    grid-template-columns: minmax(0, 720px) 240px;
    gap: var(--a-s-6);
    align-items: start;
  }
  .help-aside {
    display: block;
    position: sticky;
    top: calc(var(--a-topbar-h) + var(--a-s-6));
  }
  .help-layout .help-jump { display: none; }
}
.help-aside-card { display: flex; flex-direction: column; gap: var(--a-s-3); padding: var(--a-s-4); }
.help-aside-card h2 { margin: 0; font-size: var(--a-fs-16); }
.help-aside-card p { margin: 0; color: var(--a-text-2); font-size: var(--a-fs-13); }
.help-aside-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--a-s-2); }
.help-aside-topic {
  display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px;
  border: 1px solid var(--a-border); border-radius: 999px;
  color: var(--a-text); font-size: var(--a-fs-12); text-decoration: none;
}
.help-aside-topic:hover { background: var(--a-selected); text-decoration: none; }
.help-aside-topic:focus-visible { outline: 2px solid var(--a-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- the form */

.help-form { display: flex; flex-direction: column; gap: var(--a-s-4); margin-top: var(--a-s-2); }
.help-topics { gap: var(--a-s-2); }
.help-topic-list { display: flex; flex-wrap: wrap; gap: var(--a-s-2); }
/* Native radios inside pill-shaped labels: the whole pill is the target, and the checked one
 * carries the accent so the choice reads without the dot. */
.help-topic { position: relative; display: inline-flex; }
.help-topic input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.help-topic label {
  display: inline-flex; align-items: center; min-height: var(--a-ctl-h-sm); padding: 4px 12px;
  border: 1px solid var(--a-border); border-radius: 999px;
  font-size: var(--a-fs-13); font-weight: 400; cursor: pointer;
}
.help-topic input:hover + label { background: var(--a-selected); }
.help-topic input:checked + label {
  border-color: var(--a-accent); background: var(--a-selected); color: var(--a-text); font-weight: 600;
}
.help-topic input:focus-visible + label { outline: 2px solid var(--a-accent); outline-offset: 2px; }
@media (pointer: coarse) { .help-topic label { min-height: 44px; } }
@media (forced-colors: active) {
  .help-topic input:checked + label { border-width: 3px; }
}

.help-form textarea { min-height: 128px; }

/* What the server attaches, in small print the person can check before sending. */
.help-sent-with { display: flex; flex-direction: column; gap: var(--a-s-1); }
.help-context { margin: 0; display: flex; flex-wrap: wrap; gap: 2px var(--a-s-4); font-size: var(--a-fs-12); color: var(--a-text-2); }
.help-context > div { display: flex; gap: var(--a-s-1); min-width: 0; }
.help-context dt { color: var(--a-text-3); }
.help-context dt::after { content: ":"; }
.help-context dd { margin: 0; overflow-wrap: anywhere; }

.help-actions { display: flex; gap: var(--a-s-3); }

/* The honeypot: present for scripts, absent for people, assistive technology and autofill. Not
 * rendered at all, since autofill fills a field that is only moved off screen. */
.help-hp, .help-hp[hidden] { display: none !important; }
