/* assets/css/v2/base.css — Shared reset, typography, RTL/LTR logical layout and spacing scale for both v2 skins
   keywords: base, reset, logical properties, rtl, ltr, type scale, spacing scale, reduced motion, ad-safe
   Needs tokens-news.css or tokens-a1.css first. No transform, filter, opacity, sticky, fixed or overflow clipping here. */
:root {
  /* spacing, 4px scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;
  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 32px);
  /* motion budget (see ad.css): moving parts shift at most this far */
  --fx-max-shift: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur-fast: 150ms;
  --dur: 240ms;
  /* type scale, fluid */
  --fs-sm: .875rem;
  --fs-base: 1.0625rem;
  --fs-lg: clamp(1.15rem, 1.05rem + .5vw, 1.35rem);
  --fs-h3: clamp(1.25rem, 1.1rem + .8vw, 1.6rem);
  --fs-h2: clamp(1.6rem, 1.3rem + 1.5vw, 2.3rem);
  --fs-h1: clamp(2rem, 1.5rem + 2.6vw, 3.4rem);
  /* breakpoints for reference (custom properties cannot be used in @media): 480 / 768 / 1024 / 1440 */
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
html[dir="rtl"] { direction: rtl; }
html[dir="ltr"] { direction: ltr; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: var(--fw-body);
  line-height: 1.75;                 /* Arabic needs air; Latin stays comfortable */
  text-align: start;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(ar) { letter-spacing: 0; word-spacing: 0; }   /* never track Arabic: it breaks letter joins */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  line-height: 1.3;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-lg); font-weight: var(--fw-strong); }
p { text-wrap: pretty; }
strong, b { font-weight: var(--fw-strong); }
small { font-size: var(--fs-sm); color: var(--c-muted); }
code, kbd, pre { font-family: var(--font-mono); font-size: .92em; direction: ltr; unicode-bidi: plaintext; }

a { color: var(--c-brand); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--c-brand-strong); }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; }
::selection { background: var(--c-brand); color: var(--c-brand-ink); }

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
ul, ol { list-style-position: inside; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
hr { border: 0; border-block-start: 1px solid var(--c-line); }

/* layout primitive: logical padding keeps RTL and LTR symmetric */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.stack > * + * { margin-block-start: var(--sp-4); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
/* the skip link slides in by changing its offset, not by transforming it */
.skip-link {
  position: absolute; inset-inline-start: var(--sp-4); inset-block-start: -100px;
  padding: var(--sp-2) var(--sp-4); background: var(--c-brand); color: var(--c-brand-ink); z-index: 10;
}
.skip-link:focus { inset-block-start: var(--sp-2); }

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