/* Reusable explainer popover (js/popover.js). Markup:
   <span class="pop-wrap"><button class="pop-btn" type="button" aria-expanded="false" aria-controls="ID">Label</button>
   <span class="pop" id="ID">Longer explanation</span></span>
   Opens on hover or keyboard focus (desktop) and on tap (touch); Esc or a tap outside closes it. The script sets
   --pop-x (left offset, keeps it on screen), --pop-arrow (arrow position) and data-side ("top" when it flips). */
.pop-wrap { position: relative; display: inline-block; max-width: 100%; }
.pop-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pop-btn::after { content: "i"; flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%; color: var(--brand); font: 700 11px/1 var(--mono); }
.pop-btn { position: relative; min-width: 24px; min-height: 24px; }
.pop-btn::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 44px; transform: translateY(-50%); } /* 44 px to tap */
.pop-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 999px; }
.pop {
  position: absolute; z-index: 30; top: calc(100% + 12px); left: var(--pop-x, 0px);
  box-sizing: border-box; width: max-content; max-width: min(264px, calc(100vw - 24px));
  padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(14, 20, 64, 0.12);
  color: var(--ink); font: 400 var(--fs-sm)/1.5 var(--body); text-align: left; white-space: normal; text-transform: none; letter-spacing: 0;
  display: none; /* not just hidden: a hidden popover would still widen the page */
}
.pop-wrap.is-open .pop { display: block; }
/* arrow, and an invisible bridge so the pointer can travel from the button into the popover */
.pop::before { content: ""; position: absolute; top: -6px; left: var(--pop-arrow, 24px); width: 10px; height: 10px; margin-left: -5px; background: var(--paper); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.pop::after { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }
.pop[data-side="top"] { top: auto; bottom: calc(100% + 12px); }
.pop[data-side="top"]::before { top: auto; bottom: -6px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pop[data-side="top"]::after { top: auto; bottom: -14px; }
/* Icon-only variant (the fee note): a button with just an aria-label and the round i, set after a word or number. */
.pop-i { display: inline-flex; vertical-align: -4px; margin-inline-start: 6px; }
.pop-i::before { left: -12px; right: -12px; }
