/* ──────────────────────────────────────────────────────────────────────
   پایه: ریست، فونت دانا، RTL، دسترس‌پذیری
   ⚠ هیچ‌جای این سایت وزن بالای ۶۰۰ استفاده نمی‌شود. دامنه‌ی @font-face
     هم عمداً روی `100 600` بسته شده تا اگر جایی سهواً `bold` بنویسیم،
     مرورگر به ۶۰۰ گیر کند و خودش را نشان بدهد.
   ────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Dana";
  src: url("/assets/fonts/DanaVF.woff2") format("woff2-variations"),
       url("/assets/fonts/DanaVF.woff2") format("woff2");
  font-weight: 100 600;
  font-style: normal;
  font-display: swap;
}

/* فونت جایگزین با متریک تنظیم‌شده: تا رسیدن دانا، Tahoma تقریباً همان
   جای متن را می‌گیرد و بعد از لود، صفحه تکان نمی‌خورد (CLS ≈ 0). */
@font-face {
  font-family: "Dana Fallback";
  src: local("Tahoma"), local("Segoe UI");
  ascent-override: 90%;
  descent-override: 55%;
  line-gap-override: 0%;
  size-adjust: 88.8%;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  direction: rtl;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* ⚠ روی **ریشه** بستن مشکلی برای هدرِ چسبان ندارد (خودِ ریشه از قبل
     ظرفِ اسکرولِ صفحه است). آنچه هدر را می‌شکست، گذاشتنِ همین روی
     `body` بود که body را ظرفِ اسکرولِ دوم می‌کرد.
     `hidden` نه `clip`: `clip` را سافاری فقط از نسخه‌ی ۱۶ می‌شناسد و
     روی گوشی‌های قدیمی‌تر بی‌اثر می‌ماند. */
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: "Dana", "Dana Fallback", system-ui, "Segoe UI", Tahoma, sans-serif;
  font-weight: 400;
  font-variation-settings: "wght" 400, "KASH" 2;
  font-size: clamp(15px, 0.55vw + 13.4px, 17px);
  line-height: 1.85;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-theme) var(--ease-calm),
              color var(--t-theme) var(--ease-calm);
  /* ⚠ اینجا `overflow-x` نداریم — عمداً.
     تا وقتی html روی `visible` بود، مقدارِ body به viewport منتقل
     می‌شد و مشکلی نداشت. ولی حالا که html خودش `clip` دارد، انتقالی
     در کار نیست و `overflow-x: hidden` روی body، **خودِ body را یک
     ظرفِ اسکرول** می‌کند (چون `overflow-y` به `auto` می‌رود). آن‌وقت
     هدرِ چسبان به scrollportِ body می‌چسبد که هرگز اسکرول نمی‌شود —
     یعنی هدر روی موبایل اصلاً نمی‌چسبید. بریدنِ افقی را html
     انجام می‌دهد. */
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.4;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
  font-variation-settings: "wght" 600, "KASH" 2;
  text-wrap: balance;
}
h1 {
  font-size: clamp(30px, 4.4vw, 56px);
  line-height: 1.24;
  font-variation-settings: "wght" 600, "KASH" 0;
}
h2 { font-size: clamp(24px, 3vw, 38px); line-height: 1.3; }
h3 { font-size: clamp(18px, 1.6vw, 22px); }
h4 { font-size: 17px; font-variation-settings: "wght" 500, "KASH" 2; }

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

::selection { background: var(--brand-300); color: var(--brand-900); }

/* اعداد فارسی در همه‌ی متن‌ها؛ ولی نه در فیلدهای ورودی چون کاربر
   با کیبورد لاتین تایپ می‌کند و دیدن رقم متفاوت گیج‌کننده است. */
body { font-feature-settings: "ss01" 1; }

/* ── دسترس‌پذیری ─────────────────────────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 6px;
}
:focus:not(:focus-visible) { outline: none; }

.skip {
  position: absolute;
  right: 16px;
  top: -100px;
  z-index: 200;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--brand-600);
  color: #fff;
  transition: top var(--t-fast) var(--ease-calm);
}
.skip:focus { top: 16px; }

.sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ── داربست ──────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ⚠ هدر چسبان است، پس پرش با لنگر (#about و …) عنوان بخش را زیر نوار
   پنهان می‌کند. این حاشیه دقیقاً به اندازه‌ی بلندی نوار است. */
section { position: relative; scroll-margin-top: 96px; }
[id] { scroll-margin-top: 96px; }

/* ⚠ همه‌ی محتوا باید روی صحنه بنشیند. بدون این، ‎#scene که
     position:fixed است روی متن می‌افتد و صفحه ناخوانا می‌شود. */
.page { position: relative; z-index: 1; }

/* ── حرکت کم ─────────────────────────────────────────────────────── */

@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;
  }
}

