/**
 * @file
 * Le chargeur des appels AJAX de Drupal (module ajax_loader, « three
 * bounce », plein écran) aux couleurs du thème.
 *
 * Le module pose, à la fin du <body>, un
 * .ajax-progress.ajax-progress-fullscreen > .ajax-throbber.sk-flow > 3 points.
 * On garde son balisage et on en fait un voile léger, avec une carte au
 * centre. Voile et carte n'apparaissent qu'après un court délai : une
 * réponse rapide ne fait rien clignoter.
 */
.ajax-progress.ajax-progress-fullscreen {
  --sk-size: 2.5rem;
  --sk-color: var(--tc-accent, #00251b);
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  margin: 0;
  inset: 0;
  z-index: 11000;
  background: color-mix(in srgb, var(--tc-surface-soft, #f5f7f4) 55%, transparent);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  cursor: progress;
  opacity: 0;
  animation: tc-chargeur-entree 0.2s ease-out 0.25s forwards;
}

.ajax-progress.ajax-progress-fullscreen .ajax-throbber.sk-flow {
  box-sizing: content-box;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid color-mix(in srgb, var(--tc-accent, #00251b) 10%, transparent);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0.75rem 2rem rgb(0 37 27 / 14%);
}

.ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot {
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  background-color: var(--tc-accent, #00251b);
}

.ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot:nth-child(2) {
  background-color: var(--tc-primary, #cda06d);
}

@keyframes tc-chargeur-entree {
  to {
    opacity: 1;
  }
}

/* Sans animation : trois points fixes, qui s'estompent tour à tour. */
@media (prefers-reduced-motion: reduce) {
  .ajax-progress.ajax-progress-fullscreen {
    animation-duration: 0.01s;
  }

  .ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot {
    transform: none;
    animation: tc-chargeur-calme 1.4s ease-in-out infinite both;
  }

  .ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot:nth-child(1) {
    animation-delay: -0.3s;
  }

  .ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot:nth-child(2) {
    animation-delay: -0.15s;
  }

  @keyframes tc-chargeur-calme {
    0%, 80%, 100% { opacity: 0.35; }
    40% { opacity: 1; }
  }
}

/* Contraste forcé : des points visibles dans la couleur du texte. */
@media (forced-colors: active) {
  .ajax-progress.ajax-progress-fullscreen .ajax-throbber .sk-flow-dot {
    background-color: CanvasText;
  }
}
