/* پس‌زمینه محو و متحرک — تمام صفحات (استودیو / نور / قاب انتزاعی) */

.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
  background: transparent;
}

.bg-aurora__wash {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.94;
}

.bg-aurora__blobs {
  position: absolute;
  inset: -25%;
}

.bg-aurora__blob {
  display: block;
  position: absolute;
  border-radius: 50%;
  filter: blur(var(--ambient-blur, 72px)) saturate(92%);
  opacity: var(--blob-opacity, 0.36);
  mix-blend-mode: var(--blob-blend, normal);
  will-change: transform;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.bg-aurora__blob--1 {
  width: clamp(280px, 52vw, 640px);
  height: clamp(280px, 52vw, 640px);
  top: 18%;
  left: 0;
  background: var(--ambient-blob-1);
  animation: ambient-pass-x 52s linear infinite;
  animation-delay: -8s;
}

.bg-aurora__blob--2 {
  width: clamp(240px, 44vw, 560px);
  height: clamp(240px, 44vw, 560px);
  top: 55%;
  left: 0;
  background: var(--ambient-blob-2);
  animation: ambient-pass-x-rev 58s linear infinite;
  animation-delay: -22s;
}

.bg-aurora__blob--3 {
  width: clamp(220px, 38vw, 500px);
  height: clamp(220px, 38vw, 500px);
  left: 42%;
  top: 0;
  background: var(--ambient-blob-3);
  animation: ambient-pass-y 48s linear infinite;
  animation-delay: -14s;
}

.bg-aurora__blob--4 {
  width: clamp(200px, 32vw, 440px);
  height: clamp(200px, 32vw, 440px);
  left: 62%;
  top: 0;
  background: var(--ambient-blob-4);
  animation: ambient-pass-y-rev 54s linear infinite;
  animation-delay: -30s;
}

.bg-aurora__blob--5 {
  width: clamp(180px, 28vw, 380px);
  height: clamp(180px, 28vw, 380px);
  top: 72%;
  left: 0;
  background: var(--ambient-blob-5);
  opacity: calc(var(--blob-opacity, 0.36) * 0.9);
  animation: ambient-pass-diag 62s linear infinite;
  animation-delay: -36s;
}

/* خطوط نور نرم — شبیه لنز / نور استودیو (نامشخص) */
.bg-aurora__streaks {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  filter: blur(4px);
}

.bg-aurora__streaks span {
  position: absolute;
  display: block;
  width: clamp(140px, 32vw, 360px);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--ambient-streak),
    transparent
  );
  filter: blur(1px);
  transform-origin: center;
  animation: ambient-streak-pass 38s linear infinite;
}

.bg-aurora__streaks span:nth-child(1) {
  top: 22%;
  left: 0;
  --streak-rot: -14deg;
  animation-duration: 42s;
  animation-delay: -6s;
}

.bg-aurora__streaks span:nth-child(2) {
  top: 62%;
  left: 0;
  --streak-rot: 8deg;
  animation-duration: 48s;
  animation-delay: -20s;
}

.bg-aurora__streaks span:nth-child(3) {
  top: 44%;
  left: 0;
  --streak-rot: -4deg;
  width: clamp(100px, 24vw, 260px);
  animation-duration: 36s;
  animation-delay: -28s;
}

/* قاب‌های گوشه‌ای انتزاعی — فرم ۱۶:۹ بدون محتوا */
.bg-aurora__frames {
  position: absolute;
  inset: 0;
}

.bg-aurora__frame {
  --fx: 10%;
  --fy: 15%;
  --fr: -14deg;
  --fs: 1;
  position: absolute;
  top: var(--fy);
  inset-inline-start: var(--fx);
  width: clamp(4.5rem, 14vw, 9.5rem);
  aspect-ratio: 16 / 10;
  opacity: var(--frame-opacity, 0.11);
  transform: rotate(var(--fr)) scale(var(--fs));
  animation: ambient-frame-pass 64s linear infinite;
  filter: blur(1px);
}

.bg-aurora__frame::before,
.bg-aurora__frame::after {
  content: "";
  position: absolute;
  width: 32%;
  height: 32%;
  border: 1px solid var(--ambient-frame-stroke);
}

.bg-aurora__frame::before {
  top: 0;
  inset-inline-start: 0;
  border-inline-end: none;
  border-bottom: none;
  border-start-start-radius: 3px;
}

.bg-aurora__frame::after {
  bottom: 0;
  inset-inline-end: 0;
  border-inline-start: none;
  border-top: none;
  border-end-end-radius: 3px;
}

.bg-aurora__frame--1 { --fx: 8%; --fy: 12%; --fr: -11deg; animation-duration: 50s; animation-delay: -5s; }
.bg-aurora__frame--2 { --fx: 72%; --fy: 8%; --fr: 9deg; --fs: 1.15; animation-duration: 56s; animation-delay: -18s; }
.bg-aurora__frame--3 { --fx: 78%; --fy: 62%; --fr: -5deg; animation-duration: 46s; animation-delay: -26s; }
.bg-aurora__frame--4 { --fx: 18%; --fy: 68%; --fr: 14deg; --fs: 0.85; animation-duration: 52s; animation-delay: -32s; }
.bg-aurora__frame--5 { --fx: 44%; --fy: 38%; --fr: -22deg; --fs: 0.7; --frame-opacity: 0.08; animation-duration: 40s; animation-delay: -12s; }
.bg-aurora__frame--6 { --fx: 55%; --fy: 78%; --fr: 7deg; --fs: 1.05; animation-duration: 48s; animation-delay: -38s; }

.bg-aurora__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.5;
  mix-blend-mode: normal;
  filter: blur(6px);
}

.bg-aurora__mesh {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 95% 85% at 50% 45%, #000 25%, transparent 80%);
}

.bg-aurora__mesh::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, var(--dot-grid) 1px, transparent 0);
  background-size: clamp(24px, 4vw, 36px) clamp(24px, 4vw, 36px);
  opacity: 0.45;
}

.bg-aurora__grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: ambient-grain 7s steps(8) infinite;
  mix-blend-mode: multiply;
}

.bg-aurora__fog {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 38%, transparent);
  backdrop-filter: blur(var(--ambient-fog-blur, 42px)) saturate(105%);
  -webkit-backdrop-filter: blur(var(--ambient-fog-blur, 42px)) saturate(105%);
  pointer-events: none;
}

/* عبور از یک طرف صفحه به طرف دیگر */
@keyframes ambient-pass-x {
  0% { transform: translate(-65vw, 0); }
  100% { transform: translate(165vw, 6vh); }
}

@keyframes ambient-pass-x-rev {
  0% { transform: translate(165vw, -4vh); }
  100% { transform: translate(-65vw, 8vh); }
}

@keyframes ambient-pass-y {
  0% { transform: translate(0, -70vh); }
  100% { transform: translate(-8vw, 170vh); }
}

@keyframes ambient-pass-y-rev {
  0% { transform: translate(0, 170vh); }
  100% { transform: translate(6vw, -70vh); }
}

@keyframes ambient-pass-diag {
  0% { transform: translate(-60vw, 80vh); }
  100% { transform: translate(160vw, -60vh); }
}

@keyframes ambient-streak-pass {
  0% {
    opacity: 0;
    transform: translate(-75vw, 0) rotate(var(--streak-rot, 0deg));
  }
  12% { opacity: 0.32; }
  88% { opacity: 0.32; }
  100% {
    opacity: 0;
    transform: translate(175vw, 0) rotate(var(--streak-rot, 0deg));
  }
}

@keyframes ambient-frame-pass {
  0% {
    transform: rotate(var(--fr)) scale(var(--fs)) translate(-40vw, 0);
    opacity: 0;
  }
  8% { opacity: var(--frame-opacity, 0.1); }
  92% { opacity: var(--frame-opacity, 0.1); }
  100% {
    transform: rotate(calc(var(--fr) + 6deg)) scale(var(--fs)) translate(140vw, -12vh);
    opacity: 0;
  }
}

@keyframes ambient-grain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(-1%, -1%); }
}

@media (max-width: 768px) {
  .bg-aurora__blob {
    filter: blur(clamp(44px, 14vw, 88px)) saturate(90%);
  }

  .bg-aurora__fog {
    backdrop-filter: blur(clamp(24px, 7vw, 40px)) saturate(105%);
    -webkit-backdrop-filter: blur(clamp(24px, 7vw, 40px)) saturate(105%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-aurora__blob,
  .bg-aurora__streaks span,
  .bg-aurora__frame,
  .bg-aurora__grain {
    animation: none !important;
  }

  .bg-aurora__canvas {
    display: none;
  }
}
