/* =============================
   Responsive, RTL-friendly CSS
   ============================= */

/* Base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; /* ensure no default margins */
  font-family: 'Tajawal', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  overflow-x: hidden;
}

:root{
  /* Colors */
  --gold:#d4af37;
  --orange:#ff8800;
  --orange-deep:#e77200;
  --text:#222;
  --muted:#6b7280;
  --card-bg:#ffffff;
  --bg:#f6f7fb;
  --shadow:0 10px 30px rgba(0,0,0,.08);

  /* Layout tokens */
  --container-max: 1100px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 14px;
  --space-4: 18px;
  --space-5: 22px;
  --space-6: 26px;

  /* Fluid type scale */
  --fs-xs: clamp(12px, 1.4vw, 14px);
  --fs-sm: clamp(14px, 1.6vw, 16px);
  --fs-md: clamp(15px, 1.8vw, 18px);
  --fs-lg: clamp(18px, 2.5vw, 22px);
  --fs-xl: clamp(26px, 3.2vw, 42px);
}

/* Respect document direction via logical properties */
html { direction: rtl; } /* set to 'ltr' for LTR sites */

/* Media helpers */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Images/videos shrink properly */
img, svg, video { max-width: 100%; height: auto; }

/* ============ Animated Global Background ============ */
.bg-gradient{
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  background:
    radial-gradient(120vmax 80vmax at 10% 10%, rgba(255,205,160,.35), transparent 60%),
    radial-gradient(120vmax 80vmax at 80% 20%, rgba(255,170,80,.35), transparent 60%),
    radial-gradient(140vmax 120vmax at 50% 100%, rgba(212,175,55,.25), transparent 60%),
    linear-gradient(180deg, #fff7ec 0%, #fff0e1 35%, #ffe9d4 100%);
  animation: floatGradient 18s ease-in-out infinite alternate;
  filter: saturate(110%);
}
@keyframes floatGradient{ 0%{ transform: translateY(-2%); } 100%{ transform: translateY(2%); } }

/* ================= Header ================= */
.header{
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(6px);
  background: color-mix(in oklab, white 65%, transparent);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.header .brand{
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
}
.logo{ block-size: 40px; inline-size:auto; }
.brand-text{ font-weight: 800; color: var(--text); font-size: var(--fs-lg); }

.nav{
  display: flex; align-items: center; flex-wrap: wrap;
  gap: clamp(8px, 4vw, 20px); /* replaces hard-coded 250px */
  padding: 0 var(--space-4) var(--space-3);
}
.nav-link{
  text-decoration: none; color: var(--text); font-weight: 600;
  padding: 8px 12px; border-radius: 10px; font-size: var(--fs-sm);
}
.nav-link:hover{ background: rgba(0,0,0,.06); }

.lang-btn{
  border: 1px solid rgba(0,0,0,.08);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--fs-sm);
}

/* Small screens: stack brand and nav nicely */
@media (max-width: 640px){
  .header .brand{ justify-content: space-between; padding-inline: var(--space-4); }
  .nav{ padding-inline: var(--space-4); gap: 8px; }
}

/* ================= Hero ================= */
.hero{
  position: relative;
  min-block-size: 78dvh; /* more reliable than vh on mobile */
  display: grid; place-items: center; text-align: center; overflow: hidden;
  padding-inline: var(--space-4);
}
.hero-overlay{
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,136,0,.10), rgba(212,175,55,.12));
  z-index: -1; transform: translateZ(0);
}
.hero-content{ padding: 40px 20px; max-inline-size: 850px; margin-inline: auto; }
.hero h1{ font-size: var(--fs-xl); line-height: 1.2; letter-spacing: .2px; margin-block-end: 12px; }
.hero-sub{ color: var(--muted); margin-block-end: 20px; font-size: var(--fs-md); }
.hero-cta{ display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ================= Buttons ================= */
.btn{
  display: inline-block; text-decoration: none;
  padding: 10px 18px; border-radius: 12px; font-weight: 700;
  border: 2px solid transparent; transition: .25s ease;
}
.btn.primary{ background: var(--orange); color: #fff; }
.btn.primary:hover{ background: var(--orange-deep); transform: translateY(-1px); }
.btn.outline{ background: transparent; border-color: var(--orange); color: var(--orange); }
.btn.outline:hover{ background: var(--orange); color:#fff; transform: translateY(-1px); }

/* =========== Container + Cards =========== */
.container{
  max-inline-size: var(--container-max);
  margin: 40px auto 80px;
  padding-inline: var(--space-4);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* auto-fit for responsiveness */
  gap: 22px;
}
.card{
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-6) var(--space-5);
}
.card-title{
  color: var(--orange);
  font-size: 1.35rem; /* slightly smaller for small screens */
  margin-block-end: 10px; font-weight: 800;
}
.card-text{ color: #374151; font-size: 1.05rem; }

.features{ list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.features li{
  padding: 12px 14px; background: #fff8f0; border: 1px solid #ffe2c7; border-radius: var(--radius-md); font-weight: 600;
}

/* ============== Tracking ============== */
.track-box{ display: flex; gap: 10px; align-items: center; margin: 8px 0 6px; flex-wrap: wrap; }
.input{
  flex: 1 1 240px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(0,0,0,.12); background: #fff; outline: none; font-size: var(--fs-sm);
}
.input:focus{ border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,136,0,.15); }
.muted{ color: var(--muted); font-size: .95rem; margin-top: 6px; }

/* ============== Contact ============== */
.contact-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; }
.contact-item{
  background: #fafafa; border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-md);
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700;
}
.contact-item a{ color: var(--orange-deep); text-decoration: none; }
.social{ display: flex; gap: 10px; flex-wrap: wrap; }
.social a{
  background: #fff; border: 1px solid rgba(0,0,0,.08); padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--text);
}
.social a:hover{ background: var(--orange); color:#fff; border-color: transparent; }

/* ============== Footer ============== */
.footer{ text-align: center; padding: 24px 10px 40px; color: var(--muted); }

/* ============== WhatsApp FAB ============== */
.whatsapp-fab{
  position: fixed;
  /* logical insets + safe-areas for iOS */
  inset-block-end: max(18px, env(safe-area-inset-bottom));
  inset-inline-end: max(16px, env(safe-area-inset-right));
  inline-size: 54px; block-size: 54px;
  border-radius: 999px; background: #25D366; color: #fff;
  display: grid; place-items: center; text-decoration: none; font-size: 24px;
  box-shadow: 0 10px 30px rgba(37,211,102,.45); z-index: 120;
}

/* ================== Responsive Tweaks ================== */

/* Tighten spacing on very small devices */
@media (max-width: 380px){
  .btn{ padding: 8px 14px; }
  .card{ padding: 18px; }
  .features li{ padding: 10px 12px; }
}

/* Tablet+ layout adjustments */
@media (min-width: 900px){
  /* Allow featured sections to span full width when needed */
  #mission, #tracking{ grid-column: 1 / -1; }
}

/* Large desktop: widen readable measure but keep max */
@media (min-width: 1200px){
  .container{ gap: 26px; }
  .card-title{ font-size: 1.6rem; }
}

/* Hover optimizations for devices that support it */
@media (hover: hover) and (pointer: fine){
  .nav-link:hover{ background: rgba(0,0,0,.06); }
  .btn.primary:hover{ transform: translateY(-1px); }
  .btn.outline:hover{ transform: translateY(-1px); }
}
/* === Equal-height + Centered grids (overrides) === */

/* شبكة الكروت العامة */
.container{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  justify-content: center;   /* توسيط الأعمدة */
  align-items: stretch;       /* تساوي الارتفاع داخل الصف */
}

/* بطاقة الكرت */
.card{
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* شبكة قسم التواصل */
.contact-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
  justify-content: center;   /* توسيط آخر صف */
  align-items: stretch;       /* تساوي الارتفاع داخل الصف */
}

/* عنصر كرت التواصل */
.contact-item{
  height: 100%;
}
/* اختياري */
.card, .contact-item { min-height: 220px; } /* عدّل الرقم حسب المحتوى */
/* ===== Sticky header: hide on scroll down, show on scroll up ===== */
.header{
  transition: transform .35s ease, opacity .35s ease, background-color .3s ease, border-color .3s ease;
  will-change: transform, opacity;
}

/* تصغير الخلفية والظل بعد أول تمرير بسيط (اختياري لتحسين القراءة) */
.header--compact{
  background: color-mix(in oklab, white 80%, transparent);
  border-bottom-color: rgba(0,0,0,.08);
  box-shadow: 0 6px 20px rgba(0,0,0,.06);
}

/* إخفاء الشريط لأعلى مع تلاشي خفيف */
.header--hidden{
  transform: translateY(-100%);
  opacity: 0;
}

/* احترام تفضيل تقليل الحركة */
@media (prefers-reduced-motion: reduce){
  .header{ transition: none; }
  .header--hidden{ transform: none; opacity: 1; } /* لا نخفيه عند تقليل الحركة */
}
/* ===== Top bar centered + bigger logo (safe overrides) ===== */

/* نجعل الهيدر عمودياً ويُوسّط كل العناصر داخله */
.header{
  display: flex;
  flex-direction: column;   /* سطر للبراند وسطر للتنقّل */
  align-items: center;      /* توسيط أفقي لكل شيء */
  gap: 8px;                 /* مسافة بسيطة بين البراند والقائمة */
}

/* البراند (الشعار + النص) في المنتصف تماماً */
.header .brand{
  width: 100%;
  display: flex;
  justify-content: center;  /* توسيط عناصر البراند */
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
}

/* تكبير اللوجو بسلاسة مع الحفاظ على الاستجابة */
.logo{
  block-size: clamp(300px, 36dvh, 67px); /* كان 40px */
  inline-size: auto;
}

/* تكبير بسيط لاسم البراند */
.brand-text{
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 800;
}

/* توسيط روابط التنقل أفقياً */
.nav{
  width: 100%;
  display: flex;
  justify-content: center;  /* توسيط القائمة */
  align-items: center;
  gap: clamp(10px, 3vw, 22px);
  padding: 0 var(--space-4) var(--space-3);
}

/* شاشات صغيرة: نُبقي كل شيء في المنتصف أيضاً */
@media (max-width: 640px){
  .header .brand{ justify-content: center; padding-inline: var(--space-4); }
  .nav{ justify-content: center; padding-inline: var(--space-4); }
}


/* Hero logo sizing */
.hero .logo{inline-size: clamp(300px, 14vw, 160px);block-size: auto;filter: drop-shadow(0 6px 16px rgba(0,0,0,.10));}

/* Center nav items */
.nav{ justify-content: center; }
/* === Equal-height + Centered grids (overrides) === */

/* شبكة الكروت العامة */
.container{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
  justify-content: center;   /* توسيط الأعمدة */
  align-items: stretch;       /* تساوي الارتفاع داخل الصف */
}

/* بطاقة الكرت */
.card{
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* شبكة قسم التواصل */
.contact-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 320px));
  justify-content: center;   /* توسيط آخر صف */
  align-items: stretch;       /* تساوي الارتفاع داخل الصف */
}

/* عنصر كرت التواصل */
.contact-item{
  height: 100%;
}
/* اختياري */
.card, .contact-item { min-height: 220px; } /* عدّل الرقم حسب المحتوى */
/* Firefox fallback: تكبير بالمقياس */
html[data-zoom="150"] body{
  transform: scale(1.5);
  transform-origin: top center;
  width: calc(100% / 1.5);   /* يمنع ظهور سكرول أفقي */
}

/* لا نطبّق التكبير على الشاشات الصغيرة */
@media (max-width: 820px){
  html[data-zoom="150"] body{
    transform: none !important;
    width: auto !important;
  }
}
