/* Monogram page loader — smooth palette morph, starts on sky blue */
.site-loader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  background: var(--bg, #F6F9FB);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.site-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.site-loader__mark {
  position: relative;
  width: min(92px, 24vw);
  aspect-ratio: 304 / 307;
}

.site-loader__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.site-loader__glyph {
  fill: #FFFFFF;
}

.site-loader__layer {
  position: absolute;
  inset: 0;
}

/* Single visible mark: fill morphs smoothly through the palette */
.site-loader__layer--a {
  opacity: 1;
  z-index: 1;
}

.site-loader__layer--b {
  opacity: 0;
  z-index: 0;
  pointer-events: none;
}

.site-loader__layer--a .site-loader__bg {
  fill: #86BBD8;
  animation: loader-palette 4.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.site-loader__mark::after {
  content: '';
  position: absolute;
  inset: -24%;
  border-radius: 50%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    circle,
    color-mix(in srgb, #86BBD8 32%, transparent) 0%,
    transparent 70%
  );
  animation: loader-glow 4.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

/* Sky → Baltic → Charcoal → Honey → Blaze → Sky (smooth in + out) */
@keyframes loader-palette {
  0%   { fill: #86BBD8; } /* sky — start */
  20%  { fill: #33658A; } /* baltic */
  40%  { fill: #2F4858; } /* charcoal */
  60%  { fill: #F6AE2D; } /* honey */
  80%  { fill: #F26419; } /* blaze */
  100% { fill: #86BBD8; } /* back to sky */
}

@keyframes loader-glow {
  0% {
    opacity: 0.9;
    transform: scale(1);
    background: radial-gradient(circle, color-mix(in srgb, #86BBD8 32%, transparent) 0%, transparent 70%);
  }
  20% {
    opacity: 0.75;
    transform: scale(1.04);
    background: radial-gradient(circle, color-mix(in srgb, #33658A 30%, transparent) 0%, transparent 70%);
  }
  40% {
    opacity: 0.55;
    transform: scale(1.08);
    background: radial-gradient(circle, color-mix(in srgb, #2F4858 28%, transparent) 0%, transparent 70%);
  }
  60% {
    opacity: 0.8;
    transform: scale(1.05);
    background: radial-gradient(circle, color-mix(in srgb, #F6AE2D 30%, transparent) 0%, transparent 70%);
  }
  80% {
    opacity: 0.85;
    transform: scale(1.03);
    background: radial-gradient(circle, color-mix(in srgb, #F26419 30%, transparent) 0%, transparent 70%);
  }
  100% {
    opacity: 0.9;
    transform: scale(1);
    background: radial-gradient(circle, color-mix(in srgb, #86BBD8 32%, transparent) 0%, transparent 70%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-loader__layer--a .site-loader__bg,
  .site-loader__mark::after {
    animation: none !important;
  }
  .site-loader__layer--a .site-loader__bg { fill: #86BBD8; }
}

:root[data-theme="dark"] .site-loader {
  background: #062334;
}
