/*
 * components/help.css — Help indicator + educational panel (Session 5: UI Lab).
 *
 * Paired with templates/components/help.html. The help indicator is a
 * CSS-only hover/focus popover (like tooltip but for inline help).
 * The education panel is a collapsible rich-content block (S11 will wire
 * it to topics.py). Token-driven (D5).
 */

.help-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-fg-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  cursor: help;
  margin-left: var(--space-1);
  vertical-align: middle;
}

.help-indicator__pop {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%) translateY(var(--space-1));
  width: 15rem;
  background: var(--color-fg);
  color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--fs-sm);
  font-weight: var(--fw-normal);
  line-height: var(--lh-base);
  text-align: left;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
  z-index: var(--z-popover);
  pointer-events: none;
}

.help-indicator:hover .help-indicator__pop,
.help-indicator:focus .help-indicator__pop,
.help-indicator:focus-within .help-indicator__pop {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Topic indicator (help_topic): the popover carries a clickable "Learn more"
 * link, so it must accept pointer events (the plain popover does not). The
 * popover is a DOM descendant of .help-indicator, so :hover/:focus-within on
 * the container keeps it open while the pointer or keyboard focus is on the
 * link. */
.help-indicator__pop--rich { pointer-events: auto; }

.help-indicator__text { display: block; }

.help-indicator__learn {
  display: inline-block;
  margin-top: var(--space-2);
  color: var(--color-surface);
  font-weight: var(--fw-semibold);
  text-decoration: underline;
}

.help-indicator__learn:hover { opacity: 0.85; }
.help-indicator__learn:focus-visible { outline: 2px solid var(--color-surface); outline-offset: 2px; }

/* Education panel */
.education-panel__trigger {
  appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

.education-panel__trigger:hover { text-decoration: underline; }
.education-panel__trigger:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

.education-panel__body {
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-fg);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-2);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
}

.education-panel__body[hidden] { display: none; }

.education-panel__title { margin: 0 0 var(--space-3); font-size: var(--fs-lg); color: var(--color-info-fg); }

.education-panel__section { margin-bottom: var(--space-3); }
.education-panel__section h5 { margin: 0 0 var(--space-1); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-fg-muted); }
.education-panel__section p { margin: 0; }

.education-panel__learn {
  display: inline-block;
  margin-top: var(--space-2);
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
}
.education-panel__learn:hover { text-decoration: underline; }
.education-panel__learn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .help-indicator__pop { transition: none; }
}
