/* =====================================================================
 *  theme-toggle.css — Dark mode toggle component
 *  Design System: Quiet Luxury brand
 * ===================================================================== */

/* ۴۴px (--shafa-touch) نه ۴۰px — اندازهٔ قبلی زیر حد ۴۴px توصیه‌شدهٔ
   Apple/Google و WCAG 2.5.5 بود. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--shafa-touch);
  height: var(--shafa-touch);
  border-radius: var(--shafa-radius-full);
  border: 1px solid var(--shafa-border-subtle);
  background: var(--shafa-surface-card);
  color: var(--shafa-text-secondary);
  cursor: pointer;
  /* دقیقاً همان سه propertyی که قاعدهٔ :hover زیر تغییر می‌دهد — نه 'all'،
     چون all هر property قابل انیمیت‌شدن از جمله layout را درگیر می‌کند. */
  transition:
    background-color var(--shafa-duration-fast) var(--shafa-ease-natural),
    border-color var(--shafa-duration-fast) var(--shafa-ease-natural),
    color var(--shafa-duration-fast) var(--shafa-ease-natural);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--shafa-surface-muted);
  border-color: var(--shafa-border-strong);
  color: var(--shafa-text-primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--shafa-border-focus);
  outline-offset: 2px;
}

/* آیکون‌ها از ایموجی ☀️/🌙 به material_icon() تغییر کردند (نوامبر ۱۴۰۴):
   ایموجی بین سیستم‌عامل‌ها متفاوت رندر می‌شود، در حالت رنگی ویندوز می‌تواند
   ناخوانا شود و با پالت برند ناهماهنگ بود. مزیت دیگر: ۱٫۴KB کمتر در هر صفحه
   چون به‌جای دو گلیف فونت سیستم، از sprite پروژه استفاده می‌کند. */
.theme-toggle__icon {
  display: none;
  line-height: 1;
  transition: opacity var(--shafa-duration-fast) ease;
}
.theme-toggle__icon .material-symbols-outlined {
  font-size: 20px;
}

.theme-toggle__icon--light { display: inline-flex; }

:root[data-theme="dark"] .theme-toggle__icon--light { display: none; }
:root[data-theme="dark"] .theme-toggle__icon--dark { display: inline-flex; }

:root[data-theme="dark"] .theme-toggle {
  background: var(--shafa-surface-card);
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .theme-toggle { transition: none; }
  .theme-toggle__icon { transition: none; }
}
