/* Almlakia v5.2 - Arabic / RTL mobile geometry correction.
 * Loaded AFTER site.css, i18n.css, builder-site.css, home-v4.css and site-hotfix-v5.css.
 * Intentionally scoped to RTL + mobile; English desktop/mobile remains unchanged.
 */
@media (max-width: 1050px) {
  /* Keep Chrome's viewport coordinate system stable while retaining RTL content. */
  html[dir="rtl"] { direction:ltr; width:100%; max-width:100%; overflow-x:clip; }
  html[dir="rtl"] body { direction:rtl; width:100%; min-width:0; max-width:100%; margin:0; overflow-x:clip; }
  html[dir="rtl"] main, html[dir="rtl"] footer,
  html[dir="rtl"] main > section { width:100%; min-width:0; max-width:100%; }
  html[dir="rtl"] main > section { overflow-x:clip; }

  /* Stop mobile header flex items from being pushed beyond the LEFT edge. */
  html[dir="rtl"] .site-header { width:100%; max-width:100vw; left:0; right:0; }
  html[dir="rtl"] .site-header .header-inner {
    box-sizing:border-box; display:grid; direction:rtl;
    grid-template-columns:minmax(0,1fr) max-content;
    align-items:center; column-gap:8px;
    width:100%; max-width:100vw; height:76px;
    padding-inline:16px; margin:0;
  }
  html[dir="rtl"] .site-header .brand {
    display:flex; flex-direction:row; justify-self:start;
    align-items:center; min-width:0; max-width:100%;
    width:max-content; gap:7px; white-space:normal;
  }
  html[dir="rtl"] .site-header .brand img { flex:0 0 auto; width:42px; height:42px; }
  html[dir="rtl"] .site-header .brand-label { min-width:0; max-width:145px; text-align:right; direction:rtl; }
  html[dir="rtl"] .site-header .brand-label strong {
    font-size:clamp(16px,5vw,21px); line-height:1.25; white-space:nowrap;
  }
  html[dir="rtl"] .site-header .brand-label small {
    display:block; max-width:130px; overflow:hidden; text-overflow:ellipsis;
    white-space:nowrap; font-size:9px; line-height:1.5;
  }
  html[dir="rtl"] .site-header .header-actions {
    display:flex; direction:ltr; justify-self:end; align-items:center;
    flex:0 0 auto; width:auto; min-width:0; gap:6px;
    margin:0!important; padding:0;
  }
  html[dir="rtl"] .site-header .locale-switch {
    flex:0 0 auto; margin:0; min-width:0; gap:0; padding:2px;
  }
  html[dir="rtl"] .site-header .menu-toggle {
    display:block; flex:0 0 40px; width:40px; height:42px;
    margin:0; padding:8px; justify-self:end;
  }
  html[dir="rtl"] .site-header .mobile-nav:not([hidden]) {
    box-sizing:border-box; display:flex!important; direction:rtl; text-align:right;
    left:0; right:0; inset-inline:0; width:100%; max-width:100vw;
    padding:10px 20px 24px; overflow-x:hidden;
  }

  /* Prevent grid min-content constraints from widening the page in RTL. */
  html[dir="rtl"] main .container,
  html[dir="rtl"] footer .container {
    box-sizing:border-box; width:calc(100% - 32px)!important;
    min-width:0; max-width:1200px; margin-inline:auto!important;
  }
  html[dir="rtl"] .v4-section .container { padding-inline:0; }
  html[dir="rtl"] :is(.v4-grid,.v4-grid-3,.v4-grid-4,.v4-heading,
      .destination-grid,.tours-grid,.service-grid,.services-grid,.branch-grid,
      .footer-grid,.builder-gallery-grid,.builder-review-grid,
      .v4-advisor-wrap,.promise-section) { min-width:0; max-width:100%; }
  html[dir="rtl"] :is(.v4-grid,.v4-grid-3,.v4-grid-4,.destination-grid,
      .tours-grid,.service-grid,.branch-grid,.footer-grid,
      .builder-gallery-grid,.builder-review-grid) > * {
    box-sizing:border-box; min-width:0; max-width:100%;
  }
  html[dir="rtl"] :is(.v4-guide,.v4-card,.v4-story,.v4-person,.v4-step,
      .v4-review,.destination-card,.tour-card,.branch-card,.service-card) {
    box-sizing:border-box; min-width:0; max-width:100%;
    overflow-wrap:break-word;
  }
  html[dir="rtl"] :is(.v4-guide,.v4-card,.v4-story,.v4-person,.tour-card,.branch-card)
    :is(img,video,iframe) { max-width:100%; }
  html[dir="rtl"] :is(.v4-heading,.section-heading,.promise-content) {
    max-width:100%; min-width:0; overflow-wrap:break-word;
  }
  html[dir="rtl"] :is(a,b,span,p,h1,h2,h3,small,strong) { min-width:0; }

  /* All hero slides share ONE frame; text stays inside the visible viewport. */
  html[dir="rtl"] .hero { position:relative; width:100%; max-width:100%; overflow:hidden; }
  html[dir="rtl"] .hero .hero-slide {
    position:absolute!important; inset:0!important;
    width:100%!important; height:100%!important;
    background-position:center center;
  }
  html[dir="rtl"] .hero .hero-inner {
    box-sizing:border-box; display:flex; direction:rtl;
    width:calc(100% - 32px)!important;
    max-width:1200px; min-width:0;
    padding-inline:0; margin-inline:auto!important;
    justify-content:flex-start; align-items:center;
  }
  html[dir="rtl"] .hero .hero-copy {
    box-sizing:border-box; width:100%; min-width:0;
    max-width:580px; margin:0; padding-inline:0;
    direction:rtl; text-align:right;
  }
  html[dir="rtl"] .hero-copy h1 {
    max-width:100%; width:auto; text-wrap:balance;
    overflow-wrap:break-word; word-break:normal;
    letter-spacing:0; line-height:1.32;
  }
  html[dir="rtl"] .hero-copy p { max-width:100%; overflow-wrap:break-word; }
  html[dir="rtl"] .hero-copy .eyebrow { max-width:100%; line-height:1.7; }
  html[dir="rtl"] .hero-links { direction:rtl; justify-content:flex-start; min-width:0; }
  html[dir="rtl"] .hero-bottom {
    box-sizing:border-box; width:calc(100% - 32px)!important;
    left:16px!important; right:16px!important;
    margin:0!important; direction:rtl;
  }
}

@media (max-width: 680px) {
  html[dir="rtl"] .site-header .header-inner { height:70px; padding-inline:12px; gap:5px; }
  html[dir="rtl"] .site-header .brand img { width:37px; height:37px; }
  html[dir="rtl"] .site-header .brand-label { max-width:116px; }
  html[dir="rtl"] .site-header .brand-label small { max-width:110px; font-size:8px; }
  html[dir="rtl"] .site-header .locale-switch a { font-size:10px; padding:5px 6px; }
  html[dir="rtl"] .site-header .mobile-nav:not([hidden]) { max-height:calc(100dvh - 70px); }

  html[dir="rtl"] .hero { height:clamp(590px,88svh,760px); min-height:590px; }
  html[dir="rtl"] .hero .hero-inner { padding-top:70px; padding-bottom:100px; }
  html[dir="rtl"] .hero .hero-copy { padding-top:0; max-width:100%; }
  html[dir="rtl"] .hero-copy h1 {
    font-size:clamp(34px,9vw,49px); margin-bottom:14px;
  }
  html[dir="rtl"] .hero-copy p { font-size:14px; line-height:1.85; max-width:100%; }
  html[dir="rtl"] .hero-links { margin-top:18px; gap:10px; flex-wrap:wrap; }
  html[dir="rtl"] .hero-links .button { min-height:44px; max-width:100%; padding:9px 14px; }
  html[dir="rtl"] .hero-bottom { bottom:20px; }
  html[dir="rtl"] .hero-side-note { display:none; }
  html[dir="rtl"] .hero-bottom .slide-control { margin-inline-start:auto; }

  html[dir="rtl"] :is(.v4-grid-3,.v4-grid-4,.v4-grid,
      .destination-grid,.tours-grid,.service-grid,.services-grid,
      .branch-grid,.footer-grid,.builder-gallery-grid,.builder-review-grid,
      .steps-grid,.values-grid) {
    display:grid; grid-template-columns:minmax(0,1fr)!important;
  }
  html[dir="rtl"] .destination-grid { grid-template-rows:auto; }
  html[dir="rtl"] .destination-card.featured { grid-column:auto; grid-row:auto; }
  html[dir="rtl"] .v4-advisor-wrap,
  html[dir="rtl"] .promise-section { grid-template-columns:minmax(0,1fr)!important; }
  html[dir="rtl"] .promise-media { min-height:235px; }
  html[dir="rtl"] .promise-content { padding:34px 20px; }
  html[dir="rtl"] .v4-form-grid { grid-template-columns:minmax(0,1fr); }
  html[dir="rtl"] :is(.v4-card,.v4-guide,.v4-person,.v4-story,
      .v4-review,.service-card,.tour-card,.branch-card) { width:100%; }
  html[dir="rtl"] .section-heading { display:flex; align-items:stretch; gap:10px; }
  html[dir="rtl"] .section-heading .text-link { white-space:normal; }
  html[dir="rtl"] .v4-section .container { width:calc(100% - 32px)!important; }
}
@media (max-width: 370px) {
  html[dir="rtl"] .site-header .brand-label strong { font-size:16px; }
  html[dir="rtl"] .site-header .brand-label small { max-width:92px; }
  html[dir="rtl"] .site-header .brand img { width:34px; height:34px; }
  html[dir="rtl"] .site-header .header-actions { gap:3px; }
  html[dir="rtl"] .site-header .locale-switch a { padding-inline:4px; }
  html[dir="rtl"] .hero-copy h1 { font-size:33px; }
}


@media (max-width: 1050px) {
    html[dir="rtl"] {
        direction: rtl !important;
    }

    html[dir="rtl"] body {
        direction: rtl !important;
    }

    html[dir="rtl"] #homeHero {
        position: relative;
        width: 100%;
        max-width: 100%;
        overflow: hidden !important;
    }

    html[dir="rtl"] #homeHero .hero-slide {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
        height: 100% !important;
    }

    html[dir="rtl"] #homeHero .hero-inner {
        width: calc(100% - 32px) !important;
        max-width: 100% !important;
        margin-inline: auto !important;
        direction: rtl;
    }

    html[dir="rtl"] #homeHero .hero-copy {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        text-align: right;
        direction: rtl;
    }
}


/* ==========================================
   ALMLAKIA - NEWSLETTER FOOTER FIX
   RTL + LTR / Mobile + Desktop
   ========================================== */

.footer-grid > div {
    min-width: 0;
    max-width: 100%;
}

.footer .newsletter {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 48px;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100%;
    align-items: stretch;
    position: relative;
    margin-top: 15px;
    direction: ltr;
}

/* Email Input */
.footer .newsletter > input[type="email"] {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 48px;
    padding: 0 15px;
    background: #2b1c20;
    border: 1px solid #65454d;
    border-radius: 9px;
    color: #fff;
    font-size: 14px;
    direction: ltr;
    text-align: left;
    box-sizing: border-box;
}

.footer .newsletter > input[type="email"]:focus {
    outline: none;
    border-color: #d84362;
    box-shadow: 0 0 0 3px rgba(216, 67, 98, 0.15);
}

.footer .newsletter > input[type="email"]::placeholder {
    color: #bda7ac;
}

/* Subscribe Button */
.footer .newsletter > button {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 0;
    border: none;
    border-radius: 9px;
    background: #a30e30;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s ease;
}

.footer .newsletter > button:hover {
    background: #d52750;
}

/* Consent Checkbox */
.footer .newsletter > .consent {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex !important;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    margin: 2px 0 0;
    padding: 0;
    color: #c9b2b8;
    font-size: 12px;
    line-height: 1.8;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.footer .newsletter > .consent input {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    margin: 4px 0 0;
    accent-color: #b6123b;
}

/* Fix hidden anti-spam field without
   causing horizontal overflow */
.footer .newsletter > input.hp {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0 !important;
    clip-path: inset(50%);
    pointer-events: none;
}

/* Arabic RTL */
html[dir="rtl"] .footer .newsletter {
    direction: rtl;
}

html[dir="rtl"] .footer .newsletter > input[type="email"] {
    grid-column: 1;
    text-align: right;
}

html[dir="rtl"] .footer .newsletter > button {
    grid-column: 2;
}

html[dir="rtl"] .footer .newsletter > .consent {
    direction: rtl;
    text-align: right;
    justify-content: flex-start;
}

/* Mobile */
@media (max-width: 680px) {
    .footer .newsletter {
        grid-template-columns: minmax(0, 1fr) 46px;
        gap: 8px !important;
    }

    .footer .newsletter > input[type="email"],
    .footer .newsletter > button {
        height: 46px;
    }

    .footer .newsletter > button {
        width: 46px;
        min-width: 46px;
    }

    .footer .newsletter > .consent {
        font-size: 11px;
        line-height: 1.8;
    }
}

