/* The storefront (/): the product switch, the recipient, the amount picker (a big number with rolling digits,
   a logarithmic slider, tiles of stacked stars) and Premium's periods. Shared parts: site.css. */

.product {
  margin: 0 0 var(--space-lg);
}

/* The recipient ------------------------------------------------------------------------------------------- */

.cell--input {
  gap: 0.125rem;
}

.cell--input .at {
  color: var(--color-hint);
}

.cell--input input {
  flex: 1;
  min-width: 0;
  min-height: 1.75rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font: 400 var(--text-base) / 1.2 var(--font-ui);
}

.cell--input input:focus {
  outline: none;
}

.cell--input input::placeholder {
  color: var(--color-hint);
  opacity: 1;
}

.cell--input:focus-within {
  box-shadow: inset 0 0 0 2px var(--color-accent);
  border-radius: var(--radius-cell);
}

.cell--input .spinner {
  width: 1.125rem;
  height: 1.125rem;
}

.cell--who {
  --inset: 4.25rem;
}

[data-state="error"] .cell--who .cell__title {
  color: var(--color-hint);
}

/* The amount: the number, the slider, the tiles ------------------------------------------------------------ */

.amount {
  padding: var(--space-md) var(--space-md) var(--space-sm);
}

.amount__top {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3.125rem;
}

.amount__star {
  flex: none;
  width: 1.75rem;
  height: 1.75rem;
  align-self: center;
}

.odo {
  display: inline-flex;
  min-height: var(--tap);
  align-items: center;
  font-size: var(--text-amount);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  cursor: text;
  border-radius: 8px;
}

.odo span {
  display: inline-block;
  white-space: pre;
}

.amount__edit {
  width: 6.5rem;
  border: 0;
  border-bottom: 2px solid var(--color-accent);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--color-text);
  font: 700 var(--text-amount) / 1.1 var(--font-ui);
  letter-spacing: -0.02em;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.amount__edit::-webkit-inner-spin-button,
.amount__edit::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.amount__edit:focus {
  outline: none;
  border-bottom-color: var(--color-link);
}

.pencil {
  align-self: center;
  min-height: var(--tap);
  border: 0;
  padding: 0 var(--space-xs);
  background: transparent;
  color: var(--color-link);
  font: 400 var(--text-sm) / 1 var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
}

.amount__price {
  margin: var(--space-2xs) 0 var(--space-md);
  text-align: center;
  color: var(--color-hint);
  font-size: var(--text-sm);
}

.amount__price b {
  color: var(--color-text);
  font-weight: 600;
  border-radius: 6px;
}

.flash {
  animation: flash 1.2s var(--ease-out);
}

@keyframes flash {
  0%,
  35% {
    background: var(--color-accent-soft);
    box-shadow: 0 0 0 4px var(--color-accent-soft);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 4px transparent;
  }
}

.slider {
  position: relative;
  height: var(--tap);
  margin: 0 0 var(--space-2xs);
}

.slider input {
  --p: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: var(--tap);
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.slider input::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-gold-1), var(--color-gold-2)) 0 / var(--p) 100% no-repeat,
    var(--color-track);
}

.slider input::-moz-range-track {
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: var(--color-track);
}

.slider input::-moz-range-progress {
  height: 0.375rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--color-gold-1), var(--color-gold-2));
}

/* The thumb is a white disc with our star */
.slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: -0.6875rem;
  border-radius: var(--radius-pill);
  background: #ffffff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f6a609' d='M12 1.6c.5 0 .9.3 1.1.7l2.5 5.2 5.7.8c1 .1 1.4 1.4.7 2.1l-4.1 4 1 5.7c.2 1-.9 1.8-1.8 1.3L12 18.7l-5.1 2.7c-.9.5-2-.3-1.8-1.3l1-5.7-4.1-4c-.7-.7-.3-2 .7-2.1l5.7-.8 2.5-5.2c.2-.4.6-.7 1.1-.7z'/%3E%3C/svg%3E")
    center / 0.95rem no-repeat;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.25), 0 0 0 0.5px rgb(0 0 0 / 0.06);
  transition: transform var(--dur-micro) var(--ease-out);
}

.slider input::-moz-range-thumb {
  width: 1.75rem;
  height: 1.75rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: #ffffff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f6a609' d='M12 1.6c.5 0 .9.3 1.1.7l2.5 5.2 5.7.8c1 .1 1.4 1.4.7 2.1l-4.1 4 1 5.7c.2 1-.9 1.8-1.8 1.3L12 18.7l-5.1 2.7c-.9.5-2-.3-1.8-1.3l1-5.7-4.1-4c-.7-.7-.3-2 .7-2.1l5.7-.8 2.5-5.2c.2-.4.6-.7 1.1-.7z'/%3E%3C/svg%3E")
    center / 0.95rem no-repeat;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
}

.slider input:active::-webkit-slider-thumb {
  transform: scale(1.12);
}

.slider input:focus-visible {
  outline: none;
}

.slider input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--color-accent);
}

.slider input:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--color-accent);
}

.slider input:disabled {
  cursor: default;
  opacity: 0.5;
}

.slider__ends {
  display: flex;
  justify-content: space-between;
  margin-top: -0.375rem;
  font-size: var(--text-2xs);
  color: var(--color-hint);
}

/* Tiles: the packages, 3 × 2, with stacked stars and a drawn check */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md) var(--space-md);
  border: 0;
  margin: 0;
  min-width: 0;
}

.tile {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.tile input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tile__body {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.2rem;
  min-height: 5rem;
  padding: var(--space-sm) var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-tile);
  background: var(--color-bg);
  border: 1.5px solid transparent;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out),
    transform var(--dur-micro) var(--ease-out);
}

.tile:active .tile__body {
  transform: scale(0.96);
}

.stack {
  height: 1.25rem;
  width: auto;
  overflow: visible;
}

.stack path {
  stroke: var(--color-bg);
  stroke-width: 2.6;
  paint-order: stroke;
  transition: stroke var(--dur-micro) var(--ease-out);
}

.tile b {
  font-weight: 600;
  font-size: var(--text-base);
  white-space: nowrap;
}

.tile small {
  font-size: var(--text-xs);
  color: var(--color-hint);
  white-space: nowrap;
}

.tile input:checked + .tile__body {
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.tile input:checked + .tile__body .stack path {
  stroke: var(--color-accent-soft);
}

.tile input:focus-visible + .tile__body {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.tick {
  position: absolute;
  top: -0.4rem;
  right: -0.4rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  border: 2px solid var(--color-cell);
  display: grid;
  place-items: center;
  transform: scale(0);
  transition: transform var(--dur-short) var(--ease-spring);
}

.tick svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: none;
  stroke: var(--color-on-accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
  transition: stroke-dashoffset var(--dur-short) var(--ease-out) 80ms;
}

.tile input:checked ~ .tick {
  transform: scale(1);
}

.tile input:checked ~ .tick svg {
  stroke-dashoffset: 0;
}

/* Premium: three periods, as Telegram's gift sheet shows them ------------------------------------------------ */

.period {
  --inset: 3.375rem;
  min-height: 3.75rem;
  cursor: pointer;
}

.period input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.period__radio {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-chevron);
  display: grid;
  place-items: center;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out),
    transform var(--dur-short) var(--ease-spring);
}

.period__radio svg {
  width: 0.8rem;
  height: 0.8rem;
  fill: none;
  stroke: var(--color-on-accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
  transition: stroke-dashoffset var(--dur-short) var(--ease-out) 60ms;
}

.period input:checked ~ .period__radio {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.period input:checked ~ .period__radio svg {
  stroke-dashoffset: 0;
}

.period:active .period__radio {
  transform: scale(0.9);
}

.period input:focus-visible ~ .period__radio {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.period__title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  white-space: nowrap;
}

.period__badge {
  flex: none;
  padding: 0.1875rem 0.375rem;
  border-radius: 6px;
  background: var(--color-badge);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}

.period__price {
  flex: none;
  font-weight: 600;
  white-space: nowrap;
}

.pane-empty {
  padding: var(--space-md);
  color: var(--color-hint);
  font-size: var(--text-sm);
  text-align: center;
}

/* Skeletons while the prices come ------------------------------------------------------------------------------ */

.amount-skel {
  display: grid;
  justify-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-md) 0;
}

.skel--num {
  width: 8rem;
  height: 2.75rem;
  border-radius: 10px;
}

.skel--line {
  width: 11rem;
  height: 0.875rem;
}

.skel--bar {
  width: 100%;
  height: 0.375rem;
  margin: var(--space-sm) 0;
  border-radius: var(--radius-pill);
}

.tiles--skel {
  width: 100%;
  padding: var(--space-xs) 0 var(--space-md);
}

.skel--tile {
  height: 5rem;
  border-radius: var(--radius-tile);
}

.period-skel {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 3.75rem;
  padding: 0 var(--space-md);
}

.period-skel + .period-skel {
  border-top: 0.5px solid var(--color-line);
}

.skel--dot {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: var(--radius-pill);
}

.skel--text {
  flex: 1;
  max-width: 9rem;
  height: 0.875rem;
}

.skel--price {
  width: 4rem;
  height: 0.875rem;
  margin-left: auto;
}
