/* Counter widget. Tokens from _shared/embed.css. */

.ct {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  width: 100%;
  height: 100%;
  min-height: 0;
  font-size: clamp(10px, min(4.4vw, 7vh), 20px);
}

.ct-title {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.95em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-stage {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.ct-fit {
  flex-direction: row;
  align-items: baseline;
  gap: 0.18em;
}

.ct-value {
  line-height: 1;
}

.ct-of {
  font-size: 0.32em;
  font-weight: 600;
}

.ct.is-done .ct-value {
  color: var(--accent);
}

.ct-track {
  flex: none;
  width: min(100%, 20em);
  height: 0.42em;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.ct-fill {
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: var(--fill);
  transition: width 0.3s ease;
}

.ct-controls {
  display: flex;
  flex: none;
  gap: 0.4em;
}

.ct-minus,
.ct-plus {
  min-width: 2.6em;
  font-size: 1.05em;
}

.ct-reset {
  font-size: 0.8em;
}

.ct-reset.is-armed {
  border-color: var(--accent);
  color: var(--accent);
}

.ct-note {
  flex: none;
  font-size: 0.65em;
}

/* Short embeds: number and buttons side by side. */
@media (min-aspect-ratio: 5/2) {
  .ct {
    flex-direction: row;
    flex-wrap: wrap;
    align-content: center;
    column-gap: 1em;
    font-size: clamp(10px, min(3.2vw, 11vh), 20px);
  }

  .ct-title {
    flex: 0 0 100%;
    text-align: center;
  }

  .ct-stage {
    flex: 0 1 auto;
    width: auto;
    height: 60%;
    min-width: 4em;
    aspect-ratio: 2;
  }

  .ct-track {
    order: 5;
    flex: 0 0 60%;
  }
}
