/* Base: reset, typography, focus and layout helpers. Colours only via tokens.css. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-16);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p, figure, blockquote, dl, dd { margin: 0; }
:where(ul[class], ol[class]) { margin: 0; padding: 0; list-style: none; }
hr { border: 0; height: 1px; background: var(--border); margin: var(--sp-6) 0; }
table { border-collapse: collapse; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }

/* Arabic must never get letter-spacing: it breaks joined letters. */
h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--silver);
}
h1, .h1 { font-size: var(--fs-28); font-weight: 800; }
h2, .h2 { font-size: var(--fs-22); }
h3, .h3 { font-size: var(--fs-18); }
h4, .h4 { font-size: var(--fs-16); }
@media (min-width: 768px) {
  h1, .h1 { font-size: var(--fs-36); }
  h2, .h2 { font-size: var(--fs-28); }
}

::selection { background: var(--gold); color: var(--on-gold); }

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

/* ---------- text helpers ---------- */
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.gold { color: var(--gold); }
.silver { color: var(--silver); }
.small { font-size: var(--fs-14); }
.tiny { font-size: var(--fs-13); }
.lead { font-size: var(--fs-18); color: var(--text-muted); }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.skip-link {
  position: fixed;
  inset-inline-start: var(--sp-4);
  top: -100px;
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--gold);
  color: var(--on-gold);
  font-weight: 700;
}
.skip-link:focus { top: var(--sp-4); }

/* ---------- layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}
@media (min-width: 768px) { .container { padding-inline: var(--sp-6); } }

.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--sp-8); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.cluster-sm { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grow { flex: 1 1 auto; min-width: 0; }

.grid { display: grid; gap: var(--sp-4); }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.mt { margin-top: var(--sp-6); }
.hidden { display: none !important; }
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .hide-desktop { display: none !important; } }

/* ---------- prose (policies, help) ---------- */
.prose { max-width: 72ch; color: var(--text-muted); }
.prose > * + * { margin-block-start: var(--sp-4); }
.prose h2, .prose h3 { color: var(--silver); margin-block-start: var(--sp-8); }
.prose ul { padding-inline-start: var(--sp-6); list-style: disc; }
.prose a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

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