/* ============================================================
   Base — reset, fonts, typography, layout primitives.
   RTL-safe: only logical properties (inline-start/end) are used
   for anything direction-sensitive.
   ============================================================ */

/* Self-hosted fonts (offline-capable). Both are variable-weight. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('../assets/fonts/jakarta-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans Arabic';
  src: url('../assets/fonts/noto-arabic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Noto Sans Arabic', -apple-system,
    BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-repeat: no-repeat;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Arabic gets the Arabic family first so digits/labels harmonise */
html[lang='ar'] body {
  font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', -apple-system,
    BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h1, h2, h3, h4, p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

img {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-decoration: none;
}

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

/* Numbers, prices, article codes: always LTR even inside RTL text */
.ltr,
bdi.num {
  direction: ltr;
  unicode-bidi: isolate;
}

.num,
.mono {
  font-variant-numeric: tabular-nums;
}

/* Layout shell */
#app {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  min-height: 100dvh;
  /* never let the page scroll sideways / get stuck on an edge; `clip`
     (not `hidden`) so the sticky header keeps working */
  overflow-x: clip;
}

/* belt-and-braces: also clip at the root so nothing forces a horizontal
   scrollbar the layout can get stuck inside */
html,
body {
  overflow-x: clip;
  max-width: 100%;
}

.screen {
  padding: 0 var(--sp-4) var(--sp-6);
  animation: screen-in var(--t-med) var(--ease);
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Visually hidden (a11y) */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion: kill all transitions/animations */
@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;
  }
}

/* Scrollbars (desktop) */
@media (pointer: fine) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
  }
  ::-webkit-scrollbar-track { background: transparent; }
}
