/* ══════════════════════════════════════════════════════════════
   HORIZONTAL SCROLLBAR FIX - COMPREHENSIVE SOLUTION
   Prevents horizontal scrolling on all devices
   ══════════════════════════════════════════════════════════════ */

/* ── ROOT LEVEL OVERFLOW PREVENTION ──────────────────────────── */
html {
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

/* ── ALL CONTAINERS ──────────────────────────────────────────── */
.hero-wrap,
.sec,
.sec-about,
.sec-services,
.sec-cases,
.sec-partners,
.sec-clients,
.sec-tech,
.sec-stats,
.sec-testimonials,
.sec-why,
.sec-faq,
.footer {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

.container {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* ── PROJECTS SECTION SPECIFIC ──────────────────────────────── */
.sec-cases {
  overflow-x: hidden !important;
  width: 100%;
  max-width: 100vw;
}

.cases-stage {
  overflow: hidden !important;
  max-width: 100%;
  position: relative;
}

.cases-nav {
  overflow: hidden;
  max-width: 100%;
}

/* ── MOBILE RESPONSIVE FIXES ──────────────────────────────────── */
@media (max-width: 920px) {
  /* Ensure no element exceeds viewport width */
  * {
    max-width: 100vw;
  }
  
  /* Allow only vertical scrolling */
  html,
  body {
    overflow-x: hidden !important;
    overflow-y: auto;
  }
  
  /* Fix wide containers */
  .hero-wrap,
  .sec,
  section {
    padding-left: clamp(12px, 4vw, 24px);
    padding-right: clamp(12px, 4vw, 24px);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
}

@media (max-width: 768px) {
  .sec-cases {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  .cases-stage {
    width: 100%;
    max-width: calc(100vw - 32px);
    margin: 0 auto;
  }
  
  /* Adjust card positioning to prevent overflow */
  .case-card.pos-left {
    left: 25%;
  }
  
  .case-card.pos-right {
    left: 75%;
  }
  
  .case-card.pos-center {
    left: 50%;
    max-width: min(340px, calc(100vw - 60px));
  }
}

@media (max-width: 480px) {
  .sec-cases {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  
  .cases-stage {
    max-width: calc(100vw - 24px);
    padding: 0 5px;
  }
  
  .case-card.pos-center {
    max-width: min(290px, calc(100vw - 40px));
  }
  
  .case-card.pos-left {
    left: 20%;
  }
  
  .case-card.pos-right {
    left: 80%;
  }
  
  /* Hide far cards completely on mobile */
  .case-card.pos-far-left,
  .case-card.pos-far-right {
    opacity: 0 !important;
    pointer-events: none !important;
    display: none !important;
  }
}

@media (max-width: 360px) {
  .sec-cases {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  
  .cases-stage {
    max-width: calc(100vw - 16px);
  }
  
  .case-card.pos-center {
    max-width: calc(100vw - 32px);
    width: 92vw;
  }
  
  .case-pill {
    font-size: 9px;
    padding: 4px 8px;
  }
}

/* ── PREVENT SPECIFIC ELEMENTS FROM OVERFLOWING ──────────────── */

/* Images */
img {
  max-width: 100%;
  height: auto;
}

/* Tables */
table {
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* Pre and Code blocks */
pre,
code {
  max-width: 100%;
  overflow-x: auto;
}

/* Iframes and embeds */
iframe,
embed,
object {
  max-width: 100%;
}

/* ── SCROLLBAR STYLING (OPTIONAL) ──────────────────────────── */
/* Hide scrollbar for Chrome, Safari and Opera */
.cases-pills::-webkit-scrollbar,
.cases-stage::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.cases-pills,
.cases-stage {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ── BOX SIZING FIX ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ── DEBUGGING (Remove in production) ──────────────────────────── */
/* Uncomment to see which elements are causing overflow */
/*
* {
  outline: 1px solid rgba(255, 0, 0, 0.1) !important;
}
*/
