/* ═══════════════ Reset & base ═══════════════ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  /* The sidebar parks off-canvas via translateX; `clip` keeps that out of the
     scrollable area without turning <html> into a scroll container the way
     `hidden` would. Paired with body's overflow-x below. */
  overflow-x: clip;
}

/* English mode leads with Poppins; Arabic keeps Graphik Arabic. */
html[lang="en"] body { font-family: var(--font-en); }

body {
  font-family: var(--font-ar);
  background: var(--bg);
  color: var(--tx-1);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }

/* Latin numerals & codes render in Poppins for clarity */
.num, .en { font-family: var(--font-en); font-feature-settings: 'tnum' 1; letter-spacing: -.01em; }

::selection { background: var(--accent-glow); color: var(--brand); }

/* Scrollbars — thin, unobtrusive */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-full); }
*::-webkit-scrollbar-thumb:hover { background: var(--tx-4); }

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

/* ═══════════════ Type scale ═══════════════ */
.t-display { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }
.t-h1 { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -.015em; }
.t-h2 { font-size: 16px; font-weight: 600; line-height: 1.4; }
.t-h3 { font-size: 14px; font-weight: 600; }
.t-body { font-size: 14px; }
.t-sm { font-size: 13px; }
.t-xs { font-size: 12px; }
.t-2xs { font-size: 11px; }

.tx-2 { color: var(--tx-2); }
.tx-3 { color: var(--tx-3); }
.tx-4 { color: var(--tx-4); }
.tx-accent { color: var(--accent); }
.tx-ok { color: var(--ok); }
.tx-warn { color: var(--warn); }
.tx-danger { color: var(--danger); }

.w-400 { font-weight: 400; } .w-500 { font-weight: 500; }
.w-600 { font-weight: 600; } .w-700 { font-weight: 700; }

/* ═══════════════ Utilities ═══════════════ */
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.g-4 { gap: 4px; } .g-6 { gap: 6px; } .g-8 { gap: 8px; }
.g-10 { gap: 10px; } .g-12 { gap: 12px; } .g-16 { gap: 16px; }
.g-20 { gap: 20px; } .g-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }  .mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; } .mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }

/* Wide content scrolls inside its own box, never the page */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ═══════════════ Entrance motion ═══════════════ */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.animate-in { animation: rise .34s var(--ease) both; }
.stagger > * { animation: rise .36s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }
.stagger > *:nth-child(7) { animation-delay: .26s; }
.stagger > *:nth-child(8) { animation-delay: .30s; }

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