/*
 * Info tips: a small "i" button that reveals a short explanation.
 *
 * Markup (see core/templates/core/partials/info_tip.html):
 *   <span class="info-tip">
 *     <button class="info-tip__btn" aria-expanded="false" aria-controls="id">...</button>
 *     <span class="info-tip__bubble" id="id" role="tooltip">Text</span>
 *   </span>
 *
 * Hover or keyboard focus shows the bubble; a tap toggles it (static/js/info-tip.js).
 * The bubble anchors to the nearest `.info-tip-anchor` (a label row) so it spans
 * that row and can never run off a phone screen.
 */
.info-tip-anchor {
    position: relative;
}

.info-tip {
    display: inline-flex;
    vertical-align: middle;
}

.info-tip .info-tip__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    position: relative;
    margin: -2px 0 -2px 2px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: var(--brand-navy-light, #3b4c9b);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* A larger invisible hit area for fingers, without moving the layout. */
.info-tip .info-tip__btn::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
}

.info-tip .info-tip__btn .info-tip__icon {
    display: block;
    width: 18px;
    height: 18px;
}

.info-tip .info-tip__btn:hover {
    transform: none;
    box-shadow: none;
}

.info-tip .info-tip__btn:hover,
.info-tip .info-tip__btn[aria-expanded="true"] {
    background: var(--brand-navy-subtle-bg, #eef2ff);
    color: var(--brand-navy);
}

.info-tip .info-tip__btn:focus-visible {
    outline: 2px solid var(--brand-navy);
    outline-offset: 2px;
}

.info-tip__bubble {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-width: 22rem;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    background: var(--brand-surface-dark, #11192c);
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0;
    text-transform: none;
    text-align: left;
    box-shadow: 0 12px 28px -12px rgba(17, 25, 44, 0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    pointer-events: none;
}

.info-tip:has(.info-tip__btn:focus-visible) .info-tip__bubble,
.info-tip.is-open .info-tip__bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
    pointer-events: auto;
}

/* Hover reveal only where a real pointer hovers; on touch screens a tap
   leaves :hover stuck, so taps are handled by the is-open toggle instead. */
@media (hover: hover) {
    .info-tip:hover .info-tip__bubble {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
    }
}

/* Escape pressed: stay closed until the pointer leaves or focus moves. */
.info-tip.is-dismissed .info-tip__bubble {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .info-tip__bubble { transition: none; transform: none; }
}

/* On a dark surface (the streak card, a hero) the button is light, and its
   hover state lightens the surface instead of laying a pale disc over it. */
.info-tip--on-dark .info-tip__btn {
    color: var(--font-on-dark-muted, rgba(255, 255, 255, 0.88));
}

.info-tip--on-dark .info-tip__btn:hover,
.info-tip--on-dark .info-tip__btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.info-tip--on-dark .info-tip__btn:focus-visible {
    outline-color: #ffffff;
}

/* Under centred content the bubble is centred too, instead of hugging the left edge. */
.info-tip--centered .info-tip__bubble {
    width: min(22rem, 100%);
    margin-left: auto;
    margin-right: auto;
}

