/* Zarfiat i18n — language switcher and Arabic typography */

/* --- Arabic web font (self-hosted, IBM Plex Sans Arabic, OFL 1.1) --------- */
@font-face {
	font-family: "ZFI Plex Arabic";
	src: url("../fonts/plex-arabic-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: "ZFI Plex Arabic";
	src: url("../fonts/plex-arabic-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: "ZFI Plex Arabic";
	src: url("../fonts/plex-arabic-600.woff2") format("woff2");
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
	font-family: "ZFI Plex Arabic";
	src: url("../fonts/plex-arabic-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

/* --- Latin companion (IBM Plex Sans) -------------------------------------
 * The Arabic subset carries no Latin letters, ASCII digits or ASCII
 * punctuation, so every number, acronym and comma inside Arabic text would
 * fall back to Tahoma and break the baseline. This companion covers the basic
 * Latin block so mixed strings stay on one typeface family.
 */
@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-600.woff2") format("woff2");
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC;
}

/* --- Latin Extended (Turkish ğ ş ı İ ç ö ü) ---------------------------- */
@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-ext-400.woff2") format("woff2");
	font-weight: 400;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-017F, U+0180-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-ext-500.woff2") format("woff2");
	font-weight: 500;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-017F, U+0180-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-ext-600.woff2") format("woff2");
	font-weight: 600;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-017F, U+0180-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
	font-family: "ZFI Plex Latin";
	src: url("../fonts/plex-latin-ext-700.woff2") format("woff2");
	font-weight: 700;
	font-style: normal;
	font-display: swap;
	unicode-range: U+0100-017F, U+0180-024F, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

/* --- Arabic render typography --------------------------------------------
 * The theme and our own zmp shell set font-family on element selectors and in
 * some cases with !important. The Arabic stack is therefore declared on the
 * broadest possible selector set and marked !important so it wins the cascade
 * on every page, not only the ones that happen to be less specific.
 */
body.zfi-lang-ar,
body.zfi-lang-ar *,
body.zfi-lang-ar *::before,
body.zfi-lang-ar *::after {
	font-family: "ZFI Plex Arabic", "ZFI Plex Latin", "IBM Plex Sans Arabic", "Noto Naskh Arabic", "Segoe UI", Tahoma, Arial, sans-serif !important;
}

/* Keep code and preformatted content monospaced. */
body.zfi-lang-ar code,
body.zfi-lang-ar code *,
body.zfi-lang-ar pre,
body.zfi-lang-ar pre *,
body.zfi-lang-ar kbd,
body.zfi-lang-ar samp {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}

/* Icon fonts must keep their own family or the glyphs disappear. */
body.zfi-lang-ar .fa,
body.zfi-lang-ar .fas,
body.zfi-lang-ar .far,
body.zfi-lang-ar .fab,
body.zfi-lang-ar [class*="rtcl-icon"],
body.zfi-lang-ar [class*="dashicons"],
body.zfi-lang-ar [class*="fa-"] {
	font-family: inherit !important;
}

body.zfi-lang-ar .fa,
body.zfi-lang-ar .fas {
	font-family: "Font Awesome 5 Free", "FontAwesome", sans-serif !important;
}

body.zfi-lang-ar .fab {
	font-family: "Font Awesome 5 Brands", "FontAwesome", sans-serif !important;
}

/* --- Language switcher ---------------------------------------------------- */
.zfi-switcher {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 2px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.94);
	box-shadow: 0 4px 18px rgba(16, 24, 40, 0.16);
	border: 1px solid rgba(16, 24, 40, 0.08);
	font-family: inherit;
	line-height: 1;
}

.zfi-switcher .zfi-switch-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 7px 13px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	color: #1f2937;
	text-decoration: none;
	transition: background-color 0.18s ease, color 0.18s ease;
	white-space: nowrap;
}

.zfi-switcher .zfi-switch-link:hover,
.zfi-switcher .zfi-switch-link:focus-visible {
	background: rgba(37, 99, 235, 0.1);
	color: #1d4ed8;
	outline: none;
}

.zfi-switcher .zfi-switch-link.is-active {
	background: #1d4ed8;
	color: #ffffff;
}

/* Top-start corner: the chat launcher and the mobile bottom nav both live at
 * the bottom-start, so the switcher must not sit on top of them. */
/*
 * The floating switcher sits under the site header.
 *
 * It used to be pinned at top:88px, which cleared the 77px home header but was
 * swallowed by the 137px inner-page header, so it covered the navigation links
 * (on Turkish it covered the account-login link, making it unclickable).
 * The offset is now driven by a CSS variable the theme can override, with a
 * value that clears the tallest header on the site.
 */
.zfi-switcher--floating {
	--zfi-switcher-offset: 148px;
	position: fixed;
	inset-inline-start: 16px;
	top: var(--zfi-switcher-offset);
	bottom: auto;
	/* Below the header (which uses 999/1000) so it can never trap a nav click. */
	z-index: 900;
	/* Never eat clicks meant for the page beneath. */
	pointer-events: none;
}

.zfi-switcher--floating .zfi-switch-link {
	pointer-events: auto;
}

.zfi-switcher--menu {
	margin-inline-start: 8px;
	background: transparent;
	box-shadow: none;
	border-color: rgba(16, 24, 40, 0.14);
}

.zfi-switcher--inline {
	margin-inline-start: 6px;
}

@media (max-width: 991px) {
	.zfi-switcher--floating {
		inset-inline-start: 10px;
		top: auto;
		bottom: 74px;
		z-index: 900;
	}
}

@media (max-width: 480px) {
	.zfi-switcher--floating .zfi-switch-link {
		padding: 6px 10px;
		font-size: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.zfi-switcher .zfi-switch-link {
		transition: none;
	}
}

@media print {
	.zfi-switcher--floating {
		display: none;
	}
}

/* --- Turkish (LTR) ------------------------------------------------------
 * Turkish uses the Latin alphabet, so it needs no Arabic face; the Latin
 * companion already covers it. Only the direction and a few RTL-tuned floats
 * need attention.
 */
body.zfi-lang-tr,
body.zfi-lang-tr *,
body.zfi-lang-tr *::before,
body.zfi-lang-tr *::after {
	font-family: "ZFI Plex Latin", "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif !important;
}

body.zfi-lang-tr code,
body.zfi-lang-tr pre,
body.zfi-lang-tr kbd,
body.zfi-lang-tr samp {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
}

/* Turkish is left-to-right: mirror the few physically-positioned helpers. */
html[dir="ltr"] .zfi-switcher--floating {
	inset-inline-start: 16px;
	inset-inline-end: auto;
}

/* Keep Turkish labels from wrapping awkwardly in the switcher. */
body.zfi-lang-tr .zfi-switcher .zfi-switch-link {
	letter-spacing: 0;
}

/* The Arabic typography block above must never leak onto Turkish pages. */
body.zfi-lang-tr .zfi-switcher,
body.zfi-lang-tr .zfi-switcher .zfi-switch-link {
	font-family: "ZFI Plex Latin", "IBM Plex Sans", "Segoe UI", Roboto, Arial, sans-serif !important;
}