/* ==========================================================================
   آلنیدو — ریست، تایپوگرافی پایه و ابزارها
   ========================================================================== */

/* یکان‌بخش — میزبانی محلی. woff2 اول، woff برای مرورگرهای قدیمی */
@font-face {
  font-family: "YekanBakh";
  src: url("../fonts/yekanbakh-regular.woff2") format("woff2"),
       url("../fonts/yekanbakh-regular.woff")  format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanBakh";
  src: url("../fonts/yekanbakh-medium.woff2") format("woff2"),
       url("../fonts/yekanbakh-medium.woff")  format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanBakh";
  src: url("../fonts/yekanbakh-bold.woff2") format("woff2"),
       url("../fonts/yekanbakh-bold.woff")  format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "YekanBakh";
  src: url("../fonts/yekanbakh-heavy.woff2") format("woff2"),
       url("../fonts/yekanbakh-heavy.woff")  format("woff");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: rgb(var(--content-neutral-primary));
  background: rgb(var(--surface-neutral-subtle));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

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

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

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

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

ul, ol { list-style: none; padding: 0; }

h1, h2, h3, h4 { font-weight: 700; text-wrap: balance; }

h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); }

/* ارقام هم‌عرض تا ستون قیمت‌ها هم‌تراز بماند */
.num, .price, table { font-variant-numeric: tabular-nums; }

/* نام‌های لاتین داخل متن فارسی نباید جهت را بشکنند */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---------- فوکوس قابل مشاهده ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgb(var(--surface-brand-default));
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- لینک پرش ---------- */
.skip-link {
  position: absolute;
  inset-inline-start: var(--sp-4);
  top: -100px;
  z-index: calc(var(--z-header) + 1);
  padding: var(--sp-3) var(--sp-4);
  background: rgb(var(--surface-brand-default));
  color: #fff;
  border-radius: var(--r-md);
  font-weight: 500;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { top: var(--sp-3); }

/* ---------- ابزارها ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

/* روی نمایشگر بزرگ، ۱۶ پیکسل حاشیه محتوا را به لبه می‌چسباند */
@media (min-width: 768px)  { .container { padding-inline: var(--sp-5); } }
@media (min-width: 1200px) { .container { padding-inline: var(--sp-6); } }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stack { display: flex; flex-direction: column; }
.row   { display: flex; align-items: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.grow  { flex: 1; }

.muted  { color: rgb(var(--content-neutral-secondary)); }
.faint  { color: rgb(var(--content-neutral-tertiary)); }
.meta   { font-size: var(--fs-meta); line-height: var(--lh-meta); }
.caption{ font-size: var(--fs-caption); line-height: var(--lh-caption); }

.clamp-1, .clamp-2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-1 { -webkit-line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; }

.divider {
  height: 1px;
  background: rgb(var(--border-neutral-default));
  border: 0;
}

/* ابزارهای نمایش — با !important تا کامپوننت‌های بعدی (مثل .btn-icon که
   display: inline-flex دارد) با هم‌وزنی specificity آن‌ها را خنثی نکنند */
.hide-desktop { display: none !important; }

/* ---------- احترام به کاهش حرکت ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
