/* SPM Medicare – loading animation
   Built from the original SPM Medicare logo (layers in ./assets).
   Usage: see README.md. Loop length: 3.4s. */

.spm-loader {
  --spm-loader-size: 160px;          /* logo width */
  --spm-loader-bg: #ffffff;          /* overlay background */
  --spm-loader-duration: 3.4s;
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--spm-loader-bg);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.spm-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.spm-loader--inline { position: relative; inset: auto; background: transparent; z-index: auto; }

.spm-loader__logo {
  position: relative;
  width: var(--spm-loader-size);
  aspect-ratio: 272 / 269;
}
.spm-loader__logo img {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
}

.spm-loader__outer {
  left: 0.000%; top: 0.000%; width: 100.000%; height: 100.000%;
  transform-origin: 49.485% 50.967%;
  animation: spmld-outer-rot var(--spm-loader-duration) infinite, spmld-outer-scale var(--spm-loader-duration) infinite, spmld-outer-fade var(--spm-loader-duration) infinite;
}
.spm-loader__middle {
  left: 1.103%; top: 15.242%; width: 81.985%; height: 82.900%;
  transform-origin: 51.300% 51.121%;
  animation: spmld-middle-rot var(--spm-loader-duration) infinite, spmld-middle-scale var(--spm-loader-duration) infinite, spmld-middle-fade var(--spm-loader-duration) infinite;
}
.spm-loader__inner {
  left: 16.544%; top: 29.368%; width: 68.015%; height: 69.888%;
  transform-origin: 50.919% 50.213%;
  animation: spmld-inner-rot var(--spm-loader-duration) infinite, spmld-inner-scale var(--spm-loader-duration) infinite, spmld-inner-fade var(--spm-loader-duration) infinite;
}
.spm-loader__spm {
  left: 26.103%; top: 56.506%; width: 66.544%; height: 23.792%;
  transform-origin: 50% 50%;
  animation: spmld-spm-scale var(--spm-loader-duration) infinite, spmld-spm-fade var(--spm-loader-duration) infinite;
}

@keyframes spmld-outer-rot {
  0.00% { rotate: -150deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  22.06% { rotate: 0deg; animation-timing-function: linear; }
  39.71% { rotate: 0deg; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  72.06% { rotate: 360deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  88.24% { rotate: 420deg; animation-timing-function: linear; }
  100.00% { rotate: 420deg; animation-timing-function: linear; }
}
@keyframes spmld-outer-scale {
  0.00% { scale: 0.78; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  22.06% { scale: 1; animation-timing-function: linear; }
  76.47% { scale: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  88.24% { scale: 1.08; animation-timing-function: linear; }
  100.00% { scale: 1.08; animation-timing-function: linear; }
}
@keyframes spmld-outer-fade {
  0.00% { opacity: 0; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  10.29% { opacity: 1; animation-timing-function: linear; }
  76.47% { opacity: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  88.24% { opacity: 0; animation-timing-function: linear; }
  100.00% { opacity: 0; animation-timing-function: linear; }
}
@keyframes spmld-middle-rot {
  0.00% { rotate: 150deg; animation-timing-function: linear; }
  3.53% { rotate: 150deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  25.59% { rotate: 0deg; animation-timing-function: linear; }
  41.76% { rotate: 0deg; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  74.12% { rotate: -360deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  90.29% { rotate: -420deg; animation-timing-function: linear; }
  100.00% { rotate: -420deg; animation-timing-function: linear; }
}
@keyframes spmld-middle-scale {
  0.00% { scale: 0.78; animation-timing-function: linear; }
  3.53% { scale: 0.78; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  25.59% { scale: 1; animation-timing-function: linear; }
  78.53% { scale: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  90.29% { scale: 1.08; animation-timing-function: linear; }
  100.00% { scale: 1.08; animation-timing-function: linear; }
}
@keyframes spmld-middle-fade {
  0.00% { opacity: 0; animation-timing-function: linear; }
  3.53% { opacity: 0; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  13.82% { opacity: 1; animation-timing-function: linear; }
  78.53% { opacity: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  90.29% { opacity: 0; animation-timing-function: linear; }
  100.00% { opacity: 0; animation-timing-function: linear; }
}
@keyframes spmld-inner-rot {
  0.00% { rotate: -150deg; animation-timing-function: linear; }
  7.06% { rotate: -150deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  29.12% { rotate: 0deg; animation-timing-function: linear; }
  43.82% { rotate: 0deg; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  76.18% { rotate: 360deg; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  92.35% { rotate: 420deg; animation-timing-function: linear; }
  100.00% { rotate: 420deg; animation-timing-function: linear; }
}
@keyframes spmld-inner-scale {
  0.00% { scale: 0.78; animation-timing-function: linear; }
  7.06% { scale: 0.78; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  29.12% { scale: 1; animation-timing-function: linear; }
  80.59% { scale: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  92.35% { scale: 1.08; animation-timing-function: linear; }
  100.00% { scale: 1.08; animation-timing-function: linear; }
}
@keyframes spmld-inner-fade {
  0.00% { opacity: 0; animation-timing-function: linear; }
  7.06% { opacity: 0; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  17.35% { opacity: 1; animation-timing-function: linear; }
  80.59% { opacity: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  92.35% { opacity: 0; animation-timing-function: linear; }
  100.00% { opacity: 0; animation-timing-function: linear; }
}
@keyframes spmld-spm-scale {
  0.00% { scale: 0.4; animation-timing-function: linear; }
  14.71% { scale: 0.4; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  25.00% { scale: 1.12; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  30.88% { scale: 1; animation-timing-function: linear; }
  47.06% { scale: 1; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  50.59% { scale: 1.09; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  54.71% { scale: 1; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  58.24% { scale: 1.09; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  66.18% { scale: 1; animation-timing-function: linear; }
  77.94% { scale: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  88.24% { scale: 0.85; animation-timing-function: linear; }
  100.00% { scale: 0.85; animation-timing-function: linear; }
}
@keyframes spmld-spm-fade {
  0.00% { opacity: 0; animation-timing-function: linear; }
  14.71% { opacity: 0; animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
  21.18% { opacity: 1; animation-timing-function: linear; }
  77.94% { opacity: 1; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  88.24% { opacity: 0; animation-timing-function: linear; }
  100.00% { opacity: 0; animation-timing-function: linear; }
}

/* Respect users who turn off motion: gentle pulse only */
@media (prefers-reduced-motion: reduce) {
  .spm-loader__logo img { animation: spmld-calm 1.6s ease-in-out infinite !important; rotate: none; scale: none; opacity: 1; }
  @keyframes spmld-calm { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
}
