/* A photo being sent by photo-upload: a veil with a spinner, or a retry icon
   when the send failed. */
.photo-upload__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: inherit;
  background-color: rgb(0 0 0 / 45%);
  color: white;

  &[hidden] {
    display: none;
  }

  &[data-state="failed"] {
    cursor: pointer;
    background-color: rgb(0 0 0 / 60%);
  }

  svg {
    width: var(--photo-upload-icon-size, 24px);
    height: var(--photo-upload-icon-size, 24px);
    fill: none;
    stroke: currentColor;
  }
}

.photo-upload__spinner {
  stroke-width: 3;
  animation: btnSpinner 0.9s linear infinite;

  [data-state="failed"] & {
    display: none;
  }

  @media (prefers-reduced-motion: reduce) {
    animation-duration: 2.4s;
  }
}

.photo-upload__track {
  stroke: rgb(255 255 255 / 30%);
}

.photo-upload__arc {
  stroke-linecap: round;
}

.photo-upload__retry {
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;

  :not([data-state="failed"]) > & {
    display: none;
  }
}

.photo-upload__error {
  margin-top: var(--spacing-xs);
  font-size: var(--font-sm);
  color: var(--color-danger);
}

/* Submit buttons wait for the photo; the label is drawn over the button so
   it keeps its size and the totals inside it. */
[data-photo-upload-label] {
  pointer-events: none;
  opacity: 0.7;
}

button[data-photo-upload-label] {
  position: relative;
  color: transparent;

  & * {
    visibility: hidden;
  }

  &::before {
    content: attr(data-photo-upload-label);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--btn-color, white);
    visibility: visible;
  }
}
