/* ============================================================
   MANTOUVERT — INTERNATIONALIZATION (i18n) STYLES
   Language switcher + RTL (Arabic) support
   ============================================================ */

/* Prevent horizontal overflow globally — the slide-in reveal
   animations and splash letters translate elements off-screen,
   which can create unwanted horizontal scrollbars. */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* --------------------------------------------
   Language Switcher — fixed top-right of header
   -------------------------------------------- */
.lang-switcher {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(17, 17, 17, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(245, 242, 237, 0.18);
  border-radius: 40px;
  font-family: var(--font-body);
}

.site-header.is-scrolled .lang-switcher,
.site-header.is-on-light .lang-switcher {
  background: rgba(17, 17, 17, 0.35);
  border-color: rgba(245, 242, 237, 0.3);
}

.lang-switcher__btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(245, 242, 237, 0.6);
  border-radius: 30px;
  cursor: pointer;
  transition:
    color var(--duration-fast) var(--ease),
    background-color var(--duration-fast) var(--ease);
}

.lang-switcher__btn:hover {
  color: var(--color-white);
}

.lang-switcher__btn.is-active {
  color: var(--color-white);
  background-color: var(--color-orange);
}

/* --------------------------------------------
   Slide-in Reveal Animations — text slides in
   from the left or right as it enters the viewport.
   JS adds `.is-visible` via IntersectionObserver.
   -------------------------------------------- */
.reveal {
  opacity: 0;
  transition:
    opacity 0.7s var(--ease),
    transform 0.7s var(--ease);
  will-change: opacity, transform;
}

.reveal[data-dir='left'] {
  transform: translateX(-60px);
}

.reveal[data-dir='right'] {
  transform: translateX(60px);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* --------------------------------------------
   WhatsApp floating button
   -------------------------------------------- */
.whatsapp-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #25d366;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition:
    transform var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

.whatsapp-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

/* Legal links in the footer */
.mega-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 32px;
}

.mega-footer__legal a {
  font-size: var(--type-small);
  letter-spacing: 0.08em;
  color: rgba(245, 242, 237, 0.7);
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  transition:
    color var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease);
}

.mega-footer__legal a:hover {
  color: var(--color-orange);
  border-bottom-color: var(--color-orange);
}

html[dir='rtl'] .whatsapp-btn {
  right: auto;
  left: 24px;
}

@media (max-width: 768px) {
  .whatsapp-btn {
    right: 16px;
    bottom: 16px;
    width: 54px;
    height: 54px;
  }
  html[dir='rtl'] .whatsapp-btn {
    right: auto;
    left: 16px;
  }
}

/* --------------------------------------------
   Contact form status message (Formspree feedback)
   -------------------------------------------- */
.contact-form__status {
  margin-top: 24px;
  padding: 16px 20px;
  font-family: var(--font-body);
  font-size: var(--type-small);
  letter-spacing: 0.02em;
  border-radius: 4px;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity var(--duration-fast) var(--ease),
    transform var(--duration-fast) var(--ease);
}

.contact-form__status:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
}

.contact-form__status.is-success {
  color: #2f6b3a;
  background-color: rgba(47, 107, 58, 0.08);
  border: 1px solid rgba(47, 107, 58, 0.3);
}

.contact-form__status.is-error {
  color: var(--color-brick);
  background-color: rgba(143, 53, 38, 0.08);
  border: 1px solid rgba(143, 53, 38, 0.3);
}

/* --------------------------------------------
   RTL (Arabic) — flip layout direction
   The site uses logical properties (margin-inline,
   padding-inline) so most layouts flip automatically.
   These overrides handle remaining text-align cases.
   -------------------------------------------- */
html[dir='rtl'] body,
html[dir='rtl'] .container,
html[dir='rtl'] section,
html[dir='rtl'] .hero,
html[dir='rtl'] main,
html[dir='rtl'] footer,
html[dir='rtl'] header {
  text-align: right;
  direction: rtl;
}

html[dir='rtl'] .lang-switcher {
  right: auto;
  left: 24px;
}

/* Nav menu links align right in RTL */
html[dir='rtl'] .nav__links {
  text-align: center;
}

/* Buttons and facts list keep left alignment text but flip content
   direction so icons/arrows appear on the correct side. */
html[dir='rtl'] .btn,
html[dir='rtl'] .project-card__title,
html[dir='rtl'] .project-card__meta,
html[dir='rtl'] .intro__title,
html[dir='rtl'] .section-head__title {
  text-align: right;
}

/* Editorial spread intro columns */
html[dir='rtl'] .editorial-spread__intro-cols {
  text-align: right;
}

/* Services list items */
html[dir='rtl'] .services__item a {
  flex-direction: row-reverse;
  text-align: right;
}

/* Contact form fields */
html[dir='rtl'] .contact-form label,
html[dir='rtl'] .contact-form input,
html[dir='rtl'] .contact-form select,
html[dir='rtl'] .contact-form textarea {
  text-align: right;
}

/* --------------------------------------------
   Arabic Typography — use a suitable fallback
   stack for Arabic glyphs while keeping the
   luxury editorial serif feel via Tahoma/Segoe.
   -------------------------------------------- */
html[dir='rtl'] {
  --font-display: 'Monic DEMO', 'Times New Roman', 'Segoe UI', Tahoma, Arial, serif;
  --font-secondary: 'Ethereal Demo', Georgia, 'Segoe UI', Tahoma, Arial, serif;
  --font-body: 'Inter', 'General Sans', 'Segoe UI', Tahoma, -apple-system, sans-serif;
}

html[dir='rtl'] h1,
html[dir='rtl'] h2,
html[dir='rtl'] h3,
html[dir='rtl'] h4,
html[dir='rtl'] .hero__title,
html[dir='rtl'] .intro__title,
html[dir='rtl'] .craftsmanship__title,
html[dir='rtl'] .project-card__title {
  letter-spacing: 0;
}

/* Prevent uppercase transforms on Arabic (they don't apply) */
html[dir='rtl'] h1,
html[dir='rtl'] .hero__title,
html[dir='rtl'] .intro__eyebrow,
html[dir='rtl'] .section-head__eyebrow,
html[dir='rtl'] .btn,
html[dir='rtl'] .nav__link--cta,
html[dir='rtl'] .project-card__meta,
html[dir='rtl'] .mega-footer__bottom {
  text-transform: none;
}

/* --------------------------------------------
   Responsive — position switcher + hero title
   on mobile. The default hero uses
   clamp(80px, 12vw, 180px), whose 80px floor
   overflows small screens — especially for
   French/Arabic titles like "L'ENTREPRISE".
   -------------------------------------------- */
@media (max-width: 768px) {
  .lang-switcher {
    top: 14px;
    right: 16px;
  }
  html[dir='rtl'] .lang-switcher {
    right: auto;
    left: 16px;
  }
  .lang-switcher__btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Responsive hero title on every page hero */
  .hero__title,
  html[dir='rtl'] .hero__title {
    font-size: clamp(34px, 9.5vw, 64px);
    line-height: 1.05;
    word-break: break-word;
    hyphens: auto;
  }

  .hero--page .hero__title {
    font-size: clamp(30px, 9vw, 56px);
  }

  /* Keep the fancy display font on Arabic but shrink it more
     since Arabic headings are taller per line */
  html[dir='rtl'] .hero--page .hero__title {
    font-size: clamp(28px, 8.5vw, 52px);
    letter-spacing: 0;
    line-height: 1.3;
  }
}

/* Extra small phones */
@media (max-width: 480px) {
  .hero__title,
  html[dir='rtl'] .hero__title {
    font-size: clamp(28px, 10vw, 44px);
  }

  .hero--page .hero__title {
    font-size: clamp(24px, 9.5vw, 40px);
  }

  html[dir='rtl'] .hero--page .hero__title {
    font-size: clamp(22px, 9vw, 38px);
    line-height: 1.35;
  }
}
