/* Reset and element defaults. Uses logical properties only so the same
   rules serve RTL (Arabic) and LTR (English). */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* Set by boot.js while a non-default language is being applied, to avoid a
   flash of Arabic text for English users. */
html.i18n-pending body {
  visibility: hidden;
}

/* Author display rules (flex, grid) must not defeat the hidden attribute. */
[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p,
ul,
ol,
pre {
  margin: 0;
}

fieldset {
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  text-wrap: balance;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--color-accent-hover);
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

svg {
  display: block;
  flex-shrink: 0;
}

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

::selection {
  background: var(--color-accent-soft);
}

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

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-on-accent);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
  color: var(--color-on-accent);
}

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