:root {
    /* Layout & Surface Elements */
    --nav-bg-scrolled: rgba(26, 36, 63, 0.55);
    --nav-shadow: rgba(26, 36, 63, 0.08);
    --nav-btn-hover-bg: rgba(72, 204, 149, 0.6);
    --body-bg: rgb(255, 255, 255);
    --section-bg-alt: #f8f8f8;
    --section-dark-bg: rgb(26, 36, 63);
    
    /* Panels & Overlays */
    --panel-gradient-top: rgba(153, 153, 153, 0.651);
    --panel-gradient-bottom: rgba(12, 37, 66, 0.678);
    --panel-border: rgb(69, 109, 65);
    --panel-shadow: rgba(2, 6, 23, 0.45);
    --overlay-gradient-top: rgba(255, 255, 255, 0.65);
    --overlay-gradient-bottom: rgba(0, 0, 0, 0.25);
    --overlay-dark: rgba(0, 0, 0, 0.55);
    
    /* Typography */
    --text-primary: rgb(0, 0, 0);
    --text-heading: rgb(26, 36, 63);
    --text-light: rgb(255, 255, 255);
    --text-light-muted: rgba(255, 255, 255, 0.95);
    --text-accent: rgb(255, 255, 255);
    
    /* Cards & Interaction Elements */
    --card-overlay-bg: rgba(0, 0, 0, 0.4);
    --card-overlay-hover-bg: rgba(0, 0, 0, 0.6);
    --card-shadow: rgba(26, 36, 63, 0.08);
    --list-item-bg: rgba(204, 169, 72, 0.1);
    --list-item-hover-bg: rgba(204, 169, 72, 0.2);
    --list-item-border: rgb(65, 134, 74);
    --list-item-shadow: rgba(204, 169, 72, 0.25);
    
    /* Controls & Utilities */
    --control-bg: rgb(64, 134, 75);
    --control-icon-color: rgba(26, 36, 63, 0.9);
    --control-shadow: rgba(26, 36, 63, 0.2);
    --dot-inactive-bg: rgba(26, 36, 63, 0.16);
    --dot-active-bg: rgb(59, 133, 75);
    --icon-brand-color: rgb(2, 58, 53);
    --icon-glow: rgba(255, 255, 255, 0.4);
    --box-shadow-low: rgba(0, 0, 0, 0.1);
}

html {
    scroll-behavior: smooth;
}
/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hamburger Menu Button */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--text-light);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Navigation link sizing and stroke */
nav a {
    color: var(--text-light);
    text-decoration: none;
    display: inline-block;
    padding: 25px 45px; /* much larger clickable area for bigger square */
    font-size: 22px;
    font-weight: bold;
    border-radius: 0px; /* no rounded corners */
    position: relative;
    overflow: hidden;
    transition: color 0.3s ease;
    margin: -5px; /* negative margin to close gaps between buttons */
}

nav a::before {
    content: "";
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--nav-btn-hover-bg);
    z-index: -1;
    transition: top 0.4s ease;
}

/* buttons hover color */
nav a:hover {
    color: var(--text-light);
    cursor: pointer;
}

nav a:hover::before {
    top: 0;
}

body {
    font-family: 'Cairo', sans-serif;
    scroll-behavior: smooth;
}

a {
    text-decoration: none;
    color: var(--text-primary);
}

/* Navbar */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between; /* changed to space-between for better mobile layout */
    padding: 8px 20px; /* reduced padding for mobile */
    background: transparent;
    transition: background-color 280ms ease, box-shadow 280ms ease, backdrop-filter 280ms ease, transform 300ms ease;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
        order: 2;
        margin-left: 15px;
    }

    nav ul {
        position: fixed;
        top: -100vh;
        left: 0;
        width: 100%;
        height: auto;
        background: var(--nav-bg-scrolled);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 70px 20px 15px;
        transition: top 0.3s ease;
        box-shadow: 0 4px 12px var(--box-shadow-low);
    }

    nav ul.active {
        top: 0;
    }

    nav {
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        height: 80px;
        z-index: 1001;
    }

    nav img {
        height: 60px;
        transform: translateY(0) scale(1.2);
        order: 1;
        margin: 0;
        margin-top: 10px;
    }

    nav.nav-scrolled img {
        transform: scale(1);
    }

    nav ul li {
        margin: 5px 0;
        text-align: center;
        padding-top: 50px;
    }

    nav ul li a {
        display: block;
        width: 100%;
        padding: 8px;
        font-size: 18px;
    }
}

/* Navbar state when the page is scrolled */
nav.nav-scrolled {
    background-color: var(--nav-bg-scrolled); /* semi-transparent light green */
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px var(--nav-shadow);
    animation: rollDown 320ms ease both;
}

/* When scrolled, shrink the logo smoothly to reduce nav height */
/* When scrolled, logo returns to its small visual size (nav stays fixed) */
nav.nav-scrolled img {
    transform: translateY(0) scale(1);
}

@keyframes rollDown {
    from {
        transform: translateY(-12px);
        opacity: 0.95;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
    margin: 0; /* reset margins; layout is controlled by flex and row-reverse */
}

nav ul li {
    cursor: pointer;
    font-weight: bold;
}

nav img {
    height: 100px; /* layout height stays small */
    display: block;
    /* expand downward when scaled so it doesn't get cropped at the top */
    transform-origin: right top;
    /* visually scale up without affecting layout; translate down a bit so it sits fully visible */
    transform: translateY(8px) scale(1.8);
    transition: transform 320ms cubic-bezier(.2,.9,.2,1), filter 300ms ease;
}

/* Adjust the origin automatically when the direction switches to LTR */
:root[dir="ltr"] nav img, 
body[dir="ltr"] nav img,
[dir="ltr"] nav img {
    transform-origin: left top;
}

/* Optional: intensify on hover */
nav img:hover {
    filter: drop-shadow(0 0 15px var(--icon-glow))
           drop-shadow(0 0 30px var(--icon-glow));
}

/* Sections */
section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    overflow: hidden;
}

@media (max-width: 768px) {
    section {
        padding: 60px 15px;
    }
    
    .services-grid {
        width: 90%;
        gap: 15px;
    }
    
    .service-card {
        width: 100%;
        max-width: 320px;
    }
}

/* Second section - full screen image */
#section2 {
  background-image: url('images/background.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  /* background-size: cover; /* preserve aspect ratio and scale with viewport */
  background-position: center center;
  background-attachment: scroll;
  width: 100%;
  height: 100vh; /* keep full viewport height so image scales with screen */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

#section2::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--overlay-gradient-top) 0%, var(--overlay-gradient-bottom) 60%);
  z-index: 0;
}

/* Intro panel on section2 */
.intro-panel {
  position: relative;
  z-index: 2;
  max-width: 920px;
  margin: 0 20px;
  padding: 28px 30px;
  background: linear-gradient(180deg, var(--panel-gradient-top), var(--panel-gradient-bottom));
  backdrop-filter: blur(6px) saturate(120%);
  border-radius: 12px;
  border-left: 6px solid var(--panel-border);
  box-shadow: 0 10px 30px var(--panel-shadow);
  text-align: start;
  color: var(--text-light-muted);
  animation: fadeUp 0.9s cubic-bezier(.2,.9,.2,1) both;
}

.intro-panel h1 {
  font-size: 30px;
  margin: 0 0 12px 0;
  color: var(--text-accent);
  line-height: 1.3;
}

.intro-panel p {
  font-size: 18px;
  margin: 0;
  line-height: 1.9;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .intro-panel { padding: 20px; }
  .intro-panel h1 { font-size: 22px; }
  .intro-panel p { font-size: 15px; }
}

/* Third section - خدماتنا */
/* Section padding reduced */
#section3 {
    background-color: var(--body-bg);
    padding: 40px 0px; /* less space on top and bottom */
    text-align: center;
}

h2 {
    color: var(--text-heading);
    font-size: 36px;
    margin-bottom: 30px;
}

/* Grid layout - staggered */
.services-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center; /* center items inside */
    gap: 20px;
    width: 70%; /* your reduced width */
    margin: 0 auto; /* center the container horizontally */
    align-items: stretch;
}

/* Each service card */
.service-card {
    position: relative;
    overflow: hidden;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.3s ease;
    width: 320px; /* fixed card width to mimic the previous 3-column grid */
}

.service-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    transition: transform 0.3s ease;
}

/* Info overlay */
.service-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-overlay-bg);
    color: var(--text-light);
    padding: 15px;
    text-align: center;
}

.service-info h3 {
    margin: 0 0 5px;
    font-size: 20px;
}

.service-info p {
    font-size: 14px;
    margin: 0;
}

/* Hover effect */
.service-card:hover img {
    transform: scale(1.1);
}

.service-card:hover .service-info {
    background: var(--card-overlay-hover-bg);
}

/* Responsive - keep fixed card size and enable horizontal scroll on small screens */
@media (max-width: 992px) {
  .service-card {
    flex: 0 0 320px;
    width: 320px; /* keep fixed width */
  }
}

@media (max-width: 768px) {
  /* Phone view: stack services vertically, one per row */
  .services-grid {
    overflow-x: visible; /* disable horizontal scrolling on phones */
    flex-wrap: wrap;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    justify-content: center;
  }

  .service-card {
    flex: 0 0 auto;
    width: min(320px, 92%); /* fixed visual size but never larger than viewport */
    max-width: 100%;
    margin: 0 auto;
    scroll-snap-align: none; /* disable snapping for vertical list */
  }
}

/* Fourth section - stats */
#section4 {
  position: relative;
  min-height: 60vh; /* match section6's baseline height */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  text-align: center;
  overflow: hidden;
  padding: 40px 20px; /* same vertical padding as section6 */
  background: url('images/background-section4.jpg') center/cover no-repeat;
}

#section4 h2 {
  color: var(--text-light);
}

#section4::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('images/background-section4.jpg') center/cover no-repeat;
  filter: blur(6px); /* 👈 This actually blurs only the image */
  transform: scale(1.1); /* avoids visible edges from blur */
  z-index: 0;
}

/* color overlay on top of blurred image */
#section4::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay-dark);
  opacity: 0.7;
  z-index: 1;
}

#section4 .overlay {
  display: none; /* Not needed now since we used ::before */
}

#section4 .content {
  position: relative;
  z-index: 2;
}

#section4 .stats {
  display: flex;
  gap: 10rem;
  justify-content: center;
  margin: 0; /* remove extra top margin so height aligns with padding */
  flex-wrap: wrap; /* ⬅ makes it responsive on small screens */
}

#section4 .stat {
  font-size: 1.5rem;
}

#section4 .counter {
  font-size: 3rem;
  font-weight: bold;
  display: block;
}

.stat-item {
    text-align: center;
}

.stat-item h3 {
    font-size: 36px;
    margin-bottom: 10px;
}

.stat-item p {
    font-size: 24px;
}

.fa-solid {
  font-size: 32px; /* make all solid icons larger */
}

/* Fifth section - معرض الصور (Carousel) */
#section5 {
  background-color: var(--section-bg-alt);
  padding: 60px 0;
  text-align: center;
}

/* Carousel styles */
.carousel {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 0;
  overflow: visible;
}

.carousel-viewport {
  overflow: hidden;
  perspective: 1000px;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: 40px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* 50% padding allows the first/last slides to hit the center! 🎯 */
  padding: 60px 50%; 
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.slide {
  flex: 0 0 280px;
  height: 460px;
  scroll-snap-align: center;
  border-radius: 12px;
  overflow: hidden;
  background: var(--body-bg);
  box-shadow: 0 6px 18px var(--card-shadow);
  position: relative;
  transition: transform 0.35s ease, opacity 0.35s ease;
  transform: scale(0.88);
  opacity: 0.55;
  cursor: pointer;
}

.slide.active-focus {
  transform: scale(1.18);
  opacity: 1;
  z-index: 5;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.slide.active-focus img {
  transform: scale(1.05);
}

.carousel-controls {
  position: absolute;
  top: 50%;
  width: 100%;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  pointer-events: none; /* Allows clicking through the empty middle space */
  z-index: 10;
  padding: 0 30px;
}

.carousel-prev, .carousel-next {
  pointer-events: auto; /* Buttons stay clickable */
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5); /* Semi-transparent dark */
  color: white;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px); /* Modern Glass Effect ✨ */
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.carousel-prev:hover, .carousel-next:hover {
  background: #c5a059; /* Gold accent color 🏆 */
  color: #000;
  transform: scale(1.1);
}

/* --- MOBILE OPTIMIZATION 📱 --- */
@media (max-width: 768px) {
  .carousel-track {
    gap: 20px;
    padding: 40px 15%; /* Less padding so user sees more on small screens */
  }

  .slide {
    flex: 0 0 75vw; 
    height: 400px;
  }

  .slide.active-focus {
    transform: scale(1.05); /* Smaller zoom for mobile safety */
  }

  .carousel-prev, .carousel-next {
    width: 40px;
    height: 40px;
  }
  
  .carousel-controls {
    padding: 0 15px;
  }
  /* Add an invisible spacer at the end of the track so the last item can center correctly 🪄 */
 /* Ghost spacers at both ends so first and last slides can glide right into the center 🌟 */
  .carousel-track::before,
  .carousel-track::after {
    content: "";
    flex: 0 0 35%; /* Gives them the perfect amount of runway to center up! */
    pointer-events: none;
  }
}

.lightbox {
  display: none; /* Hidden by default */
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  justify-content: center;
  align-items: center;
  cursor: zoom-out;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
}

/* Sixth Section - ما نقدمه */
#section6 {
  background-color: var(--section-dark-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-light);
  text-align: center;
  position: relative;
  overflow: visible;
  padding: 60px 20px;
}

#section6 h2 {
  font-size: 42px;
  margin-bottom: 60px;
  color: var(--text-accent);
  font-weight: bold;
}

/* Animated Services List */
.services-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

.service-item {
  display: flex;
  align-items: flex-start;
  gap: 25px;
  padding: 25px 30px;
  background: var(--list-item-bg);
  border-left: 5px solid var(--list-item-border);
  border-radius: 10px;
  transition: all 0.4s ease;
  opacity: 0;
  transform: translateX(-50px);
  animation: slideInLeft 0.6s ease forwards;
  cursor: pointer;
}

.service-item:nth-child(1) { animation-delay: 0.1s; }
.service-item:nth-child(2) { animation-delay: 0.2s; }
.service-item:nth-child(3) { animation-delay: 0.3s; }
.service-item:nth-child(4) { animation-delay: 0.4s; }
.service-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.service-item:hover {
  background: var(--list-item-hover-bg);
  border-left-color: var(--list-item-border);
  transform: translateX(15px);
  box-shadow: 0 8px 25px var(--list-item-shadow);
}

.service-icon {
  width: 60px;
  height: 60px;
  min-width: 60px;
  background: linear-gradient(135deg, var(--control-bg), var(--list-item-border));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: bold;
  transition: transform 0.3s ease, background 0.3s ease;
}

.service-item:hover .service-icon {
  transform: scale(1.15) rotate(10deg);
  background: linear-gradient(135deg, var(--list-item-border), var(--control-bg));
}

.service-content {
  text-align: start;
  flex: 1;
}

.service-content h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--text-accent);
  font-weight: bold;
}

.service-content p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-light-muted);
}

/* Responsive */
@media (max-width: 768px) {
  #section6 h2 {
    font-size: 32px;
    margin-bottom: 40px;
  }

  .services-list {
    gap: 15px;
    max-width: 100%;
  }

  .service-item {
    padding: 20px 20px;
    border-left: 4px solid var(--list-item-border);
    gap: 15px;
  }

  .service-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    font-size: 24px;
  }

  .service-content h3 {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .service-content p {
    font-size: 14px;
    line-height: 1.6;
  }
}

#section7 {
    background-color: var(--body-bg);
    color: var(--text-primary);
    padding: 60px 40px;
    text-align: center;
}

#section7 h2 {
    font-size: 36px;
    margin-bottom: 40px;
}

.contact-info {
    display: flex;
    justify-content: space-around; /* spread items evenly across the width */
    gap: 200px; /* more space between each item */
    flex-wrap: wrap;
    margin-bottom: 50px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 18px;
}

.info-item i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--icon-brand-color);
}

.map-container iframe {
    border-radius: 15px;
    max-width: 1200px; /* wider map */
    width: 100%;
    height: 400px; /* taller map */
}

/* Responsive adjustments */
@media (max-width: 992px) {
  .contact-info {
    gap: 50px; /* smaller gap for medium screens */
  }
}

@media (max-width: 768px) {
  .contact-info {
    flex-direction: column;
    gap: 30px; /* stacked items on small screens */
  }
  
  .map-container iframe {
    height: 300px;
  }
}

/* Responsive - remove separators on small screens */
@media (max-width: 768px) {
  #section6 {
    padding: 60px 15px;
  }

  .why-grid {
    flex-direction: column;
    gap: 40px;
    width: 100%;
    max-width: 100%;
  }

  .why-item {
    max-width: 100%;
    padding: 0 15px;
  }

  .why-item p {
    font-size: 14px;
    line-height: 1.5;
  }

  .separator {
    display: none;
  }
}

/* Responsive adjustments */
@media (max-width: 992px) {
  #section2 {
    background-size: cover;
  }

  .client-card {
    width: 300px;
    height: 200px;
  }
}

@media (max-width: 768px) {
  .client-card {
    width: calc(50% - 20px);
    height: 180px;
  }
}

@media (max-width: 480px) {
  .client-card {
    width: 100%;
    height: 160px;
  }
}

/* Responsive */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 20px;
    }

    /* reduce sizes on small screens so header doesn't dominate */
    nav img {
        height: 70px;
    }

    nav a {
        font-size: 20px;
        padding: 6px 10px;
    }

    .services-table {
        flex-direction: column;
        align-items: center;
    }

    #section4 {
        flex-direction: column;
    }
}