@use "tokens" as *;
@use "mixins" as *;
@use "preloader";

// Fonts: Latin subset only for the Latin families (the site is EN / AR — no Cyrillic,
// Greek or Vietnamese faces), Arabic subset only for the Arabic families.
// The four faces the hero paints with are served from /assets/namma/fonts so the
// layout can preload them (see app/[locale]/layout.tsx); same files as Fontsource.
@import "@fontsource/space-grotesk/latin-400.css";
@import "@fontsource/space-grotesk/latin-500.css";
@import "@fontsource/space-grotesk/latin-700.css";
@import "@fontsource/manrope/latin-500.css";
@import "@fontsource/manrope/latin-600.css";
@import "@fontsource/manrope/latin-700.css";
@import "@fontsource/readex-pro/arabic-400.css";
@import "@fontsource/readex-pro/arabic-500.css";
@import "@fontsource/readex-pro/arabic-700.css";
@import "@fontsource/ibm-plex-sans-arabic/arabic-500.css";
@import "@fontsource/ibm-plex-sans-arabic/arabic-600.css";
@import "@fontsource/ibm-plex-sans-arabic/arabic-700.css";
@font-face { font-family: "Space Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/namma/fonts/space-grotesk-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/namma/fonts/manrope-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Readex Pro"; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/namma/fonts/readex-pro-arabic-600-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/namma/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2) format("woff2"); }

:root {
  --start: left;
  --dir: 1;
  --end: right;
  --f-display: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --lh-display: 1.08;
}
[dir="rtl"] { --start: right; --end: left; --dir: -1; }
// Arabic script must never be tracked: letter-spacing breaks the joins between letters.
:lang(ar) { letter-spacing: 0 !important; }
// Arabic headings need taller lines than the Latin display face (dots, hamza, descenders).
:lang(ar) :is(h1, h2, h3, h4) { line-height: var(--lh-display) !important; }
// Masked line reveals (SplitText "lines" masks): leave room for ascenders/descenders so
// Arabic marks (ج ع ي, hamza, shadda) and Latin descenders are never clipped.
.split-line-mask { padding-block: 0.1em 0.24em; margin-block: -0.1em -0.24em; }
html[lang="ar"] {
  --f-display: "Space Grotesk", "Readex Pro", Tahoma, sans-serif;
  --f-body: "Manrope", "IBM Plex Sans Arabic", Tahoma, sans-serif;
  --lh-display: 1.32;
  --ls-display: 0;
}
// Arabic is a connected script: tracking breaks the letterforms.
html[lang="ar"] body * { letter-spacing: 0 !important; }
html[lang="ar"] body { line-height: 1.75; }

// Numbers (counters, phones) never reorder inside Arabic text.
[data-count] { direction: ltr; unicode-bidi: isolate; }

// Directional icons (arrows) — see components/ui/Icon.tsx
[data-dir="back"] { transform: scaleX(-1); }
[dir="rtl"] [data-dir="forward"] { transform: scaleX(-1); }
[dir="rtl"] [data-dir="back"] { transform: none; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
  // Mobile Safari pans sideways on any stray overflow unless the root clips it too (clip keeps sticky/pins working).
  overflow-x: clip;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: $c-paper;
  color: $c-ink;
  font-family: $f-body;
  font-size: $fs-body;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.container {
  width: 100%;
  max-width: $container + $gutter * 2;
  margin-inline: auto;
  padding-inline: $gutter;
}

.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; left: 16px; top: -60px; z-index: 1000;
  padding: 10px 16px; background: $c-yellow; color: $c-ink; font-weight: 600;
  border-radius: $radius-sm;
  &:focus { top: 16px; }
}

// Pre-hydration hide for above-the-fold intro only (see app/[locale]/layout.tsx).
// Released by the hero timeline. Safety net that does not need the main thread:
// a CSS animation reveals the content at 1.4s even while JS is still loading /
// hydrating on a slow phone; the hero then skips its entrance (lib/motion introExpired).
@keyframes introSafety { to { opacity: 1; } }
html.is-intro [data-intro] { opacity: 0; animation: introSafety 0.01s linear 3s forwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

// Quote + footer share one rounded dark panel (Figma)
.closing-panel {
  // Full-bleed (Nov 2026, client): the quote block and footer run edge to edge,
  // no paper gutter or rounded corners around them.
  margin: 0;
  border-radius: 0;
  background: $c-ink;
  color: $c-white;
  overflow: hidden;
}

// RichText "~muted~" — the softer second line of light/yellow section titles (Figma).
.muted { color: rgba(46, 46, 46, 0.55); }
[data-tone="dark"] .muted, .on-dark .muted, .closing-panel .muted { color: rgba(255, 255, 255, 0.55); }
