/* =========================================================================
   Badge tooltip — shared across the calendar host badges and the playing
   groups widget badges.

   This is a self-contained port of the handicap-system tooltip
   (.tooltip-trigger / .tooltip-content). It is intentionally namespaced
   (.sohg-badge-tooltip) and uses literal values rather than the handicap
   design-system custom properties (--stripe-*, --space-*, etc.), because
   those variables do not exist on the calendar or widget pages.

   Unlike the handicap tooltip, the bubble here is INTERACTIVE: it contains a
   link, so pointer-events are enabled when open and the open/close state is
   driven by JS (.is-open) with a small close delay so the cursor can travel
   from the icon into the bubble. The :hover / :focus-within rules below are a
   no-JS fallback only.
   ========================================================================= */

.sohg-badge-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  vertical-align: middle;
  line-height: 1;
  cursor: help;
}

.sohg-badge-tooltip i.fa-question-circle {
  font-size: 0.875rem;
  color: #425466;
  transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sohg-badge-tooltip:hover i.fa-question-circle,
.sohg-badge-tooltip:focus i.fa-question-circle,
.sohg-badge-tooltip.is-open i.fa-question-circle {
  color: #0154A6;
}

.sohg-badge-tooltip__content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  /* Hardened against theme/Elementor resets that collapse the box to one line
     (e.g. white-space:nowrap, display:inline/flex on spans). */
  display: block !important;
  box-sizing: border-box !important;
  width: 280px !important;
  max-width: calc(100vw - 16px);
  height: auto !important;
  min-height: 75px !important;
  max-height: none !important;
  white-space: normal !important;
  padding: 1rem;
  background: #0a2540 !important;
  color: #ffffff !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5 !important;
  text-align: left;
  text-transform: none;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),
              visibility 150ms cubic-bezier(0.4, 0, 0.2, 1),
              transform 150ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Max z-index so the bubble paints over the badge image and the adjacent
     widget fields, which otherwise cover its lower half. */
  z-index: 2147483647 !important;
}

/* Arrow */
.sohg-badge-tooltip__content::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  margin-left: -6px;
  width: 12px;
  height: 12px;
  background: #0a2540 !important;
  transform: rotate(45deg);
  border-radius: 2px;
}

/* Links inside the bubble stay readable against the dark background.
   !important guards against the theme's link colour/decoration resets. */
.sohg-badge-tooltip__content a,
.sohg-badge-tooltip__content a:link,
.sohg-badge-tooltip__content a:visited {
  color: #ffffff !important;
  font-weight: 600;
  text-decoration: underline !important;
}

.sohg-badge-tooltip__content a:hover,
.sohg-badge-tooltip__content a:focus {
  color: #ffffff !important;
  text-decoration: underline !important;
}

/* Shown state. JS adds .is-open for hover, focus AND tap so all three behave
   identically; the :hover/:focus-within selectors are the no-JS fallback. */
.sohg-badge-tooltip.is-open .sohg-badge-tooltip__content,
.sohg-badge-tooltip__content.is-open,
.sohg-badge-tooltip:hover .sohg-badge-tooltip__content,
.sohg-badge-tooltip:focus-within .sohg-badge-tooltip__content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* When JS pins the bubble to the viewport (so it can't be clipped by a
   scrolling container or pushed off-screen), the left/top values are written
   inline and the arrow tracks the trigger through --tooltip-arrow-left. Only
   fade + lift are transitioned; animating the inline top/left would slide the
   bubble across the screen. */
.sohg-badge-tooltip__content.is-fixed {
  position: fixed;
  left: auto;
  transform: translateY(4px);
  transition-property: opacity, visibility, transform;
}

.sohg-badge-tooltip.is-open .sohg-badge-tooltip__content.is-fixed,
.sohg-badge-tooltip__content.is-fixed.is-open {
  transform: translateY(0);
}

.sohg-badge-tooltip__content.is-fixed::before {
  left: var(--tooltip-arrow-left, 50%);
  margin-left: -6px;
}

/* Bubble flipped below the trigger: arrow moves to the top edge. */
.sohg-badge-tooltip__content.is-fixed.is-below::before {
  bottom: auto;
  top: -6px;
}
