/* ===========================================================================
   base.css — reset + خطوط Cairo (self-hosted) + الأساسيات + RTL.
   يعتمد على المتغيّرات في tokens.css. خصائص منطقية فقط (لا left/right).
   =========================================================================== */

/* ===== Cairo (self-hosted, offline) — خط متغيّر: نفس الملف لكل الأوزان ===== */
/* الملفات subset (arabic + latin + latin-ext) للحجم الأصغر. */
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/public/fonts/Cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FBFC-FBFD;
}
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/public/fonts/Cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/public/fonts/Cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FBFC-FBFD;
}
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/public/fonts/Cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/public/fonts/Cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FBFC-FBFD;
}
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/public/fonts/Cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, picture, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { list-style: none; padding: 0; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Headings ===== */
h1 { font-size: var(--text-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold); }
h2 { font-size: var(--text-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); }
h3 { font-size: var(--text-h3); line-height: var(--lh-h3); font-weight: var(--fw-semibold); }
h4 { font-size: var(--text-h4); line-height: var(--lh-h4); font-weight: var(--fw-semibold); }

/* ===== Numerals: tabular + lining للمبالغ والجداول ===== */
.num, td.amount, .stat-value, .amount {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* ===== Focus (لا تُزال أبدًا) ===== */
:focus-visible {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 2px;
}

/* ===== Skip link ===== */
.skip-link {
  position: absolute;
  inset-inline-start: var(--space-4);
  inset-block-start: -100px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: var(--z-toast);
  transition: inset-block-start .15s;
}
.skip-link:focus {
  inset-block-start: var(--space-2);
  text-decoration: none;
}

/* ===== Visually hidden (متاح للقارئ الشاشي فقط) ===== */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Landmarks base ===== */
[dir="rtl"] { text-align: start; }

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