/* ==========================================================================
   GMAP · پایه: ریست، تایپوگرافی، فوکوس و ابزارهای راست‌چین
   ========================================================================== */

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

html {
  overflow-x: hidden; /* منوی کشویی بسته (بیرون از صفحه) نباید اسکرول افقی بسازد */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: clip;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-sm);
  line-height: var(--lh-sm);
  font-weight: 400;
  color: var(--c-text);
  background: var(--c-bg);
  text-align: start;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--c-primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; border-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--c-divider); margin: var(--sp-5) 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }

::selection { background: var(--c-primary-soft-2); color: var(--c-text); }

/* ---------- فوکوس: حلقهٔ ۳px با فاصلهٔ ۲px؛ outline هرگز حذف نمی‌شود ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- تایپوگرافی ---------- */
.t-display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: 600; }
.t-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: 700; }
.t-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: 600; }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: 600; }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); }
.t-sm { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.t-xs { font-size: var(--fs-xs); line-height: var(--lh-xs); }
.t-muted { color: var(--c-muted); }
.t-strong { font-weight: 700; }
.t-medium { font-weight: 500; }
.t-success { color: var(--c-success); }
.t-danger { color: var(--c-danger); }
.t-warning { color: var(--c-warning); }
.t-primary { color: var(--c-primary-text); }
.t-center { text-align: center; }
.t-end { text-align: end; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
bdi.ltr, .ltr-inline { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nowrap { white-space: nowrap; }

/* ---------- دسترس‌پذیری ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-weight: 600;
  transition: top var(--t-med) var(--ease);
}
.skip-link:focus { top: 16px; text-decoration: none; }

/* ---------- چیدمان کمکی ---------- */
.row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.row-3 { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.row-4 { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-5); min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.spacer { flex: 1 1 auto; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.mt-1 { margin-top: var(--sp-1); } .mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.w-full { width: 100%; }

/* ---------- اسکرول‌بار ظریف ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--c-border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--c-border-strong) 55%, transparent);
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

/* ---------- قفل اسکرول هنگام باز بودن لایه ---------- */
body.is-locked { overflow: hidden; }

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