/* Global responsive layer for all pages */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  overflow-x: clip;
}

/* Lenis smooth scrolling integration for all pages */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

img,
video {
  max-width: 100%;
  height: auto;
}

/* Canonical footer layout (agencies.html as reference) */
footer.container,
.site-footer {
  position: relative;
  width: 100%;
  max-width: 100% !important;
  margin-top: 0 !important;
  padding-top: 18px !important;
  padding-bottom: 16px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  background:
    radial-gradient(
      ellipse 62% 44px at 50% 100%,
      rgba(77, 171, 247, 0.1) 0%,
      rgba(77, 171, 247, 0.045) 38%,
      rgba(77, 171, 247, 0.012) 60%,
      rgba(77, 171, 247, 0) 82%
    ),
    #050505;
  z-index: 2;
}

footer.container::before,
.site-footer::before {
  content: none !important;
}

.site-footer > .container {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

/* Fixed footer mechanism for pages embedding footer inside sections */
.footer-unified-shell {
  position: relative;
  width: 100%;
  max-width: 100% !important;
  margin-top: 0 !important;
  padding: 18px 0 16px !important;
  background:
    radial-gradient(
      ellipse 62% 44px at 50% 100%,
      rgba(77, 171, 247, 0.1) 0%,
      rgba(77, 171, 247, 0.045) 38%,
      rgba(77, 171, 247, 0.012) 60%,
      rgba(77, 171, 247, 0) 82%
    ),
    #050505;
  z-index: 2;
}

.footer-unified-shell .main-footer {
  max-width: 1320px;
  margin: 0 auto !important;
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

.main-footer [style*="transform"] {
  transform: none !important;
}

.main-footer {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  max-width: 1320px;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-top: 0.35rem !important;
  padding-bottom: 0.35rem !important;
}

/* Large desktops */
@media (min-width: 1600px) {
  .container,
  .container-fluid {
    max-width: 1400px;
  }
}

/* Tablet and below */
@media (max-width: 1199.98px) {
  .menu-overlay {
    max-width: 86%;
  }

  .hero-title {
    font-size: clamp(2.2rem, 8vw, 4.8rem);
    line-height: 1.2;
  }

  .page > section.hero #video-bg {
    object-position: center 26% !important;
    transform: rotate(180deg) scale(1.02) !important;
    transform-origin: center center;
  }
}

@media (max-width: 991.98px) {
  /* Cancel forced section heights from legacy styles */
  section {
    min-height: auto !important;
    height: auto !important;
  }

  .hamburger-btn {
    width: 52px;
    height: 52px;
    top: 16px;
    right: 16px;
  }


  /* Index page critical fixes */
  .page > section.hero {
    min-height: 60vh !important;
    height: 60vh !important;
    border-bottom-right-radius: 9vw !important;
  }

  .page > section.hero .video-wrap,
  .page > section.hero .gradient-overlay {
    border-bottom-right-radius: 9vw !important;
  }

  .page > section.hero .content {
    margin-bottom: 0 !important;
    padding: 0 1rem;
  }

  .page > section.hero #video-bg {
    object-position: center 24% !important;
    height: 114% !important;
    top: -7% !important;
    transform: rotate(180deg) scale(1.04) !important;
  }

  .page > section.franchise-custom {
    margin-top: 0 !important;
    padding-top: 3.25rem !important;
    padding-bottom: 3rem !important;
    min-height: auto !important;
  }

  .page > section.franchise-custom .container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .page > section.franchise-custom .row {
    row-gap: 1.4rem;
  }

  .page > section.franchise-custom .col-lg-8,
  .page > section.franchise-custom .col-lg-7,
  .page > section.franchise-custom .col-lg-5 {
    transform: none !important;
    text-align: right !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  .page > section.franchise-custom .position-relative.p-3 {
    padding: 0.65rem !important;
    border-radius: 14px !important;
  }

  .page > section.franchise-custom .position-relative.p-3 img {
    width: min(62vw, 280px) !important;
    transform: scale(1) !important;
  }

  /* Hide only decorative absolute layer of the first section after hero */
  .page > section.franchise-custom:nth-of-type(2) .position-absolute.h-100.w-100,
  .page > section.franchise-custom:nth-of-type(2) .position-absolute.w-100.h-100 {
    display: none !important;
  }

  /* Keep the second section background image visible on mobile */
  .page > section.franchise-custom:nth-of-type(3) .position-absolute.h-100.w-100 {
    display: block !important;
    opacity: 0.18 !important;
  }

  .page > section.franchise-custom:nth-of-type(3) .position-absolute.h-100.w-100 img {
    height: 58% !important;
    width: auto !important;
    bottom: 0 !important;
    left: 0 !important;
  }

  .featured-agencies .slider-section-container {
    padding: 0 14px 54px !important;
  }

  .featured-agencies .swiper {
    padding: 18px 0 52px !important;
  }

  .featured-agencies .swiper-slide,
  .featured-agencies .swiper-slide-active {
    transform: none !important;
  }

  .consultation-card {
    padding: 1.45rem !important;
    border-radius: 16px !important;
  }
}

/* Mobile */
@media (max-width: 767.98px) {
  .menu-overlay {
    width: 78%;
  }

  .menu-logo {
    max-width: 160px !important;
  }

  .menu-nav .menu-link {
    font-size: 0.95rem;
    padding: 0.62rem 0.75rem;
  }

  /* Hamburger icon centering on mobile */
  .hamburger-btn {
    width: 52px !important;
    height: 52px !important;
  }

  .hamburger-btn .bar {
    left: 11px !important;
    width: 30px !important;
  }

  .hamburger-btn .bar:nth-child(1) {
    top: 16px !important;
  }

  .hamburger-btn .bar:nth-child(2) {
    top: 25px !important;
  }

  .hamburger-btn .bar:nth-child(3) {
    top: 34px !important;
  }

  .hamburger-btn.active .bar:nth-child(1),
  .hamburger-btn.active .bar:nth-child(3) {
    top: 25px !important;
  }

  .hero-title,
  .hero .hero-title,
  .hero-section .hero-title {
    font-size: clamp(2rem, 9.6vw, 3.2rem) !important;
    line-height: 1.2;
  }

  /* Index mobile hero video: extend video coverage inside hero */
  .page > section.hero #video-bg {
    object-position: center 22% !important;
    height: 122% !important;
    top: -11% !important;
    transform: rotate(180deg) scale(1.06) !important;
    transform-origin: center center;
  }

  /* Whyus mobile hero balance */
  .whyus-page .hero-logo {
    max-width: 535px !important;
    width: 100% !important;
  }

  .whyus-page .hero-title {
    font-size: clamp(1.55rem, 6.7vw, 2.15rem) !important;
    line-height: 1.32 !important;
    gap: 0.28rem !important;
  }

  .whyus-page .hero-content {
    margin-top: -24px !important;
  }

  .whyus-page .hero-text-wrapper {
    margin-top: 10px !important;
  }

  .whyus-page .hero-video {
    transform: translate(-50%, -50%) scale(1.12) !important;
  }

  /* Whyus second section: hide side image on mobile */
  .whyus-page .sec-1 .abstract-shape {
    display: none !important;
  }

  /* Whyus CEO message: center all text elements on mobile */
  .whyus-page .ceo-message-content {
    text-align: center !important;
  }

  .whyus-page .ceo-message-content .section-title,
  .whyus-page .ceo-message-content .section-desc,
  .whyus-page .ceo-message-content .ceo-signature,
  .whyus-page .ceo-message-content .ceo-signature h4,
  .whyus-page .ceo-message-content .ceo-signature span {
    text-align: center !important;
  }

  .whyus-page .ceo-message-content .section-desc {
    max-width: 95%;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Keep hero blend effect on index mobile: avoid transform on the text wrapper */
  .page > section.hero .content {
    transform: none !important;
    margin-top: -30px !important;
  }

  .hero-section .hero-content {
    transform: translateY(-18px) !important;
  }

  .section-title,
  .franchise-def {
    font-size: clamp(1.35rem, 7vw, 2rem) !important;
    line-height: 1.35;
  }

  .section-desc,
  .section-desc-std,
  .franchise-val {
    font-size: 0.96rem !important;
    line-height: 1.85 !important;
  }

  .cta-button {
    width: 100%;
    justify-content: center;
    padding: 0.8rem 1rem !important;
    font-size: 0.96rem;
  }

  /* Index hero-following CTAs: keep natural width on mobile */
  .index-compact-cta {
    width: auto !important;
    display: inline-flex !important;
    max-width: fit-content;
    padding: 0.72rem 0.95rem !important;
  }

  /* Keep service details buttons natural size on mobile */
  .support-services .cta-button,
  #support-services .cta-button {
    width: auto !important;
    display: inline-flex !important;
  }

  /* Support services text alignment on mobile */
  .support-services h2,
  .support-services h3,
  .support-services p,
  #support-services h2,
  #support-services h3,
  #support-services p {
    text-align: center !important;
  }

  .support-services .text-start,
  #support-services .text-start {
    text-align: center !important;
  }

  .support-services .cta-button,
  #support-services .cta-button {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Services page: center the three main detail blocks on mobile */
  .service-detail-section .text-start,
  .service-detail-section .service-main-title,
  .service-detail-section .service-intro {
    text-align: center !important;
  }

  .social-circle {
    width: 36px !important;
    height: 36px !important;
  }

  .social-circle svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Keep footer geometry identical on mobile */
  .main-footer {
    margin-top: 0 !important;
    padding-bottom: 0.35rem !important;
  }

  /* Featured agencies arrows: force visible on mobile */
  .featured-agencies .swiper-button-prev,
  .featured-agencies .swiper-button-next {
    display: flex !important;
    width: 38px !important;
    height: 38px !important;
    opacity: 1 !important;
    z-index: 60 !important;
    pointer-events: auto !important;
    top: 46% !important;
  }

  .featured-agencies .swiper-button-prev::after,
  .featured-agencies .swiper-button-next::after {
    font-size: 14px !important;
  }

  .featured-agencies .swiper-button-prev {
    right: 6px !important;
    left: auto !important;
    transform: translateY(-50%) scaleX(-1) !important;
  }

  .featured-agencies .swiper-button-next {
    left: 6px !important;
    right: auto !important;
    transform: translateY(-50%) scaleX(-1) !important;
  }

  /* Agencies page slider arrows: force visible on mobile */
  .agencies-swiper .swiper-button-prev,
  .agencies-swiper .swiper-button-next {
    display: flex !important;
    width: 38px !important;
    height: 38px !important;
    opacity: 1 !important;
    z-index: 60 !important;
    pointer-events: auto !important;
    top: 46% !important;
    background: rgba(74, 171, 247, 0.28) !important;
    border-radius: 50% !important;
  }

  .agencies-swiper .swiper-button-prev::after,
  .agencies-swiper .swiper-button-next::after {
    font-size: 14px !important;
    color: #fff !important;
  }

  .agencies-swiper .swiper-button-prev {
    right: 6px !important;
    left: auto !important;
  }

  .agencies-swiper .swiper-button-next {
    left: 6px !important;
    right: auto !important;
  }

  /* Whyus / Services hero cleanup */
  .hero-section .hero-content {
    transform: none !important;
    margin-top: 0 !important;
    padding: 1rem !important;
  }

  .hero-section .hero-text-wrapper {
    margin-top: 0 !important;
    transform: none !important;
  }

  /* Agencies modal readability on mobile */
  .agency-modal .modal-content-wrapper,
  .modal-content-wrapper {
    width: min(94vw, 94vw) !important;
    max-height: 92vh !important;
  }

  .agency-modal .modal-content {
    position: relative !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .agency-modal .modal-image-side {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    z-index: 1 !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
  }

  .agency-modal .modal-image-wrapper img {
    object-fit: cover !important;
    object-position: center !important;
  }

  .agency-modal .modal-image-side::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background: linear-gradient(
      to bottom,
      rgba(4, 8, 16, 0.58) 0%,
      rgba(5, 10, 20, 0.8) 45%,
      rgba(5, 10, 20, 0.9) 100%
    ) !important;
    z-index: 2 !important;
    pointer-events: none !important;
  }

  .agency-modal .modal-text-side {
    position: relative !important;
    z-index: 3 !important;
    flex: 1 1 auto !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    background: transparent !important;
  }

  .modal-text-container {
    padding: 4.4rem 1.25rem 1.25rem !important;
    min-height: max-content !important;
    justify-content: flex-end !important;
  }

  .agency-modal .modal-title,
  .agency-modal .modal-description {
    color: #fff !important;
  }

  .agency-modal .modal-title {
    margin-top: 0.45rem !important;
  }

  .agency-modal .modal-close-btn svg {
    color: #000 !important;
    stroke: #000 !important;
  }

  /* Consultation page */
  .consultation-hero {
    min-height: 64vh !important;
    height: auto !important;
    border-bottom-right-radius: 10vw !important;
  }

  .consultation-hero .content {
    transform: translateY(0) !important;
    padding: 0 1rem;
  }

  .consultation-main {
    padding-top: 1.2rem !important;
  }

  .contact-side-card,
  .consultation-card {
    padding: 1rem !important;
  }
}

/* Very small devices */
@media (max-width: 479.98px) {
  .hero-title,
  .hero .hero-title,
  .hero-section .hero-title {
    font-size: clamp(1.55rem, 9.2vw, 2.2rem) !important;
  }

  .whyus-page .hero-logo {
    max-width: 465px !important;
    width: 100% !important;
  }

  .whyus-page .hero-title {
    font-size: clamp(1.35rem, 7.8vw, 1.9rem) !important;
    line-height: 1.35 !important;
  }

  .whyus-page .hero-content {
    margin-top: -14px !important;
  }

  .whyus-page .hero-text-wrapper {
    margin-top: 12px !important;
  }

  .menu-overlay {
    width: 84%;
  }

  .page > section.hero #video-bg {
    object-position: center 20% !important;
    height: 126% !important;
    top: -13% !important;
    transform: rotate(180deg) scale(1.08) !important;
  }

  .page > section.franchise-custom {
    padding-top: 2.5rem !important;
    padding-bottom: 2.25rem !important;
  }

  .featured-agencies .slider-section-container {
    padding: 0 10px 48px !important;
  }

  .agency-modal .modal-content-wrapper {
    width: 95vw !important;
    max-height: 90vh !important;
  }

}

/* Index hero video fine-tuning by screen ratio */
@media (min-width: 768px) and (max-width: 991.98px) and (min-aspect-ratio: 4/3) {
  .page > section.hero #video-bg {
    object-position: center 28% !important;
    height: 108% !important;
    top: -4% !important;
    transform: rotate(180deg) scale(1.01) !important;
  }
}

@media (max-width: 767.98px) and (max-aspect-ratio: 9/18) {
  .page > section.hero #video-bg {
    object-position: center 18% !important;
    height: 130% !important;
    top: -15% !important;
    transform: rotate(180deg) scale(1.1) !important;
  }
}

@media (max-width: 767.98px) and (min-aspect-ratio: 9/16) {
  .page > section.hero #video-bg {
    object-position: center 26% !important;
    height: 116% !important;
    top: -8% !important;
    transform: rotate(180deg) scale(1.03) !important;
  }
}
html, body {
  font-family: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
