/* =============================================================================
   Zagros Tech — Base / Reset
   ============================================================================= */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--fs-base);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  line-height: var(--lh-tight);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-3xl);
}

h2 {
  font-size: var(--fs-2xl);
}

h3 {
  font-size: var(--fs-xl);
}

h4 {
  font-size: var(--fs-lg);
}

p {
  text-wrap: pretty;
}

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

a:hover {
  color: var(--contrast);
}

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

img {
  background: var(--surface-2);
}

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

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

ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

::selection {
  background: var(--brand);
  color: var(--brand-contrast);
}

[hidden] {
  display: none !important;
}

/* helpers */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-4);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--s-5);
  }
}

.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;
}

.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  letter-spacing: 0;
}

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

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

.eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
}

/* reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(14px);
}

.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 460ms var(--ease-out), transform 460ms var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* page progress bar */
#page-progress {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--brand));
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent);
  width: 0;
  z-index: var(--z-toast);
  transition: width 200ms var(--ease-out), opacity 320ms;
}

/* گذارِ نرمِ بین صفحات (ناوبری چنددکومنتی) */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

::view-transition-old(root) {
  animation: zt-vt-out 150ms var(--ease-out) both;
  z-index: 1;
}

::view-transition-new(root) {
  animation: zt-vt-in 240ms var(--ease-out) both;
  z-index: 2;
  mix-blend-mode: normal;
}

@keyframes zt-vt-out {
  to {
    opacity: 0;
  }
}

@keyframes zt-vt-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- تعویض تم: پرده‌ی دایره‌ای (انیمیشن با JS) — بدون فِیدِ ناوبری ---------- */
:root[data-vt='theme']::view-transition-old(root),
:root[data-vt='theme']::view-transition-new(root) {
  animation: none;
}

:root.theme-anim,
:root.theme-anim *,
:root.theme-anim *::before,
:root.theme-anim *::after {
  transition:
    background-color 320ms var(--ease),
    border-color 320ms var(--ease),
    color 240ms var(--ease),
    box-shadow 320ms var(--ease),
    fill 240ms var(--ease) !important;
}

/* ---------- Skeleton ---------- */
.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-1);
}

.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface-3) 70%, transparent), transparent);
  transform: translateX(-100%);
  animation: skel-sweep 1.4s ease-in-out infinite;
}

[dir='rtl'] .skel::after {
  animation-name: skel-sweep-rtl;
}

@keyframes skel-sweep {
  100% {
    transform: translateX(100%);
  }
}

@keyframes skel-sweep-rtl {
  100% {
    transform: translateX(100%);
  }
}

.skel-line {
  height: 12px;
  border-radius: var(--r-1);
}

.skel-line.sm {
  height: 10px;
}

[aria-busy='true'] {
  cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
  .skel::after {
    animation: none;
    opacity: 0.5;
    transform: none;
  }
}