/* timeline-tooltip follows the mouse around and are controlled with stimulus */
.timeline-tooltip {
  position: fixed;
  background: var(--clr-dark-a0-alpha);
  color: var(--clr-light-a0);
  padding: 0.75rem;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 0 10px 0 var(--clr-dark-a10);
  backdrop-filter: blur(4px);
  display: grid;
  row-gap: 0.5rem;
}

.timeline-tooltip .tooltip-header {
  font-weight: bold;
}

.timeline-tooltip .tooltip-body span {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--clr-surface-tonal-a30);
}

.timeline-tooltip .tooltip-body {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.timeline-tooltip .tooltip-divider {
  height: 1px;
  background: var(--clr-surface-tonal-a30);
}

/* hint-tooltip is for short messages (2-4 words) and appear on hover/focus of an element and dont use stimulus */
.hint-tooltip {
  --hint-gap: 0.5rem;
  --hint-enter-shift: 0.25rem;

  max-width: min-content;
  height: auto;
  white-space: nowrap;
  padding: 0.65rem 0.75rem;
  border-radius: var(--border-radius);
  background: var(--clr-dark-a0-alpha);
  color: var(--clr-light-a0);
  box-shadow: 0 0 10px 0 var(--clr-dark-a10);
  font-size: 0.8125rem;
  font-style: italic;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease, translate 120ms ease, visibility 120ms linear;

  /* Fallback placement for browsers without CSS anchor positioning support. */
  position: fixed;
  left: 50%;
  top: calc(100% + var(--hint-gap));
  translate: -50% var(--hint-enter-shift);

  @starting-style {
    opacity: 0;
    translate: -50% calc(var(--hint-enter-shift) + 0.5rem);
  }
}

.has-tooltip:is(:hover, :focus-visible) + .hint-tooltip {
  opacity: 1;
  visibility: visible;
  translate: -50% 0;
}

@supports (anchor-name: --tip) and (left: anchor(center)) {
  /* In anchored mode, keep hint tooltips above the trigger by default. */
  .hint-tooltip {
    left: anchor(center);
    top: anchor(top);
    translate: -50% calc(-100% - (var(--hint-gap) - var(--hint-enter-shift)));
  }

  .has-tooltip:is(:hover, :focus-visible) + .hint-tooltip {
    translate: -50% calc(-100% - var(--hint-gap));
  }
}
