/* =========================================================================
   LOADERS MAYIA  ·  20 animações de carregamento em CSS puro
   Fonte de cor/tempo/easing: MOTION.md (Mayia). Zero dependência.
   Uso: <link rel="stylesheet" href="loaders.css"> + snippet de cada loader
   (veja LEIA-ME.md ou abra index.html e clique no loader para copiar).

   Personalizar por projeto (cliente com outra cor):
     .meu-app { --ld-accent:#005196; }        cor de destaque
     .meu-app { --ld-size:32px; }             tamanho base
     class="ld-light" em qualquer ancestral   versão para fundo claro
     class="ld-delay" num wrapper             só aparece se a espera passar de 250ms
   ========================================================================= */

@property --ld-p { syntax: "<integer>"; inherits: true; initial-value: 0; }

:root {
  --ld-accent: #22DD00;          /* acento único de marca */
  --ld-on-accent: #0E1115;       /* texto/ícone SOBRE verde, nunca branco */
  --ld-ink: #F2F4F0;             /* texto sobre escuro */
  --ld-track: #2a313b;           /* borda/trilho em escuro */
  --ld-muted: #8b939e;           /* rótulo */
  --ld-size: 48px;
  --ld-speed: 1;                 /* multiplicador de duração */
  --ld-expo-out: cubic-bezier(.16, 1, .3, 1);
  --ld-expo-inout: cubic-bezier(.87, 0, .13, 1);
  --ld-back: cubic-bezier(.34, 1.8, .64, 1);
  --ld-sine: cubic-bezier(.37, 0, .63, 1);
  --ld-font: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.ld-light {
  --ld-ink: #1F2328;
  --ld-track: #d3d6cf;
  --ld-muted: #5f6772;
}

.ld {
  position: relative;
  display: inline-block;
  flex: none;
  width: var(--ld-size);
  height: var(--ld-size);
  box-sizing: border-box;
  vertical-align: middle;
  color: var(--ld-accent);
}
.ld *, .ld::before, .ld::after, .ld *::before, .ld *::after { box-sizing: border-box; }
.ld i { display: block; font-style: normal; }

/* dentro de botão/texto: herda a cor do texto (verde vira #0E1115 em botão verde sozinho) */
.ld-inline {
  --ld-size: 1.15em;
  --ld-accent: currentColor;
  --ld-ink: currentColor;
  --ld-track: color-mix(in srgb, currentColor 25%, transparent);
  margin-right: .5em;
  vertical-align: -.2em;
}

/* aparece só se a espera passar de 250ms (evita piscar em load rápido) */
.ld-delay { animation: ld-appear .3s calc(.25s) both; }
@keyframes ld-appear { from { opacity: 0; } to { opacity: 1; } }

/* rótulo padrão (Manrope 800, caixa alta, tracking .2em) */
.ld-bar::before, .ld-percent::before {
  font: 800 max(10px, calc(var(--ld-size) * .2))/1 var(--ld-font);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ld-muted);
}

@keyframes ld-spin { to { transform: rotate(360deg); } }

/* ---------- 01 Spinner Arc ---------- */
.ld-spinner {
  border-radius: 50%;
  border: calc(var(--ld-size) * .09) solid var(--ld-track);
  border-top-color: var(--ld-accent);
  animation: ld-spin calc(.85s * var(--ld-speed)) cubic-bezier(.55, .15, .45, .85) infinite;
}

/* ---------- 02 Bouncing Dots ---------- */
.ld-dots {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--ld-size) * .12);
}
.ld-dots i {
  width: calc(var(--ld-size) * .2);
  height: calc(var(--ld-size) * .2);
  border-radius: 50%;
  background: var(--ld-ink);
  animation: ld-bounce calc(.9s * var(--ld-speed)) var(--ld-sine) infinite;
}
.ld-dots i:nth-child(2) { background: var(--ld-accent); animation-delay: calc(.13s * var(--ld-speed)); }
.ld-dots i:nth-child(3) { animation-delay: calc(.26s * var(--ld-speed)); }
@keyframes ld-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-80%); }
}

/* ---------- 03 Pulse Rings ---------- */
.ld-pulse::before {
  content: "";
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: var(--ld-accent);
  box-shadow: 0 0 calc(var(--ld-size) * .3) color-mix(in srgb, var(--ld-accent) 42%, transparent);
}
.ld-pulse i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--ld-accent);
  opacity: 0;
  animation: ld-ring calc(1.8s * var(--ld-speed)) var(--ld-expo-out) infinite;
}
.ld-pulse i:nth-child(2) { animation-delay: calc(.9s * var(--ld-speed)); }
@keyframes ld-ring {
  0% { transform: scale(.32); opacity: 1; }
  100% { transform: scale(1); opacity: 0; }
}

/* ---------- 04 Indeterminate Bar ---------- */
.ld-bar {
  width: calc(var(--ld-size) * 3.6);
  height: auto;
  display: inline-flex;
  flex-direction: column;
  gap: calc(var(--ld-size) * .16);
}
.ld-bar::before { content: attr(data-label); }
.ld-bar i {
  position: relative;
  height: calc(var(--ld-size) * .1);
  border-radius: 999px;
  background: var(--ld-track);
  overflow: hidden;
}
.ld-bar i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--ld-accent);
  animation: ld-slide calc(1.5s * var(--ld-speed)) var(--ld-expo-inout) infinite;
}
@keyframes ld-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(240%); }
}

/* ---------- 05 Skeleton Shimmer ---------- */
.ld-skeleton {
  width: calc(var(--ld-size) * 4.2);
  height: auto;
  display: inline-grid;
  grid-template-columns: calc(var(--ld-size) * .7) 1fr;
  column-gap: calc(var(--ld-size) * .25);
  row-gap: calc(var(--ld-size) * .14);
  align-items: center;
}
.ld-skeleton i {
  height: calc(var(--ld-size) * .13);
  border-radius: 999px;
  background: linear-gradient(90deg,
      var(--ld-track) 0 38%,
      color-mix(in srgb, var(--ld-track), var(--ld-ink) 16%) 50%,
      var(--ld-track) 62% 100%);
  background-size: 300% 100%;
  animation: ld-shimmer calc(1.5s * var(--ld-speed)) linear infinite;
}
.ld-skeleton i:first-child {
  grid-row: span 2;
  height: calc(var(--ld-size) * .7);
  border-radius: 50%;
}
.ld-skeleton i:nth-child(2) { width: 62%; }
.ld-skeleton i:nth-child(3) { width: 88%; }
.ld-skeleton i:nth-child(n+4) { grid-column: 1 / -1; }
.ld-skeleton i:nth-child(5) { width: 74%; }
@keyframes ld-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

/* ---------- 06 Orbit ---------- */
.ld-orbit::before {
  content: "";
  position: absolute;
  inset: 44%;
  border-radius: 50%;
  background: var(--ld-ink);
}
.ld-orbit i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--ld-track);
  animation: ld-spin calc(2.6s * var(--ld-speed)) linear infinite;
}
.ld-orbit i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: calc(var(--ld-size) * .13);
  height: calc(var(--ld-size) * .13);
  margin: calc(var(--ld-size) * -.065) 0 0 calc(var(--ld-size) * -.065);
  border-radius: 50%;
  background: var(--ld-accent);
}
.ld-orbit i:nth-child(1) { inset: 28%; animation-duration: calc(1.1s * var(--ld-speed)); }
.ld-orbit i:nth-child(2) { inset: 14%; animation-duration: calc(1.8s * var(--ld-speed)); animation-direction: reverse; }
.ld-orbit i:nth-child(2)::before { background: var(--ld-ink); }
.ld-orbit i:nth-child(3)::before { background: var(--ld-muted); }

/* ---------- 07 Equalizer Bars ---------- */
.ld-eq {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--ld-size) * .07);
}
.ld-eq i {
  width: calc(var(--ld-size) * .09);
  height: 80%;
  border-radius: 999px;
  background: var(--ld-accent);
  animation: ld-eq calc(1s * var(--ld-speed)) var(--ld-sine) infinite alternate;
}
.ld-eq i:nth-child(1), .ld-eq i:nth-child(7) { background: var(--ld-muted); }
.ld-eq i:nth-child(2) { animation-delay: calc(-.7s * var(--ld-speed)); }
.ld-eq i:nth-child(3) { animation-delay: calc(-.25s * var(--ld-speed)); }
.ld-eq i:nth-child(4) { animation-delay: calc(-.85s * var(--ld-speed)); }
.ld-eq i:nth-child(5) { animation-delay: calc(-.4s * var(--ld-speed)); }
.ld-eq i:nth-child(6) { animation-delay: calc(-.95s * var(--ld-speed)); }
.ld-eq i:nth-child(7) { animation-delay: calc(-.55s * var(--ld-speed)); }
@keyframes ld-eq {
  from { transform: scaleY(.25); }
  to { transform: scaleY(1); }
}

/* ---------- 08 Square Morph ---------- */
.ld-morph::before {
  content: "";
  position: absolute;
  inset: 22%;
  background: var(--ld-accent);
  border-radius: 14%;
  animation: ld-morph calc(2.4s * var(--ld-speed)) infinite;
}
@keyframes ld-morph {
  0%   { transform: rotate(0) scale(1); border-radius: 14%; animation-timing-function: var(--ld-back); }
  25%  { transform: rotate(90deg) scale(.72); border-radius: 50%; animation-timing-function: var(--ld-back); }
  50%  { transform: rotate(180deg) scale(1); border-radius: 14%; animation-timing-function: var(--ld-back); }
  75%  { transform: rotate(270deg) scale(.72); border-radius: 50%; animation-timing-function: var(--ld-back); }
  100% { transform: rotate(360deg) scale(1); border-radius: 14%; }
}

/* ---------- 09 Liquid Fill ---------- */
.ld-liquid {
  border-radius: 50%;
  overflow: hidden;
  background: var(--ld-track);
  box-shadow: inset 0 0 0 2px var(--ld-track);
  animation: ld-count calc(3.2s * var(--ld-speed)) var(--ld-sine) infinite;
}
.ld-liquid i {
  position: absolute;
  left: -50%;
  width: 200%;
  height: 200%;
  top: calc(96% - var(--ld-p) * 1.04%);
  border-radius: 42%;
  background: var(--ld-accent);
  animation: ld-spin calc(3s * var(--ld-speed)) linear infinite;
}
.ld-liquid::before, .ld-liquid::after {
  counter-reset: ld var(--ld-p);
  content: counter(ld) "%";
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font: 800 calc(var(--ld-size) * .24)/1 var(--ld-font);
  font-variant-numeric: tabular-nums;
  color: var(--ld-ink);
}
.ld-liquid::after {               /* parte do número que está sobre o verde fica escura */
  color: var(--ld-on-accent);
  clip-path: inset(calc(100% - var(--ld-p) * 1%) 0 0 0);
}
@keyframes ld-count {
  0% { --ld-p: 0; }
  85%, 100% { --ld-p: 100; }
}

/* ---------- 10 Dot Grid Wave ---------- */
.ld-grid {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: calc(var(--ld-size) * .1);
  padding: calc(var(--ld-size) * .08);
}
.ld-grid i {
  border-radius: 50%;
  background: var(--ld-accent);
  animation: ld-wave calc(1.3s * var(--ld-speed)) var(--ld-sine) infinite;
}
.ld-grid i:nth-child(2), .ld-grid i:nth-child(4) { animation-delay: calc(.1s * var(--ld-speed)); }
.ld-grid i:nth-child(3), .ld-grid i:nth-child(5), .ld-grid i:nth-child(7) { animation-delay: calc(.2s * var(--ld-speed)); }
.ld-grid i:nth-child(6), .ld-grid i:nth-child(8) { animation-delay: calc(.3s * var(--ld-speed)); }
.ld-grid i:nth-child(9) { animation-delay: calc(.4s * var(--ld-speed)); }
@keyframes ld-wave {
  0%, 60%, 100% { transform: scale(1); opacity: 1; }
  30% { transform: scale(.35); opacity: .35; }
}

/* ---------- 11 Infinity Trail (SVG) ---------- */
.ld-infinity { width: calc(var(--ld-size) * 2); overflow: visible; }
.ld-infinity path {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}
.ld-infinity .ld-t { stroke: var(--ld-track); }
.ld-infinity .ld-h {
  stroke: var(--ld-accent);
  stroke-dasharray: 26 74;
  animation: ld-trail calc(1.9s * var(--ld-speed)) linear infinite;
}
@keyframes ld-trail { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }

/* ---------- 12 Flipping Square ---------- */
.ld-flip { perspective: calc(var(--ld-size) * 3); }
.ld-flip::before {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 12%;
  background: var(--ld-accent);
  animation: ld-flip calc(1.6s * var(--ld-speed)) var(--ld-expo-inout) infinite;
}
@keyframes ld-flip {
  0% { transform: rotateX(0) rotateY(0); }
  50% { transform: rotateX(-180deg) rotateY(0); }
  100% { transform: rotateX(-180deg) rotateY(-180deg); }
}

/* ---------- 13 Gradient Ring ---------- */
.ld-gradient {
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 8%, var(--ld-accent));
  --ld-ring: calc(var(--ld-size) * .1);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-ring)), #000 calc(100% - var(--ld-ring) + 1px));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-ring)), #000 calc(100% - var(--ld-ring) + 1px));
  animation: ld-spin calc(1s * var(--ld-speed)) linear infinite;
}

/* ---------- 14 Typing Dots ---------- */
.ld-typing {
  width: calc(var(--ld-size) * 1.5);
  height: calc(var(--ld-size) * .72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ld-size) * .09);
  border-radius: 999px 999px 999px calc(var(--ld-size) * .12);
  background: var(--ld-track);
}
.ld-typing i {
  width: calc(var(--ld-size) * .13);
  height: calc(var(--ld-size) * .13);
  border-radius: 50%;
  background: var(--ld-ink);
  animation: ld-type calc(1.2s * var(--ld-speed)) var(--ld-sine) infinite;
}
.ld-typing i:nth-child(2) { animation-delay: calc(.16s * var(--ld-speed)); }
.ld-typing i:nth-child(3) { animation-delay: calc(.32s * var(--ld-speed)); }
@keyframes ld-type {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-35%); }
}

/* ---------- 15 Spoke Spinner ---------- */
.ld-spokes i {
  position: absolute;
  left: 46%;
  top: 4%;
  width: 8%;
  height: 28%;
  border-radius: 999px;
  background: var(--ld-ink);
  transform-origin: 50% 164%;
  opacity: .15;
  animation: ld-spoke calc(1s * var(--ld-speed)) linear infinite;
}
.ld-spokes i:nth-child(1)  { transform: rotate(0deg);   animation-delay: calc(-.917s * var(--ld-speed)); }
.ld-spokes i:nth-child(2)  { transform: rotate(30deg);  animation-delay: calc(-.833s * var(--ld-speed)); }
.ld-spokes i:nth-child(3)  { transform: rotate(60deg);  animation-delay: calc(-.75s * var(--ld-speed)); }
.ld-spokes i:nth-child(4)  { transform: rotate(90deg);  animation-delay: calc(-.667s * var(--ld-speed)); }
.ld-spokes i:nth-child(5)  { transform: rotate(120deg); animation-delay: calc(-.583s * var(--ld-speed)); }
.ld-spokes i:nth-child(6)  { transform: rotate(150deg); animation-delay: calc(-.5s * var(--ld-speed)); }
.ld-spokes i:nth-child(7)  { transform: rotate(180deg); animation-delay: calc(-.417s * var(--ld-speed)); }
.ld-spokes i:nth-child(8)  { transform: rotate(210deg); animation-delay: calc(-.333s * var(--ld-speed)); }
.ld-spokes i:nth-child(9)  { transform: rotate(240deg); animation-delay: calc(-.25s * var(--ld-speed)); }
.ld-spokes i:nth-child(10) { transform: rotate(270deg); animation-delay: calc(-.167s * var(--ld-speed)); }
.ld-spokes i:nth-child(11) { transform: rotate(300deg); animation-delay: calc(-.083s * var(--ld-speed)); }
.ld-spokes i:nth-child(12) { transform: rotate(330deg); animation-delay: 0s; }
@keyframes ld-spoke {
  0% { opacity: 1; background: var(--ld-accent); }
  100% { opacity: .15; background: var(--ld-ink); }
}

/* ---------- 16 Percent Bar ---------- */
.ld-percent {
  width: calc(var(--ld-size) * 3.6);
  height: auto;
  display: inline-grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  row-gap: calc(var(--ld-size) * .16);
  animation: ld-count calc(4s * var(--ld-speed)) var(--ld-expo-out) infinite;
}
.ld-percent::before { content: attr(data-label); }
.ld-percent::after {
  counter-reset: ld var(--ld-p);
  content: counter(ld) "%";
  font: 800 calc(var(--ld-size) * .3)/1 var(--ld-font);
  font-variant-numeric: tabular-nums;
  color: var(--ld-ink);
}
.ld-percent i {
  grid-column: 1 / -1;
  order: 1;
  height: calc(var(--ld-size) * .1);
  border-radius: 999px;
  background: var(--ld-track);
  overflow: hidden;
}
.ld-percent i::after {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--ld-p) * 1%);
  border-radius: inherit;
  background: var(--ld-accent);
}

/* ---------- 17 Chasing Squares ---------- */
.ld-chase { --ld-step: calc(var(--ld-size) * .55); }
.ld-chase i {
  position: absolute;
  left: 0;
  top: 0;
  width: 45%;
  height: 45%;
  border-radius: 18%;
  background: var(--ld-accent);
  animation: ld-chase calc(3s * var(--ld-speed)) infinite;
}
.ld-chase i:nth-child(2) { background: var(--ld-ink); animation-delay: calc(-2s * var(--ld-speed)); }
.ld-chase i:nth-child(3) { background: var(--ld-muted); animation-delay: calc(-1s * var(--ld-speed)); }
@keyframes ld-chase {      /* caminho: baixo-esq → cima-esq → cima-dir → baixo-dir; 1 casa vazia corre ao contrário */
  0%       { transform: translate(0, var(--ld-step)); animation-timing-function: var(--ld-back); }
  6%, 25%  { transform: translate(0, 0); animation-timing-function: var(--ld-back); }
  31%, 50% { transform: translate(var(--ld-step), 0); animation-timing-function: var(--ld-back); }
  56%, 75% { transform: translate(var(--ld-step), var(--ld-step)); animation-timing-function: var(--ld-back); }
  81%, 100%{ transform: translate(0, var(--ld-step)); }
}

/* ---------- 18 Text Shimmer ---------- */
.ld-text {
  width: auto;
  height: auto;
  font: 800 calc(var(--ld-size) * .42)/1.1 var(--ld-font);
  letter-spacing: .02em;
  color: transparent;
  background: linear-gradient(100deg, var(--ld-muted) 0 40%, var(--ld-ink) 50%, var(--ld-muted) 60% 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
          background-clip: text;
  animation: ld-shimmer calc(1.8s * var(--ld-speed)) linear infinite;
}

/* ---------- 19 Battery Charge ---------- */
.ld-battery {
  width: calc(var(--ld-size) * 1.5);
  height: calc(var(--ld-size) * .74);
  margin-right: calc(var(--ld-size) * .1);
  border: calc(var(--ld-size) * .06) solid var(--ld-ink);
  border-radius: calc(var(--ld-size) * .14);
}
.ld-battery::after {             /* polo */
  content: "";
  position: absolute;
  right: calc(var(--ld-size) * -.15);
  top: 28%;
  bottom: 28%;
  width: calc(var(--ld-size) * .07);
  border-radius: 0 3px 3px 0;
  background: var(--ld-ink);
}
.ld-battery::before {            /* células */
  content: "";
  position: absolute;
  inset: calc(var(--ld-size) * .05);
  border-radius: calc(var(--ld-size) * .06);
  background: repeating-linear-gradient(90deg,
      var(--ld-accent) 0 calc(25% - 3px), transparent calc(25% - 3px) 25%);
  animation: ld-charge calc(2.4s * var(--ld-speed)) infinite;
}
.ld-battery i {                  /* raio */
  position: absolute;
  z-index: 1;
  inset: 16% 36%;
  background: var(--ld-ink);
  clip-path: polygon(58% 0, 8% 56%, 44% 56%, 34% 100%, 92% 40%, 54% 40%);
}
@keyframes ld-charge {
  0%, 16%  { clip-path: inset(0 100% 0 0); }
  17%, 33% { clip-path: inset(0 75% 0 0); }
  34%, 50% { clip-path: inset(0 50% 0 0); }
  51%, 67% { clip-path: inset(0 25% 0 0); }
  68%, 100%{ clip-path: inset(0 0 0 0); }
}

/* ---------- 20 Bouncing Ball (squash & stretch) ---------- */
.ld-ball::before {
  content: "";
  position: absolute;
  left: 34%;
  top: 6%;
  width: 32%;
  height: 32%;
  border-radius: 50%;
  background: var(--ld-accent);
  transform-origin: 50% 100%;
  animation: ld-ball calc(.9s * var(--ld-speed)) infinite;
}
.ld-ball::after {
  content: "";
  position: absolute;
  left: 30%;
  bottom: 4%;
  width: 40%;
  height: 7%;
  border-radius: 50%;
  background: var(--ld-ink);
  animation: ld-shadow calc(.9s * var(--ld-speed)) infinite;
}
@keyframes ld-ball {
  0%   { transform: translateY(0) scale(1, 1); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  44%  { transform: translateY(calc(var(--ld-size) * .5)) scale(.88, 1.12); }
  50%  { transform: translateY(calc(var(--ld-size) * .54)) scale(1.3, .7); animation-timing-function: cubic-bezier(0, .55, .45, 1); }
  58%  { transform: translateY(calc(var(--ld-size) * .44)) scale(.92, 1.08); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes ld-shadow {
  0%, 100% { transform: scaleX(.45); opacity: .12; animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  50% { transform: scaleX(1); opacity: .35; animation-timing-function: cubic-bezier(0, .55, .45, 1); }
}

/* ---------- movimento reduzido: continua sinalizando, só mais devagar ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --ld-speed: 2.5; }
}
