/* ==========================================================
   Deltavisor · the history chart (site/property/chart.js): one property's records counted over
   time, on the shared `.dv-hist` (../css/hist.css), plus the floating readout and the key the
   site adds.

   Bars are drawn at full color, as every histogram is. A bar lit by the pointer or the keyboard
   takes a quiet column wash, as the app's interactive histogram does on hover.
========================================================== */
.dv-hist--history { --dv-hist-h: 4rem; }
.dv-hist--history .dv-hist__bars { border-radius: var(--radius-sm); cursor: default; }
.dv-hist--history .dv-hist__bars:focus-visible { outline: 0.125rem solid var(--accent); outline-offset: 0.25rem; }
.dv-hist--history .dv-hist__bar { border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: background var(--dur) var(--ease); }
.dv-hist--history .dv-hist__bar.is-active { background: var(--paper-3); }
@media (max-width: 34rem) { .dv-hist--history { --dv-hist-h: 3.25rem; } }

.dv-history { position: relative; }

/* The readout: a raised label floating above the bars, anchored on the lit bar's center by the
   script (`left`, and `top` at the bars' upper edge), lifted clear of them by the transform. It
   takes no layout space, so lighting a bar moves nothing on the page. */
.dv-history__tip {
  position: absolute; z-index: 5; left: 0; top: 0;
  transform: translate(-50%, calc(-100% - 0.5rem));
  /* Sized to its content, not to the room right of its anchor, which near the right edge is
     almost none and would squeeze the label into an ellipsis before the script clamps it. */
  width: max-content; min-width: 9rem; max-width: 16rem;
  padding: var(--s-2) var(--s-3);
  background: var(--paper-3); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity var(--dur-fast) var(--ease), visibility 0s linear var(--dur-fast);
}
.dv-history__tip.is-on { opacity: 1; visibility: visible; transition: opacity var(--dur-fast) var(--ease); }
.dv-history__tip-h { color: var(--ink); font-size: var(--t-sm); font-weight: 600; font-variant-numeric: tabular-nums; margin-bottom: var(--s-1); }
.dv-history__tip-none { color: var(--ink-mid); font-size: var(--t-xs); }
.dv-history__tip-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1875rem; }
.dv-history__tip-rows li { display: grid; grid-template-columns: 0.5rem minmax(0, 1fr) auto; align-items: center; gap: var(--s-2); font-size: var(--t-xs); color: var(--ink-soft); white-space: nowrap; }
.dv-history__tip-rows i { width: 0.5rem; height: 0.5rem; border-radius: 50%; }
.dv-history__tip-rows span { overflow: hidden; text-overflow: ellipsis; }
.dv-history__tip-rows b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* What a screen reader hears as a bar is lit; the floating label is aria-hidden. */
.dv-history__live {
  position: absolute; width: 0.0625rem; height: 0.0625rem; padding: 0; margin: -0.0625rem; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.dv-history__key { list-style: none; margin: var(--s-1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); }
.dv-history__key li { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink-mid); font-size: var(--t-xs); }
.dv-history__key i { width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .dv-hist--history .dv-hist__bar, .dv-history__tip, .dv-history__tip.is-on { transition: none; }
}
