/* Tooltip — interactive positioning + stacking for PatternFly v6 tooltips.
   PatternFly styles the bubble itself; this file positions it around the
   trigger (15px / 0.9375rem away, PF's default distance) and lifts it above
   page content with a high z-index — the job PF's popper portal normally does. */

[x-cloak] {
  display: none !important;
}

.pha-tooltip {
  position: relative;
  display: inline-flex;
}

.pha-tooltip > .pf-v6-c-tooltip {
  position: absolute;
  z-index: 9999;

  /* An absolutely positioned box's shrink-to-fit width is capped by its containing
     block — here the trigger wrapper, often just an icon button — which collapsed
     the bubble into an unreadable sliver. width: max-content sizes it to the text
     instead (what PF's body-level popper portal gets for free), and PF's own
     18.75rem cap keeps long content wrapping at the same point as upstream. */
  width: max-content;
  max-width: var(--pf-v6-c-tooltip--MaxWidth, 18.75rem);
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-top {
  inset-block-end: 100%;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  margin-block-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-bottom {
  inset-block-start: 100%;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  margin-block-start: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-left {
  inset-inline-end: 100%;
  inset-block-start: 50%;
  transform: translateY(-50%);
  margin-inline-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-right {
  inset-inline-start: 100%;
  inset-block-start: 50%;
  transform: translateY(-50%);
  margin-inline-start: 0.9375rem;
}

/* Diagonal placements — PF's popper "-start/-end" semantics: the bubble's edge
   aligns with the trigger's matching edge instead of centering on it. PF's own
   stylesheet moves the arrow to the matching corner for these modifiers; these
   rules only place the bubble. */

.pha-tooltip > .pf-v6-c-tooltip.pf-m-top-left {
  inset-block-end: 100%;
  inset-inline-start: 0;
  margin-block-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-top-right {
  inset-block-end: 100%;
  inset-inline-end: 0;
  margin-block-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-bottom-left {
  inset-block-start: 100%;
  inset-inline-start: 0;
  margin-block-start: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-bottom-right {
  inset-block-start: 100%;
  inset-inline-end: 0;
  margin-block-start: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-left-top {
  inset-inline-end: 100%;
  inset-block-start: 0;
  margin-inline-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-left-bottom {
  inset-inline-end: 100%;
  inset-block-end: 0;
  margin-inline-end: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-right-top {
  inset-inline-start: 100%;
  inset-block-start: 0;
  margin-inline-start: 0.9375rem;
}

.pha-tooltip > .pf-v6-c-tooltip.pf-m-right-bottom {
  inset-inline-start: 100%;
  inset-block-end: 0;
  margin-inline-start: 0.9375rem;
}
