/* Scrubbable numbers in prose. Colour comes from currentColor, so a span
   with data-ent picks up its entity hue from the registry's linkage CSS and
   the dashed underline follows. Without data-ent it uses --accent. */

.scrub {
  position: relative;
  color: var(--scrub-color, var(--accent, #7cc4ff));
  border-bottom: 1px dashed currentColor;
  cursor: col-resize;
  touch-action: none;           /* the span only, so the page still scrolls */
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border-radius: 2px;
}
.scrub[data-ent] { cursor: col-resize; }   /* beat registry's cursor: default */

/* R15: an invisible hit area at least 40px tall and 40px wide, whatever the
   font size. Pseudo-elements take pointer events for their host. */
.scrub::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% + 8px);
  min-width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
}

/* The tiny "drag" hint above the number. */
.scrub::after {
  content: attr(data-hint);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);   /* clear of the focus ring */
  transform: translateX(-50%);
  font: 600 9px/1 system-ui, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #8a8a9c);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms;
}
.scrub:not([data-hint])::after { content: "drag"; }
.scrub.scrub-hint::after { opacity: 0.9; }

.scrub.scrub-drag { border-bottom-style: solid; filter: brightness(1.25); }
html.scrubbing, html.scrubbing * { cursor: col-resize !important; user-select: none; }

.scrub:focus { outline: none; }
.scrub:focus-visible {
  outline: 2px solid var(--focus, var(--accent, #7cc4ff));
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .scrub::after { transition: none; }
}
