/* ------------------------------------------------------------------
   Shared tooltip. Matches the HubSpot form tooltip (.hs-tip in form.css):
   16px info disc, navy bubble, CSS-only reveal.

   Opens downward by default. Consumers that sit against an edge can switch
   the anchor with .tooltip--align-start / .tooltip--align-end, or override
   .tooltip__bubble positioning in their own stylesheet.
   ------------------------------------------------------------------ */
.tooltip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 0.4rem;
}

.tooltip__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--color-blue-light);
  line-height: 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tooltip__trigger svg {
  display: block;
}

.tooltip__trigger:hover {
  color: var(--color-blue);
}

.tooltip__trigger:focus-visible {
  outline: 2px solid var(--color-navy);
  outline-offset: 2px;
}

.bg-blue .tooltip__trigger:focus-visible,
.bg-gradient .tooltip__trigger:focus-visible {
  outline-color: var(--color-white);
}

.tooltip__bubble {
  position: absolute;
  top: calc(100% + 0.8rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 24rem;
  padding: 8px 10px;
  border-radius: 4px;
  background-color: var(--color-navy);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-family: var(--font-inter);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

/* The navy bubble is close in tone to the dark section backgrounds, so give it
   an edge there to keep it readable as a distinct surface. */
.bg-blue .tooltip__bubble,
.bg-gradient .tooltip__bubble {
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Anchor left/right instead of centring, for triggers near a container edge. */
.tooltip--align-start .tooltip__bubble {
  left: 0;
  transform: none;
}

.tooltip--align-end .tooltip__bubble {
  left: auto;
  right: 0;
  transform: none;
}

/* Keeping the bubble open on its own hover lets the pointer cross the gap from
   the trigger without the bubble closing mid-read. */
.tooltip__trigger:hover + .tooltip__bubble,
.tooltip__trigger:focus-visible + .tooltip__bubble,
.tooltip__bubble:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Touch devices: :focus-visible is a keyboard-modality heuristic and doesn't
   match a tapped button, so the reveal above is unreachable by tap. Plain
   :focus scoped to (hover: none) only matches touch-primary devices. */
@media (hover: none) {
  .tooltip__trigger:focus + .tooltip__bubble {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

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