/**
 * Direction + Farsi fonts
 * ─ EN pages: LTR (html[dir=ltr] / body.lang-en / body.ltr)
 * ─ FA pages: RTL (html[dir=rtl] / body.lang-fa / body.rtl)
 */

/* ═══════════════════════════════════════════
   BASE DIRECTION
   ═══════════════════════════════════════════ */

html[dir="ltr"],
body.lang-en,
body.ltr {
	direction: ltr;
	text-align: left;
	unicode-bidi: embed;
}

html[dir="rtl"],
html[lang="fa"],
html[lang^="fa-"],
body.lang-fa,
body.rtl {
	direction: rtl;
	text-align: right;
	unicode-bidi: embed;
}

html[dir="ltr"] body,
body.lang-en,
body.ltr {
	--wp--preset--font-family--body: "Satoshi", system-ui, sans-serif;
	--wp--preset--font-family--display: "Satoshi", system-ui, sans-serif;
	--wp--preset--font-family--mono: "Satoshi", system-ui, sans-serif;
	direction: ltr;
	font-family: "Satoshi", system-ui, sans-serif;
	text-align: left;
}

html[dir="rtl"] body,
html[lang="fa"] body,
body.lang-fa,
body.rtl {
	direction: rtl;
	text-align: right;
}

/* ═══════════════════════════════════════════
   FARSI FONTS (Vazirmatn everywhere on FA)
   ═══════════════════════════════════════════ */

html[dir="rtl"],
html[lang="fa"],
html[lang^="fa-"],
body.lang-fa,
body.rtl {
	--wp--preset--font-family--body: "Vazirmatn", Tahoma, sans-serif;
	--wp--preset--font-family--display: "Vazirmatn", Tahoma, sans-serif;
	--wp--preset--font-family--farsi: "Vazirmatn", Tahoma, sans-serif;
	--wp--preset--font-family--mono: "Vazirmatn", Tahoma, sans-serif;
	font-family: var(--wp--preset--font-family--farsi);
}

html[dir="rtl"] body,
html[lang="fa"] body,
body.lang-fa,
body.rtl {
	font-family: var(--wp--preset--font-family--farsi);
	font-optical-sizing: auto;
	font-style: normal;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea,
html[dir="rtl"] select,
html[dir="rtl"] button,
html[lang="fa"] input,
html[lang="fa"] textarea,
html[lang="fa"] select,
html[lang="fa"] button,
body.lang-fa input,
body.lang-fa textarea,
body.lang-fa select,
body.lang-fa button,
body.lang-fa .wp-block-button__link,
body.lang-fa .wp-block-navigation,
body.lang-fa .wp-block-navigation-item__content,
body.lang-fa .wp-block-site-title,
body.lang-fa .wp-block-heading,
body.lang-fa .has-display-font-family,
body.lang-fa .has-body-font-family,
body.lang-fa .has-farsi-font-family,
body.lang-fa .hb-lang,
body.lang-fa .hb-lang__link,
body.lang-fa .hb-header,
body.lang-fa .hb-footer,
body.lang-fa .schema-faq-question,
body.lang-fa .schema-faq-answer,
body.lang-fa .ff-el-form-control,
body.lang-fa .ff-el-input--label label,
body.lang-fa .ff-btn-md.ff-btn-submit,
body.lang-fa .hb-primary-nav,
body.lang-fa .hb-primary-nav a {
	font-family: var(--wp--preset--font-family--farsi);
	font-optical-sizing: auto;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[lang="fa"] h1,
html[lang="fa"] h2,
html[lang="fa"] h3,
html[lang="fa"] h4,
html[lang="fa"] h5,
html[lang="fa"] h6,
body.lang-fa h1,
body.lang-fa h2,
body.lang-fa h3,
body.lang-fa h4,
body.lang-fa h5,
body.lang-fa h6 {
	font-family: var(--wp--preset--font-family--farsi);
	font-optical-sizing: auto;
	font-style: normal;
	font-weight: 700;
}

html[dir="rtl"] p,
html[dir="rtl"] li,
html[dir="rtl"] blockquote,
html[lang="fa"] p,
html[lang="fa"] li,
html[lang="fa"] blockquote,
body.lang-fa p,
body.lang-fa li,
body.lang-fa blockquote {
	font-family: var(--wp--preset--font-family--farsi);
}

/* ═══════════════════════════════════════════
   HEADER / NAV
   Same menu style EN + FA; only direction/font differ.
   ═══════════════════════════════════════════ */

body.lang-en .hb-primary-nav,
body.ltr .hb-primary-nav,
html[dir="ltr"] .hb-primary-nav {
	flex-direction: row;
}

body.lang-fa .hb-primary-nav,
body.rtl .hb-primary-nav,
html[dir="rtl"] .hb-primary-nav {
	flex-direction: row; /* dir=rtl on nav handles reading order */
}

body.lang-fa .hb-primary-nav,
body.lang-fa .hb-primary-nav__link {
	font-family: var(--wp--preset--font-family--farsi);
}

/* Language toggle keeps EN | فارسی order in both modes */
body.lang-fa .hb-lang-toggle,
body.rtl .hb-lang-toggle,
html[dir="rtl"] .hb-lang-toggle {
	direction: ltr;
}

/* فارسی label uses Vazirmatn on both EN and FA pages */
body.lang-en .hb-lang-toggle__btn--fa,
body.ltr .hb-lang-toggle__btn--fa,
html[dir="ltr"] .hb-lang-toggle__btn--fa,
body.lang-fa .hb-lang-toggle__btn--fa,
body.rtl .hb-lang-toggle__btn--fa,
html[dir="rtl"] .hb-lang-toggle__btn--fa {
	font-family: "Vazirmatn", Tahoma, sans-serif;
}

/*
 * Header outer bar only (logo cluster ↔ nav cluster).
 * Nested logo/title and nav/lang groups keep natural order.
 */
body.lang-en .hb-header > .wp-block-group.is-layout-flex,
body.ltr .hb-header > .wp-block-group.is-layout-flex,
html[dir="ltr"] .hb-header > .wp-block-group.is-layout-flex {
	flex-direction: row;
}

body.lang-fa .hb-header > .wp-block-group.is-layout-flex,
body.rtl .hb-header > .wp-block-group.is-layout-flex,
html[dir="rtl"] .hb-header > .wp-block-group.is-layout-flex {
	flex-direction: row-reverse;
}

/* Footer text column stays a vertical stack (EN + FA) */
body.lang-en .hb-footer__stack,
body.ltr .hb-footer__stack,
html[dir="ltr"] .hb-footer__stack,
body.lang-fa .hb-footer__stack,
body.rtl .hb-footer__stack,
html[dir="rtl"] .hb-footer__stack {
	align-items: flex-start !important;
	flex-direction: column !important;
}

/* Footer grid: text then map side-by-side on desktop only */
@media (min-width: 901px) {
	body.lang-en .hb-footer__grid,
	body.ltr .hb-footer__grid,
	html[dir="ltr"] .hb-footer__grid,
	body.lang-fa .hb-footer__grid,
	body.rtl .hb-footer__grid,
	html[dir="rtl"] .hb-footer__grid {
		flex-direction: row !important;
	}
}

@media (max-width: 900px) {
	body.lang-en .hb-footer__grid,
	body.ltr .hb-footer__grid,
	html[dir="ltr"] .hb-footer__grid,
	body.lang-fa .hb-footer__grid,
	body.rtl .hb-footer__grid,
	html[dir="rtl"] .hb-footer__grid {
		flex-direction: column !important;
	}
}

/* ═══════════════════════════════════════════
   TEXT ALIGNMENT HELPERS
   ═══════════════════════════════════════════ */

/* Keep explicitly centered blocks centered in both dirs */
html[dir="rtl"] .has-text-align-center,
body.lang-fa .has-text-align-center {
	text-align: center;
}

html[dir="ltr"] .has-text-align-left,
body.lang-en .has-text-align-left {
	text-align: left;
}

html[dir="rtl"] .has-text-align-left,
body.lang-fa .has-text-align-left {
	text-align: right;
}

html[dir="ltr"] .has-text-align-right,
body.lang-en .has-text-align-right {
	text-align: right;
}

html[dir="rtl"] .has-text-align-right,
body.lang-fa .has-text-align-right {
	text-align: left;
}

/* ═══════════════════════════════════════════
   COMPONENT MIRRORS (physical left/right)
   ═══════════════════════════════════════════ */

/* Hero quote accent */
html[dir="ltr"] .hb-hero__quote,
body.lang-en .hb-hero__quote {
	border-left: 4px solid var(--wp--preset--color--accent);
	border-right: none;
	padding-left: var(--wp--preset--spacing--5);
	padding-right: 0;
}

html[dir="rtl"] .hb-hero__quote,
body.lang-fa .hb-hero__quote {
	border-left: none;
	border-right: 4px solid var(--wp--preset--color--accent);
	padding-left: 0;
	padding-right: var(--wp--preset--spacing--5);
}

/* Hero badge position */
html[dir="ltr"] .hb-hero__badge,
body.lang-en .hb-hero__badge {
	left: var(--wp--preset--spacing--6);
	right: auto;
}

html[dir="rtl"] .hb-hero__badge,
body.lang-fa .hb-hero__badge {
	left: auto;
	right: var(--wp--preset--spacing--6);
}

/* Beliefs highlight accent */
html[dir="ltr"] .hb-beliefs__highlight,
body.lang-en .hb-beliefs__highlight {
	border-left: 4px solid var(--wp--preset--color--accent) !important;
	border-right-width: 1px !important;
}

html[dir="rtl"] .hb-beliefs__highlight,
body.lang-fa .hb-beliefs__highlight {
	border-left-width: 1px !important;
	border-right: 4px solid var(--wp--preset--color--accent) !important;
}

/* Meetings glow */
html[dir="ltr"] .hb-meetings::after,
body.lang-en .hb-meetings::after {
	left: auto;
	right: -10rem;
}

html[dir="rtl"] .hb-meetings::after,
body.lang-fa .hb-meetings::after {
	left: -10rem;
	right: auto;
}

/* Two-column sections: reverse content/media order in RTL */
html[dir="rtl"] .hb-hero__grid,
html[dir="rtl"] .hb-beliefs__grid,
html[dir="rtl"] .hb-cta .wp-block-columns,
html[dir="rtl"] .hb-location .wp-block-columns,
body.lang-fa .hb-hero__grid,
body.lang-fa .hb-beliefs__grid,
body.lang-fa .hb-cta .wp-block-columns,
body.lang-fa .hb-location .wp-block-columns {
	flex-direction: row-reverse;
}

html[dir="ltr"] .hb-hero__grid,
html[dir="ltr"] .hb-beliefs__grid,
html[dir="ltr"] .hb-cta .wp-block-columns,
html[dir="ltr"] .hb-location .wp-block-columns,
body.lang-en .hb-hero__grid,
body.lang-en .hb-beliefs__grid,
body.lang-en .hb-cta .wp-block-columns,
body.lang-en .hb-location .wp-block-columns {
	flex-direction: row;
}

/* Inner-page two-column templates (about, contact, etc.) */
html[dir="ltr"] main > .wp-block-group > .wp-block-columns,
body.lang-en main > .wp-block-group > .wp-block-columns {
	flex-direction: row;
}

html[dir="rtl"] main > .wp-block-group > .wp-block-columns,
body.lang-fa main > .wp-block-group > .wp-block-columns {
	flex-direction: row-reverse;
}

/* Buttons: natural start side */
html[dir="ltr"] .wp-block-buttons.is-layout-flex,
body.lang-en .wp-block-buttons.is-layout-flex {
	justify-content: flex-start;
}

html[dir="rtl"] .wp-block-buttons.is-layout-flex,
body.lang-fa .wp-block-buttons.is-layout-flex {
	justify-content: flex-start; /* start = right in RTL */
}

/* FAQ */
html[dir="ltr"] .schema-faq-section,
body.lang-en .schema-faq-section {
	border-left: var(--wp--preset--spacing--1) solid var(--wp--preset--color--accent);
	border-right: 1px solid var(--wp--preset--color--neutral-200);
}

html[dir="rtl"] .schema-faq-section,
body.lang-fa .schema-faq-section {
	border-left: 1px solid var(--wp--preset--color--neutral-200);
	border-right: var(--wp--preset--spacing--1) solid var(--wp--preset--color--accent);
}

html[dir="ltr"] .schema-faq-question,
body.lang-en .schema-faq-question {
	padding-left: var(--wp--preset--spacing--5);
	padding-right: var(--wp--preset--spacing--12);
}

html[dir="rtl"] .schema-faq-question,
body.lang-fa .schema-faq-question {
	padding-left: var(--wp--preset--spacing--12);
	padding-right: var(--wp--preset--spacing--5);
}

html[dir="ltr"] .schema-faq-question::after,
body.lang-en .schema-faq-question::after {
	left: auto;
	right: var(--wp--preset--spacing--5);
}

html[dir="rtl"] .schema-faq-question::after,
body.lang-fa .schema-faq-question::after {
	left: var(--wp--preset--spacing--5);
	right: auto;
}

html[dir="ltr"] .schema-faq-answer,
body.lang-en .schema-faq-answer {
	padding-left: var(--wp--preset--spacing--5);
	padding-right: var(--wp--preset--spacing--5);
}

html[dir="rtl"] .schema-faq-answer,
body.lang-fa .schema-faq-answer {
	padding-left: var(--wp--preset--spacing--5);
	padding-right: var(--wp--preset--spacing--5);
}

/* Forms */
html[dir="ltr"] .ff-form,
html[dir="ltr"] .fluentform,
body.lang-en .ff-form,
body.lang-en .fluentform {
	direction: ltr;
	text-align: left;
}

html[dir="rtl"] .ff-form,
html[dir="rtl"] .fluentform,
body.lang-fa .ff-form,
body.lang-fa .fluentform {
	direction: rtl;
	text-align: right;
}

/* Navigation submenus */
html[dir="ltr"] .wp-block-navigation__submenu-container,
body.lang-en .wp-block-navigation__submenu-container {
	left: 0;
	right: auto;
}

html[dir="rtl"] .wp-block-navigation__submenu-container,
body.lang-fa .wp-block-navigation__submenu-container {
	left: auto;
	right: 0;
}

/* Lists */
html[dir="ltr"] ul,
html[dir="ltr"] ol,
body.lang-en ul,
body.lang-en ol {
	padding-left: 1.25em;
	padding-right: 0;
}

html[dir="rtl"] ul,
html[dir="rtl"] ol,
body.lang-fa ul,
body.lang-fa ol {
	padding-left: 0;
	padding-right: 1.25em;
}

/* Skip link */
html[dir="ltr"] .skip-link:focus,
body.lang-en .skip-link:focus {
	left: var(--wp--preset--spacing--3);
	right: auto;
}

html[dir="rtl"] .skip-link:focus,
body.lang-fa .skip-link:focus {
	left: auto;
	right: var(--wp--preset--spacing--3);
}

/* ═══════════════════════════════════════════
   SHARED MAP PATTERN ON FA PAGES
   ═══════════════════════════════════════════ */

body.lang-fa .hb-location,
body.lang-fa .hb-location .wp-block-heading,
body.lang-fa .hb-location p,
body.lang-fa .hb-location .wp-block-button__link {
	font-family: var(--wp--preset--font-family--farsi);
}

/* ═══════════════════════════════════════════
   RESPONSIVE (FA / RTL)
   ═══════════════════════════════════════════ */

@media (max-width: 900px) {
	/* Keep logo → nav → lang stack order on FA (don't reverse into column) */
	body.lang-fa .hb-header > .wp-block-group.is-layout-flex,
	body.rtl .hb-header > .wp-block-group.is-layout-flex,
	html[dir="rtl"] .hb-header > .wp-block-group.is-layout-flex,
	body.lang-fa .hb-header__bar {
		flex-direction: column !important;
	}

	body.lang-fa .hb-header__brand {
		order: 1;
	}

	body.lang-fa .hb-header__actions {
		order: 2;
	}
}

@media (max-width: 781px) {
	/* Columns stack: don't force reverse order on mobile */
	html[dir="rtl"] .hb-hero__grid,
	html[dir="rtl"] .hb-beliefs__grid,
	html[dir="rtl"] .hb-cta .wp-block-columns,
	html[dir="rtl"] .hb-location .wp-block-columns,
	html[dir="rtl"] .hb-footer__grid,
	html[dir="rtl"] main > .wp-block-group > .wp-block-columns,
	body.lang-fa .hb-hero__grid,
	body.lang-fa .hb-beliefs__grid,
	body.lang-fa .hb-cta .wp-block-columns,
	body.lang-fa .hb-location .wp-block-columns,
	body.lang-fa .hb-footer__grid,
	body.lang-fa main > .wp-block-group > .wp-block-columns {
		flex-direction: column !important;
	}

	html[dir="ltr"] .hb-hero__badge,
	body.lang-en .hb-hero__badge {
		left: var(--wp--preset--spacing--4);
		right: auto;
	}

	/* FAQ chevron on the start side for RTL */
	body.lang-fa .schema-faq-question::after {
		left: var(--wp--preset--spacing--5);
		right: auto;
	}

	html[dir="rtl"] .hb-hero__badge,
	body.lang-fa .hb-hero__badge {
		left: auto;
		right: var(--wp--preset--spacing--4);
	}
}
