/*
 * Attribute-driven tooltips ([data-tip]) for the Blade buyer / advisor portal.
 *
 * Port of the [data-tip] block in resources/css/app.css (the React workspace),
 * for pages that do not load the Vite bundle. Keep the two in step.
 *
 * Usage:   <button data-tip="Saves your note — no email is sent">…</button>
 *          data-tip-pos="bottom" | "left" | "right" when the default (above) would clip.
 *
 * - The bubble is the host's ::after and the arrow its ::before, so never put
 *   data-tip on an element that uses its own ::before/::after.
 * - data-tip="" renders nothing, so conditional strings are safe.
 * - Hover reveal only on devices that truly hover; keyboard focus also reveals.
 * - position: relative is applied via :where() (zero specificity) so any class
 *   or inline style that positions the host still wins.
 */
:where([data-tip]) { position: relative; }

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -6px);
    width: max-content;
    max-width: 280px;
    padding: 5px 10px;
    border-radius: 8px;
    background: #1B2A4A;
    color: #fff;
    font: 400 11px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
    text-align: left;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.25);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease, visibility 0s linear;
}

[data-tip]::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -2px);
    border: 4px solid transparent;
    border-top-color: #1B2A4A;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 120ms ease, visibility 0s linear;
}

[data-tip=""]::after,
[data-tip=""]::before { display: none; }

[data-tip][data-tip-pos="bottom"]::after { bottom: auto; top: 100%; transform: translate(-50%, 6px); }
[data-tip][data-tip-pos="bottom"]::before { bottom: auto; top: 100%; transform: translate(-50%, 2px); border-top-color: transparent; border-bottom-color: #1B2A4A; }

[data-tip][data-tip-pos="left"]::after { bottom: auto; left: auto; right: 100%; top: 50%; transform: translate(-6px, -50%); }
[data-tip][data-tip-pos="left"]::before { bottom: auto; left: auto; right: 100%; top: 50%; transform: translate(-2px, -50%); border-top-color: transparent; border-left-color: #1B2A4A; }

[data-tip][data-tip-pos="right"]::after { bottom: auto; left: 100%; top: 50%; transform: translate(6px, -50%); }
[data-tip][data-tip-pos="right"]::before { bottom: auto; left: 100%; top: 50%; transform: translate(2px, -50%); border-top-color: transparent; border-right-color: #1B2A4A; }

@media (hover: hover) {
    [data-tip]:hover::after,
    [data-tip]:hover::before { opacity: 1; visibility: visible; transition-delay: 180ms; }
}

[data-tip]:focus-visible::after,
[data-tip]:focus-visible::before { opacity: 1; visibility: visible; transition-delay: 0ms; }
