/* Les Mascarilles admin: loading indicator "Le croissant" (R16), the same as
   the public site. The emblem of the logo makes one turn and lands back in
   place. Blocks are placed at once and keep their room (label line
   included); after 300 ms admin-ui/loader.js writes the label and adds
   --shown, and the drawing and the label appear together. In a button it
   takes the colour of the text. Masks are defined once per page
   (AdminLoader::page()). Colours from tokens.css. */

/* ---------- Common box ---------- */
.ml-loader {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  gap: 1rem;
  color: var(--color-text-muted);
  text-align: center;
}
.ml-loader--block { min-block-size: 10rem; padding-block: 1.25rem; }
.ml-loader__label {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--color-text-muted);
}
/* The line of the label is kept while it is empty: nothing moves when it comes */
.ml-loader--block .ml-loader__label { min-block-size: 1.5em; }
.ml-loader__art { display: block; }
.ml-loader--delayed:not(.ml-loader--shown) .ml-loader__art { visibility: hidden; }
.ml-loader--shown .ml-loader__art,
.ml-loader--shown .ml-loader__label { animation: ml-appear 200ms ease both; }
@keyframes ml-appear {
  from { opacity: 0; visibility: hidden; }
  to { opacity: 1; visibility: visible; }
}

/* In a button: replaces the icon, at text size, in the colour of the text */
.ml-loader--inline { display: inline-flex; vertical-align: -0.2em; color: inherit; margin-inline-end: 0.4em; }
.ml-loader.ml-loader--inline .ml-loader__art { inline-size: 1.35em; block-size: 1.35em; animation: none; }

/* Hidden holder of the shared masks: not display:none, or the masks would not apply */
.ml-defs { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }

/* ---------- The crescent ---------- */
.ml-crescent .ml-loader__art { inline-size: 3.5rem; block-size: 3.5rem; }
/* The original logo on its light plate, in both themes (no outline, as on the site) */
.ml-crescent__plate { fill: var(--logo-plate); }
.ml-crescent__black { fill: #000000; }
.ml-crescent__grey { fill: #a4a5a5; }
.ml-crescent__red { fill: var(--brand-red); }
.ml-crescent__turn {
  transform-box: view-box;
  transform-origin: 50% 50%;
  animation: ml-crescent-turn 2.2s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
.ml-crescent__turn--grey { animation-delay: 0.1s; }
.ml-crescent__turn--red { animation-delay: 0.16s; }
@keyframes ml-crescent-turn {
  0% { transform: rotate(0deg); }
  78%, 100% { transform: rotate(360deg); }
}
.ml-loader--inline.ml-crescent .ml-crescent__plate { fill: none; }
/* No plate in a button: the emblem takes the whole size */
.ml-loader--inline.ml-crescent .ml-crescent__emblem { transform: none; }
.ml-loader--inline.ml-crescent .ml-crescent__black,
.ml-loader--inline.ml-crescent .ml-crescent__red { fill: currentColor; }
.ml-loader--inline.ml-crescent .ml-crescent__grey { fill: currentColor; opacity: 0.7; }

/* ---------- Reduced motion: the emblem stays as in the logo and breathes ---------- */
@keyframes ml-breathe {
  from { opacity: 1; }
  to { opacity: 0.35; }
}
/* tokens.css stops every animation with !important under reduced motion:
   the breathing is wanted instead of the turn, so it says !important too. */
@media (prefers-reduced-motion: reduce) {
  /* The three parts of the emblem breathe together, without turning */
  .ml-crescent__turn { animation: ml-breathe 2.4s ease-in-out infinite alternate !important; }
}

/* A button waiting keeps its own colours (not the greyed disabled look): its
   text says what happens and the crescent turns in that colour. */
.btn[aria-busy="true"] {
  --bs-btn-disabled-color: var(--bs-btn-color);
  --bs-btn-disabled-bg: var(--bs-btn-bg);
  --bs-btn-disabled-border-color: var(--bs-btn-border-color);
  --bs-btn-disabled-opacity: 1;
  cursor: progress;
}

/* A block in a table that scrolls sideways (phones): it stays on the visible
   width, at the left, instead of being cut by the scroll. */
.table-responsive:has(.ml-loader) { container-type: inline-size; }
td > .ml-loader--block { position: sticky; left: 0; inline-size: calc(100cqi - 1rem); }
