/* ==========================================================================
   Base: reset and typography
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1.25rem);
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Headings */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.012em;
  color: var(--text);
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: var(--fs-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-lg); font-family: var(--font-body); font-weight: 650; letter-spacing: 0; }

p { margin: 0; text-wrap: pretty; }
strong, b { font-weight: 650; }
em, i { font-style: italic; }
small { font-size: var(--fs-sm); }

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
a:hover { text-decoration-color: var(--accent); color: var(--accent-ink); }

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-7) 0; }

abbr[title] { text-decoration: underline dotted; cursor: help; }

kbd, code {
  font-family: var(--font-mono);
  font-size: .86em;
}
code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .08em .38em;
  border-radius: 6px;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: .05em .45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
  line-height: 1.5;
}

/* Arabic, inline and block */
[lang="ar"], .ar {
  font-family: var(--font-arabic);
  font-size: 1.12em;
  line-height: 1.9;
  font-style: normal;
  letter-spacing: 0;
}

/* Transliteration of Arabic terms */
.tr { font-style: italic; }

.skip-link {
  position: fixed;
  left: 1rem; top: -4rem;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 1rem; }

.icon { width: 1.25rem; height: 1.25rem; flex: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

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