/* Kodza — Badge
   Small labels: soft (default), --solid, --live (a dot that breathes), --mono (a version, a
   hash) and --count, whose number rolls when data-count changes. Tags (--tag) in a
   .kodza-badge-list can be removed: the tag shrinks away and its neighbours glide to their new
   place, across lines too. Monochrome: no color has to carry a meaning.
   Everything is tuned with the --kz-badge-* variables. */
.kodza-badge-row,
.kodza-badge-list {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.kodza-badge {
  --kz-badge-fg: #0a0a0a;
  --kz-badge-soft: rgba(10, 10, 10, 0.07);
  --kz-badge-line: rgba(10, 10, 10, 0.16);
  --kz-badge-ink: #0a0a0a;
  --kz-badge-on-ink: #ffffff;
  --kz-badge-ease: cubic-bezier(0.22, 1, 0.36, 1);

  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--kz-badge-soft);
  color: var(--kz-badge-fg);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.kodza-badge--solid {
  background: var(--kz-badge-ink);
  color: var(--kz-badge-on-ink);
}

.kodza-badge--mono {
  background: none;
  box-shadow: inset 0 0 0 1px var(--kz-badge-line);
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 400;
}

/* Live: a dot, and a ring that leaves it now and then */
.kodza-badge--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 var(--kz-badge-line);
  animation: kodza-badge-live 1.8s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

@keyframes kodza-badge-live {
  0% {
    box-shadow: 0 0 0 0 var(--kz-badge-fg);
  }
  70%,
  100% {
    box-shadow: 0 0 0 7px transparent;
  }
}

/* Count: the number sits in its own window and rolls */
.kodza-badge--count {
  padding-right: 4px;
}

.kodza-badge__count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 999px;
  background: var(--kz-badge-ink);
  color: var(--kz-badge-on-ink);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}

.kodza-badge__count > span {
  grid-area: 1 / 1;
}

/* Tag: a label you can take away */
.kodza-badge--tag {
  height: 30px;
  padding: 0 4px 0 12px;
  font-size: 13px;
}

.kodza-badge__remove {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.kodza-badge__remove:hover {
  background: var(--kz-badge-soft);
  opacity: 1;
}

.kodza-badge__remove:focus-visible {
  outline: 2px solid var(--kz-badge-fg);
  outline-offset: 1px;
  opacity: 1;
}

.kodza-badge__remove svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

@media (prefers-reduced-motion: reduce) {
  .kodza-badge--live::before {
    animation: none;
  }

  .kodza-badge__remove {
    transition-duration: 0.01ms !important;
  }
}

/* Theming example — on a dark background:
.dark-section .kodza-badge {
  --kz-badge-fg: #f2f2f0;
  --kz-badge-soft: rgba(255, 255, 255, 0.1);
  --kz-badge-line: rgba(255, 255, 255, 0.22);
  --kz-badge-ink: #f2f2f0;
  --kz-badge-on-ink: #0a0a0a;
}
*/
