/* ==========================================================================
   kit/base.css — reset, primitives, RTL machinery
   --------------------------------------------------------------------------
   Load AFTER tokens.css, BEFORE any section file.

   RTL RULE FOR THIS KIT: no physical direction properties, anywhere.
   Never  left / right / margin-left / padding-right / text-align:left /
          border-left / float / translateX with a fixed sign.
   Always inline-start / inline-end / margin-inline / padding-inline /
          text-align:start / border-inline-start / inset-inline.
   One stylesheet then serves ar and en; you flip <html dir> and nothing else.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }

/* Arabic: negative tracking shreds letter joins, and the tighter Latin
   leading collides with diacritics. Reset both whenever the language is
   Arabic — attribute-scoped so a single page can mix scripts safely. */
[lang|="ar"] h1, [lang|="ar"] h2, [lang|="ar"] h3, [lang|="ar"] h4 {
  letter-spacing: 0;
  line-height: 1.4;
}
[lang|="ar"] { line-height: 1.85; }

/* Arabic-Indic numerals, opt-in per project via the token. */
[data-numerals="arabic"] { font-feature-settings: "numr" 0; }
[data-numerals="arabic"] .u-num { font-variant-numeric: normal; }

/* --- Layout primitives ------------------------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.section { padding-block: var(--section-y); }
.section--tint { background: var(--surface); }
.section--edge { border-block-start: 1px solid var(--line-soft); }

/* Section heading pair, used by most sections. */
.section__head { max-width: 62ch; margin-block-end: clamp(2rem, 5vw, 3.5rem); }
.section__eyebrow {
  font-size: var(--step--1);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-block-end: .9rem;
}
/* Uppercase is meaningless in Arabic — it does nothing to the glyphs but the
   tracking still wrecks the joins. Undo it. */
[lang|="ar"] .section__eyebrow { text-transform: none; letter-spacing: 0; }

.section__title { font-size: var(--step-3); }
.section__lede  { font-size: var(--step-1); color: var(--muted); margin-block-start: 1rem; }

/* --- Buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .85em 1.6em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--step-0);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--hover), color var(--hover), border-color var(--hover);
}
.btn--solid  { background: var(--brand); color: var(--on-brand); }
.btn--solid:hover  { background: color-mix(in srgb, var(--brand) 84%, var(--ink)); }
.btn--ghost  { background: transparent; color: var(--brand-text); border-color: var(--line); }
.btn--ghost:hover  { border-color: var(--brand-text); }

/* Directional glyphs must mirror. An arrow that points "forward" points LEFT
   in Arabic. Rotate on the RTL root rather than swapping the character. */
[dir="rtl"] .btn__arrow { transform: scaleX(-1); }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-block-start: 2rem; }

/* --- Utilities -------------------------------------------------------- */

.u-muted { color: var(--muted); }
.u-measure { max-width: 62ch; }

.u-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Focus must survive every re-skin — it is the one thing a client can't see
   in the mockup and every audit checks. */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 2px solid var(--brand-text);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
