@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

/* Stand-in sized to match Bricolage, so text does not reflow when the web font arrives. */
@font-face {
  font-family: "Bricolage Fallback";
  src: local("Arial"), local("Liberation Sans"), local("Helvetica");
  size-adjust: 93.5%;
  font-weight: 200 800;
  unicode-range: U+0000-024F, U+2000-206F, U+20A0-20CF;
}

/* Arabic glyphs only; Latin text keeps Bricolage. */
@font-face {
  font-family: "Cairo";
  src: url("../fonts/cairo-arabic-wght-normal.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-text);
  font-optical-sizing: auto;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--bar-height) + 16px);
  text-rendering: optimizeLegibility;
}
[lang="ar"] { line-height: 1.85; }

body { margin: 0; font-size: var(--step-0); min-height: 100vh; overflow-x: clip; }

h1, h2, h3, p, ul, ol, figure, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-inline-size: 0; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
strong { font-weight: 700; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 160ms var(--ease-out), text-underline-offset 160ms var(--ease-out), color 160ms;
}
a:hover { text-decoration-thickness: 4px; text-underline-offset: 0.28em; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
[data-theme="dark"] :focus-visible { outline-color: var(--yellow); }

/* Browser surfaces carry the palette too. */
::selection { background: var(--yellow); color: #101114; }
html { caret-color: var(--blue); accent-color: var(--blue); scrollbar-color: var(--muted) var(--ground); scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 8px; border: 2px solid var(--ground); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--yellow);
  color: #101114;
  font-weight: 700;
}
.skip-link:focus { top: 8px; }

.section-title { font-size: var(--step-3); font-weight: 800; font-variation-settings: "opsz" 96; letter-spacing: var(--track); line-height: 1.08; margin-block-end: 28px; text-wrap: balance; }
.section-lead { margin-block: -12px 28px; color: var(--muted); max-width: var(--measure); font-size: var(--step-1); }

.prose { max-width: var(--measure); }
.prose p + p { margin-block-start: 1.2em; }
