/* ui/Tooltip - a short text under its trigger, shown at once under the
   cursor or the focus (docs/design-system.md, Components). Ink on the
   surface, no shadow: the one dark floating thing, so it reads as a hint,
   not a panel. */

.tooltip {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.tooltip__tip {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  z-index: var(--z-tooltip);
  display: none;
  width: max-content;
  max-width: 280px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-note);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  text-align: left;
  white-space: normal;
  color: var(--color-text-on-dark);
  background: var(--color-bg-surface-inverse);
  border-radius: var(--radius-small);
  pointer-events: none;
}

.tooltip:hover .tooltip__tip,
.tooltip:focus-within .tooltip__tip {
  display: block;
}

/* A trigger near the right edge of its panel: the tip ends at the
   trigger's right edge, so it stays inside. */
.tooltip--end .tooltip__tip {
  left: auto;
  right: 0;
}
