/* Reset, typography and the browser surfaces we did not draw ourselves. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; color: var(--ink); }
h1 { font-size: var(--text-xl); font-weight: 600; letter-spacing: -0.015em; }
h2 { font-size: var(--text-md); font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: var(--text-base); font-weight: 600; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; }
b, strong { font-weight: 600; }

button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Browser surfaces, themed from the palette */
::selection { background: var(--accent-soft); color: var(--ink); }
:root { accent-color: var(--accent); caret-color: var(--accent); scrollbar-color: var(--line) transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent); text-underline-offset: 3px; }

.skip-link {
  position: fixed; top: 8px; inset-inline-start: 8px; z-index: 100;
  padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink);
  font-weight: 600; text-decoration: none; transform: translateY(-150%);
}
.skip-link:focus-visible { transform: none; }
main:focus { outline: none; }

/* Utilities */
.ar { font-family: var(--arabic); }
.mono { font-family: var(--mono); font-size: 0.95em; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-bad { color: var(--bad); }
.small { font-size: var(--text-sm); }
.xs { font-size: var(--text-xs); }
.nowrap { white-space: nowrap; }
.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; }

.ph { font-size: 1.15em; line-height: 1; vertical-align: -0.15em; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
