/* ==========================================================================
   Base — reset, typography, direction.
   Logical properties throughout, so RTL and LTR are correct by construction.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--nav-h) + var(--sp-16));
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-body-lg);
  font-weight: var(--w-regular);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Latin reads comfortably at the reference's tighter values. */
html[lang="en"], html[lang^="en-"] { --lh-display: 1.14; --lh-heading: 1.3; --lh-body: 1.5; --text-caption: 10px; }

img, svg, video, iframe { display: block; max-inline-size: 100%; }
img, video { block-size: auto; }

h1, h2, h3, h4 {
  margin-block: 0 var(--sp-16);
  color: var(--text);
  line-height: var(--lh-heading);
  font-weight: var(--w-bold);
  text-wrap: balance;
}
h1 { font-size: var(--text-display); font-weight: var(--w-extra); line-height: var(--lh-display); }
h2 { font-size: var(--text-heading); }
h3 { font-size: var(--text-heading-sm); }
h4 { font-size: var(--text-subheading); }

p, ul, ol { margin-block: 0 var(--sp-16); }
p:last-child, ul:last-child, ol:last-child { margin-block-end: 0; }
ul, ol { padding-inline-start: 1.3em; }
li { margin-block-end: var(--sp-8); }

a { color: inherit; text-decoration: none; }
/* Links inside running text are brand blue and underlined — colour alone is
   not enough to identify a link. */
.prose a, p > a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
}

strong, b { font-weight: var(--w-bold); }

blockquote {
  margin: var(--sp-32) 0;
  padding: var(--sp-20) var(--sp-24);
  background: var(--surface);
  border-radius: var(--radius-cards);
  box-shadow: var(--shadow-subtle);
  font-size: var(--text-subheading);
  font-weight: var(--w-bold);
}

code, kbd, pre { font-family: var(--mono); font-size: .88em; }
code {
  direction: ltr; unicode-bidi: isolate; display: inline-block;
  padding: .05em .35em; background: var(--blue-tint); border-radius: var(--radius-inputs);
}
pre { direction: ltr; overflow-x: auto; padding: var(--sp-16); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-inputs); }
pre code { background: none; padding: 0; }

/* Latin terms inside Arabic prose: isolated so "SOC Tier 1" never reverses. */
.en { direction: ltr; unicode-bidi: isolate; display: inline-block; }

hr { border: 0; border-block-start: 1px solid var(--rule); margin-block: var(--sp-48); }

table { inline-size: 100%; border-collapse: collapse; font-size: var(--text-body); }
th, td { padding: var(--sp-12) var(--sp-16); text-align: start; border-block-end: 1px solid var(--rule); }
th { font-weight: var(--w-bold); }
.num, .tabular { font-variant-numeric: tabular-nums; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--blue-tint); color: var(--text); }

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

.skip-link {
  position: absolute; inset-inline-start: -9999px; inset-block-start: 0; z-index: 200;
  padding: var(--sp-12) var(--sp-20); background: var(--charcoal); color: #fff; border-radius: 0 0 8px 8px;
}
.skip-link:focus { inset-inline-start: var(--sp-16); inset-block-start: var(--sp-16); }

.sr, .screen-reader-text, .visually-hidden {
  position: absolute !important; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
