*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keeps anchored sections clear of the sticky header. */
  scroll-padding-block-start: 6rem;
}

body {
  margin: 0;
  min-block-size: 100vh;
  overflow-x: clip;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
}

:lang(ar) body, body:lang(ar) { font-family: var(--font-arabic); line-height: 1.8; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; overflow-wrap: break-word; text-wrap: balance; }
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); font-weight: 600; }
p, ul, ol { margin: 0; }
ul[role="list"], ol[role="list"] { padding: 0; list-style: none; }
img, svg { display: block; max-inline-size: 100%; block-size: auto; }
a { color: var(--color-link); text-underline-offset: 0.15em; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.on-dark :focus-visible { outline-color: var(--color-focus-on-dark); }

.container {
  inline-size: 100%;
  max-inline-size: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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