/* help.css
   Styles for the in-app User guide (help centre) and the reusable "?" help
   tooltips. Everything is themed through the design tokens (main.css :root,
   overridden per theme in themes.css) so the guide and tips restyle with the
   chosen theme. Tap targets stay large for small hands, and the popover reveal
   is gated behind a reduced-motion guard so it stops cleanly when asked. */

/* ------------------------------------------------------------------ *
 * The "?" help-tip button and its popover.
 * ------------------------------------------------------------------ */
.help-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  margin: 0 1px;
  flex: 0 0 auto;
  border-radius: 50%;
  /* Subtle by default: a faint "?" hint, not a button. No solid ring, muted and
     semi-transparent, so it sits quietly beside the real controls. It gains a
     ring and full strength only on hover, focus, or while its popover is open. */
  border: 1px solid transparent;
  background: transparent;
  color: var(--gold);
  opacity: 0.5;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
}
.help-tip-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(201, 168, 76, 0.5);
}
.help-tip-btn[aria-expanded='true'] {
  opacity: 1;
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}
.help-tip-btn:focus-visible {
  opacity: 1;
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* The popover floats above everything (above overlays at z 60) and is positioned
   in script. It is themed and sized for a short, readable hint. */
.help-tip-pop {
  position: fixed;
  z-index: 200;
  max-width: min(280px, calc(100vw - 16px));
  background: linear-gradient(180deg, #11173a, #0a0e2e);
  /* Tint the bubble to the active surface so it follows the theme. */
  background: linear-gradient(180deg, color-mix(in srgb, var(--navy) 88%, #ffffff 12%), var(--navy));
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow, 0 10px 30px rgba(0, 0, 0, 0.45));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}
.help-tip-pop.shown { opacity: 1; transform: translateY(0); }
.help-tip-pop.no-anim { transition: none; transform: none; }
.help-tip-pop:focus-visible,
.help-tip-pop:focus { outline: none; }

.help-tip-text {
  font-size: 15px;
  line-height: 1.4;
}
.help-tip-close {
  margin-top: 10px;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--gold);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--cream);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.help-tip-close:hover { background: rgba(255, 255, 255, 0.16); }
.help-tip-close:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* A small arrow pointing toward the "?". Its horizontal position is set in
   script (clamped to the bubble); it flips edge for above vs below placement. */
.help-tip-arrow {
  position: absolute;
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid var(--gold);
  border-top: 1px solid var(--gold);
  transform: rotate(45deg);
}
.help-tip-pop[data-placement='below'] .help-tip-arrow { top: -7px; }
.help-tip-pop[data-placement='above'] .help-tip-arrow {
  bottom: -7px;
  transform: rotate(225deg);
}

/* A small inline label + "?" grouping for callers that want both. Used widely
   to drop a "?" beside a heading, label or score block. flex-wrap keeps a long
   heading and its "?" tidy at large text sizes. */
.help-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.help-row-label { font-size: inherit; }

/* Header "?" buttons are extra subtle: smaller and fainter so they read as
   quiet hints beside the icons, never as another control. They brighten on use. */
.app-header .help-tip-btn { width: 20px; height: 20px; min-height: 20px; font-size: 11px; margin: 0; opacity: 0.4; }
.app-header .help-tip-btn:hover,
.app-header .help-tip-btn:focus-visible,
.app-header .help-tip-btn[aria-expanded='true'] { opacity: 1; }

/* The start-screen join row keeps its primary button full width with the "?"
   tucked alongside. */
.title-join-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; }
.title-join-row .btn-amber.big { margin-top: 0; }
.setup-title-row { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------------------ *
 * The User guide / help centre screen.
 * ------------------------------------------------------------------ */
.guide-screen { max-width: 720px; margin: 0 auto; }

.guide-search-row { margin: 4px 0 14px; }
.guide-search {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}

/* Table of contents: a wrap of large, tappable chips. */
.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.guide-toc-item {
  flex: 1 1 auto;
  min-height: 44px;
  text-align: left;
  background: var(--panel, rgba(255, 255, 255, 0.06));
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.guide-toc-item:hover { background: rgba(255, 255, 255, 0.12); }
.guide-toc-item:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.guide-section {
  border-top: 1px solid rgba(201, 168, 76, 0.3);
  padding-top: 12px;
  margin-top: 12px;
  scroll-margin-top: 12px;
}
.guide-section-title { margin-top: 0; }
.guide-section-blurb { margin-bottom: 12px; }

.guide-entries { display: flex; flex-direction: column; gap: 12px; }
.guide-entry {
  background: var(--panel, rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
}
.guide-q {
  font-family: var(--font-head);
  color: var(--gold);
  font-size: 17px;
  margin-bottom: 6px;
}
.guide-a {
  color: var(--cream);
  font-size: 15px;
  line-height: 1.5;
}

.guide-top-btn { margin-top: 12px; }
.guide-empty { margin-top: 18px; }

/* ------------------------------------------------------------------ *
 * Reduced motion: no animated reveal, instant show. Mirrors the project
 * convention (media query plus the body.reduce-motion class set by effects).
 * ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .help-tip-pop { transition: none; transform: none; }
}
body.reduce-motion .help-tip-pop { transition: none; transform: none; }
