/* The site's tooltip (app/lib/tooltip.js) for title="", and the operator charts'
   pointer tip (operator/shell.js, .is-follow). A popover, so the UA's centring
   and frame are reset. The buff tooltip (plan.css) shares its surface and
   arrow. */

@layer components {
  /* The tooltip surface, shared with the buff tooltip (plan.css). */
  :is(.ui-tip, .buff-tip) {
    border: 1px solid var(--border-hover);
    border-radius: 7px;
    background: var(--bg-card);
    box-shadow: 0 6px 18px rgb(0 0 0 / 40%);
  }

  .ui-tip {
    position: fixed;
    inset: auto;
    top: 0;
    left: 0;
    z-index: 1000;
    margin: 0;
    max-width: min(280px, calc(100vw - 16px));
    padding: 6px 10px;
    color: var(--text-primary);
    font: 500 12px/1.4 var(--font-heading);
    white-space: pre-line;
    overflow: visible;
    overflow-wrap: anywhere;
    pointer-events: none;
    opacity: 0;
    transition: opacity 90ms ease-out;
  }

  .ui-tip.is-open,
  .ui-tip.is-follow {
    opacity: 1;
  }

  .ui-tip[hidden] {
    display: none;
  }

  /* The arrow, at --tip-arrow from the left, towards the element. */
  :is(.ui-tip, .buff-tip)[data-side]::before {
    content: "";
    position: absolute;
    left: var(--tip-arrow, 50%);
    width: 8px;
    height: 8px;
    border: solid var(--border-hover);
    background: var(--bg-card);
    translate: -50% 0;
    rotate: 45deg;
  }

  :is(.ui-tip, .buff-tip)[data-side="top"]::before {
    bottom: -5px;
    border-width: 0 1px 1px 0;
  }

  :is(.ui-tip, .buff-tip)[data-side="bottom"]::before {
    top: -5px;
    border-width: 1px 0 0 1px;
  }

  .ui-tip.is-follow {
    display: grid;
    gap: 2px;
    max-width: 260px;
    padding: 7px 10px;
    color: var(--text-secondary);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    white-space: normal;
    transition: none;
  }

  .ui-tip.is-follow[hidden] {
    display: none;
  }

  .ui-tip strong {
    color: var(--text-primary);
    font-weight: 600;
  }
}
