/* ── Lang pill (above Contact) ── */
.fm-lang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(215, 226, 234, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #d7e2ea;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.fm-lang:hover {
  border-color: rgba(125, 211, 252, 0.5);
  background: rgba(125, 211, 252, 0.1);
  color: #7dd3fc;
  transform: scale(1.05);
}
.fm-lang:active { transform: scale(0.94); }
.fm-lang:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 2px;
}

/* ── Arabic type ── */
html[dir="rtl"] body,
html[dir="rtl"] .fm-copy,
html[dir="rtl"] .rd-card__story,
html[dir="rtl"] .rd-card__hook,
html[dir="rtl"] .rd-card__role,
html[dir="rtl"] .rd-card__place,
html[dir="rtl"] .rd-metric__label,
html[dir="rtl"] .pw-modal__lead,
html[dir="rtl"] .pw-modal__para,
html[dir="rtl"] .pw-modal__tagline,
html[dir="rtl"] .pw-modal__kicker,
html[dir="rtl"] .pw-modal__chapter-title,
html[dir="rtl"] .fm-biz-card,
html[dir="rtl"] .fm-role-line,
html[dir="rtl"] .fm-nav-link {
  font-family: "Cairo", "Kanit", system-ui, sans-serif;
  letter-spacing: 0;
}

html[dir="rtl"] .hero-heading,
html[dir="rtl"] .rd-title,
html[dir="rtl"] .rd-eyebrow,
html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3 {
  font-family: "Cairo", "Kanit", system-ui, sans-serif;
  letter-spacing: -0.02em;
}

/* ═══════════════ HERO ═══════════════ */
.fm-hero {
  overflow-x: clip;
}
.fm-hero-title {
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  max-width: 100%;
  padding-inline: 0.25rem;
  box-sizing: border-box;
}

/* Arabic hero title: wrap + scale so it fits */
html[dir="rtl"] .fm-hero-title {
  white-space: normal;
  text-transform: none;
  font-size: clamp(2rem, 11vw, 6.5rem) !important;
  line-height: 1.12;
  letter-spacing: 0;
  padding-inline: 0.75rem;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
html[dir="rtl"] .fm-hero-title-wrap {
  overflow: visible;
  margin-top: 0.5rem;
}
html[dir="rtl"] .fm-hero-nav .fm-nav-link {
  text-transform: none;
  letter-spacing: 0.04em;
  font-weight: 600;
}
html[dir="rtl"] .fm-role-line {
  text-transform: none;
  letter-spacing: 0.02em;
  text-align: start;
  max-width: min(200px, 42vw);
  line-height: 1.55;
}
html[dir="rtl"] .fm-hero-bottom {
  /* dir=rtl already flips start/end; keep space-between */
  gap: 0.75rem;
}
html[dir="rtl"] .fm-hero-contact {
  align-items: flex-start;
  text-align: start;
}
/* Contact card root: stick to contact column end (logical) */
#hero-biz-card-root {
  margin-inline-start: auto;
  margin-left: unset;
}
html[dir="rtl"] #hero-biz-card-root {
  margin-inline-start: 0;
  margin-inline-end: auto;
  width: min(280px, 72vw);
}
html[dir="rtl"] .fm-biz-card__face {
  text-align: start;
}
html[dir="rtl"] .fm-biz-card__label {
  letter-spacing: 0.08em;
  text-transform: none;
}
html[dir="rtl"] .fm-biz-card__name {
  letter-spacing: 0;
  text-transform: none;
}
html[dir="rtl"] .fm-biz-card__row {
  flex-direction: row;
}

/* Video stays centered (desktop / tablet) */
.fm-hero-video {
  left: 50% !important;
  right: auto !important;
  transform: translate3d(-50%, -50%, 0);
}
@media (min-width: 640px) {
  .fm-hero-video {
    transform: translate3d(-50%, 0, 0);
  }
}

/* ── Phone only: face ABOVE contact (no overlap) ── */
@media (max-width: 639.98px) {
  .fm-hero {
    height: 100svh;
    min-height: 100svh;
    max-height: 100svh;
    overflow-x: clip !important;
  }
  /* Edge-aware gutters: hug screen edges with safe-area, no right overflow */
  .fm-hero-nav {
    flex-shrink: 0;
    padding-inline:
      max(0.75rem, env(safe-area-inset-left, 0px))
      max(0.75rem, env(safe-area-inset-right, 0px)) !important;
    gap: 0.15rem;
    box-sizing: border-box;
    max-width: 100%;
  }
  .fm-nav-link {
    font-size: clamp(0.62rem, 2.8vw, 0.8rem) !important;
    letter-spacing: 0.04em !important;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .fm-hero-bottom {
    padding-inline:
      max(0.75rem, env(safe-area-inset-left, 0px))
      max(0.75rem, env(safe-area-inset-right, 0px)) !important;
    box-sizing: border-box;
    max-width: 100%;
  }
  .fm-hero-title-wrap {
    flex-shrink: 0;
    margin-top: 0.15rem !important;
  }
  .fm-hero-title {
    font-size: clamp(2rem, 11.5vw, 3.25rem) !important;
    line-height: 0.95;
  }
  /* Face in document flow between title and bottom bar */
  .fm-hero-media {
    position: relative !important;
    inset: auto !important;
    flex: 1 1 auto;
    min-height: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 5 !important;
    pointer-events: none;
    overflow: hidden;
  }
  .fm-hero-video {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    width: min(230px, 64vw) !important;
    max-height: 100%;
  }
  .fm-hero-video video {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(36svh, 260px);
    object-fit: contain;
  }
  /* Contact stack stays under the face */
  .fm-hero-bottom {
    flex-shrink: 0;
    position: relative;
    z-index: 20;
    padding-top: 0.15rem;
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
    gap: 0.5rem !important;
    background: linear-gradient(to top, #000 55%, rgba(0, 0, 0, 0.85) 85%, transparent);
  }
  .fm-hero-contact,
  #contact {
    width: min(188px, 50vw) !important;
    max-width: min(188px, 50vw) !important;
    align-items: flex-end !important;
  }
  #hero-biz-card-root {
    width: 100% !important;
    margin-inline-start: auto;
  }
  .fm-biz-card__face {
    padding: 8px 10px 7px !important;
  }
  .fm-biz-card__label {
    font-size: 0.55rem !important;
    margin-bottom: 3px !important;
  }
  .fm-biz-card__name {
    font-size: 0.8rem !important;
    margin-bottom: 3px !important;
  }
  .fm-biz-card__row {
    margin: 2px 0 !important;
    min-height: 20px !important;
    font-size: 0.65rem !important;
    gap: 6px !important;
  }
  .fm-biz-card__icon {
    width: 13px !important;
    height: 13px !important;
    flex-basis: 13px !important;
  }
  #contact a[href="#meet-me"],
  #contact > a,
  .fm-hero-contact a[href="#meet-me"] {
    min-height: 38px !important;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.08em !important;
  }
  .fm-role-line {
    max-width: min(118px, 30vw) !important;
    font-size: 0.68rem !important;
    line-height: 1.35 !important;
  }
  .fm-lang {
    width: 1.9rem;
    height: 1.9rem;
    font-size: 0.55rem;
  }
}

/* Meet Me CTA: no forced uppercase stretch in AR */
html[dir="rtl"] #contact a[href="#meet-me"],
html[dir="rtl"] .fm-hero-contact a {
  letter-spacing: 0.06em;
  text-transform: none;
  font-weight: 700;
}

/* ═══════════════ ABOUT ═══════════════ */
html[dir="rtl"] #about p {
  text-align: center;
  line-height: 1.85;
}
html[dir="rtl"] #about .hero-heading {
  text-transform: none;
  white-space: normal;
  font-size: clamp(2.5rem, 12vw, 8rem) !important;
}

/* ═══════════════ SKILLS ═══════════════ */
html[dir="rtl"] #services h2 {
  text-transform: none;
}
html[dir="rtl"] #services .sm\:flex-row {
  /* numbers on the right (start in RTL) — flex row already reverses */
}
html[dir="rtl"] #services [style*="text-align"] {
  text-align: start !important;
}
html[dir="rtl"] #services h3 {
  text-transform: none;
  letter-spacing: 0;
}
html[dir="rtl"] #services p {
  line-height: 1.75;
}

/* ═══════════════ ROAD ═══════════════ */
html[dir="rtl"] #road .rd-track {
  padding-left: 0;
  padding-right: 3.5rem;
}
@media (min-width: 640px) {
  html[dir="rtl"] #road .rd-track {
    padding-left: 0;
    padding-right: 4rem;
  }
}
html[dir="rtl"] #road .rd-spine {
  left: auto;
  right: 1.5rem;
  transform: translateX(50%);
}
@media (min-width: 640px) {
  html[dir="rtl"] #road .rd-spine {
    left: auto;
    right: 1.75rem;
  }
}
html[dir="rtl"] #road .rd-node {
  left: auto;
  right: -3.5rem;
}
@media (min-width: 640px) {
  html[dir="rtl"] #road .rd-node {
    left: auto;
    right: -4rem;
  }
}
html[dir="rtl"] #road .rd-title,
html[dir="rtl"] #road .rd-eyebrow {
  text-transform: none;
  text-align: start;
}
html[dir="rtl"] #road .rd-head {
  text-align: start;
}
html[dir="rtl"] #road .rd-card__head {
  flex-direction: row-reverse;
}
html[dir="rtl"] #road .rd-card__meta {
  flex-direction: row-reverse;
}
html[dir="rtl"] #road .rd-card__copy {
  text-align: start;
  direction: rtl;
}
html[dir="rtl"] #road .rd-card__aside {
  direction: rtl;
  text-align: start;
}
html[dir="rtl"] #road .rd-metric {
  text-align: start;
}
html[dir="rtl"] #road .rd-metric__label {
  letter-spacing: 0.04em;
  text-transform: none;
}
html[dir="rtl"] #road .rd-stage__head {
  flex-direction: row-reverse;
  text-align: start;
}
html[dir="rtl"] #road .rd-stage__title {
  text-transform: none;
}
html[dir="rtl"] #road .rd-stage__cap {
  text-align: start;
  direction: rtl;
}

/* ═══════════════ PROJECTS ═══════════════ */
html[dir="rtl"] #projects .hero-heading {
  text-transform: none;
  white-space: normal;
  font-size: clamp(2.2rem, 11vw, 8rem) !important;
  line-height: 1.1;
}
html[dir="rtl"] #projects > p,
html[dir="rtl"] #projects .fm-copy {
  letter-spacing: 0.06em;
  text-transform: none;
}
/* Card header: number + title + more btn */
html[dir="rtl"] #projects .sm\:flex-row {
  /* browser rtl handles row reverse of main flow when dir=rtl on html... 
     Tailwind flex-row does NOT auto-reverse; force logical order */
}
html[dir="rtl"] #projects .sticky > div:first-child {
  /* header row */
}
html[dir="rtl"] #projects .pw-more-btn {
  letter-spacing: 0.08em;
  text-transform: none;
}
html[dir="rtl"] #projects h3 {
  text-transform: none;
  letter-spacing: 0;
  text-align: start;
}

/* Image grid: keep visual hierarchy (big image on start side in RTL = right) */
html[dir="rtl"] #projects .flex.flex-1 {
  flex-direction: row-reverse;
}

/* Modal */
html[dir="rtl"] .pw-modal__chrome {
  flex-direction: row-reverse;
}
html[dir="rtl"] .pw-modal__chrome-left {
  flex-direction: row-reverse;
  text-align: start;
}
html[dir="rtl"] .pw-modal__chrome-actions {
  flex-direction: row-reverse;
}
html[dir="rtl"] .pw-modal__body {
  direction: rtl;
  text-align: start;
}
html[dir="rtl"] .pw-modal__tagline {
  max-width: none;
  text-align: start;
}
html[dir="rtl"] .pw-modal__lead,
html[dir="rtl"] .pw-modal__para {
  text-align: start;
  line-height: 1.8;
}
html[dir="rtl"] .pw-modal__progress {
  transform-origin: 100% 50%;
}
html[dir="rtl"] .pw-modal__metric-l {
  letter-spacing: 0.04em;
  text-transform: none;
}
html[dir="rtl"] .pw-modal__chapter-title {
  letter-spacing: 0.08em;
}
html[dir="rtl"] .pw-modal__gallery-label {
  letter-spacing: 0.1em;
  text-transform: none;
  text-align: start;
}
html[dir="rtl"] .pw-modal__footer {
  flex-direction: row-reverse;
  justify-content: flex-start;
}
html[dir="rtl"] .pw-modal__cta {
  letter-spacing: 0.06em;
  text-transform: none;
}
html[dir="rtl"] .pw-lightbox__close {
  right: auto;
  left: max(0.75rem, env(safe-area-inset-left));
}
html[dir="rtl"] .pw-modal__hero-cue {
  right: auto;
  left: 0.75rem;
}
html[dir="rtl"] .pw-img-cue {
  letter-spacing: 0.08em;
  text-transform: none;
}

/* ═══════════════ MEET MODAL ═══════════════ */
html[dir="rtl"] #fm-meet-root,
html[dir="rtl"] .fm-meet,
html[dir="rtl"] [class*="fm-meet"] {
  direction: rtl;
  text-align: start;
  font-family: "Cairo", "Kanit", system-ui, sans-serif;
}
html[dir="rtl"] .fm-meet label,
html[dir="rtl"] .fm-meet input,
html[dir="rtl"] .fm-meet button,
html[dir="rtl"] .fm-meet h2 {
  font-family: "Cairo", "Kanit", system-ui, sans-serif;
  letter-spacing: 0;
}

/* ═══════════════ GENERAL ═══════════════ */
html[dir="rtl"] {
  text-align: start;
}
html[dir="rtl"] body {
  line-height: 1.65;
}

@media (prefers-reduced-motion: reduce) {
  .fm-lang { transition: none; }
  .fm-lang:hover { transform: none; }
}


/* ── Marquee ──
   Desktop/tablet (≥640px): scroll-down parallax (original)
   Phone (<640px only): manual swipe left/right
*/
.fm-mq__row {
  width: 100%;
  overflow: visible;
}
.fm-mq__track {
  width: max-content;
}

/* Desktop / big screens: keep original overflow clip + JS transform */
@media (min-width: 640px) {
  .fm-mq {
    overflow: hidden !important;
  }
  .fm-mq__row {
    overflow: visible !important;
    touch-action: auto;
    scroll-snap-type: none;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    padding-inline: 0;
    cursor: default;
  }
  .fm-mq__track {
    will-change: transform;
  }
  .fm-mq-item {
    width: 420px !important;
    height: 270px !important;
    scroll-snap-align: none;
    pointer-events: auto;
  }
}

/* Phone only — NOT tablets in landscape / touch laptops */
@media (max-width: 639.98px) {
  .fm-mq {
    overflow: visible;
  }
  .fm-mq__row {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    padding-inline: 1rem;
    cursor: grab;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }
  .fm-mq__row::-webkit-scrollbar {
    display: none;
  }
  .fm-mq__track {
    transform: none !important;
    will-change: auto;
    padding-inline-end: 1rem;
  }
  .fm-mq-item {
    width: 280px !important;
    height: 200px !important;
    scroll-snap-align: start;
    pointer-events: none;
  }
}

/* JS class (same phone breakpoint) */
.fm-mq--phone .fm-mq__row {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding-inline: 1rem;
}
.fm-mq--phone .fm-mq__row::-webkit-scrollbar { display: none; }
.fm-mq--phone .fm-mq__track {
  transform: none !important;
  will-change: auto;
}
.fm-mq--phone .fm-mq-item {
  width: 280px !important;
  height: 200px !important;
  scroll-snap-align: start;
  pointer-events: none;
}
