.loading-indicator {
  color: var(--primary-text-color--faint);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  span {
    display: block;
    margin-top: 10px;
    white-space: nowrap;
  }
}

.loading-indicator__container {
  width: 42px;
  height: 42px;
  position: relative;
}

.loading-indicator__figure {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  box-sizing: border-box;
  background-color: transparent;
  border: 0 solid;
  border-color: hsla(var(--brand-color_hsl), 0.5);
  border-width: 6px;
  border-radius: 50%;
}

.no-reduce-motion .loading-indicator span {
  animation: loader-label 1.15s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.no-reduce-motion .loading-indicator__figure {
  animation: loader-figure 1.15s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

.app-body--loading .loading-indicator {
  width: 100vw;
  height: 100vh;
  align-items: center;

  &__figure {
    border-color: #ddd;
  }
}

@keyframes loader-figure {
  0% {
    width: 0;
    height: 0;
    background-color: hsla(var(--brand-color_hsl), 0.5);
  }

  29% {
    background-color: hsla(var(--brand-color_hsl), 0.5);
  }

  30% {
    width: 42px;
    height: 42px;
    background-color: transparent;
    border-width: 21px;
    opacity: 1;
  }

  100% {
    width: 42px;
    height: 42px;
    border-width: 0;
    opacity: 0;
    background-color: transparent;
  }
}

@keyframes loader-label {
  0% { opacity: 0.25; }
  30% { opacity: 1; }
  100% { opacity: 0.25; }
}

@keyframes heartbeat {
  from {
    transform: scale(1);
    animation-timing-function: ease-out;
  }

  10% {
    transform: scale(0.91);
    animation-timing-function: ease-in;
  }

  17% {
    transform: scale(0.98);
    animation-timing-function: ease-out;
  }

  33% {
    transform: scale(0.87);
    animation-timing-function: ease-in;
  }

  45% {
    transform: scale(1);
    animation-timing-function: ease-out;
  }
}

.no-reduce-motion .pulse-loading {
  transform-origin: center center;
  animation: heartbeat 1.5s ease-in-out infinite both;
}

@keyframes shake-bottom {
  0%,
  100% {
    transform: rotate(0deg);
    transform-origin: 50% 100%;
  }

  10% {
    transform: rotate(2deg);
  }

  20%,
  40%,
  60% {
    transform: rotate(-4deg);
  }

  30%,
  50%,
  70% {
    transform: rotate(4deg);
  }

  80% {
    transform: rotate(-2deg);
  }

  90% {
    transform: rotate(2deg);
  }
}

.no-reduce-motion .shake-bottom {
  transform-origin: 50% 100%;
  animation: shake-bottom 0.8s cubic-bezier(0.455, 0.03, 0.515, 0.955) 2s 2 both;
}

.load-more {
  display: block;
  color: var(--primary-text-color);
  background-color: transparent;
  border: 0;
  font-size: inherit;
  text-align: center;
  line-height: inherit;
  margin: 0;
  padding: 15px;
  box-sizing: border-box;
  width: 100%;
  clear: both;
  text-decoration: none;

  &:hover,
  &:focus {
    background: var(--brand-color--faint);
  }
}

.load-gap {
  border-bottom: 1px solid var(--brand-color--med);
}

.regeneration-indicator {
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--primary-text-color);
  background: var(--accent-color--faint);
  cursor: default;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 10px;

  @media screen and (max-width: 580px) {
    border-radius: 0;
  }

  & > div {
    width: 100%;
    background: transparent;
    padding-top: 0;
  }

  &__label {
    strong {
      display: block;
      margin-bottom: 10px;
      color: var(--primary-text-color);
    }

    span {
      font-size: 15px;
      font-weight: 400;
    }
  }
}

// Pull to refresh
.lds-ellipsis div {
  background: var(--primary-text-color--faint) !important;
}

.ptr,
.ptr__children {
  overflow: visible !important;
}

.ptr .lds-spinner {
  width: 40px;
  height: 40px;
}

/**
 * iOS style loading spinner.
 * Adapted from: https://loading.io/css/
 * With some help scaling it: https://signalvnoise.com/posts/2577-loading-spinner-animation-using-css-and-webkit
 */
.lds-spinner {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;

  div {
    position: absolute;
    transform-origin: 50% 50%;
    animation: lds-spinner 1.2s linear infinite;
    width: 100%;
    height: 100%;

    &::after {
      content: ' ';
      display: block;
      position: absolute;
      top: 3.75%;
      left: 46.25%;
      width: 7.5%;
      height: 22.5%;
      border-radius: 20%;
      background: var(--primary-text-color);
    }

    &:nth-child(1) {
      transform: rotate(0deg);
      animation-delay: -1.1s;
    }

    &:nth-child(2) {
      transform: rotate(30deg);
      animation-delay: -1s;
    }

    &:nth-child(3) {
      transform: rotate(60deg);
      animation-delay: -0.9s;
    }

    &:nth-child(4) {
      transform: rotate(90deg);
      animation-delay: -0.8s;
    }

    &:nth-child(5) {
      transform: rotate(120deg);
      animation-delay: -0.7s;
    }

    &:nth-child(6) {
      transform: rotate(150deg);
      animation-delay: -0.6s;
    }

    &:nth-child(7) {
      transform: rotate(180deg);
      animation-delay: -0.5s;
    }

    &:nth-child(8) {
      transform: rotate(210deg);
      animation-delay: -0.4s;
    }

    &:nth-child(9) {
      transform: rotate(240deg);
      animation-delay: -0.3s;
    }

    &:nth-child(10) {
      transform: rotate(270deg);
      animation-delay: -0.2s;
    }

    &:nth-child(11) {
      transform: rotate(300deg);
      animation-delay: -0.1s;
    }

    &:nth-child(12) {
      transform: rotate(330deg);
      animation-delay: 0s;
    }
  }
}

@keyframes lds-spinner {
  0% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}
