/* =========================================================
   1) الخطوط
   لتغيير الخط: غيّر رابط Google Fonts هنا،
   ثم غيّر أسماء الخطوط في المتغيرات بالأسفل. هذا كل شيء.
   ========================================================= */
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;700&family=IBM+Plex+Sans+Arabic:wght@400;500;700&display=swap");

/* =========================================================
   2) المتغيرات: الألوان والخطوط والمقاسات
   كل ألوان الموقع تأتي من هنا فقط.
   ========================================================= */
:root {
  /* الألوان الأساسية للشركة */
  --color-primary: #0e3b4f;        /* اللون الرئيسي: الترويسة الداكنة، الأزرار */
  --color-primary-dark: #082736;   /* درجة أغمق منه: خلفية الواجهة و"لماذا نحن" */
  --color-accent: #e0a526;         /* لون التمييز: زر الطلب والخطوط الصغيرة */
  --color-on-primary: #ffffff;     /* النص فوق اللون الرئيسي */
  --color-on-accent: #1b1405;      /* النص فوق لون التمييز */
  --color-whatsapp: #15803d;       /* زر واتساب: أخضر داكن قليلاً ليبقى النص الأبيض مقروءاً */

  /* النصوص والخلفيات */
  --color-text: #142530;
  --color-text-muted: #56656f;
  --color-bg: #ffffff;
  --color-bg-alt: #f1f5f6;
  --color-border: #dbe3e6;

  /* شفافية طبقة اللون فوق صور خلفيات الأقسام:
     كلما زادت النسبة اختفت الصورة أكثر وصار النص أوضح */
  --overlay-dark: 86%;    /* للأقسام الداكنة: الواجهة و"لماذا نحن" */
  --overlay-light: 90%;   /* للأقسام الفاتحة */
  --card-overlay: 88%;    /* أسفل بطاقات الخدمات حيث يقع النص */

  /* الخطوط */
  --font-latin: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
  --font-body: var(--font-latin);
  --font-heading: var(--font-body);   /* ضع هنا خطاً مختلفاً للعناوين إن أردت */
  --line-height: 1.65;

  /* المقاسات */
  --radius: 10px;
  --container: 1160px;
  --header-height: 4.5rem;
  --section-space: clamp(4rem, 9vw, 6.5rem);
}

/* الصفحة العربية تأخذ الخط العربي وتباعد أسطر أكبر */
html:lang(ar) {
  --font-body: var(--font-arabic);
  --line-height: 1.85;
}

/* =========================================================
   3) أساسيات
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-padding-top: var(--header-height);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.25; margin: 0; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.icon {
  width: 1.4rem;
  height: 1.4rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =========================================================
   4) الأزرار
   ========================================================= */
.btn {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-accent { background: var(--color-accent); color: var(--color-on-accent); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { border-color: currentColor; color: var(--color-on-primary); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }

/* =========================================================
   5) الأقسام: عناوين ومسافات مشتركة
   ========================================================= */
.section { padding-block: var(--section-space); }

.section-head { max-width: 40rem; margin-block-end: 3rem; }
.section-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-block-end: 0.75rem; }
.section-head p { font-size: 1.125rem; color: var(--color-text-muted); }

.section-cta { margin-block-start: 3rem; }

/* =========================================================
   5.5) صور خلفيات الأقسام
   ضع الصور في images/backgrounds بالأسماء التالية.
   إن لم توجد الصورة يظهر لون القسم العادي فقط.
   ========================================================= */
.has-bg {
  position: relative;
  isolation: isolate;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--color-bg) var(--overlay-light), transparent);
}
.bg-hero     { background-image: url("images/backgrounds/hero.jpg"); }
.bg-about    { background-image: url("images/backgrounds/about.jpg"); }
.bg-services { background-image: url("images/backgrounds/services.jpg"); }
.bg-why      { background-image: url("images/backgrounds/why.jpg"); }
.bg-partners { background-image: url("images/backgrounds/partners.jpg"); }
.bg-contact  { background-image: url("images/backgrounds/contact.jpg"); }

/* الأقسام الداكنة تأخذ طبقة داكنة */
.bg-hero::before,
.bg-why::before {
  background: color-mix(in srgb, var(--color-primary-dark) var(--overlay-dark), transparent);
}
/* الأقسام ذات الخلفية الرمادية تأخذ طبقة بلونها */
.bg-services::before,
.bg-contact::before {
  background: color-mix(in srgb, var(--color-bg-alt) var(--overlay-light), transparent);
}

/* =========================================================
   6) الترويسة
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-block-end: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-height);
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--color-primary);
  margin-inline-end: auto;
}
.logo { display: flex; flex-direction: column; line-height: 1.15; }
.logo-name { font-size: 1.25rem; }
.logo-sub { font-size: 0.8rem; font-weight: 500; color: var(--color-text-muted); }
.logo img { max-height: 2.75rem; width: auto; }

.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
  color: var(--color-text-muted);
  font-weight: 500;
}
.nav-links a:hover { color: var(--color-primary); background: var(--color-bg-alt); }

.header-tools { display: flex; align-items: center; gap: 0.5rem; }

/* ----- القائمة المنسدلة للغات ----- */
.lang-dropdown { position: relative; }

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
}
.lang-toggle:hover,
.lang-toggle[aria-expanded="true"] { border-color: var(--color-primary); color: var(--color-primary); }

.lang-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.5rem);
  min-width: 11rem;
  padding: 0.4rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(8, 39, 54, 0.14);
}
.lang-menu[hidden] { display: none; }

.lang-menu a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
}
.lang-menu a:hover { background: var(--color-bg-alt); }
.lang-menu a[aria-current="true"] { font-weight: 700; color: var(--color-primary); }
.lang-menu a[lang="ar"] { font-family: var(--font-arabic); }
.lang-menu a[lang="tr"],
.lang-menu a[lang="en"] { font-family: var(--font-latin); }

.flag {
  width: 1.5rem;
  height: 1rem;
  flex-shrink: 0;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* ----- زر القائمة على الجوال ----- */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.menu-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* أيقونة ☰ عند الإغلاق، و ✕ عند فتح القائمة */
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-menu { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 900px) {
  .menu-toggle { display: flex; }

  .site-nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--color-bg);
    border-block-end: 1px solid var(--color-border);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .nav-links { flex-direction: column; padding: 0.75rem 1.25rem 1.25rem; }
  .nav-links a { padding: 0.8rem 0.5rem; }
}

/* =========================================================
   7) الواجهة الرئيسية
   ========================================================= */
.hero {
  background-color: var(--color-primary-dark);
  color: var(--color-on-primary);
  overflow: hidden;
}

.hero-inner {
  display: grid;
  align-items: center;
  gap: 3rem;
  padding-block: clamp(4rem, 10vw, 7rem);
}

.hero h1 {
  font-size: clamp(2.1rem, 5.2vw, 3.6rem);
  font-weight: 700;
  max-width: 18ch;
  margin-block-end: 1.25rem;
}
html:lang(ar) .hero h1 { max-width: 22ch; line-height: 1.4; }

.hero-text p {
  font-size: 1.2rem;
  max-width: 36rem;
  opacity: 0.85;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block-start: 2.25rem; }

.hero-route { width: 100%; max-width: 440px; justify-self: center; }
.route-line {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2.5;
  stroke-dasharray: 2 10;
  stroke-linecap: round;
}
.route-line-2 { stroke: var(--color-on-primary); opacity: 0.35; }
.route-node { fill: var(--color-on-primary); }
.route-hub { fill: none; stroke: var(--color-accent); stroke-width: 2; }

/* نبض مستمر حول مركز التوريد: حلقتان تتسعان وتتلاشيان بالتناوب */
.route-pulse {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 2;
  transform-box: fill-box;
  transform-origin: center;
  animation: hub-pulse 2.4s ease-out infinite;
}
.route-pulse-2 { animation-delay: 1.2s; }

@keyframes hub-pulse {
  0%   { transform: scale(1);   opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

@media (min-width: 900px) {
  .hero-inner { grid-template-columns: 1.4fr 1fr; }
}
@media (max-width: 899px) {
  .hero-route { display: none; }
}

/* =========================================================
   8) من نحن
   ========================================================= */
.about-grid { display: grid; gap: 3rem; }
.about-grid p { color: var(--color-text-muted); font-size: 1.1rem; max-width: 38rem; }
.about-grid p + p { margin-block-start: 1rem; }

.facts { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 1.5rem; align-content: start; }
.facts div { border-inline-start: 3px solid var(--color-accent); padding-inline-start: 1.25rem; }
.facts dt { color: var(--color-text-muted); }
.facts dd { margin: 0; font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.facts dd.fact-note { font-size: 0.9rem; font-weight: 400; color: var(--color-text-muted); }

@media (min-width: 900px) {
  .about-grid { grid-template-columns: 1.6fr 1fr; gap: 5rem; }
}

/* =========================================================
   9) الخدمات: بطاقات بصورة خلفية
   صورة كل بطاقة في images/services (انظر اسم الملف في HTML)
   ========================================================= */
.services { background-color: var(--color-bg-alt); }

/* 8 بطاقات: عمود على الجوال، عمودان على الأجهزة اللوحية، أربعة على الحاسوب */
.service-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 600px) { .service-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .service-grid { grid-template-columns: repeat(4, 1fr); } }

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 320px;
  padding: 1.5rem;
  border-radius: 18px;
  overflow: hidden;
  color: var(--color-on-primary);
  background-color: var(--color-primary);
  background-image:
    linear-gradient(to top,
      color-mix(in srgb, var(--color-primary-dark) var(--card-overlay), transparent) 35%,
      color-mix(in srgb, var(--color-primary-dark) 25%, transparent)),
    var(--card-img);
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--color-primary-dark) 18%, transparent);
  transition: transform 0.25s, box-shadow 0.25s;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px color-mix(in srgb, var(--color-primary-dark) 28%, transparent);
}

.service-card .service-icon {
  position: absolute;
  top: 1.25rem;
  inset-inline-start: 1.25rem;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.55rem;
  border-radius: 12px;
  background: var(--color-accent);
  stroke: var(--color-on-accent);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.service-card h3 { font-size: 1.2rem; margin-block-end: 0.5rem; }
.service-card p { font-size: 0.97rem; opacity: 0.88; }

/* =========================================================
   10) لماذا نحن
   ========================================================= */
.why { background-color: var(--color-primary-dark); color: var(--color-on-primary); }
.why .section-head p { color: inherit; opacity: 0.8; }

.why-list { display: grid; gap: 2.5rem; }
.why-item { border-block-start: 3px solid var(--color-accent); padding-block-start: 1.25rem; }
.why-item h3 { font-size: 1.25rem; margin-block-end: 0.5rem; }
.why-item p { opacity: 0.8; }

@media (min-width: 640px) { .why-list { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .why-list { grid-template-columns: repeat(4, 1fr); } }

/* =========================================================
   11) شركاء النجاح
   ========================================================= */
.partner-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }

.partner > a,
.partner > div {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 7rem;
  padding: 1.25rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
}
.partner > a:hover { border-color: var(--color-primary); }

/* الشعار في الأعلى واسم الشركة تحته دائماً */
.partner > a,
.partner > div {
  flex-direction: column;
  gap: 0.85rem;
  text-align: center;
}
.partner img + .partner-name {
  font-size: 0.9rem;
  font-weight: 500;
}

/* الشعارات رمادية ثم تظهر بألوانها عند المرور عليها */
.partner img {
  max-height: 3.5rem;
  object-fit: contain;
}

.partner-name { font-weight: 700; font-size: 1rem; color: var(--color-text-muted); text-align: center; }

/* 8 شركاء: عمودان على الجوال والأجهزة اللوحية، أربعة على الحاسوب */
@media (min-width: 960px) { .partner-grid { grid-template-columns: repeat(4, 1fr); } }

/* =========================================================
   12) اتصل بنا
   ========================================================= */
.contact { background-color: var(--color-bg-alt); }

.contact-grid { display: grid; gap: 3rem; }

.contact-details { display: grid; gap: 1.25rem; margin-block-end: 2rem; }
.contact-details li { display: flex; gap: 1rem; align-items: flex-start; }
.contact-details .icon { color: var(--color-primary); margin-block-start: 0.2rem; }
.contact-details .label { display: block; font-size: 0.9rem; color: var(--color-text-muted); }
.contact-details a { font-weight: 500; text-decoration: none; color: var(--color-primary); }
.contact-details a:hover { text-decoration: underline; }
.contact-details li > div { flex: 1; min-width: 0; }
.contact-details a[dir="ltr"] { unicode-bidi: isolate; white-space: nowrap; }

.map {
  width: 100%;
  height: 260px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.contact-form {
  display: grid;
  gap: 1.25rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  align-content: start;
}

.field label { display: block; font-weight: 500; margin-block-end: 0.4rem; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}
html:lang(ar) .field input[dir="ltr"] { text-align: right; }
.field textarea { resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus { outline: 2px solid var(--color-primary); outline-offset: 0; border-color: var(--color-primary); }

.form-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.form-status { font-weight: 500; }
.form-status.is-success { color: #1d7a46; }
.form-status.is-error { color: #b3261e; }

@media (min-width: 640px) {
  .contact-form { grid-template-columns: 1fr 1fr; }
  .field-full { grid-column: 1 / -1; }
}
@media (min-width: 960px) {
  .contact-grid { grid-template-columns: 1fr 1.2fr; gap: 4rem; }
}

/* =========================================================
   13) التذييل
   ========================================================= */
.site-footer {
  background: var(--color-primary-dark);
  color: var(--color-on-primary);
  padding-block: 2rem;
  font-size: 0.95rem;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { text-decoration: none; opacity: 0.85; }
.footer-links a:hover { opacity: 1; text-decoration: underline; }
.footer-links { align-items: center; }
.social-icon { display: inline-flex; }
.social-icon .icon { width: 1.3rem; height: 1.3rem; }

/* =========================================================
   13.5) زر واتساب الثابت
   يظهر أسفل اليمين في التركية والإنجليزية، وأسفل اليسار في العربية
   ========================================================= */
.wa-float {
  position: fixed;
  z-index: 60;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  inset-inline-end: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.4rem 0.85rem 1.1rem;
  border-radius: 999px;
  background: var(--color-whatsapp);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
html[dir="rtl"] .wa-float { padding: 0.85rem 1.1rem 0.85rem 1.4rem; }
.wa-float:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  filter: brightness(1.08);
}
.wa-float-icon { width: 1.6rem; height: 1.6rem; fill: currentColor; flex-shrink: 0; }
.wa-float-short { display: none; }

/* على الشاشات الصغيرة يصبح الزر أقصر حتى لا يغطي المحتوى */
@media (max-width: 600px) {
  .wa-float { bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); inset-inline-end: 1rem; padding: 0.75rem 1.1rem; }
  .wa-float-long { display: none; }
  .wa-float-short { display: inline; }
}

/* مسافة أسفل التذييل حتى لا يغطي الزر روابطه */
.site-footer { padding-block-end: 5.5rem; }

/* =========================================================
   14) أقسام بارتفاع الشاشة + الالتصاق عند التمرير
   ========================================================= */
/* كل قسم يملأ الشاشة على الأقل، ويتوسطه المحتوى عمودياً.
   القسم الأطول من الشاشة يبقى بطوله الطبيعي. */
.hero,
.section {
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero > .container,
.section > .container { width: 100%; }

/* الالتصاق: يعمل على الشاشات الكبيرة فقط.
   على الجوال تكون الأقسام أطول بكثير من الشاشة،
   والالتصاق هناك يزعج القراءة بدل أن يساعدها. */
@media (min-width: 900px) and (min-height: 640px) {
  html { scroll-snap-type: y mandatory; }
  .hero,
  .section { scroll-snap-align: start; }
  .site-footer { scroll-snap-align: end; }
}

/* =========================================================
   15) ظهور المحتوى تدريجياً عند الوصول إليه
   (يضيفه main.js تلقائياً، ويتوقف لمن فعّل "تقليل الحركة")
   ========================================================= */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: var(--reveal-delay, 0s);
}
.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .route-pulse { animation: none; opacity: 0; }
  html { scroll-snap-type: none !important; }
}
