/*
 * ADG theme — LTR layout overrides.
 *
 * Loaded after theme.css only when the theme-wide LTR option is enabled.
 * Keep structural and visual rules in theme.css; this file should contain
 * direction changes and the small number of physically positioned mirrors.
 */

html[dir="ltr"] body.adg-direction-ltr {
	direction: ltr;
	text-align: left;
}

html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-site-shell,
	.adg-site-header,
	.adg-main,
	.adg-site-footer,
	.adg-home,
	.adg-content-shell,
	.adg-pattern-page
) {
	direction: ltr;
}

/* Keep punctuation correct while Persian content is being translated. */
html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-site-header,
	main,
	.adg-site-footer
) :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, figcaption, blockquote) {
	unicode-bidi: plaintext;
}

/* Core alignment utilities retain their normal LTR float semantics. */
html[dir="ltr"] body.adg-direction-ltr .alignleft {
	float: left;
}

html[dir="ltr"] body.adg-direction-ltr .alignright {
	float: right;
}

html[dir="ltr"] body.adg-direction-ltr .screen-reader-text:focus {
	right: auto;
	left: 0.75rem;
}

/* Header, navigation and the keyboard skip link. */
html[dir="ltr"] body.adg-direction-ltr .adg-site-header__inner,
html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation,
html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .wp-block-navigation__responsive-container,
html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .wp-block-navigation__responsive-container-content {
	direction: ltr;
}

html[dir="ltr"] body.adg-direction-ltr .wp-block-navigation__submenu-container {
	text-align: left;
}

html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .wp-block-navigation-item__content::after {
	right: 100%;
	left: 0;
	transition: right var(--adg-transition);
}

html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .wp-block-navigation-item__content:hover::after,
html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .current-menu-item > .wp-block-navigation-item__content::after {
	right: 0;
	left: 0;
}

html[dir="ltr"] body.adg-direction-ltr .adg-skip-link {
	right: auto;
	left: 1rem;
}

/* Existing/saved Gutenberg markup can retain its original RTL justification. */
html[dir="ltr"] body.adg-direction-ltr .adg-hero__content {
	justify-items: start;
}

html[dir="ltr"] body.adg-direction-ltr .adg-hero__content > :where(
	:not(.alignleft):not(.alignright):not(.alignfull)
) {
	margin-right: auto !important;
	margin-left: 0 !important;
}

html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-about-cta,
	.adg-contact-cta
) .wp-block-buttons.is-content-justification-right,
html[dir="ltr"] body.adg-direction-ltr .adg-not-found__actions.is-content-justification-right {
	justify-content: flex-start;
}

html[dir="ltr"] body.adg-direction-ltr .wp-block-button.is-style-adg-text .wp-block-button__link::after {
	content: "↗";
}

/* Directional hover movement follows the new reading flow. */
html[dir="ltr"] body.adg-direction-ltr .adg-text-link a:hover,
html[dir="ltr"] body.adg-direction-ltr .adg-editorial-related__all:hover,
html[dir="ltr"] body.adg-direction-ltr .adg-rnd-feature:hover,
html[dir="ltr"] body.adg-direction-ltr .adg-timeline-item:hover,
html[dir="ltr"] body.adg-direction-ltr .adg-site-footer .adg-footer-navigation .wp-block-navigation-item__content:hover {
	transform: translateX(0.3rem);
}

/* Homepage editorial composition: lead story at inline start in LTR. */
html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured {
	grid-template-areas: "lead secondary";
	direction: ltr;
}

html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured__lead,
html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured__secondary {
	direction: ltr;
}

html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured--secondary-0 {
	grid-template-areas: "lead";
}

/* Editorial listings, single posts, archives and related content. */
html[dir="ltr"] body.adg-direction-ltr .adg-news::before {
	right: -15rem;
	left: auto;
}

html[dir="ltr"] body.adg-direction-ltr .adg-editorial-single-hero__ambient {
	right: auto;
	left: -8rem;
	transform: rotate(14deg);
}

html[dir="ltr"] body.adg-direction-ltr .adg-editorial-single-hero__media figcaption {
	right: 1rem;
	left: auto;
}

html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-editorial-card__body,
	.adg-related-editorial-card__body,
	.adg-related-product-card__body,
	.adg-editorial-single-hero__copy,
	.adg-editorial-body,
	.adg-post-card__body
) {
	text-align: left;
}

/* Category/product ornaments are mirrored, while Latin product data stays LTR. */
html[dir="ltr"] body.adg-direction-ltr .adg-product-categories::before {
	right: auto;
	left: -15rem;
}

html[dir="ltr"] body.adg-direction-ltr .adg-product-categories::after {
	right: -15rem;
	left: auto;
}

html[dir="ltr"] body.adg-direction-ltr .adg-category-card::after {
	right: auto;
	left: -4rem;
}

html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-product-card__body,
	.adg-catalog-card__body,
	.adg-product-copy,
	.adg-product-content,
	.adg-product-detail
) {
	direction: ltr;
	text-align: left;
}

html[dir="ltr"] body.adg-direction-ltr .adg-catalog-card .adg-product-meta dd {
	direction: ltr;
	text-align: right;
}

html[dir="ltr"] body.adg-direction-ltr .adg-product-latin {
	direction: ltr;
	text-align: left;
}

/* Research, innovation journey and manufacturing. */
html[dir="ltr"] body.adg-direction-ltr .adg-rnd__media {
	padding: 0 clamp(0rem, 4vw, 3.5rem) clamp(0rem, 4vw, 3.5rem) 0;
}

html[dir="ltr"] body.adg-direction-ltr .adg-rnd__note {
	right: 0;
	left: auto;
}

html[dir="ltr"] body.adg-direction-ltr .adg-timeline {
	padding-right: 0;
	padding-left: clamp(1.5rem, 4vw, 3.25rem);
}

html[dir="ltr"] body.adg-direction-ltr .adg-timeline::before {
	right: auto;
	left: 0;
}

html[dir="ltr"] body.adg-direction-ltr .adg-timeline-item::before {
	right: auto;
	left: calc(clamp(1.5rem, 4vw, 3.25rem) * -1 - 7px);
}

html[dir="ltr"] body.adg-direction-ltr .adg-manufacturing::before {
	right: -18rem;
	left: auto;
}

html[dir="ltr"] body.adg-direction-ltr .adg-manufacturing__badge {
	right: auto;
	left: -1.25rem;
}

html[dir="ltr"] body.adg-direction-ltr .adg-csr::before {
	right: auto;
	left: -16rem;
}

/* About page visual accents and numbered capability rows. */
html[dir="ltr"] body.adg-direction-ltr .adg-about-capability__number {
	direction: ltr;
}

html[dir="ltr"] body.adg-direction-ltr .adg-about-standards::before {
	inset: -50% -12% -50% 38%;
}

html[dir="ltr"] body.adg-direction-ltr .adg-about-standard__name {
	direction: ltr;
}

/* Flip glyph arrows that are part of translated link labels. */
html[dir="ltr"] body.adg-direction-ltr .adg-directional-arrow {
	display: inline-block;
	transform: scaleX(-1);
}

/* Contact page and third-party form plugins. */
html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell :where(
	.wpcf7,
	.wpcf7-form,
	.adg-contact-form,
	.contact-form,
	.wpforms-form,
	.gform_wrapper,
	.gform-theme
) {
	direction: ltr;
	text-align: left;
}

html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell form :where(
	input:not([type]),
	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="url"],
	input[type="search"],
	input[type="number"],
	input[type="date"],
	input[type="time"],
	select,
	textarea
) {
	direction: ltr;
	text-align: left;
}

html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell :where(
	.wpcf7-not-valid-tip,
	label.wpforms-error,
	.validation_message,
	.wpcf7-response-output,
	.adg-contact-form__status,
	.contact-form__status
) {
	direction: ltr;
	text-align: left;
	unicode-bidi: plaintext;
}

html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell form :where(
	input:not([type]),
	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="url"],
	input[type="search"],
	input[type="number"],
	input[type="date"],
	input[type="time"],
	select,
	textarea
):where(:user-invalid, [aria-invalid="true"], .wpcf7-not-valid, .wpforms-error),
html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell :where(.adg-contact-field.has-error, .contact-field.has-error, .gfield_error) :where(input, select, textarea) {
	box-shadow: inset 3px 0 0 var(--adg-contact-error);
}

html[dir="ltr"] body.adg-direction-ltr .adg-contact-form-shell form :where(
	input:not([type]),
	input[type="text"],
	input[type="email"],
	input[type="tel"],
	input[type="url"],
	input[type="search"],
	input[type="number"],
	input[type="date"],
	input[type="time"],
	select,
	textarea
):where(:user-invalid, [aria-invalid="true"], .wpcf7-not-valid, .wpforms-error):focus {
	box-shadow:
		inset 3px 0 0 var(--adg-contact-error),
		0 0 0 4px color-mix(in srgb, var(--adg-contact-error) 10%, transparent);
}

/* 404 content and search controls inherit the site direction explicitly. */
html[dir="ltr"] body.adg-direction-ltr :where(
	.adg-not-found__inner,
	.adg-not-found__content,
	.adg-not-found__search,
	.adg-not-found__actions
) {
	direction: ltr;
	text-align: left;
}

@media (max-width: 980px) {
	html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured,
	html[dir="ltr"] body.adg-direction-ltr .adg-home-query--articles .adg-editorial-featured--secondary-0 {
		grid-template-areas:
			"lead"
			"secondary";
	}
}

@media (max-width: 781px) {
	html[dir="ltr"] body.adg-direction-ltr .adg-rnd__media {
		padding: 0 1.5rem 2rem 0;
	}
}

@media (max-width: 600px) {
	html[dir="ltr"] body.adg-direction-ltr .adg-primary-navigation .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content {
		justify-content: flex-start;
		text-align: left;
	}

	html[dir="ltr"] body.adg-direction-ltr .adg-rnd__note {
		right: auto;
		left: auto;
	}

	html[dir="ltr"] body.adg-direction-ltr .adg-rnd__media {
		padding: 0;
	}

	html[dir="ltr"] body.adg-direction-ltr .adg-timeline {
		padding-right: 0;
		padding-left: 1.25rem;
	}

	html[dir="ltr"] body.adg-direction-ltr .adg-timeline-item::before {
		right: auto;
		left: calc(-1.25rem - 7px);
	}

	html[dir="ltr"] body.adg-direction-ltr .adg-manufacturing__badge {
		right: auto;
		left: -0.75rem;
	}
}
