/* Tally: a pricing table whose prices count to the new value when the billing period changes. */

.tally {
  box-sizing: border-box;
  width: min(906px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  font-family: var(--tl-font);
  font-size: 15px;
  color: var(--tl-ink);
}

.tally__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.tally__title {
  margin: 0;
  font-size: clamp(28px, 5vw, 38px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.035em;
}

/* Billing period: a group of two toggle buttons. */
.tally__toggle {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--tl-surface);
  border: 1px solid var(--tl-line);
  border-radius: 999px;
}

.tally__period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tl-muted);
  font: inherit;
  cursor: pointer;
  transition: background-color var(--tl-fade) linear, color var(--tl-fade) linear;
}

.tally__period[aria-pressed="true"] {
  background: var(--tl-ink);
  color: var(--tl-surface);
  font-weight: 600;
}

.tally__badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tl-accent);
  color: var(--tl-on-accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Plans */
.tally__plans {
  box-sizing: border-box;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  align-items: stretch;
  margin: 0;
  padding: var(--tl-lift) 0 0;
  list-style: none;
}

.tally__plan {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px;
  background: var(--tl-surface);
  border: 1px solid var(--tl-line);
  border-radius: var(--tl-radius);
  box-shadow: var(--tl-shadow);
}

.tally__plan--featured {
  background: var(--tl-featured-bg);
  color: var(--tl-featured-ink);
  border-color: transparent;
  box-shadow: var(--tl-featured-shadow);
  transform: translateY(calc(-1 * var(--tl-lift)));
}

.tally__plan-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.tally__name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* Price: the counting figure sits over a ghost of the old figure. */
.tally__price {
  position: relative;
  height: 52px;
  margin: 0;
  overflow: hidden;
}

.tally__figure,
.tally__ghost {
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tally__per {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--tl-muted);
}

.tally__ghost {
  color: var(--tl-ghost);
  opacity: 0;
  pointer-events: none;
}

.tally__plan--featured .tally__per { color: var(--tl-featured-muted); }
.tally__plan--featured .tally__ghost { color: var(--tl-featured-ghost); }

.tally__ghost--go { animation: tally-ghost var(--tl-duration) var(--tl-ease) both; }
.tally__figure--fade { animation: tally-fade var(--tl-fade) linear both; }

@keyframes tally-ghost {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-34px); }
}

@keyframes tally-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tally__note {
  margin: 0;
  font-size: 14px;
  color: var(--tl-muted);
}

.tally__plan--featured .tally__note { color: var(--tl-featured-muted); }

.tally__features {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--tl-body);
}

.tally__plan--featured .tally__features { color: var(--tl-featured-body); }

.tally__cta {
  width: 100%;
  height: 44px;
  margin-top: auto;
  border: 1px solid var(--tl-ink);
  border-radius: var(--tl-button-radius);
  background: transparent;
  color: var(--tl-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tally__plan--featured .tally__cta {
  border-color: transparent;
  background: var(--tl-accent);
  color: var(--tl-on-accent);
}

.tally__period:focus-visible,
.tally__cta:focus-visible {
  outline: 2px solid var(--tl-focus);
  outline-offset: 2px;
}

.tally__plan--featured .tally__cta:focus-visible { outline-color: var(--tl-featured-focus); }

.tally__sr,
.tally__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Reduced motion: no counting and no ghost; the new price fades in over --tl-fade. */
@media (prefers-reduced-motion: reduce) {
  .tally__ghost { display: none; }
}
