/* Prevent horizontal shift / overflow on mobile & RTL */
html {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

main,
.site-header,
.site-header .container,
.container {
  max-width: 100%;
}

/* Hero & swiper must not exceed viewport */
.hero-section,
.hero-swiper,
.hero-swiper .swiper-wrapper,
.hero-swiper .swiper-slide {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.hero-slide {
  max-width: 100vw;
  background-size: cover !important;
}

/* Logo responsive */
.site-logo {
  max-height: 52px;
  width: auto;
  max-width: min(220px, 55vw);
  object-fit: contain;
}

/* Header: logo at start (right in RTL), menu toggler at end (left in RTL) */
.site-header .navbar {
  justify-content: space-between;
  align-items: center;
}

.site-header .navbar-brand {
  flex-shrink: 0;
}

.site-header .navbar-toggler {
  flex-shrink: 0;
}

/* Mega menu must not blow out mobile width */
.mega-menu {
  max-width: calc(100vw - 2rem);
}

@media (max-width: 991.98px) {
  .mega-menu {
    min-width: 0 !important;
    width: 100%;
  }

  .site-header .navbar-collapse {
    padding-top: 1rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  html[dir="rtl"] .site-header .navbar-nav {
    text-align: right;
    width: 100%;
  }

  html[dir="ltr"] .site-header .navbar-nav {
    text-align: left;
    width: 100%;
  }

  .site-header .d-flex.gap-2 {
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.75rem;
  }

  html[dir="rtl"] .site-header .d-flex.gap-2 {
    justify-content: flex-start;
  }

  /* Hero text centered on small screens */
  .hero-content {
    text-align: center;
    padding-top: 120px;
    padding-bottom: 80px;
  }

  .hero-content .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-content .d-flex {
    justify-content: center !important;
    flex-wrap: wrap;
  }

  .section-padding {
    padding: 60px 0;
  }

  .section-title::after {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  html[dir="rtl"] .section-title::after {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  /* Disable ken burns on mobile (causes overflow) */
  .swiper-slide-active .hero-slide {
    animation: none !important;
  }

  /* Floating orb inside viewport in RTL */
  .hero-section::after {
    width: 200px;
    height: 200px;
    right: auto;
    left: -60px;
    opacity: 0.5;
  }

  html[dir="rtl"] .hero-section::after {
    left: auto;
    right: -60px;
  }

  .cta-section {
    padding: 2.5rem 1.25rem;
  }

  /* AOS horizontal animations cause overflow on small screens */
  [data-aos^="fade-left"],
  [data-aos^="fade-right"] {
    transform: none !important;
    opacity: 1 !important;
  }

  .floating-actions {
    left: 16px;
    right: auto;
    bottom: 16px;
  }

  html[dir="ltr"] .floating-actions {
    right: 16px;
    left: auto;
  }
}

/* Swiper pagination RTL */
html[dir="rtl"] .swiper-pagination {
  direction: rtl;
}

/* Nav underline logical */
.nav-link::after {
  left: auto;
  right: auto;
  inset-inline-start: 0;
}

/* Scroll progress RTL */
html[dir="rtl"] .scroll-progress {
  left: auto;
  right: 0;
  transform-origin: right;
}
