/* ==========================================================================
   کاد — Base / Reset / Typography
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  direction: rtl;
  text-align: right;
  font-family: var(--font-family);
  font-size: var(--text-body1-size);
  font-weight: var(--fw-regular);
  color: var(--color-gray-800);
  background: #fbf8f2;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

ul,
ol {
  list-style: none;
}

/* -------- Headings & type scale -------- */
h1,
h2,
h3,
h4 {
  font-weight: var(--fw-bold);
  line-height: 1.35;
  color: var(--color-gray-900);
}

h1 {
  font-size: var(--text-h1-size);
}

h2 {
  font-size: var(--text-h2-size);
}

h3 {
  font-size: var(--text-h3-size);
}

h4 {
  font-size: var(--text-h4-size);
  font-weight: var(--fw-medium);
}

.text-body2 {
  font-size: var(--text-body2-size);
}

.text-caption {
  font-size: var(--text-caption-size);
  color: var(--color-gray-500);
}

.text-muted {
  color: var(--color-gray-500);
}

.text-primary {
  color: var(--color-primary);
}

/* -------- Accessibility: visible focus ring -------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------- Layout helpers -------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-4);
  }
}

.section {
  padding: var(--space-12) 0;
}

.section-tint {
  background: linear-gradient(180deg, #fbf1dc, #f7eeda 85%);
}

[data-theme='dark'] .section-tint {
  background: linear-gradient(180deg, #211a12, #14100a 85%);
}

@media (max-width: 640px) {
  .section {
    padding: var(--space-8) 0;
  }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
}

.section-head h2 {
  margin: 0;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-primary);
  font-weight: var(--fw-medium);
  font-size: var(--text-body2-size);
  white-space: nowrap;
}

.link-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.link-arrow:hover svg {
  transform: translateX(-3px);
}

.visually-hidden-mobile {
  display: none;
}

@media (min-width: 641px) {
  .visually-hidden-mobile {
    display: revert;
  }
}

/* -------- Skip link -------- */
.skip-link {
  position: absolute;
  right: var(--space-4);
  top: -60px;
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  z-index: 999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* -------- Scrollbar (webkit) -------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-gray-50);
}

::-webkit-scrollbar-thumb {
  background: var(--color-gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-gray-400);
}

/* -------- Theme toggle icon (sun/moon) — global rule so every page (incl. auth/admin) works -------- */
.theme-toggle {
  position: relative;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}

[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}
