* {
  box-sizing: border-box;
}

html {
  min-inline-size: 320px;
  background: var(--surface-page);
  color: var(--text-primary);
  color-scheme: light;
  scroll-behavior: smooth;
  scroll-padding-block-start: var(--header-offset);
  text-rendering: optimizeLegibility;
}

html[data-theme='dark'] {
  color-scheme: dark;
}

body {
  min-block-size: 100dvh;
  margin: 0;
  overflow-wrap: anywhere;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-latin);
  font-size: var(--type-body-size);
  line-height: var(--line-body);
}

body[data-navigation-open='true'] {
  overflow: hidden;
}

html[lang='ar'] body {
  font-family: var(--font-arabic);
  line-height: var(--line-arabic-body);
}

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

button,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

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

h1,
h2,
h3,
p {
  margin-block-start: 0;
}

h1,
h2,
h3 {
  line-height: var(--line-heading);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

a {
  color: var(--link-default);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--link-hover);
}

::selection {
  background: var(--selection-surface);
  color: var(--selection-text);
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

:target {
  scroll-margin-block-start: var(--header-offset);
}

.skip-link {
  position: fixed;
  z-index: var(--layer-skip-link);
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--interactive-primary);
  color: var(--text-inverse);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--duration-fast) var(--easing-productive);
}

.skip-link:focus {
  transform: translateY(0);
}

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

[aria-disabled='true'] {
  cursor: not-allowed;
}

bdi,
[data-bidi-isolate='true'] {
  unicode-bidi: isolate;
}

@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid CanvasText;
  }

  .skip-link {
    border: 1px solid CanvasText;
  }
}

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