/* ==========================================================================
   Purple Llama Digital — Motion
   Preloader, cursor, scroll reveals, llamas, flares, keyframes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Scroll progress
   -------------------------------------------------------------------------- */

.pl-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--pl-purple), var(--pl-glow) 55%, var(--pl-gold));
  box-shadow: 0 0 18px rgba(177, 75, 224, 0.7);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Preloader
   -------------------------------------------------------------------------- */

.pl-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background:
    radial-gradient(60% 60% at 50% 42%, rgba(139, 58, 158, 0.16), transparent 70%),
    #07030c;
  overflow: hidden;
  transition: opacity 0.5s ease;
}

.pl-preloader__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  transition: transform 1s var(--pl-ease), opacity 0.6s ease;
}

.pl-preloader__logo {
  position: relative;
  width: clamp(110px, 14vw, 168px);
  aspect-ratio: 822 / 1096;
}

.pl-preloader__llama {
  position: absolute;
  inset: 0;
  -webkit-mask: url("../img/logo-icon.png") no-repeat center / contain;
  mask: url("../img/logo-icon.png") no-repeat center / contain;
}

.pl-preloader__llama--base {
  background: rgba(247, 242, 236, 0.08);
}

.pl-preloader__llama--fill {
  background: linear-gradient(180deg, #c46fe0 0%, #9b3fb2 42%, #6f44a3 100%);
  clip-path: inset(100% 0 0 0);
  filter: drop-shadow(0 0 24px rgba(177, 75, 224, 0.55));
}

.pl-preloader__surface {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  box-shadow: 0 0 22px 4px rgba(196, 111, 224, 0.75);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pl-preloader__word {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.46em;
  text-transform: uppercase;
  color: rgba(247, 242, 236, 0.55);
  text-indent: 0.46em;
}

.pl-preloader__bar {
  width: clamp(140px, 18vw, 220px);
  height: 1px;
  background: rgba(247, 242, 236, 0.14);
  overflow: hidden;
}

.pl-preloader__bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--pl-purple), var(--pl-glow));
}

.pl-preloader__count {
  position: absolute;
  right: var(--pl-gutter);
  bottom: calc(var(--pl-gutter) * 0.8);
  font-size: clamp(2.6rem, 7vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: rgba(247, 242, 236, 0.9);
  font-variant-numeric: tabular-nums;
}

.pl-preloader__count::after {
  content: "%";
  font-size: 0.32em;
  margin-left: 0.15em;
  color: var(--pl-lilac);
}

.pl-preloader__tag {
  position: absolute;
  left: var(--pl-gutter);
  bottom: calc(var(--pl-gutter) * 0.9);
  max-width: 22ch;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  line-height: 2;
  color: rgba(247, 242, 236, 0.4);
}

.pl-preloader__curtain {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #07030c;
  transform-origin: top;
}

.pl-preloader.is-done .pl-preloader__inner {
  transform: translateY(-24px) scale(1.04);
  opacity: 0;
}

.pl-preloader.is-done {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease 0.15s;
}

/* Page transition curtain */
.pl-curtain {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: #07030c;
  transform: scaleY(0);
  transform-origin: bottom;
  pointer-events: none;
}

.pl-curtain.is-active {
  transform: scaleY(1);
  transition: transform 0.55s var(--pl-ease-io);
}

/* --------------------------------------------------------------------------
   Cursor
   -------------------------------------------------------------------------- */

.pl-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9998;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pl-cursor.is-visible {
  opacity: 1;
}

.pl-cursor__dot,
.pl-cursor__ring {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}

.pl-cursor__dot {
  width: 5px;
  height: 5px;
  background: #fff;
}

.pl-cursor__ring {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  transition: width 0.35s var(--pl-ease), height 0.35s var(--pl-ease), border-color 0.3s ease, background 0.3s ease;
}

.pl-cursor.is-hover .pl-cursor__ring {
  width: 58px;
  height: 58px;
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
}

.pl-cursor.is-drag .pl-cursor__ring {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.16);
}

@media (hover: none), (pointer: coarse) {
  .pl-cursor {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Scroll reveal system
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-y, 42px), 0);
  filter: blur(10px);
  transition:
    opacity 0.9s var(--pl-ease),
    transform 1.05s var(--pl-ease),
    filter 0.9s var(--pl-ease),
    clip-path 1.1s var(--pl-ease);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

[data-reveal="left"] {
  --reveal-y: 0px;
  transform: translate3d(-60px, 0, 0);
}

[data-reveal="right"] {
  --reveal-y: 0px;
  transform: translate3d(60px, 0, 0);
}

[data-reveal="scale"] {
  --reveal-y: 0px;
  transform: scale(0.92);
}

[data-reveal="clip"] {
  --reveal-y: 0px;
  transform: none;
  opacity: 1;
  filter: none;
  clip-path: inset(0 0 100% 0);
}

[data-reveal="clip-left"] {
  --reveal-y: 0px;
  transform: none;
  opacity: 1;
  filter: none;
  clip-path: inset(0 100% 0 0);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
  filter: none;
  clip-path: inset(0 0 0 0);
}

[data-reveal].is-out {
  opacity: 0;
  transform: translate3d(0, calc(var(--reveal-y, 42px) * -0.7), 0);
  filter: blur(7px);
}

[data-reveal="left"].is-out {
  transform: translate3d(-30px, 0, 0);
}

[data-reveal="right"].is-out {
  transform: translate3d(30px, 0, 0);
}

[data-reveal="scale"].is-out {
  transform: scale(0.96);
}

[data-reveal="clip"].is-out,
[data-reveal="clip-left"].is-out {
  opacity: 1;
  clip-path: inset(0 0 0 0);
  transform: none;
  filter: none;
}

/* Line-by-line heading reveal */
.pl-lines .pl-line {
  display: block;
  overflow: hidden;
}

.pl-lines .pl-line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 1.1s var(--pl-ease);
  transition-delay: var(--line-delay, 0s);
}

.pl-lines.is-in .pl-line > span {
  transform: translateY(0);
}

.pl-heading-motion { background:linear-gradient(100deg,var(--pl-cream) 0%,var(--pl-cream) 27%,var(--pl-lilac) 43%,var(--pl-glow) 52%,var(--pl-cream) 66%,var(--pl-cream) 100%); background-size:240% 100%; -webkit-background-clip:text; background-clip:text; color:transparent; animation:pl-heading-rise 1s var(--pl-ease) both,pl-heading-gradient 7s linear 1s infinite; }
@keyframes pl-heading-rise { from { opacity:0; transform:translateY(24px); filter:blur(8px); } to { opacity:1; transform:translateY(0); filter:blur(0); } }
@keyframes pl-heading-gradient { from { background-position:0% 50%; } to { background-position:240% 50%; } }

/* Image mask reveal */
.pl-mask {
  position: relative;
  overflow: hidden;
}

.pl-mask::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pl-ink);
  transform-origin: bottom;
  transition: transform 1.3s var(--pl-ease-io);
  z-index: 3;
}

.pl-mask.is-in::after {
  transform: scaleY(0);
}

/* --------------------------------------------------------------------------
   Llamas
   -------------------------------------------------------------------------- */

.pl-llama {
  display: block;
  position: absolute;
  width: var(--llama-w, 120px);
  aspect-ratio: 822 / 1096;
  pointer-events: none;
  z-index: 1;
  background: var(--llama-fill, linear-gradient(165deg, #b56ac9 0%, #8b3a9e 45%, #6f44a3 100%));
  -webkit-mask: url("../img/logo-icon.png") no-repeat center / contain;
  mask: url("../img/logo-icon.png") no-repeat center / contain;
  opacity: var(--llama-opacity, 0.22);
  rotate: var(--llama-rotate, 0deg);
  translate: 0 0;
  animation: pl-float 11s var(--pl-ease-soft) infinite;
  will-change: transform;
}

.pl-llama--outline {
  background: none;
  -webkit-mask: none;
  mask: none;
  background-image: url("../img/logo-icon.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: brightness(0) invert(1);
  opacity: var(--llama-opacity, 0.1);
}

.pl-llama--gold {
  --llama-fill: linear-gradient(160deg, #f6e4b8 0%, #e3c27e 40%, #a9803a 100%);
}

.pl-llama--glow {
  filter: drop-shadow(0 0 26px rgba(177, 75, 224, 0.7));
  --llama-opacity: 0.5;
}

.pl-llama--walk {
  animation: none;
}

/* Procession band */
.pl-llama-band {
  position: relative;
  overflow: hidden;
  padding-block: clamp(1.6rem, 3vw, 2.8rem);
  border-block: 1px solid var(--pl-line);
  background: linear-gradient(90deg, rgba(139, 58, 158, 0.1), transparent 40%, rgba(111, 68, 163, 0.1));
}

.pl-llama-band__track {
  display: flex;
  align-items: center;
  gap: clamp(1.6rem, 4vw, 4rem);
  width: max-content;
  animation: pl-marquee 36s linear infinite;
}

.pl-llama-band .pl-llama {
  position: relative;
  width: clamp(38px, 5vw, 76px);
  opacity: 0.75;
  animation: none;
}

.pl-llama-band__text {
  font-size: clamp(0.68rem, 0.9vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--pl-cream-mute);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Lens flares + light
   -------------------------------------------------------------------------- */

.pl-flare {
  position: absolute;
  pointer-events: none;
  z-index: 2;
  width: clamp(200px, 30vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(196, 111, 224, 0.32) 22%, rgba(139, 58, 158, 0.14) 45%, transparent 70%);
  filter: blur(14px);
  mix-blend-mode: screen;
  opacity: 0.55;
  animation: pl-flare-breathe 9s ease-in-out infinite;
}

.pl-flare--gold {
  background: radial-gradient(circle, rgba(255, 246, 214, 0.6) 0%, rgba(227, 194, 126, 0.3) 26%, transparent 68%);
}

.pl-streak {
  position: absolute;
  height: 1px;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), rgba(196, 111, 224, 0.6), transparent);
  filter: blur(0.4px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 2;
  animation: pl-streak 7s var(--pl-ease) infinite;
}

.pl-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 30%),
    rgba(177, 75, 224, 0.16),
    transparent 65%
  );
  transition: opacity 0.4s ease;
}

/* --------------------------------------------------------------------------
   Hover utilities
   -------------------------------------------------------------------------- */

.pl-tilt {
  transform-style: preserve-3d;
  transition: transform 0.5s var(--pl-ease);
  will-change: transform;
}

.pl-magnetic {
  transition: transform 0.35s var(--pl-ease);
  will-change: transform;
}

.pl-underline {
  position: relative;
}

.pl-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15em;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--pl-ease);
}

.pl-underline:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Animated icon strokes */
.pl-icon-draw path,
.pl-icon-draw circle,
.pl-icon-draw rect {
  stroke-dasharray: 90;
  stroke-dashoffset: 90;
  transition: stroke-dashoffset 1.2s var(--pl-ease);
}

.is-in .pl-icon-draw path,
.is-in .pl-icon-draw circle,
.is-in .pl-icon-draw rect,
.pl-icon-draw:hover path,
.pl-icon-draw:hover circle,
.pl-icon-draw:hover rect {
  stroke-dashoffset: 0;
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */

@keyframes pl-gradient-pan {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes pl-marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes pl-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -16px; }
}

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

@keyframes pl-slow-spin {
  to { transform: translateX(-50%) rotate(360deg); }
}

@keyframes pl-pulse-ring {
  0% { transform: scale(1); opacity: 0.7; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes pl-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@keyframes pl-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes pl-grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -3%); }
  20% { transform: translate(-4%, 2%); }
  30% { transform: translate(2%, -4%); }
  40% { transform: translate(-1%, 3%); }
  50% { transform: translate(-4%, 1%); }
  60% { transform: translate(3%, 2%); }
  70% { transform: translate(1%, -3%); }
  80% { transform: translate(-3%, -1%); }
  90% { transform: translate(2%, 3%); }
}

@keyframes pl-dot {
  0% { box-shadow: 0 0 0 0 rgba(125, 255, 168, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(125, 255, 168, 0); }
  100% { box-shadow: 0 0 0 0 rgba(125, 255, 168, 0); }
}

@keyframes pl-flare-breathe {
  0%, 100% { opacity: 0.35; transform: scale(0.95); }
  50% { opacity: 0.7; transform: scale(1.08); }
}

@keyframes pl-streak {
  0% { transform: translateX(-120%) translateY(0); opacity: 0; }
  12% { opacity: 0.7; }
  55% { opacity: 0.45; }
  100% { transform: translateX(320%) translateY(0); opacity: 0; }
}

@keyframes pl-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pl-reveal-line {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }

  .pl-hero__line > span,
  .pl-lines .pl-line > span {
    transform: none !important;
  }

  .pl-preloader {
    display: none !important;
  }

  .pl-cursor {
    display: none !important;
  }

  .pl-grain {
    animation: none;
  }
}
