/*
 * ONE UPLOAD LOOK (ui/UploadProgress.tsx). Drawn over any tile: the picture dimmed, then Preparing..., a ring with the
 * percentage, a short tick, or a red "Tap to try again". The shade is dark in both themes, so the ring (lime) and the
 * white numbers read over any photo, light or dark. No surface of its own outside the tile: nothing floats.
 */
.up-ov {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  color: #ffffff;
  font-size: var(--fs-meta);
  font-weight: 600;
  pointer-events: none;
}
/* The local picture, under the shade, for a tile that would otherwise show the old one. */
.up-under {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.up-shade {
  position: absolute;
  inset: 0;
  background: rgba(11, 12, 13, 0.52);
  transition: background 260ms ease;
}
.up-ov.ok .up-shade {
  background: rgba(11, 12, 13, 0.16);
}
.up-ov > :not(.up-under):not(.up-shade) {
  position: relative;
}
button.up-ov {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: inherit;
  cursor: pointer;
  pointer-events: auto;
}
button.up-ov:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: -3px;
}
/* A retry with no button of its own: the tile under it is the button, so taps go through. */
span.up-ov.err {
  pointer-events: none;
}

/* The ring: a conic fill masked to a band, so no drawing of its own. --up-p is the percentage. */
.up-ring {
  --up-size: calc(52 * var(--px, 1px));
  position: relative;
  display: grid;
  place-items: center;
  width: var(--up-size);
  height: var(--up-size);
  border-radius: 50%;
}
.up-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--up-p, 0) * 1%), rgba(255, 255, 255, 0.26) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
}
.up-pct {
  position: relative;
  font-size: var(--fs-meta);
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.up-prep {
  display: grid;
  justify-items: center;
  gap: calc(6 * var(--px, 1px));
  text-align: center;
}
.up-spin {
  width: calc(22 * var(--px, 1px));
  height: calc(22 * var(--px, 1px));
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--lime);
  animation: up-spin 0.9s linear infinite;
}
@keyframes up-spin {
  to {
    transform: rotate(360deg);
  }
}

.up-ok {
  display: grid;
  place-items: center;
  width: calc(40 * var(--px, 1px));
  height: calc(40 * var(--px, 1px));
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  animation: up-pop 360ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.up-ok .ico {
  width: 58%;
  height: 58%;
}
@keyframes up-pop {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.up-retry {
  display: inline-flex;
  align-items: center;
  gap: calc(6 * var(--px, 1px));
  max-width: calc(100% - 12px);
  padding: calc(6 * var(--px, 1px)) calc(10 * var(--px, 1px));
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: var(--fs-meta);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}
.up-retry .ico {
  flex: none;
  width: calc(15 * var(--px, 1px));
  height: calc(15 * var(--px, 1px));
}

/* A small chip (Ask Remy's box): a smaller ring, and Retry on two lines. */
.up-ov.compact .up-ring {
  --up-size: 2.25rem;
}
.up-ov.compact .up-pct {
  font-size: var(--fs-micro);
}
.up-ov.compact .up-ok {
  width: 1.625rem;
  height: 1.625rem;
}
.up-ov.compact .up-prep > span:last-child {
  display: none;
}
.up-ov.compact .up-retry {
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 10px;
  font-size: var(--fs-label);
}

/* The big round or square picture (a logo, your photo): the shade sits inside its button, clipped to its shape. */
.lk-pic > .lk-pic-in {
  position: relative;
  z-index: 0;
}
.set-ava .up-ov {
  border-radius: 50%;
}

/* The line by Save. */
.up-wait {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: calc(8 * var(--px, 1px));
  margin: 0;
  padding: calc(2 * var(--px, 1px)) calc(16 * var(--px, 1px)) 0;
  color: var(--lk-sub, var(--t2));
  font-size: var(--fs-meta);
  font-weight: 600;
}
.up-wait.bad {
  color: var(--red);
}
.up-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lk-btn, var(--green));
  animation: up-blink 1.1s ease-in-out infinite;
}
@keyframes up-blink {
  50% {
    opacity: 0.3;
  }
}

.up-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Reduced motion: nothing spins or pops; the numbers and the words still change. */
@media (prefers-reduced-motion: reduce) {
  .up-spin {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.28);
    display: none;
  }
  .up-ok,
  .up-dot {
    animation: none;
  }
  .up-shade {
    transition: none;
  }
}

/* The tile's own buttons stay above the shade: the x can still take a photo out halfway. */
.lk-ptile .lk-rm,
.achip .ax {
  z-index: 2;
}
/* The cover box, wrapped so the shade can sit over it. */
.up-host {
  position: relative;
  display: block;
  border-radius: calc(16 * var(--px, 1px));
  overflow: hidden;
}
.up-wait.c {
  justify-content: center;
  padding-top: 0;
}
