/* Reset, typography and layout primitives. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--c-black);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-stretch: var(--stretch-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.15; letter-spacing: -0.01em; }
p { text-wrap: pretty; }

::selection { background: var(--c-gold); color: var(--ink); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-s); }

.container { width: min(100% - 2 * var(--gutter), var(--maxw)); margin-inline: auto; }
.section { padding-block: var(--space-6); position: relative; }
.section--paper { background: var(--c-white); color: var(--c-paper-text); }
.section--ink { background: var(--c-ink-1); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-gold-text);
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.section--paper .eyebrow { color: var(--c-gold-deep); }

.lead { font-size: var(--fs-lead); color: var(--c-text-muted); max-width: 60ch; }
.section--paper .lead { color: var(--c-paper-muted); }
.muted { color: var(--c-text-muted); }
.mono { font-family: var(--font-mono); }
.gold { color: var(--c-gold-text); }

.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;
}

.skip-link {
  position: fixed; top: 12px; inset-inline-start: 12px; z-index: 1000;
  padding: 0.6rem 1rem; background: var(--c-gold); color: var(--ink);
  border-radius: var(--radius-s); transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

.section-head { display: grid; gap: var(--space-2); margin-bottom: var(--space-5); max-width: 860px; }
.section-head--split {
  max-width: none; grid-template-columns: 1fr; align-items: end; gap: var(--space-3);
}
@media (min-width: 900px) { .section-head--split { grid-template-columns: 1.1fr 0.9fr; } }

/* Theme switch: change every colour in one step (no per-element transitions). */
.theme-switching, .theme-switching * { transition: none !important; }

/* ---------- Arabic & right-to-left ---------- */
/* Letter-spacing pulls Arabic letters apart (they join), so it's off for Arabic text. */
:root[lang="ar"] body *:not(.credit *, .brand__name, .brand__mark, .hero__word, .hero__word *, .wstep__verb, .footer-wordmark, [lang="en"]) { letter-spacing: 0 !important; }
:root[lang="ar"] body { line-height: 1.75; }
:root[lang="ar"] :is(h1, h2, h3, .display) { line-height: 1.3; font-weight: 800; }
:root[lang="ar"] p, :root[lang="ar"] li { text-wrap: pretty; }
/* Direction-bearing arrows and the hero prev/next glyphs point the other way. */
[dir="rtl"] :is(.arrow, .hero__arrow) { scale: -1 1; }
/* English display words and counters keep left-to-right order (per-letter spans would otherwise reverse). */
[dir="rtl"] :is(.hero__word, .hero__index, .wstep__verb, .pd-stage__ghost, .page-hero__ghost, .footer-wordmark, .brand) { direction: ltr; }

/* Reveal hooks (motion.js adds .is-in; without JS everything stays visible) */
.js [data-reveal] { opacity: 0; transform: translateY(28px); }
.js [data-reveal].is-in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
}
