/* Loader with the Perivallon.City mark (js/loader.js; the animation is in
   assets/loader.svg). */

/* While it loads, the element is tall enough for the mark and its label:
   a short one (an empty list's single line) cuts them off otherwise, as it
   hides what overflows. */
.has-perivallon-loader {
  min-height: 160px;
  position: relative;
}

.perivallon-loader {
  animation: perivallon-loader-in 0.2s ease-out;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  background: rgba(243, 246, 252, 0.72);
  border-radius: inherit;
  inset: 0;
  position: absolute;
  /* Under the sticky filter headers (z-index 10) a list scrolls beneath. */
  z-index: 5;
}

/* On a map: over Leaflet's panes and controls. */
.leaflet-container > .perivallon-loader {
  z-index: 1001;
}

@keyframes perivallon-loader-in {
  from {
    opacity: 0;
  }
}

/* Placed by js/loader.js in the middle of the visible part. */
.perivallon-loader__inner {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  left: 0;
  padding: 1.5rem 0;
  position: absolute;
  right: 0;
  top: 0;
}

/* The mark, also on its own (e.g. the batch page). */
.perivallon-loader__mark {
  aspect-ratio: 57 / 47;
  background: url(../assets/loader.svg) center / contain no-repeat;
  display: block;
  flex-shrink: 0;
  width: 4.5rem;
}

.perivallon-loader__label {
  color: #2A315A;
  font-family: Poppins, sans-serif;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Animated dots, of fixed width so that the centred label does not move. */
.perivallon-loader__label::after {
  animation: perivallon-loader-dots 1.6s steps(4, jump-none) infinite;
  content: '...';
  display: inline-block;
  text-align: left;
  width: 1.2em;
}

@keyframes perivallon-loader-dots {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .perivallon-loader__label {
    animation: perivallon-loader-in 1s ease-in-out infinite alternate;
  }

  .perivallon-loader__label::after {
    animation: none;
  }
}

/* Drupal's throbbers (next to the filters, or the full screen one) are
   replaced by the loader while it covers what loads. */
body:has(.is-perivallon-loading) .ajax-progress {
  display: none;
}
