/* ui/QuantaCounter — the Quanta balance. Contract: ./QuantaCounter.spec.md */

.qc-quanta {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--qc-font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--qc-text);
  white-space: nowrap;
}
.qc-quanta[data-size="md"] .qc-quanta__value { font-size: 18px; }
.qc-quanta[data-size="sm"] { gap: 5px; }
.qc-quanta[data-size="sm"] .qc-quanta__value { font-size: 13px; }

.qc-quanta__glyph {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--qc-glyph, 16px);
  height: var(--qc-glyph, 16px);
  vertical-align: middle;
  transition: opacity var(--qc-dur) var(--qc-ease-out), filter var(--qc-dur) var(--qc-ease-out);
}
/* The rhombus: a square turned a quarter, its diagonal the glyph's size. */
.qc-quanta__glyph::before {
  content: "";
  position: absolute;
  width: 70%;
  height: 70%;
  transform: rotate(45deg);
  border: 1px solid var(--qc-quanta);
  background: color-mix(in srgb, var(--qc-quanta) 12%, transparent);
}
.qc-quanta__core {
  position: relative;
  width: 24%;
  height: 24%;
  min-width: 2px;
  min-height: 2px;
  border-radius: 50%;
  background: var(--qc-text);
}

.qc-quanta[data-state="gain"] .qc-quanta__glyph {
  filter: drop-shadow(0 0 5px var(--qc-quanta)) drop-shadow(0 0 var(--qc-glow-sm) color-mix(in srgb, var(--qc-quanta) 60%, transparent));
}
.qc-quanta[data-state="gain"] .qc-quanta__value { text-shadow: 0 0 var(--qc-glow-sm) color-mix(in srgb, var(--qc-quanta) 55%, transparent); }
.qc-quanta[data-state="spend"] .qc-quanta__glyph { opacity: 0.5; }

.qc-quanta__delta {
  position: absolute;
  right: 0;
  bottom: 100%;
  font-size: 13px;
  color: var(--qc-quanta);
  text-shadow: 0 0 var(--qc-glow-sm) color-mix(in srgb, var(--qc-quanta) 60%, transparent);
  animation: qc-quanta-rise 900ms var(--qc-ease-out) both;
}
@keyframes qc-quanta-rise {
  from { transform: translateY(0); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translateY(-12px); opacity: 0; }
}
@keyframes qc-quanta-fade {
  from { opacity: 0; }
  20% { opacity: 1; }
  to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .qc-quanta__delta { animation-name: qc-quanta-fade; }
}
