/* Dolvero v2 - select control.
   Pairs with assets/v2-select.js. Everything is drawn from the shared tokens in
   v2.css, so the control follows the theme toggle with no per-scheme rules of
   its own. */

.v2sel{position:relative;display:inline-flex;min-width:0;max-width:100%}

/* The native element stays in the DOM and in the form, but must not be visible
   or focusable. display:none would drop it from some form serialisations, so it
   is collapsed instead. */
.v2sel__native{position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}

.v2sel__btn{
  display:flex;align-items:center;gap:8px;width:100%;min-width:0;
  height:34px;padding:0 10px 0 12px;
  font-family:inherit;font-size:13.5px;font-weight:500;line-height:1;
  color:var(--text);
  background:var(--w1,rgba(255,255,255,.03));
  border:1px solid var(--line);border-radius:9px;
  cursor:pointer;text-align:left;
  transition:border-color .14s ease,background .14s ease;
}
.v2sel__btn:hover{border-color:var(--line2)}
.v2sel__btn:focus-visible{outline:none;border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(79,125,240,.22)}
.v2sel.is-open .v2sel__btn{border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(79,125,240,.16)}
.v2sel.is-disabled .v2sel__btn,.v2sel__btn:disabled{opacity:.5;cursor:not-allowed}

.v2sel__val{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-variant-numeric:tabular-nums}
.v2sel.is-empty .v2sel__val{color:var(--faint)}

.v2sel__caret{flex:none;width:9px;height:9px;margin-left:2px;
  border-right:1.6px solid var(--muted);border-bottom:1.6px solid var(--muted);
  transform:translateY(-2px) rotate(45deg);transition:transform .18s ease}
.v2sel.is-open .v2sel__caret{transform:translateY(1px) rotate(-135deg)}

/* ---- the panel ----
   Body-level and fixed, so no ancestor's overflow or stacking context can clip
   it. z-index sits above the nav (which is 60 in v2.css). */
/* `body > .v2sel__panel`, not `.v2sel__panel`. The panel is appended to <body>
   so it can escape any card's overflow, which puts it in range of this rule in
   v2-bg.css:

       body > *:not(.bg){position:relative;z-index:1}

   That selector scores 0-1-1 and a bare class scores 0-1-0, so it WON: the panel
   was handed position:relative, its fixed coordinates were measured against its
   static position at the end of the document, and it opened somewhere below the
   whole page. The button looked open and nothing appeared. Matching 0-1-1 and
   loading after v2-bg.css takes the position back. v2-bg.css says as much in its
   own comment - anything deliberately layered has to reclaim it here. */
body > .v2sel__panel{
  position:fixed;z-index:400;
  min-width:180px;max-width:min(92vw,460px);
  padding:5px;
  /* --solid-fallback, NOT --panel2. Thirteen page stylesheets redefine
     --panel2 as a translucent rgba for their own glass panels, and this menu is
     appended to <body>, so on every one of those pages it inherited a
     see-through surface and the balance behind it read straight through the
     options. --solid-fallback is defined in v2-bg.css in both themes and is
     genuinely opaque, which is what a menu covering live figures has to be. */
  background:var(--solid-fallback);
  border:1px solid var(--line2);border-radius:11px;
  box-shadow:0 18px 44px rgba(0,0,0,.42),0 2px 8px rgba(0,0,0,.28);
  overflow-y:auto;overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
:root[data-theme="light"] .v2sel__panel{
  box-shadow:0 18px 44px rgba(16,26,48,.16),0 2px 8px rgba(16,26,48,.10);
}
.v2sel__panel[hidden]{display:none}

.v2sel__panel.is-in{animation:v2selIn .14s cubic-bezier(.16,1,.3,1)}
.v2sel__panel.is-in.is-up{animation-name:v2selInUp}
@keyframes v2selIn{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}
@keyframes v2selInUp{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  .v2sel__panel.is-in{animation:none}
  .v2sel__caret{transition:none}
}

.v2sel__grp{
  padding:9px 10px 5px;font-size:9.5px;font-weight:800;letter-spacing:.1em;
  text-transform:uppercase;color:var(--faint)}
.v2sel__grp:first-child{padding-top:5px}

.v2sel__opt{
  display:flex;align-items:center;gap:8px;
  padding:8px 10px;border-radius:7px;
  font-size:13.5px;line-height:1.35;color:var(--muted);
  cursor:pointer;user-select:none}
.v2sel__opt:hover{color:var(--text);background:var(--w1,rgba(255,255,255,.045))}

/* Keyboard focus is a distinct state from pointer hover: the active row must be
   obvious while arrowing even though the mouse is elsewhere. */
.v2sel__opt.is-active{color:var(--text);background:rgba(79,125,240,.16);
  box-shadow:inset 0 0 0 1px rgba(79,125,240,.34)}
.v2sel__opt.is-on{color:var(--text);font-weight:600}
.v2sel__opt[aria-disabled="true"]{opacity:.4;cursor:not-allowed}
.v2sel__opt[aria-disabled="true"]:hover{background:none;color:var(--muted)}

.v2sel__lbl{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-variant-numeric:tabular-nums}

/* The tick column is always present so labels align whether or not a row is the
   selected one - a checkmark that shifts the text is worse than no checkmark. */
.v2sel__tick{flex:none;width:14px;height:14px;position:relative}
.v2sel__opt.is-on .v2sel__tick::after{
  content:"";position:absolute;left:4px;top:1px;width:4px;height:8px;
  border-right:2px solid var(--accent);border-bottom:2px solid var(--accent);
  transform:rotate(45deg)}

@media (max-width:600px){
  .v2sel__panel{max-width:calc(100vw - 20px)}
  .v2sel__opt{padding:11px 10px}   /* 44px touch target */
}

/* ---------- tooltips ----------
   Pairs with assets/v2-tip.js, which replaces the OS tooltip on [data-tip].
   Body-level and fixed, like the select panel, so the nav's overflow cannot
   clip it. Sits above the select panel because a tip can open over one. */
/* Same trap as the select panel above: body-level, so it must out-specify
   body > *:not(.bg) or it loses position:fixed and drifts off-screen. */
body > .v2tip{position:fixed;z-index:500;max-width:260px;
  padding:6px 9px;border-radius:7px;
  font-size:12px;font-weight:500;line-height:1.4;
  color:var(--text);background:var(--raise,#141d31);
  border:1px solid var(--line2);
  box-shadow:0 10px 26px -12px rgba(0,0,0,.55);
  pointer-events:none;                       /* never eat a click meant for the control */
  opacity:0;transform:translateY(-2px);
  transition:opacity .12s ease,transform .12s ease}
:root[data-theme="light"] .v2tip{
  background:#101a2e;color:#eaf0fb;border-color:rgba(255,255,255,.10);
  box-shadow:0 10px 26px -12px rgba(16,26,48,.34)}
.v2tip.is-in{opacity:1;transform:none}
.v2tip.is-up{transform:translateY(2px)}
.v2tip.is-up.is-in{transform:none}
.v2tip[hidden]{display:none}
@media (prefers-reduced-motion:reduce){.v2tip{transition:none}}
