/* 2026-10-27: Arabic mobile layout. Desktop rules above remain unchanged.
   Kept more specific than the hero/partner styles embedded in the templates. */
@media (max-width: 991.98px) {
  body[dir="rtl"] { --fm-mobile-space: clamp(18px, 4.6vw, 32px); }
  body[dir="rtl"] > header:has(#nav-bar) {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .98);
  }
  body[dir="rtl"] #nav-bar,
  body[dir="rtl"] #nav-bar.sticky {
    position: relative;
    top: auto;
    width: 100%;
    padding: 12px 0;
    background: #fff;
    box-shadow: none;
  }
  body[dir="rtl"] #nav-bar.fm-nav-scrolled {
    box-shadow: 0 5px 18px rgba(7, 87, 130, .07);
  }
  body[dir="rtl"] #nav-bar > .container {
    width: 100% !important;
    max-width: 900px !important;
    padding-inline: var(--fm-mobile-space);
    gap: 12px;
  }
  body[dir="rtl"] #nav-bar .navbar-brand { margin: 0; }
  body[dir="rtl"] #nav-bar .navbar-brand img {
    width: clamp(148px, 34vw, 205px);
    max-width: 100%;
    height: auto;
    transform: none;
  }
  body[dir="rtl"] #nav-bar .navbar-toggler {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 8px;
    color: #0c5370;
    background: #fff;
    border: 1px solid #d8e9ef;
    border-radius: 12px;
    box-shadow: none;
  }
  body[dir="rtl"] #nav-bar .navbar-toggler-icon {
    width: 24px;
    height: 24px;
    filter: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230c5370' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E");
  }
  body[dir="rtl"] #nav-bar #navbarNav {
    flex-basis: 100%;
    max-height: 75vh;
    max-height: 75dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-inline: 2px;
  }
  body[dir="rtl"] #nav-bar #navbarNav.show { padding-block: 12px 5px; }
  body[dir="rtl"] #navbarNav .navbar-nav { gap: 2px; }
  body[dir="rtl"] #navbarNav .nav-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 46px;
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 15px;
  }
  body[dir="rtl"] #navbarNav .nav-link.active {
    background: #edf8fc;
    color: #087dbb;
  }
  body[dir="rtl"] #navbarNav .nav-link::after { display: none; }
  body[dir="rtl"] #navbarNav .dropdown-menu {
    position: static;
    min-width: 0;
    margin: 2px 0 8px;
    padding: 5px 8px;
    border: 1px solid #e2edf2;
    border-radius: 10px;
    background: #f7fbfd;
  }
  body[dir="rtl"] #navbarNav .dropdown-item {
    min-height: 44px;
    padding: 11px 9px;
    white-space: normal;
    font-size: 14px;
  }
  body[dir="rtl"] #navbarNav > div > .d-flex { gap: 12px; padding-top: 10px; }
  body[dir="rtl"] #navbarNav .search a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }
  body[dir="rtl"] #navbarNav .list-unstyled { margin: 0; }

  /* A left-aligned photo emblem and right-aligned copy, sized for a phone. */
  body[dir="rtl"] .slide_bg.fm-motion-hero {
    display: block;
    position: relative;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: clamp(250px, 64vw, 430px) 0 32px;
    overflow: hidden;
    isolation: isolate;
  }
  body[dir="rtl"] .fm-motion-hero .fm-hero-frame {
    position: absolute;
    inset: 0 auto auto clamp(-52px, -6vw, -20px);
    width: clamp(245px, 66vw, 440px);
    height: auto;
    max-width: none;
    aspect-ratio: 687 / 650;
    margin: 0;
    overflow: hidden;
  }
  body[dir="rtl"] .fm-motion-hero .fm-hero-art {
    position: static;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    transform: none;
    animation: none;
    will-change: auto;
  }
  body[dir="rtl"] .fm-motion-hero::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 15px;
    width: 132px;
    height: 132px;
    background: #087dbb;
    opacity: .035;
    -webkit-mask: url("../images/favicon.png") repeat 0 0 / 44px 44px;
    mask: url("../images/favicon.png") repeat 0 0 / 44px 44px;
    pointer-events: none;
    z-index: 0;
  }
  body[dir="rtl"] .fm-motion-hero > .container {
    position: relative;
    width: 100% !important;
    max-width: 900px !important;
    height: auto;
    padding-inline: var(--fm-mobile-space);
  }
  body[dir="rtl"] .fm-motion-hero .content {
    position: static;
    width: 100%;
    max-width: 680px;
    margin-inline: 0 auto;
    text-align: start;
  }
  body[dir="rtl"] .fm-motion-hero .content .customTitle {
    width: auto;
    color: #20334a;
    font-size: clamp(38px, 9.6vw, 61px);
    line-height: 1.4;
    margin: 0;
    animation: none;
    opacity: 1;
    transform: none;
  }
  body[dir="rtl"] .fm-motion-hero .content h1.fs_60 {
    font-size: clamp(21px, 5.2vw, 32px);
    line-height: 1.6;
    margin: 7px 0 0 !important;
    animation: none;
    opacity: 1;
    transform: none;
  }
  body[dir="rtl"] .fm-motion-hero .content p {
    max-width: 38ch;
    font-size: clamp(15px, 3.8vw, 18px);
    line-height: 1.9;
    color: #64768a;
    margin: 14px 0 0 !important;
    animation: none;
    opacity: 1;
    transform: none;
  }
  body[dir="rtl"] .fm-motion-hero .content .fm-hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
    gap: 10px;
    margin: 20px 0 0;
  }
  body[dir="rtl"] .fm-motion-hero .fm-hero-actions .fm-action {
    width: auto;
    min-width: 0;
    min-height: 46px;
    padding: 11px 14px;
    font-size: 14px;
  }

  /* Keep tabs adjacent to their details; avoid five tall rows on a phone. */
  body[dir="rtl"] #fm-services {
    margin-block: 24px 38px !important;
    scroll-margin-top: 95px;
  }
  body[dir="rtl"] #fm-services > .container {
    width: 100% !important;
    padding-inline: var(--fm-mobile-space);
  }
  body[dir="rtl"] #fm-services > .container > .text-center {
    margin-bottom: 24px !important;
    text-align: start !important;
  }
  body[dir="rtl"] #fm-services h1,
  body[dir="rtl"] .beforCounterSection h1,
  body[dir="rtl"] .News h1,
  body[dir="rtl"] .fm-partners .fm-partners-title {
    font-size: clamp(25px, 6.5vw, 34px);
    line-height: 1.5;
    color: #20334a;
  }
  body[dir="rtl"] #fm-services .section-subheading {
    font-size: 14px;
    line-height: 1.9;
    font-family: "Almarai-Regular", sans-serif !important;
  }
  body[dir="rtl"] .our_services { padding-inline: 0; }
  body[dir="rtl"] .our_services #service_img,
  body[dir="rtl"] .our_services .circle { display: none !important; }
  body[dir="rtl"] .our_services > .row {
    width: 100% !important;
    margin: 0 !important;
    --bs-gutter-x: 0;
    --bs-gutter-y: 16px;
  }
  body[dir="rtl"] .our_services #v-pills-tab {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    max-width: none;
    margin: 0 !important;
    padding: 3px var(--fm-mobile-space) 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--fm-mobile-space);
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: #a7d7e9 #f4f8fa;
    -webkit-overflow-scrolling: touch;
  }
  body[dir="rtl"] .our_services #v-pills-tab > .nav-link {
    position: relative;
    inset: auto;
    display: flex;
    flex: 0 0 auto;
    width: auto !important;
    max-width: calc(100vw - 48px);
    min-height: 52px;
    margin: 0;
    padding: 8px 12px;
    gap: 8px;
    border: 1px solid #d8e8ef;
    border-radius: 12px;
    background: #fff;
    color: #20334a;
    font-size: 13px;
    text-align: start;
    white-space: nowrap;
    line-height: 1.6;
    scroll-snap-align: start;
    transform: none;
  }
  body[dir="rtl"] .our_services #v-pills-tab > .nav-link.active {
    background: #eaf8fe;
    border-color: #087dbb;
    color: #075782;
    box-shadow: inset 0 -2px 0 #087dbb;
  }
  body[dir="rtl"] .our_services #v-pills-tab .icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    padding: 6px;
    margin: 0 !important;
    border-color: #deedf3;
  }
  body[dir="rtl"] .our_services #v-pills-tab .nav-link span { flex: 0 1 auto; }
  body[dir="rtl"] .our_services > .row > .col-lg-7 {
    padding-inline: var(--fm-mobile-space) !important;
  }
  body[dir="rtl"] .our_services #v-pills-tabContent {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: clamp(18px, 4vw, 28px) !important;
    border: 1px solid #e0eef3;
    border-radius: 18px;
    background: #f2f9fc;
  }
  body[dir="rtl"] #v-pills-tabContent .tab-pane h5 {
    margin-bottom: 14px !important;
    font-size: 21px;
    line-height: 1.7;
  }
  body[dir="rtl"] #v-pills-tabContent .tab-pane .prograph_color {
    color: #52687c;
    font-size: 15px;
    line-height: 1.95 !important;
    font-family: "Almarai-Regular", sans-serif !important;
    margin-bottom: 18px !important;
    overflow-wrap: break-word;
  }
  body[dir="rtl"] #v-pills-tabContent .row {
    width: 100%;
    margin: 0 !important;
    --bs-gutter-x: 0;
    --bs-gutter-y: 18px;
  }
  body[dir="rtl"] #v-pills-tabContent .tab-pane img.w-100 {
    display: block;
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: contain;
    border-radius: 12px;
  }
  body[dir="rtl"] .custom_btn { width: max-content; max-width: 100%; min-height: 44px; }
  body[dir="rtl"] .custom_btn > :is(span, i) { min-height: 44px; display: inline-flex; align-items: center; }
  body[dir="rtl"] .fm-service-action { min-height: 44px; margin-top: 10px; font-size: 14px; }

  /* Request fields use 16px text to avoid Safari zooming when focused. */
  body[dir="rtl"] .fm-inquiry { padding: 0 var(--fm-mobile-space) 40px; scroll-margin-top: 95px; }
  body[dir="rtl"] .fm-inquiry__shell { padding: 24px 18px; border-radius: 18px; }
  body[dir="rtl"] .fm-inquiry__layout { grid-template-columns: 1fr; gap: 24px; }
  body[dir="rtl"] .fm-inquiry__intro p { font-size: 14px; line-height: 1.9; }
  body[dir="rtl"] .fm-inquiry :is(input, select, textarea) { font-size: 16px; min-height: 48px; min-width: 0; }
  body[dir="rtl"] .fm-inquiry__submit { width: 100%; justify-self: stretch; min-height: 48px; }

  /* Let About, News and the footer take their natural content height. */
  body[dir="rtl"] .about { margin: 0 0 38px; }
  body[dir="rtl"] .about > .title {
    position: static;
    width: 100%;
    padding: 23px var(--fm-mobile-space) !important;
  }
  body[dir="rtl"] .about > .title h1 { font-size: 26px; line-height: 1.6; }
  body[dir="rtl"] .about > .row { margin: 0 !important; --bs-gutter-x: 0; --bs-gutter-y: 0; }
  body[dir="rtl"] .about .bg_primary_color.list {
    height: auto;
    min-height: 0;
    padding: 25px var(--fm-mobile-space) !important;
  }
  body[dir="rtl"] .about .list ul { margin: 0; }
  body[dir="rtl"] .about .list li { font-size: 14px; line-height: 2; }
  body[dir="rtl"] .about .list li:last-child { margin-bottom: 0 !important; }
  body[dir="rtl"] .about .BrochureBg {
    height: auto;
    min-height: 220px;
    padding: 30px var(--fm-mobile-space) !important;
  }
  body[dir="rtl"] .about .BrochureBg h1 { font-size: 25px; line-height: 1.6; margin-bottom: 20px !important; }
  body[dir="rtl"] .about > .container { display: none; }
  body[dir="rtl"] .beforCounterSection { width: 100% !important; padding-inline: var(--fm-mobile-space); }
  body[dir="rtl"] .beforCounterSection > .text-center { margin-bottom: 24px !important; }
  body[dir="rtl"] .beforCounterSection > .text-center p { color: #64768a; font-size: 14px; line-height: 1.9; }
  body[dir="rtl"] .beforCounterSection > .row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    margin: 0 !important;
  }
  body[dir="rtl"] .beforCounterSection > .row > div { width: auto; min-width: 0; margin: 0; padding: 0; }
  body[dir="rtl"] .beforCounterSection > .row > div:last-child:nth-child(odd) { grid-column: 1 / -1; width: calc((100% - 12px) / 2); justify-self: center; }
  body[dir="rtl"] .beforCounterSection .statistic-item {
    height: 100%;
    min-height: 145px;
    flex-direction: column;
    justify-content: center;
    gap: 9px;
    padding: 18px 10px !important;
    transform: none;
  }
  body[dir="rtl"] .statistic-item > i { padding: 0 !important; font-size: 32px; line-height: 1; }
  body[dir="rtl"] .statistic-item h2 { font-size: clamp(25px, 6vw, 31px); line-height: 1.4; }
  body[dir="rtl"] .statistic-item p { padding: 0 !important; text-align: center !important; font-size: 13px; line-height: 1.7; }
  body[dir="rtl"] .News { margin: 40px 0 !important; }
  body[dir="rtl"] .News .news_bg { position: relative; z-index: auto; height: auto; margin: 0; isolation: isolate; }
  body[dir="rtl"] .News .news_bg::after { display: none; }
  body[dir="rtl"] .News .news_bg > .container { width: 100% !important; padding: 32px var(--fm-mobile-space) !important; }
  body[dir="rtl"] .News .container > .d-flex { align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 22px !important; }
  body[dir="rtl"] .News .container > .d-flex a { min-height: 44px; font-size: 13px; }
  body[dir="rtl"] .News .container > .row { width: 100%; margin: 0 !important; --bs-gutter-x: 0; --bs-gutter-y: 18px; }
  body[dir="rtl"] .News .news-item { margin-top: 18px; padding-inline: 0; transform: none; }
  body[dir="rtl"] .News .news-item:first-child { margin-top: 0; }
  body[dir="rtl"] .News .news-item:nth-child(2) { margin-top: 18px; }
  body[dir="rtl"] .News .news-item img { aspect-ratio: 16 / 10; height: auto; object-fit: cover; }
  body[dir="rtl"] .News .news-item .content { min-height: 0; padding: 20px 18px 25px !important; }
  body[dir="rtl"] .News .news-item .content span { font-size: 16px; line-height: 1.8; }
  body[dir="rtl"] .News .news-item .link_icon { display: inline-block; margin-inline-start: 7px; }
  body[dir="rtl"] .News .news-item .link_icon::before { position: static; padding: 0; }
  body[dir="rtl"] .fm-partners { margin: 0 !important; padding: 0 0 36px; }
  body[dir="rtl"] .fm-partners > .container { width: 100% !important; padding-inline: var(--fm-mobile-space); }
  body[dir="rtl"] .fm-partners-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  body[dir="rtl"] .fm-partners .fm-partner-card { min-width: 0; height: 100px; padding: 12px; border-radius: 13px; }
  body[dir="rtl"] .fm-partners .fm-partner-card img { max-width: 100%; max-height: 70px; width: auto; height: auto; object-fit: contain; }
  body[dir="rtl"] footer .bg_footer {
    height: auto;
    min-height: 230px;
    padding: 85px var(--fm-mobile-space) calc(28px + env(safe-area-inset-bottom));
    background-position: center bottom, center bottom;
    background-size: 100% 100%, auto 210px;
  }
  body[dir="rtl"] footer .bg_footer > .container { width: 100% !important; padding: 0; margin-bottom: 0 !important; }
  body[dir="rtl"] footer .bg_footer .row { width: 100%; margin: 0 !important; --bs-gutter-x: 0; --bs-gutter-y: 16px; }
  body[dir="rtl"] footer .bg_footer .row > div { width: 100%; text-align: center !important; padding: 0; }
  body[dir="rtl"] footer .list-inline { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; }
  body[dir="rtl"] footer .list-inline-item { margin: 0; }
  body[dir="rtl"] footer .list-inline a { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #dfebf0; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 20px; }
  body[dir="rtl"] footer p { color: #52687c; font-size: 12px; line-height: 1.9; overflow-wrap: break-word; }
  body[dir="rtl"] .whatsapp-float {
    width: 48px !important;
    height: 48px !important;
    right: max(14px, env(safe-area-inset-right)) !important;
    bottom: calc(16px + env(safe-area-inset-bottom)) !important;
  }
  body[dir="rtl"] .whatsapp-float i { font-size: 28px !important; }
  body[dir="rtl"] .fm-back-top {
    inset-inline-end: auto;
    left: max(14px, env(safe-area-inset-left));
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
  }
  body[dir="rtl"] .fm-mobile-floats-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
  body[dir="rtl"] [data-aos] { opacity: 1 !important; transform: none !important; transition: none !important; }
  body[dir="rtl"] #search_modal :is(input, button) { font-size: 16px; min-height: 48px; }
}
@media (max-width: 575.98px) {
  body[dir="rtl"] .fm-inquiry__form { grid-template-columns: 1fr; }
  body[dir="rtl"] .fm-inquiry__field--wide,
  body[dir="rtl"] .fm-inquiry__submit,
  body[dir="rtl"] .fm-inquiry__note { grid-column: auto; }
  body[dir="rtl"] .fm-partners-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[dir="rtl"] .fm-partners .fm-partner-card { height: 100px; padding: 12px 16px; }
  body[dir="rtl"] .fm-partners-grid > .fm-partner-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    width: calc((100% - 12px) / 2);
    justify-self: center;
  }
}
@media (max-width: 359.98px) {
  body[dir="rtl"] .fm-motion-hero .fm-hero-actions .fm-action { flex: 1 1 100%; }
  body[dir="rtl"] .News .container > .d-flex { align-items: flex-start; }
}
