/* ============================================================
   base.css — reset, design tokens, themes, typography
   Palette: strict black / white / gray. Dark-first.
   ============================================================ */

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
  --font-ar: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-accent: "Bebas Neue", "Space Grotesk", sans-serif;

  --maxw: 1080px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius: 2px;
  --speed: 0.25s;

  /* type scale */
  --fs-hero: clamp(2.8rem, 9vw, 6.5rem);
  --fs-h2: clamp(1.6rem, 4vw, 2.6rem);
  --fs-role: clamp(1.05rem, 2vw, 1.3rem);
  --fs-body: clamp(0.95rem, 1.1vw, 1.05rem);
  --fs-mono: 0.78rem;
}

/* ---- Dark (default) ---- */
:root, [data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #121212;
  --fg: #ededed;
  --fg-strong: #ffffff;
  --muted: #8c8c8c;
  --line: #262626;
  --line-soft: #1b1b1b;
  --ascii: #2a2a2a;
  --ascii-bright: #6a6a6a;
  --invert-bg: #ffffff;
  --invert-fg: #0a0a0a;
}

/* ---- Light ---- */
[data-theme="light"] {
  --bg: #f4f4f2;
  --bg-soft: #ececea;
  --fg: #1a1a1a;
  --fg-strong: #000000;
  --muted: #5c5c5c;
  --line: #d6d6d2;
  --line-soft: #e3e3e0;
  --ascii: #d2d2cd;
  --ascii-bright: #9a9a94;
  --invert-bg: #0a0a0a;
  --invert-fg: #ffffff;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--speed) ease, color var(--speed) ease;
}

/* Arabic typography swap */
[lang="ar"] body, body[lang="ar"], [lang="ar"] {
  font-family: var(--font-ar);
}
[lang="ar"] .hero-name,
[lang="ar"] .section-title,
[lang="ar"] .role { font-family: var(--font-ar); font-weight: 700; }

h1, h2, h3 { font-weight: 600; line-height: 1.05; color: var(--fg-strong); }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.mono { font-family: var(--font-mono); font-size: var(--fs-mono); letter-spacing: 0.04em; }

::selection { background: var(--fg-strong); color: var(--bg); }

:focus-visible { outline: 2px solid var(--fg-strong); outline-offset: 3px; }

/* ---- reveal-on-scroll (only when JS is active; no-JS keeps content visible) ---- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.6, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.6, 0.2, 1);
  will-change: opacity, transform;
}
.js [data-reveal].in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--fg-strong); color: var(--bg); padding: 10px 16px;
  font-family: var(--font-mono); font-size: var(--fs-mono);
}
.skip-link:focus { left: 8px; top: 8px; }

.noscript {
  position: relative; z-index: 5; max-width: var(--maxw);
  margin: 120px auto; padding: 0 var(--gutter);
  font-family: var(--font-mono); line-height: 1.8;
}
