/* ============================================================================
   Teradix RTL stylesheet
   Loaded ONLY on Arabic pages (`<html dir="rtl" lang="ar">`).
   Targets `[dir="rtl"]` so it can also be loaded on a mixed page if needed.

   STRATEGY:
   1. Apply Arabic-friendly typography to body via locally-hosted Dahab font
   2. RELY on inherited `direction: rtl` from <html dir="rtl"> — flexbox
      automatically lays children right-to-left under direction:rtl. Do NOT
      add `flex-direction: row-reverse` on top, that REVERSES the layout
      back to LTR (this was the bug that put the logo on the left).
   3. Explicitly flip what doesn't auto-flip: margin-left/right swaps,
      transforms (arrows), absolute-positioned items, mock UIs (kept LTR).
   ============================================================================ */

/* --- Local Arabic font: Forma DJR Arabic (optical-size strategy) -------- */
/* Forma DJR is hand-tuned per text size. We use three optical sizes:
     Display → headings (32px+) — narrower proportions, refined detail
     Text    → body copy (14–24px) — balanced for sustained reading
     Micro   → tiny UI labels (<14px) — wider proportions, max legibility
   Each is a separate font-family in CSS so we can pick per selector. */

/* ===== Display (headings, hero title, large pull text) ===== */
@font-face {
  font-family: 'Forma Display';
  src: url('../fonts/Forma/FormaDJRArabicDisplay-Light-Testing.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Display';
  src: url('../fonts/Forma/FormaDJRArabicDisplay-Regular-Testing.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Display';
  src: url('../fonts/Forma/FormaDJRArabicDisplay-Medium-Testing.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
/* No 800/900 cut in Display — map heavy weights to Bold */
@font-face {
  font-family: 'Forma Display';
  src: url('../fonts/Forma/FormaDJRArabicDisplay-Bold-Testing.otf') format('opentype');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

/* ===== Text (body copy, paragraphs, descriptions, buttons) ===== */
@font-face {
  font-family: 'Forma Text';
  src: url('../fonts/Forma/FormaDJRArabicText-ExtraLight-Testing.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Text';
  src: url('../fonts/Forma/FormaDJRArabicText-Light-Testing.otf') format('opentype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Text';
  src: url('../fonts/Forma/FormaDJRArabicText-Regular-Testing.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Text';
  src: url('../fonts/Forma/FormaDJRArabicText-Medium-Testing.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Text';
  src: url('../fonts/Forma/FormaDJRArabicText-Bold-Testing.otf') format('opentype');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

/* ===== Micro (tiny UI labels — eyebrows, metric values, tabular nums) ===== */
@font-face {
  font-family: 'Forma Micro';
  src: url('../fonts/Forma/FormaDJRArabicMicro-Regular-Testing.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Micro';
  src: url('../fonts/Forma/FormaDJRArabicMicro-Medium-Testing.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Forma Micro';
  src: url('../fonts/Forma/FormaDJRArabicMicro-Bold-Testing.otf') format('opentype');
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}

/* --- Typography ---------------------------------------------------------- */

/* Body default: Forma Text — tuned for sustained reading (14–24px) */
[dir="rtl"] body {
  font-family: 'Forma Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: 0;
}

/* Headings: Forma Display — tuned for large sizes (32px+).
   Display has tighter spacing + refined detail vs Text/Micro. */
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3,
[dir="rtl"] .hero__title,
[dir="rtl"] .showcase__h,
[dir="rtl"] .voice-slide__quote,
[dir="rtl"] .platform-section__title,
[dir="rtl"] .voices-pro__title,
[dir="rtl"] .cta-full__title,
[dir="rtl"] .gap-section__title,
[dir="rtl"] .section__title,
[dir="rtl"] .showcase__title,
[dir="rtl"] .demo-hero__title,
[dir="rtl"] .demo-faq__title {
  font-family: 'Forma Display', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
  font-weight: 700;
}

/* Forma Display runs large and bold; condense the hero headline so the
   Arabic copy reads balanced rather than oversized, with the line-height
   Arabic needs. */
[dir="rtl"] .hero__title {
  font-size: clamp(1.85rem, 2.4vw, 2.2rem);
  line-height: 1.32;
}
[dir="rtl"] .hero__description {
  font-size: 1rem;
  line-height: 1.75;
}

/* H4 + smaller headings can stay in Text family — they're sized closer to body */
[dir="rtl"] h4,
[dir="rtl"] .platform-stage__title {
  font-family: 'Forma Text', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

/* Body copy + descriptions — Regular weight, Text family */
[dir="rtl"] p,
[dir="rtl"] li,
[dir="rtl"] .showcase__p,
[dir="rtl"] .showcase__bullet-desc,
[dir="rtl"] .menu-item__desc,
[dir="rtl"] .gap-card__pain,
[dir="rtl"] .footer__blurb,
[dir="rtl"] .demo-hero__lead {
  font-weight: 400;
}

/* Medium weight — nav, menu titles, bullet titles, names */
[dir="rtl"] .nav__link,
[dir="rtl"] .nav__trigger,
[dir="rtl"] .menu-item__title,
[dir="rtl"] .showcase__bullet-title,
[dir="rtl"] .voice-pill__name,
[dir="rtl"] .voice-slide__name,
[dir="rtl"] .footer__col-head {
  font-weight: 500;
}

/* Bold — buttons + em emphasis */
[dir="rtl"] .btn,
[dir="rtl"] .voice-slide__quote em {
  font-weight: 700;
}

/* Tiny labels (eyebrows, trust-band note, micro UI text) — use Forma Micro
   which is hand-tuned for legibility below 14px with wider letter shapes */
[dir="rtl"] .hero__eyebrow,
[dir="rtl"] .showcase__eyebrow,
[dir="rtl"] .gap-section__eyebrow,
[dir="rtl"] .voices-pro__eyebrow,
[dir="rtl"] .demo-faq__eyebrow,
[dir="rtl"] .trust-band__note,
[dir="rtl"] .platform-section__eyebrow,
[dir="rtl"] .case-card__eyebrow {
  font-family: 'Forma Micro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

/* Numeric values (KPIs, metrics, counters) — Micro renders digits cleanly
   at any size; combined with the existing direction:ltr isolation block
   above, this gives stable tabular numbers in headlines. */
[dir="rtl"] .voice-metric__value,
[dir="rtl"] .voices-pro__trust-item strong,
[dir="rtl"] .showcase__metric-value,
[dir="rtl"] .gap-card__value,
[dir="rtl"] .demo-stats__value,
[dir="rtl"] .demo-hero__stat-value,
[dir="rtl"] [data-count],
[dir="rtl"] [data-gap-count] {
  font-family: 'Forma Micro', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 700;
}

/* Arabic doesn't use italic — strip the italic styling on em + cite */
[dir="rtl"] em,
[dir="rtl"] cite,
[dir="rtl"] i {
  font-style: normal;
}

/* Restore visual emphasis weight on inline gradients (italic was carrying
   the visual weight in Latin; in Arabic we lean on weight + color) */
[dir="rtl"] .voice-slide__quote em {
  font-weight: 800;
}

/* Numbers stay LTR-isolated so they don't get mirrored by the bidi engine */
[dir="rtl"] .voice-metric__value,
[dir="rtl"] .voices-pro__trust-item strong,
[dir="rtl"] .showcase__metric-value,
[dir="rtl"] [data-count],
[dir="rtl"] [data-gap-count] {
  direction: ltr;
  unicode-bidi: isolate;
  font-variant-numeric: tabular-nums;
}

/* --- Inline arrows + chevrons need horizontal mirror -------------------- */
[dir="rtl"] .btn-arrow,
[dir="rtl"] .nav-arrow,
[dir="rtl"] .arrow-right,
[dir="rtl"] .showcase__cta span[aria-hidden],
[dir="rtl"] .case-card__cta span[aria-hidden],
[dir="rtl"] .cta-full__cta span[aria-hidden] {
  display: inline-block;
  transform: scaleX(-1);
}

/* --- Nav --------------------------------------------------------------- */
/* DO NOT add flex-direction: row-reverse here. With <html dir="rtl">,
   inherited direction:rtl already lays nav children right-to-left
   (logo on right, action buttons on left). Adding row-reverse REVERSES
   that back to LTR — that was the bug producing "logo on left". */

/* Dropdown menus in RTL: both wide (Products) and narrow (Company) panels
   anchor to the trigger's RIGHT edge and grow LEFTWARD. This matches the
   conventional Arabic-web menu UX — the panel extends in the same direction
   the user is reading (right→left). Apply to both menus uniformly so the
   narrow Company menu doesn't overflow the page on the left. */
[dir="rtl"] .nav__menu,
[dir="rtl"] .nav__menu--narrow,
[dir="rtl"] .nav__menu--wide {
  left: auto !important;
  right: 0 !important;
}

/* Menu grid: explicitly mark RTL so items flow right→left
   (item 1 top-right, item 2 top-left, etc.) — needed because some
   browsers don't reliably inherit direction into absolutely-positioned
   grid containers. */
[dir="rtl"] .menu-grid { direction: rtl; }

/* Language switcher visual lives in style-v2.css (loaded on every page).
   Don't redefine .nav__lang here — earlier draft had a pill-styled
   override that won via cascade order and brought the border back. */

/* --- Hero --------------------------------------------------------------- */
[dir="rtl"] .hero__trust-points li {
  text-align: right;
}
[dir="rtl"] .hero__check { margin-right: 0; margin-left: 8px; }
[dir="rtl"] .hero__watch-body { text-align: right; }

/* Background gradient corner accents — mirror so the green/cyan accents
   feel native to the visual reading direction */
[dir="rtl"] .hero::before {
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(143, 255, 153, 0.1), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(3, 254, 249, 0.08), transparent 60%);
}

/* --- Trust band -------------------------------------------------------- */
[dir="rtl"] .trust-cells { direction: ltr; } /* keep logo cycle order LTR */

/* --- Showcase / module panels ------------------------------------------ */
[dir="rtl"] .showcase__bullet { text-align: right; }
[dir="rtl"] .showcase__bullet-icon { margin-right: 0; margin-left: 14px; }
[dir="rtl"] .showcase__bullets { padding-right: 0; padding-left: 0; }

/* The scroll-rail (numbered side rail) — flip to the LEFT edge in RTL */
[dir="rtl"] .showcase__rail {
  left: auto;
  right: 24px;
}

/* Mock device chrome stays LTR — UI mocks should look like the actual
   product UI, which is typically LTR even in Arabic markets */
[dir="rtl"] .mock,
[dir="rtl"] .mock__chrome,
[dir="rtl"] .mock__crumb,
[dir="rtl"] .mock-pr,
[dir="rtl"] .mock-rfx,
[dir="rtl"] .mock-auc,
[dir="rtl"] .mock-sup,
[dir="rtl"] .mock-con,
[dir="rtl"] .mock-ana,
[dir="rtl"] .mock-int,
[dir="rtl"] .mock-set {
  direction: ltr;
}

/* --- Voices / testimonials --------------------------------------------- */
[dir="rtl"] .voice-slide__identity {
  align-items: flex-start;
}
[dir="rtl"] .voice-slide__identity::after {
  right: auto;
  left: -20px;
}
[dir="rtl"] .voice-slide__quote { text-align: right; }
[dir="rtl"] .voice-slide__mark { text-align: right; }
[dir="rtl"] .voice-metric { text-align: right; }
[dir="rtl"] .voice-pill__text { text-align: right; }

/* --- Case study card --------------------------------------------------- */
[dir="rtl"] .case-card__quote { text-align: right; }
[dir="rtl"] .case-card__author { text-align: right; }
[dir="rtl"] .video-thumb__caption { text-align: right; }

/* --- CTA / closing block ---------------------------------------------- */
[dir="rtl"] .cta-full__inner { text-align: center; }
[dir="rtl"] .cta-full__list li .dash { margin-right: 0; margin-left: 6px; }

/* --- Footer ------------------------------------------------------------ */
[dir="rtl"] .footer__list { padding-right: 0; text-align: right; }
[dir="rtl"] .footer__brand,
[dir="rtl"] .footer__col-head { text-align: right; }

/* --- Forms (book-demo + others) --------------------------------------- */
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="search"],
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
  direction: rtl;
}
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="url"],
[dir="rtl"] input[type="tel"] {
  /* email + URLs + phone stay LTR for legibility */
  direction: ltr;
  text-align: left;
}
[dir="rtl"] label { text-align: right; display: block; }

/* --- Demo page specific ------------------------------------------------ */
[dir="rtl"] .demo-faq__item { text-align: right; }

/* --- Nav layout: hug the logo (mirror of LTR margin) ------------------ */
/* LTR uses `margin: 0 auto 0 32px` so the menu sits 32px from the logo on
   the left and `auto` pushes nav__side to the right. In RTL the logo is on
   the right, so we flip: 32px from the logo on the right, auto on the left. */
[dir="rtl"] .nav__main { margin: 0 32px 0 auto; }

/* --- Trust band note ---------------------------------------------------
   EN base style is 0.74rem + uppercase + 0.22em letter-spacing — designed
   for compact Latin micro-caps. In Arabic, uppercase is a no-op and the
   wide letter-spacing pulls glyphs apart awkwardly while the small size
   feels under-weighted next to the rest of the dark hero. Bump size,
   reset letter-spacing, and use Forma Text for proper at-size hinting. */
[dir="rtl"] .trust-band__note {
  font-family: 'Forma Text', 'Forma Display', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.62);
}
[dir="rtl"] .trust-band__note .highlight {
  letter-spacing: 0;
  font-weight: 800;
}
@media (max-width: 720px) {
  [dir="rtl"] .trust-band__note { font-size: 0.92rem; }
}

/* --- Reduced-motion + utility ----------------------------------------- */
[dir="rtl"] .arrow-flip-ltr { transform: none; } /* opt-out class */


/* ============================================================================
   HELVETICA NEUE ARABIC — body / paragraph / UI font for Arabic pages
   ============================================================================
   Forma Display stays on the big headlines (h1, h2, h3, hero__title, etc.)
   Forma Micro stays on tiny labels (eyebrows, metric values).
   Everything else — body, descriptions, nav, buttons, footer — uses
   Helvetica Neue Arabic. The font ships in Light (300), Roman (400), and
   Bold (700); Medium-weight (500) UI text is still snapped to Bold so it
   doesn't fall back to Light/Roman and look thin.
   ========================================================================== */

@font-face {
  font-family: 'Helvetica Neue Arabic';
  src: url('../fonts/Helvatica%20Neue/helvetica-neue-lt-arabic-45-light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue Arabic';
  src: url('../fonts/Helvatica%20Neue/helvetica-neue-lt-arabic-55-roman.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Helvetica Neue Arabic';
  src: url('../fonts/Helvatica%20Neue/helvetica-neue-lt-arabic-75-bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Body inherits Al Jazeera — catches all <p>, <li>, descriptions, and any
   text that doesn't have an explicit font-family override. */
[dir="rtl"] body {
  font-family: 'Helvetica Neue Arabic', 'Forma Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Override the explicit Forma Text rules above so smaller headings,
   buttons, and descriptions also use Al Jazeera. (Big headlines keep
   their Forma Display rule; eyebrows + numeric metrics keep Forma Micro.) */
[dir="rtl"] h4,
[dir="rtl"] .platform-stage__title,
[dir="rtl"] .nav__link,
[dir="rtl"] .nav__trigger,
[dir="rtl"] .menu-item__title,
[dir="rtl"] .menu-item__desc,
[dir="rtl"] .voice-pill__name,
[dir="rtl"] .voice-slide__name,
[dir="rtl"] .footer__col-head,
[dir="rtl"] .footer__list a,
[dir="rtl"] .footer__blurb,
[dir="rtl"] .btn,
[dir="rtl"] .hero__description,
[dir="rtl"] .platform-section__desc,
[dir="rtl"] .gap-card__pain,
[dir="rtl"] .voice-slide__quote,
[dir="rtl"] .cta-full__lead,
[dir="rtl"] .demo-hero__lead,
[dir="rtl"] p,
[dir="rtl"] li {
  font-family: 'Helvetica Neue Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Al Jazeera ships only Regular (400) and Bold (700) — no Medium (500).
   Snap the would-be-medium UI text to Bold so it doesn't render thin. */
[dir="rtl"] .nav__link,
[dir="rtl"] .nav__trigger,
[dir="rtl"] .menu-item__title,
[dir="rtl"] .voice-pill__name,
[dir="rtl"] .voice-slide__name,
[dir="rtl"] .footer__col-head,
[dir="rtl"] h4,
[dir="rtl"] .platform-stage__title {
  font-weight: 700;
}
