/* ============================================================
   YAR Animated Logo — لوگوی متحرک یار
   حلقه‌ی دایره‌ای می‌چرخد؛ کلمه‌ی دوم هر ۲ ثانیه تغییر می‌کند:
   یار مالیاتی → یار مالی → یار فروش → یار مدیر → یار هوشمند
   ============================================================ */

.yar-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-primary);
  line-height: 1;
}

/* ---------- نشان متحرک ---------- */
.yar-logo__mark {
  position: relative;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: var(--color-primary);
}

.yar-logo__mark svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

/* حلقه می‌چرخد — آرام و پیوسته */
.yar-logo__mark #yar-ring {
  transform-origin: 60px 60px;
  animation: yar-spin 14s linear infinite;
}

/* مرکز ثابت می‌ماند — فقط با نفس ملایم */
.yar-logo__mark #yar-core {
  transform-origin: 60px 60px;
  animation: yar-breathe 4s ease-in-out infinite;
}

@keyframes yar-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes yar-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.93); }
}

/* احترام به ترجیح کاربر برای کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
  .yar-logo__mark #yar-ring,
  .yar-logo__mark #yar-core {
    animation: none;
  }
}

/* ---------- واژه‌نشان ---------- */
.yar-logo__text {
  display: inline-flex;
  align-items: baseline;
  gap: 0.28em;
  font-weight: 800;
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-tight);
  white-space: nowrap;
}

.yar-logo__fixed {
  color: var(--color-text);
}

/* محفظه‌ی کلمه‌ی چرخشی — عرض بر پایه‌ی بلندترین کلمه ثابت می‌ماند */
.yar-logo__cycle {
  position: relative;
  display: inline-block;
  min-width: 5.2em;          /* جای «مالیاتی» — بلندترین کلمه */
  height: 1.25em;
  overflow: hidden;
  vertical-align: bottom;
}

.yar-logo__cycle span {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  height: 1.25em;
  line-height: 1.25em;
  color: var(--color-primary);
  opacity: 0;
  transform: translateY(110%);
  animation: yar-word 10s cubic-bezier(.32,.72,0,1) infinite;
  will-change: transform, opacity;
}

/* پنج کلمه × ۲ ثانیه = چرخه‌ی ۱۰ ثانیه */
.yar-logo__cycle span:nth-child(1) { animation-delay: 0s;   }
.yar-logo__cycle span:nth-child(2) { animation-delay: 2s;   }
.yar-logo__cycle span:nth-child(3) { animation-delay: 4s;   }
.yar-logo__cycle span:nth-child(4) { animation-delay: 6s;   }
.yar-logo__cycle span:nth-child(5) { animation-delay: 8s;   }

@keyframes yar-word {
  0%    { opacity: 0; transform: translateY(110%); }
  3%    { opacity: 1; transform: translateY(0); }
  17%   { opacity: 1; transform: translateY(0); }
  20%   { opacity: 0; transform: translateY(-110%); }
  100%  { opacity: 0; transform: translateY(-110%); }
}

@media (prefers-reduced-motion: reduce) {
  .yar-logo__cycle { min-width: 0; }
  .yar-logo__cycle span { animation: none; transform: none; }
  .yar-logo__cycle span:nth-child(1) { opacity: 1; position: static; }
  .yar-logo__cycle span:not(:nth-child(1)) { display: none; }
}

/* ---------- اندازه‌های کوچک (فوتر / موبایل) ---------- */
.yar-logo--sm .yar-logo__mark { width: 30px; height: 30px; flex-basis: 30px; }
.yar-logo--sm .yar-logo__text { font-size: var(--text-base); }

/* ---------- اندازه‌های بزرگ ---------- */
.yar-logo--lg .yar-logo__mark { width: 56px; height: 56px; flex-basis: 56px; }
.yar-logo--lg .yar-logo__text { font-size: 28px; }

.yar-logo--xl .yar-logo__mark { width: 84px; height: 84px; flex-basis: 84px; }
.yar-logo--xl .yar-logo__text { font-size: 42px; }
.yar-logo--xl { gap: var(--space-4); }

/* نشان بزرگِ صفحه‌ی ورود */
.yar-logo--auth .yar-logo__mark { width: 64px; height: 64px; flex-basis: 64px; }
.yar-logo--auth .yar-logo__text { font-size: 24px; }

.yar-logo--lg .yar-logo__cycle,
.yar-logo--xl .yar-logo__cycle,
.yar-logo--auth .yar-logo__cycle { min-width: 5.4em; }

/* نمایش مستقل (بدون متغیرهای سیستم طراحی) — مقادیر بازگشتی */
.yar-logo { --space-3: 12px; --space-4: 16px; --text-lg: 17px; --text-base: 15px; --tracking-tight: -0.02em;
  --color-primary: #0b5d2a; --color-text: #080912; }


/* روی پس‌زمینه‌ی تیره / سبز */
.yar-logo--onPrimary,
.yar-logo--onPrimary .yar-logo__fixed {
  color: #fff;
}
.yar-logo--onPrimary .yar-logo__mark,
.yar-logo--onPrimary .yar-logo__cycle span {
  color: #fff;
}
