/* ==========================================================================
   Arabic (RTL) layer. Loads after main-rtl.css / home-rtl.css, which are generated
   from main.css / home.css with rtlcss (run scratchpad build again after CSS edits).
   ========================================================================== */

@font-face {
	font-family: "Noto Sans Arabic";
	src: url("../fonts/noto-sans-arabic.woff2") format("woff2");
	font-weight: 300 800;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

html[dir="rtl"] {
	--font: "Noto Sans Arabic", "Inter", "Segoe UI", Tahoma, system-ui, sans-serif;
}

/* Arabic letters join: tracking must be zero everywhere. */
html[dir="rtl"] *,
html[dir="rtl"] *::before,
html[dir="rtl"] *::after {
	letter-spacing: 0 !important;
}

html[dir="rtl"] body {
	line-height: 1.8;
}

/* Arabic needs more vertical room than the tight Latin headings. */
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] .hero__title,
html[dir="rtl"] .page-hero__title,
html[dir="rtl"] .showcase__title,
html[dir="rtl"] .statement__text,
html[dir="rtl"] .vision__quote {
	line-height: 1.4;
}

html[dir="rtl"] .hero__title .line,
html[dir="rtl"] .split-line {
	padding-top: 0.12em;
	padding-bottom: 0.3em;
}

/* Phone numbers and emails keep their left-to-right order inside Arabic text. */
html[dir="rtl"] a[href^="tel:"]:not(.btn),
html[dir="rtl"] a[href^="mailto:"]:not(.btn),
html[dir="rtl"] .site-footer__phones a,
html[dir="rtl"] .cta__contacts a {
	direction: ltr;
	unicode-bidi: isolate;
	display: inline-block;
}

/* Arrow icons point the way the text reads. */
html[dir="rtl"] .icon-arrow,
html[dir="rtl"] .icon-arrow-up {
	scale: -1 1;
}

/* Motion that is positioned with transforms keeps its left-to-right mechanics. */
html[dir="rtl"] .marquee,
html[dir="rtl"] .marquee__track,
html[dir="rtl"] .vmarquee,
html[dir="rtl"] .vmarquee__track,
html[dir="rtl"] .namewall,
html[dir="rtl"] .namewall__row,
html[dir="rtl"] .chip-marquee,
html[dir="rtl"] .chip-marquee__track {
	direction: ltr;
}

html[dir="rtl"] .vmarquee__track > *,
html[dir="rtl"] .namewall__row > * {
	direction: rtl;
}

@keyframes wall {
	to {
		transform: translateX(calc(-50% - var(--gap) / 2));
	}
}

@keyframes marquee {
	to {
		transform: translateX(calc(-50% - 30px));
	}
}

@keyframes marquee-q {
	to {
		transform: translateX(calc(-50% - 10px));
	}
}

/* Product screens are drawn interfaces; they stay left-to-right and keep their own layout. */
html[dir="rtl"] .hero__stage,
html[dir="rtl"] .hpanel,
html[dir="rtl"] .pscreen,
html[dir="rtl"] .showcase__screen,
html[dir="rtl"] .demo__device {
	direction: ltr;
}

/* Numbers with a trailing + or unit read left to right ("300+", "2.4GHz"). */
html[dir="rtl"] .stat__num,
html[dir="rtl"] strong:has(> [data-count]) {
	direction: ltr;
	unicode-bidi: isolate;
	display: block;
	text-align: right;
}

html[dir="rtl"] .stat__num {
	display: block;
	text-align: right;
}

/* The clients wall is a left-to-right marquee, but its labels sit on the reading edge. */
html[dir="rtl"] .namewall__label {
	direction: rtl;
	text-align: right;
}

/* Hero headline: Arabic glyphs are taller than Latin, so the size and line gap come down. */
@media (min-width: 1024px) {
	html[dir="rtl"] .hero__title {
		font-size: clamp(34px, min(9.4cqw, 7.4vh), 64px);
		line-height: 1.25;
	}
}

html[dir="rtl"] .hero__title .line {
	margin-bottom: -0.1em;
}
/* Mobile menu contact links sit on the reading edge. */
html[dir="rtl"] .site-nav__mobile-foot a {
	display: flex;
	justify-content: flex-end;
}
/* Short spec values (mostly Latin units and numbers) take their own reading order. */
html[dir="rtl"] .spec-models td,
html[dir="rtl"] .spec-models th,
html[dir="rtl"] .sizes__specs dd,
html[dir="rtl"] .sizes__best span,
html[dir="rtl"] .chips li,
html[dir="rtl"] .product-card__brands,
html[dir="rtl"] .hero-chips li {
	unicode-bidi: plaintext;
	text-align: right;
}

html[dir="rtl"] .spec-models td.is-shared {
	text-align: center;
}
html[dir="rtl"] .pframe {
	direction: ltr;
}

html[dir="rtl"] .pframe__device {
	transform: rotateY(12deg) rotateX(2deg);
	transform-origin: 60% 50%;
}

@media (max-width: 1023px) {
	html[dir="rtl"] .pframe__device {
		transform: none;
	}
}

/* Photo content is not mirrored, so the crop keeps the same side as in LTR. */
img[src*="automation-smart-building"] {
	object-position: 6% 50%;
}
