/* ==========================================================================
   Elixerra — Arabic typography and RTL corrections
   Loaded only when the page is rendered in Arabic.
   --------------------------------------------------------------------------
   The main stylesheet already uses logical properties, so this file only has
   to swap the typefaces, restore comfortable metrics for Arabic script and fix
   the few places where a glyph is inherently directional.
   ========================================================================== */

@font-face {
	font-family: "Amiri";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../fonts/amiri-400.woff2") format("woff2");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FDF2, U+FDFD;
}

@font-face {
	font-family: "Amiri";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/amiri-700.woff2") format("woff2");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FDF2, U+FDFD;
}

@font-face {
	font-family: "Noto Sans Arabic";
	font-style: normal;
	font-weight: 300 600;
	font-display: swap;
	src: url("../fonts/noto-sans-arabic-var.woff2") format("woff2-variations");
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FDF2, U+FDFD;
}

/* --------------------------------------------------------------------------
   Typefaces
   -------------------------------------------------------------------------- */

.elx-lang-ar {
	/* Arabic first, Latin fallback for brand names and figures. */
	--wp--preset--font-family--body: "Noto Sans Arabic", "Jost", "Segoe UI", Tahoma, sans-serif;
	--wp--preset--font-family--heading: "Amiri", "Playfair Display", "Times New Roman", serif;
}

.elx-lang-ar body,
body.elx-lang-ar {
	font-family: "Noto Sans Arabic", "Jost", "Segoe UI", Tahoma, sans-serif;
	/* Arabic needs more leading and no negative tracking. */
	line-height: 1.95;
	letter-spacing: 0;
	font-weight: 400;
}

body.elx-lang-ar h1,
body.elx-lang-ar h2,
body.elx-lang-ar h3,
body.elx-lang-ar h4,
body.elx-lang-ar h5,
body.elx-lang-ar h6,
body.elx-lang-ar .wp-block-heading {
	font-family: "Amiri", "Playfair Display", serif;
	line-height: 1.5;
	letter-spacing: 0;
	font-weight: 400;
}

/* Amiri runs small next to Playfair; nudge display sizes back up. */
body.elx-lang-ar .ex-hero h1,
body.elx-lang-ar .ex-page-hero h1 {
	font-size: clamp(2.4rem, 1.8rem + 3vw, 4.6rem);
	line-height: 1.45;
}

/* Uppercase and wide tracking are meaningless in Arabic — remove both. */
body.elx-lang-ar .ex-eyebrow,
body.elx-lang-ar .is-style-elixerra-eyebrow,
body.elx-lang-ar .ex-badge,
body.elx-lang-ar .is-style-elixerra-badge,
body.elx-lang-ar .ex-marquee__item,
body.elx-lang-ar .ex-step__index,
body.elx-lang-ar .elx-stat__label,
body.elx-lang-ar .elx-contact__label,
body.elx-lang-ar .elx-field > label,
body.elx-lang-ar .elx-group-label,
body.elx-lang-ar .is-style-elixerra-specs th,
body.elx-lang-ar .wp-block-quote cite,
body.elx-lang-ar .ex-footer h4,
body.elx-lang-ar .ex-header .wp-block-navigation-item > a {
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.86rem;
}

body.elx-lang-ar .wp-block-button__link,
body.elx-lang-ar .elx-submit {
	text-transform: none;
	letter-spacing: 0;
	font-size: 0.95rem;
	font-weight: 500;
}

/* The brand name stays Latin — Elixerra is a wordmark, not a translated word. */
body.elx-lang-ar .elx-brand__name {
	font-family: "Playfair Display", serif;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

body.elx-lang-ar .elx-brand__tagline {
	font-family: "Noto Sans Arabic", sans-serif;
	letter-spacing: 0;
	text-transform: none;
	font-size: 0.72rem;
}

/* Language codes in the switcher are always Latin. */
body.elx-lang-ar .elx-lang {
	font-family: "Jost", sans-serif;
	letter-spacing: 0.12em;
}

/* Figures read better in Latin numerals with tabular alignment. */
body.elx-lang-ar .ex-stat-number,
body.elx-lang-ar .elx-stat__value {
	font-family: "Playfair Display", serif;
	direction: ltr;
	unicode-bidi: isolate;
}

/* --------------------------------------------------------------------------
   Directional glyphs
   -------------------------------------------------------------------------- */

/* Chevrons built from borders must be mirrored explicitly. */
[dir="rtl"] .elx-field--select::after,
[dir="rtl"] .wp-block-details.is-style-elixerra-accordion > summary::after {
	border-right: 0;
	border-left: 1.5px solid var(--wp--preset--color--gold);
	border-bottom: 1.5px solid var(--wp--preset--color--gold);
	rotate: -45deg;
}

[dir="rtl"] .wp-block-details.is-style-elixerra-accordion[open] > summary::after {
	rotate: -225deg;
}

[dir="rtl"] .is-style-elixerra-checks > li::before {
	border-left: 0;
	border-right: 1.5px solid var(--wp--preset--color--gold);
	border-bottom: 1.5px solid var(--wp--preset--color--gold);
	rotate: 45deg;
}

[dir="rtl"] .elx-check-box::after {
	border-right: 0;
	border-left: 2px solid var(--wp--preset--color--ink, #0e060f);
	border-bottom: 2px solid var(--wp--preset--color--ink, #0e060f);
	rotate: -40deg;
}

[dir="rtl"] .elx-check input:checked + .elx-check-box::after {
	rotate: -40deg;
	scale: 1;
}

/* The gold offset frame should lean the other way. */
[dir="rtl"] .is-style-elixerra-frame::before {
	translate: -14px 14px;
}

[dir="rtl"] .is-style-elixerra-frame:hover::before {
	translate: -8px 8px;
}

/* Gradients that fade "towards the reading direction". */
[dir="rtl"] .ex-header::after {
	background: linear-gradient(270deg, var(--wp--preset--color--gold), rgba(201, 162, 75, 0.05));
}

[dir="rtl"] .ex-scroll-cue::after {
	background: linear-gradient(270deg, var(--wp--preset--color--gold), transparent);
}

/* Latin fragments inside Arabic copy (e-mails, sizes, codes) must not flip. */
body.elx-lang-ar a[href^="mailto:"],
body.elx-lang-ar a[href^="tel:"],
body.elx-lang-ar code,
body.elx-lang-ar .elx-contact__value a {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
}

/* Form fields hold Latin data (e-mail, phone) even in the Arabic version. */
body.elx-lang-ar input[type="email"],
body.elx-lang-ar input[type="tel"],
body.elx-lang-ar input[type="url"] {
	direction: ltr;
	text-align: start;
}
