/* =====================================================
   ایلچی (ILCHI) — موتور موشن پیشرفته و رقص لایه‌های تودرتو
   ===================================================== */

/* ===== نشانگر دنبال‌کننده ظریف موس (فقط دسکتاپ) ===== */
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid rgba(217, 119, 6, 0.55);
  pointer-events: none;
  z-index: 1900;
  transform: translate3d(-100px, -100px, 0);
  transition: width 0.25s var(--ease-expo), height 0.25s var(--ease-expo),
              background-color 0.25s, border-color 0.25s, opacity 0.25s;
  opacity: 0;
  mix-blend-mode: normal;
}

.cursor-ring.visible { opacity: 1; }

.cursor-ring.hover {
  width: 54px;
  height: 54px;
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--amber-bright);
}

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

/* ===== نور پویا روی کارت‌ها (Spotlight) ===== */
[data-spotlight] {
  position: relative;
  overflow: hidden;
}

[data-spotlight]::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    340px circle at var(--sx, 50%) var(--sy, 50%),
    rgba(245, 158, 11, 0.14),
    transparent 68%
  );
  opacity: 0;
  transition: opacity 0.35s var(--ease-expo);
  pointer-events: none;
  z-index: 1;
}

[data-spotlight]:hover::before { opacity: 1; }

/* ===== ورود سینمایی خطوط تیتر ===== */
.line-mask {
  display: block;
  overflow: hidden;
}

.line-mask > span {
  display: inline-block;
  animation: lineRise 0.95s var(--ease-expo) var(--d, 0s) both;
}

@keyframes lineRise {
  from { opacity: 0; transform: translateY(110%) skewY(2.5deg); }
  to   { opacity: 1; transform: none; }
}

.kinetic-hero-badge { animation: kineticUp 0.75s var(--ease-expo) 0.05s both; }
.kinetic-hero-desc  { animation: kineticUp 0.9s var(--ease-expo) 0.22s both; }
.kinetic-hero-act   { animation: kineticUp 0.95s var(--ease-expo) 0.32s both; }
.kinetic-hero-kpi   { animation: kineticUp 1s var(--ease-expo) 0.42s both; }

@keyframes kineticUp {
  from { opacity: 0; transform: translateY(34px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* ===== ورود پلکانی عناصر با اسکرول ===== */
.motion-reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  transition: opacity 0.9s var(--ease-expo), transform 0.9s var(--ease-expo), clip-path 0.95s var(--ease-expo);
  will-change: transform, opacity;
}

.motion-reveal { transform: translateY(38px) scale(0.965); }
.reveal-left   { transform: translateX(-56px) rotate(-2deg); }
.reveal-right  { transform: translateX(56px) rotate(2deg); }
.reveal-scale  { transform: scale(0.86); clip-path: inset(10% 10% 10% 10% round 26px); }

.motion-reveal.in-view,
.reveal-left.in-view,
.reveal-right.in-view,
.reveal-scale.in-view {
  opacity: 1;
  transform: none;
  clip-path: inset(0% 0% 0% 0% round 24px);
}

/* ===== نوار مهندسی متحرک دوردیفه ===== */
.kinetic-ribbon {
  overflow: hidden;
  border-block: 1px solid var(--border);
  background: var(--teal);
  color: #fff;
  padding: 0.85rem 0;
  position: relative;
}

body.dark-mode .kinetic-ribbon {
  background: var(--surface);
}

.ribbon-track {
  display: flex;
  width: max-content;
  gap: 2.5rem;
  animation: ribbonSlide 28s linear infinite;
}

.ribbon-track:hover { animation-play-state: paused; }

.ribbon-item {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: #e2e8f0;
  white-space: nowrap;
}

.ribbon-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-bright);
}

@keyframes ribbonSlide {
  from { transform: translateX(0); }
  to   { transform: translateX(50%); }
}

/* ===== پس‌زمینه هندسی متحرک در بنر صفحات داخلی ===== */
.banner-orbits {
  position: absolute;
  top: -60px;
  left: -60px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 1.5px dashed rgba(245, 158, 11, 0.35);
  animation: slowSpin 34s linear infinite;
  pointer-events: none;
}

.banner-orbits::after {
  content: '';
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  animation: slowSpin 22s linear infinite reverse;
}

@keyframes slowSpin {
  to { transform: rotate(360deg); }
}

/* =====================================================
   صحنه‌ی اسکرول-محور چسبان ۳فازه (Scroll-Scrubbed Stage)
   متغیر --p با فیزیک Lerp از 0 تا 1 حرکت می‌کنه
   ===================================================== */
.choreo-track {
  position: relative;
  height: 250vh;
}

.choreo-sticky {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 2rem 0;
}

.choreo-stage {
  position: relative;
  width: 100%;
  height: min(580px, 78vh);
  display: grid;
  place-items: center;
  perspective: 1400px;
}

/* هاله نور مرکزی که با اسکرول نفس می‌کشه */
.choreo-aura {
  position: absolute;
  width: clamp(320px, 48vw, 600px);
  height: clamp(320px, 48vw, 600px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.22), transparent 68%);
  transform: scale(calc(0.65 + var(--p, 0) * 0.55));
  pointer-events: none;
}

/* حلقه‌های هندسی هم‌مرکز */
.choreo-ring {
  position: absolute;
  width: clamp(300px, 44vw, 550px);
  height: clamp(300px, 44vw, 550px);
  border-radius: 50%;
  border: 1.5px dashed rgba(217, 119, 6, 0.45);
  transform: rotate(calc(var(--p, 0) * 180deg)) scale(calc(0.66 + var(--p, 0) * 0.46));
  pointer-events: none;
}

.choreo-ring-inner {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  border: 1px solid rgba(12, 36, 38, 0.22);
  transform: rotate(calc(var(--p, 0) * -260deg));
}

body.dark-mode .choreo-ring-inner {
  border-color: rgba(245, 158, 11, 0.28);
}

/* کارت مرکزی با باز شدن پنجره‌ای (Clip-Path Aperture) */
.choreo-center-card {
  position: relative;
  z-index: 3;
  width: min(560px, 80vw);
  height: min(400px, 56vh);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 2px solid rgba(245, 158, 11, 0.5);
  clip-path: inset(
    calc((1 - var(--p, 0)) * 12%)
    calc((1 - var(--p, 0)) * 10%)
    calc((1 - var(--p, 0)) * 12%)
    calc((1 - var(--p, 0)) * 10%)
    round 28px
  );
  transform:
    scale(calc(0.76 + var(--p, 0) * 0.26))
    rotateX(calc((0.5 - var(--p, 0)) * 8deg))
    rotateZ(calc((0.5 - var(--p, 0)) * 4deg));
}

.choreo-center-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(calc(1.22 - var(--p, 0) * 0.22));
}

.choreo-center-caption {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 38%, rgba(12, 36, 38, 0.94) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.65rem;
  color: #fff;
}

.choreo-center-caption span {
  color: var(--amber-bright);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.choreo-center-caption h3 {
  font-size: clamp(1.15rem, 2.1vw, 1.5rem);
  font-weight: 900;
}

/* دو بال جانبی با چرخش سه‌بعدی و قفل شدن روی صحنه */
.choreo-wing {
  position: absolute;
  z-index: 4;
  width: clamp(210px, 24vw, 295px);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.choreo-wing-right {
  right: 1.5%;
  top: 9%;
  transform:
    translate3d(calc((1 - var(--p, 0)) * 165px), calc((var(--p, 0) - 0.5) * -60px), 0)
    rotateY(calc((1 - var(--p, 0)) * -22deg))
    rotateZ(calc((1 - var(--p, 0)) * 10deg));
  opacity: calc(0.15 + var(--p, 0) * 0.85);
}

.choreo-wing-left {
  left: 1.5%;
  bottom: 9%;
  transform:
    translate3d(calc((1 - var(--p, 0)) * -165px), calc((var(--p, 0) - 0.5) * 60px), 0)
    rotateY(calc((1 - var(--p, 0)) * 22deg))
    rotateZ(calc((1 - var(--p, 0)) * -10deg));
  opacity: calc(0.15 + var(--p, 0) * 0.85);
}

.choreo-wing img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.choreo-wing-body { padding: 0.85rem 1rem; }
.choreo-wing-body strong { display: block; font-size: 0.88rem; margin-bottom: 0.15rem; }
.choreo-wing-body span { font-size: 0.76rem; color: var(--txt-2); }

/* نشانگرهای شناور و نوار فاز اسکرول */
.choreo-chip {
  position: absolute;
  z-index: 5;
  padding: 0.65rem 1.05rem;
  border-radius: var(--r-md);
  background: var(--teal);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(245, 158, 11, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.choreo-chip i { color: var(--amber-bright); }

.choreo-chip-top {
  left: 6%;
  top: 12%;
  transform: translate3d(calc((1 - var(--p, 0)) * -50px), calc((0.5 - var(--p, 0)) * 85px), 0);
}

.choreo-chip-bottom {
  right: 6%;
  bottom: 10%;
  transform: translate3d(calc((1 - var(--p, 0)) * 50px), calc((var(--p, 0) - 0.5) * 85px), 0);
}

.choreo-meter {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 1rem;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  font-size: 0.76rem;
  font-weight: 800;
}

.choreo-meter-bar {
  width: 96px;
  height: 5px;
  border-radius: var(--r-full);
  background: var(--bg-2);
  overflow: hidden;
}

.choreo-meter-fill {
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  background: linear-gradient(90deg, var(--amber), var(--amber-bright));
}

/* افکت تغییر نرم در استودیو مدل و انتخاب‌گر */
.morph-pop {
  animation: morphPop 0.42s var(--ease-expo);
}

@keyframes morphPop {
  0%   { opacity: 0.45; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  .choreo-track { height: auto; }
  .choreo-sticky { position: static; height: auto; padding: 3rem 0; }
  .choreo-stage { height: auto; gap: 1rem; }
  .choreo-center-card, .choreo-wing, .choreo-chip, .choreo-meter {
    position: static;
    transform: none !important;
    clip-path: none !important;
    opacity: 1 !important;
    width: 100%;
  }
  .choreo-ring, .choreo-aura, .choreo-meter { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .motion-reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1; transform: none; clip-path: none; transition: none;
  }
  .choreo-track { height: auto; }
  .choreo-sticky { position: static; height: auto; }
  .choreo-center-card, .choreo-wing, .choreo-chip, .choreo-ring {
    transform: none !important;
    clip-path: none !important;
    opacity: 1 !important;
  }
  .ribbon-track, .banner-orbits { animation: none; }
}
