/* ============================================================
   Trixo Market — Base / Reset / Typography
   ============================================================ */

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

* { margin: 0; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;       /* clip (not hidden) so RTL never shifts the scroll origin */
  min-height: 100vh;
}

/* Reinforce horizontal clipping at the root so no off-canvas element
   (e.g. the skip link or marquee) can create an RTL scroll shift. */
html { overflow-x: clip; max-width: 100%; }

/* Arabic typography */
html[lang="ar"] body { font-family: var(--font-ar); }

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button { cursor: pointer; background: none; border: none; }

a { color: inherit; text-decoration: none; }

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
}
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3,
html[lang="ar"] h4, html[lang="ar"] h5, html[lang="ar"] h6 {
  font-family: var(--font-ar);
  letter-spacing: 0;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); }

p { color: var(--text-muted); }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Accessible skip link */
.skip-link {
  position: absolute;
  inset-inline-start: -9999px;   /* logical: stays off-canvas on the start edge in both LTR & RTL */
  top: 0;
  z-index: var(--z-toast);
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-weight: var(--fw-semibold);
}
.skip-link:focus { inset-inline-start: 1rem; }

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

/* Page is hidden until i18n applies, to avoid a flash of default language.
   A no-JS fallback reveals it after a short delay via the <noscript> rule. */
html.i18n-pending body { opacity: 0; }
html.i18n-ready body { opacity: 1; transition: opacity var(--t-med) var(--ease); }
