/* Color palette variables */
:root {
	--primary: #566A89;
	--secondary: #AEB2B8;
	--background: #FFFFFF;
	--accent: #DA8652;
	--accent-alt: #1C6766;
}

/* Base reset and typography */
*,
*::before,
*::after { box-sizing: border-box; }
html:focus-within { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
	margin: 0;
	font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
	color: var(--primary);
	background: var(--background);
	line-height: 1.6;
}
[lang="ar"] body {
	font-family: "Cairo", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
	width: min(1120px, 92vw);
	margin-inline: auto;
}

/* Navigation */
.site-header {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: var(--background);
	transition: box-shadow .2s ease;
}
.site-header.scrolled {
	box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.nav {
	display: grid;
	grid-template-columns: auto auto auto 1fr;
	grid-template-areas: "brand toggle lang links";
	align-items: center;
	column-gap: 16px;
	padding: 14px 0;
	direction: ltr;
}
.brand { grid-area: brand; justify-self: start; }
.nav-links { grid-area: links; justify-self: end; }
.lang-switch { grid-area: lang; }
.nav-toggle { grid-area: toggle; }
.lang-switch { display: flex; gap: 8px; margin-right: 0; margin-left: 14px; }
.lang-btn {
	padding: 6px 10px;
	border-radius: 6px;
	border: 1px solid rgba(174,178,184,.35);
	background: var(--background);
	color: var(--secondary);
	font-weight: 700;
	cursor: pointer;
}
.lang-btn[aria-pressed="true"] {
	color: var(--background);
	background: var(--primary);
	border-color: var(--primary);
}
.logo { width: 110px; height: auto; }
.nav-links {
	list-style: none;
	display: flex;
	gap: 28px;
	margin: 0;
	padding: 0;
	/* Keep logical item order (Home, About, Services, Contact) even in RTL */
	direction: ltr;
}
.nav-link {
	padding: 6px 0;
	border-bottom: 2px solid transparent;
	color: var(--secondary);
	font-weight: 600;
}
.nav-link:hover { color: var(--accent); }
.nav-link.active,
.nav-link:focus-visible {
	border-color: var(--accent);
	color: var(--primary);
}
.nav-toggle {
	display: none;
	background: transparent;
	border: 0;
	cursor: pointer;
}
.nav-toggle .bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--primary);
	margin: 5px 0;
	transition: transform .2s ease;
}

/* Sections */
.section { padding: 72px 0; }
.section-header { text-align: center; max-width: 760px; margin: 0 auto 40px; }
.section-header h2 {
	margin: 0 0 10px;
	font-size: 2rem;
	color: var(--primary);
}
.section-header p { color: #6B7A8F; margin: 0; }

/* Hero */
.hero {
	padding: 96px 0 72px;
	background-image: url('src/assets/herot.jpg');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	position: relative;
}
.hero::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(255, 255, 255, 0.85);
	z-index: 0;
}
.hero-grid {
	display: grid;
	grid-template-columns: 1fr;
	max-width: 760px;
	position: relative;
	z-index: 1;
}
.hero-title {
	margin: 0 0 12px;
	font-size: clamp(2rem, 3vw + 1rem, 3rem);
	color: var(--primary);
	line-height: 1.2;
}
.hero-subtitle { color: #6B7A8F; margin: 0 0 24px; }
.hero-copy p:not(.hero-subtitle) { color: #6B7A8F; margin: 0 0 24px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
/* RTL: Swap button positions - View Solutions left, Start Project right, but keep aligned to right */
[dir="rtl"] .hero-actions { 
	justify-content: flex-end; 
	padding-right: 12px; 
	flex-direction: row-reverse;
}
[dir="rtl"] .hero-actions .btn-primary { order: 2; }
[dir="rtl"] .hero-actions .btn-outline { order: 1; }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 20px;
	border-radius: 8px;
	font-weight: 700;
	border: 2px solid transparent;
	transition: transform .12s ease, background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
	background: var(--primary);
	color: var(--background);
}
.btn-primary:hover { 
	background: var(--accent);
	box-shadow: 0 10px 24px rgba(218,134,82,.24); 
}
.btn-outline {
	background: transparent;
	color: var(--accent);
	border-color: var(--accent);
}
.btn-outline:hover {
	background: rgba(218,134,82,.08);
	color: var(--accent);
}

/* About cards */
.card-row {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.info-card {
	border: 1px solid rgba(174,178,184,.25);
	border-radius: 12px;
	padding: 22px;
	background: var(--background);
	transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.info-card img { width: 56px; height: 56px; }
.info-card h3 {
	margin: 14px 0 6px;
	color: var(--primary);
}
.info-card p { margin: 0; color: #6B7A8F; }
.info-card:hover {
	border-color: var(--accent);
	box-shadow: 0 14px 28px rgba(218,134,82,.18);
	transform: translateY(-2px);
}

/* Services */
.services-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.service-card {
	border: 1px solid rgba(174,178,184,.25);
	border-radius: 12px;
	padding: 16px;
	background: var(--background);
	transition: box-shadow .25s ease, border-color .25s ease, transform .12s ease;
}
.service-card img { 
	border-radius: 8px; 
	margin-bottom: 12px; 
	width: 80px;
	height: 80px;
	object-fit: contain;
}
.service-card h3 { margin: 8px 0; color: var(--primary); }
.service-card p { margin: 0; color: #6B7A8F; }
.service-card:hover {
	border-color: var(--accent);
	box-shadow: 0 16px 32px rgba(218,134,82,.2);
	transform: translateY(-2px);
}

/* Contact */
.contact {
	background: rgba(174,178,184,.06);
}
.contact-grid {
	display: grid;
	grid-template-columns: 1fr;
	max-width: 800px;
	margin: 0 auto;
	gap: 28px;
	align-items: start;
	justify-items: center;
}
.contact-form {
	border-radius: 12px;
	padding: 18px;
	background: var(--background);
	box-shadow: 0 6px 22px rgba(0,0,0,.05);
}
.form-field { display: grid; gap: 8px; margin-bottom: 14px; }
.form-field label { font-weight: 600; color: var(--primary); }
.form-field input,
.form-field textarea {
	width: 100%;
	padding: 12px 14px;
	border: 1px solid rgba(174,178,184,.35);
	border-radius: 8px;
	font: inherit;
	color: var(--primary);
	outline: none;
	transition: border-color .2s ease, box-shadow .2s ease;
}
.form-field input:focus,
.form-field textarea:focus {
	border-color: var(--accent);
	box-shadow: 0 0 0 4px rgba(218,134,82,.12);
}
.contact-info {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 20px;
	width: 100%;
}
.contact-info li {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px;
	border: 1px solid rgba(174,178,184,.25);
	border-radius: 12px;
	background: var(--background);
	transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.contact-info li:hover {
	border-color: var(--accent);
	box-shadow: 0 8px 24px rgba(218,134,82,.15);
	transform: translateY(-2px);
}
.contact-info img { 
	width: 32px; 
	height: 32px; 
	flex-shrink: 0;
}
.contact-info span {
	color: var(--secondary);
	font-size: 1rem;
}
.contact-info span[data-i18n="contact.phone"] {
	direction: ltr;
	unicode-bidi: embed;
}

/* Footer */
.site-footer {
	background: var(--primary);
	color: var(--background);
	padding: 22px 0;
}
.footer-grid {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
}
.footer-links {
	list-style: none;
	display: flex;
	gap: 14px;
	padding: 0;
	margin: 0;
}
.footer-link { color: var(--background); opacity: .9; }
.footer-link:hover { 
	color: var(--accent);
	text-decoration: underline; 
	opacity: 1; 
}
.social {
	list-style: none;
	display: flex;
	gap: 14px;
	padding: 0;
	margin: 0;
}
.social img { width: 22px; height: 22px; filter: brightness(0) invert(1); }

/* Desktop - zoom out hero background */
@media (min-width: 901px) {
	.hero {
		background-size: 105%;
		padding: 220px 0;
	}
}

/* Responsive */
@media (max-width: 900px) {
	.hero-grid { grid-template-columns: 1fr; }
	.card-row { grid-template-columns: 1fr 1fr; }
	.services-grid { grid-template-columns: 1fr 1fr; }
	.contact-grid { grid-template-columns: 1fr; }
	.contact-info { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
	/* Mobile: use flex to ensure logo and hamburger swap sides with dir */
	.nav {
		display: flex !important;
		align-items: center;
		gap: 60px;
		padding: 8px 0;
	}
	.nav-toggle { order: 1; }
	/* Keep nav links following the toggle; push lang + brand toward the far edge */
	.lang-switch {
		order: 2;
		margin: 0;
		margin-inline-start: auto;
	}
	.brand {
		order: 3;
		margin-inline-start: 12px;
	}
	.logo {
		width: 100px;
	}

	.nav-toggle { display: inline-block; }
	.nav-links {
		position: absolute;
		inset: 52px 0 auto 0;
		background: var(--background);
		border-top: 1px solid rgba(174,178,184,.25);
		display: grid;
		gap: 0;
		transform-origin: top;
		transform: scaleY(0);
		opacity: 0;
		pointer-events: none;
		transition: transform .18s ease, opacity .18s ease;
		padding: 8px 20px 14px;
	}
	.nav-links.open {
		transform: scaleY(1);
		opacity: 1;
		pointer-events: auto;
	}
	.nav-links li { padding: 10px 0; }

	/* RTL: have the menu drop from the right edge instead of left */
	[dir="rtl"] .nav-links {
		inset: 52px auto auto 0;
		right: 0;
		left: auto;
		transform-origin: top right;
		text-align: right;
	}
}

/* Desktop: Reverse nav for EN (LTR) and RTL */
@media (min-width: 721px) {
	[dir="ltr"] .nav {
		direction: ltr;
		grid-template-columns: auto auto auto 1fr;
		grid-template-areas: "brand toggle lang links";
		column-gap: 24px;
	}
	[dir="ltr"] .brand { 
		grid-area: brand;
		justify-self: start; 
		margin-inline-start: 8px;
		margin-inline-end: 20px;
	}
	[dir="ltr"] .nav-links { 
		grid-area: links;
		justify-self: end;
		margin-inline-start: 20px;
	}
	[dir="ltr"] .lang-switch { 
		grid-area: lang;
		margin-right: 0; 
		margin-left: 20px;
	}
	[dir="ltr"] .nav-toggle {
		grid-area: toggle;
	}
	
	[dir="rtl"] .nav {
		direction: rtl;
		grid-template-columns: auto auto auto 1fr;
		grid-template-areas: "brand toggle lang links";
		column-gap: 24px;
	}
	[dir="rtl"] .brand { 
		grid-area: brand;
		justify-self: end; 
		margin-inline-start: 20px;
		margin-inline-end: 8px;
	}
	[dir="rtl"] .nav-links { 
		grid-area: links;
		justify-self: end;
		margin-inline-end: 20px;
		flex-direction: row-reverse;
	}
	[dir="rtl"] .lang-switch { 
		grid-area: lang;
		margin-right: 20px; 
		margin-left: 0;
	}
	[dir="rtl"] .nav-toggle {
		grid-area: toggle;
	}
}

/* RTL Support - for mobile and default */
@media (max-width: 720px) {
	[dir="rtl"] .nav {
		direction: rtl;
	}
}
[dir="rtl"] .nav-links li { text-align: right; }
[dir="rtl"] .section-header,
[dir="rtl"] .hero-copy { text-align: right; }
[dir="rtl"] .contact-info li { justify-content: space-between; }
[dir="rtl"] .contact-info li img { order: 2; }
[dir="rtl"] .contact-info li span { order: 1; }

@media (max-width: 720px) {
	/* Keep same alignment style for RTL as LTR per requirement 2b */
	[dir="rtl"] .nav-links { align-items: start; text-align: left; padding-left: 20px; padding-right: 20px; }
}

/* New sections for Aldhilal content */
.features-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.feature-item {
	border: 1px solid rgba(174,178,184,.25);
	border-radius: 12px;
	padding: 18px;
	background: var(--background);
	transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease;
}
.feature-item h3 {
	margin: 0 0 8px;
	color: var(--primary);
}
.feature-item p {
	margin: 0;
	color: #6B7A8F;
}
.feature-item:hover {
	border-color: var(--accent);
	box-shadow: 0 8px 24px rgba(218,134,82,.15);
	transform: translateY(-2px);
}
.bullets-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 14px 20px;
	padding-left: 18px;
}
.bullets-grid li {
	margin-left: 0;
	color: #6B7A8F;
}
.stack-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
}
.stack-col h3 {
	margin: 0 0 8px;
	color: var(--primary);
}
.stack-col ul {
	margin: 0 0 14px;
	padding-left: 18px;
	color: #6B7A8F;
}
/* Partners Scrolling Animation */
.partners-scroll-container {
	width: 100%;
	overflow: hidden;
	mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
	-webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
	direction: ltr;
}
[dir="rtl"] .partners-scroll-container {
	direction: ltr;
}
.partners-scroll {
	display: flex;
	gap: 60px;
	align-items: center;
	animation: scroll-partners 30s linear infinite;
	width: max-content;
	will-change: transform;
	direction: ltr;
	position: relative;
}
[dir="rtl"] .partners-scroll {
	direction: ltr;
	transform-origin: left center;
}
.partners-scroll img {
	width: 140px;
	height: auto;
	filter: grayscale(100%) contrast(1.1);
	opacity: .9;
	flex-shrink: 0;
	transition: filter .3s ease, opacity .3s ease;
}
.partners-scroll img.partner-logo-small {
	width: 100px;
}
.partners-scroll img:hover {
	filter: none;
	opacity: 1;
}
@keyframes scroll-partners {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

@media (max-width: 900px) {
	.features-grid { grid-template-columns: 1fr 1fr; }
	.bullets-grid { grid-template-columns: 1fr 1fr; }
	.stack-grid { grid-template-columns: 1fr 1fr; }
	.partners-scroll {
		gap: 40px;
		animation-duration: 25s;
	}
	.partners-scroll img {
		width: 120px;
	}
	.partners-scroll img.partner-logo-small {
		width: 90px;
	}
}
@media (max-width: 600px) {
	.features-grid,
	.bullets-grid,
	.stack-grid { grid-template-columns: 1fr; }
	.partners-scroll {
		gap: 30px;
		animation-duration: 20s;
	}
	.partners-scroll img {
		width: 100px;
	}
	.partners-scroll img.partner-logo-small {
		width: 80px;
	}
}
