/* =====================================================================
   Miftah — Base: reset, typography, utilities
   Urbanist carries the Latin interface; IBM Plex Sans Arabic carries
   Arabic, and takes over the whole page when the interface is in Arabic.
   ===================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root[dir="rtl"] body { font-family: var(--font-ar); }

h1, h2, h3, h4, h5 {
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.012em;
  text-wrap: balance;
}
h1 { font-size: 28px; font-weight: 500; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 15.5px; }
h4 { font-size: 13.5px; }
:root[dir="rtl"] h1, :root[dir="rtl"] h2, :root[dir="rtl"] h3 { letter-spacing: 0; line-height: 1.45; }

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

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); font-weight: 500; }
a.link:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

img, svg, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }

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

/* --- Numerals: every figure in the product is tabular ---------------- */
.mono,
.num,
table td,
table th {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.mono {
  font-family: var(--mono);
  letter-spacing: 0;
}

/* --- Type utilities --------------------------------------------------- */
.label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-3);
}

.muted   { color: var(--ink-2); }
.dim     { color: var(--ink-3); }
.sm      { font-size: 13px; }
.xs      { font-size: 12px; }
.strong  { font-weight: 600; }
.nowrap  { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* --- Layout utilities ------------------------------------------------- */
.row     { display: flex; align-items: center; gap: 10px; }
.row-sb  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrapf   { flex-wrap: wrap; }
.col     { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.grow    { flex: 1; min-width: 0; }
.stack   { display: grid; gap: 16px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }

.scroll-x { overflow-x: auto; }

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

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