/**
 * Accueil V3 arabe (/ar/, DCT-0014) — surcharges RTL et typographie arabe de home-v3.css.
 *
 * Chargée UNIQUEMENT sur l'accueil arabe (functions.php, bloc « AR / RTL assets » : doctiva_is_arabic_locale()
 * et doctiva-home-v3 mis en file), après home-v3.css et rtl-overrides.css. home-v3.css (FR en production) n'est
 * pas modifiée. Sélecteurs préfixés html[dir="rtl"] .doctiva-home-v3 : spécificité toujours supérieure aux règles FR.
 *
 * Principes :
 *  - grilles et flex se retournent seuls avec dir="rtl" : jamais row-reverse ; seules les propriétés physiques
 *    (left/right, padding-left, background-position, translateX, dégradés orientés) sont corrigées, en propriétés
 *    logiques quand elles existent (inset-inline-*, padding-inline, margin-inline) ;
 *  - flèches : retournées par rtl-overrides.css (« scale: -1 1 », composée avec les transform des survols et de
 *    la rotation de l'offre) : aucune surcharge ici ;
 *  - jamais retournées : carte du Maroc, captures, loupe, coche, symbole Doctiva, icônes ;
 *  - typographie arabe : espacement des lettres 0, pas de capitales ni d'italique, interlignage du texte 1.75-1.8,
 *    titres ≥ 1.25, graisses 750/800 ramenées à 700, petits textes 12 → 13 px et 14 → 15 px.
 * Repères « (n) » : tableau §1.1 de l'analyse RTL DCT-0014 (analyse-4-rtl.md).
 */

/* ---------- Polices : arabe d'abord (Readex Pro « Doctiva Arabic » si présente), latin et chiffres en Inter / Manrope ---------- */
html[dir="rtl"] .doctiva-home-v3 {
  --v3-display: 'Doctiva Arabic', 'Doctiva Home Manrope', 'IBM Plex Sans Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  font-family: 'Doctiva Arabic', 'Doctiva Home Inter', 'IBM Plex Sans Arabic', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  line-height: 1.75;
  font-synthesis: none;
}
html[dir="rtl"] .doctiva-home-v3 .v3-offer__group h4 span { font-family: inherit; }

/* ---------- Typographie arabe ---------- */
html[dir="rtl"] .doctiva-home-v3 :is(h1, h2, h3, h4, .v3-chip, .v3-profile__initials, .v3-offer__amount, .v3-btn, .v3-link, summary) {
  letter-spacing: 0;
  text-transform: none;
}
html[dir="rtl"] .doctiva-home-v3 :is(em, i, cite, blockquote) { font-style: normal; }
html[dir="rtl"] .doctiva-home-v3 h2 { font-weight: 700; line-height: 1.35; }
html[dir="rtl"] .doctiva-home-v3 h3 { line-height: 1.4; }
html[dir="rtl"] .doctiva-home-v3 h4 { line-height: 1.45; }
html[dir="rtl"] .doctiva-home-v3 .v3-hero__title { max-width: 14em; font-weight: 700; line-height: 1.3; }
html[dir="rtl"] .doctiva-home-v3 :is(.v3-lead, .v3-hero__lead, .v3-hero__coverage, .v3-service__text, .v3-trust__item p, .v3-points li, .v3-offer__group li, .v3-faq__item p, .v3-program__faq dd, .v3-contact__intro) { line-height: 1.8; }
html[dir="rtl"] .doctiva-home-v3 :is(.v3-service__name, .v3-clinic h3, .v3-offer__name, .v3-contact h3) { font-weight: 700; line-height: 1.35; }
html[dir="rtl"] .doctiva-home-v3 .v3-city__name { font-weight: 700; line-height: 1.25; }
html[dir="rtl"] .doctiva-home-v3 .v3-profile__initials { font-weight: 700; font-size: 22px; }
html[dir="rtl"] .doctiva-home-v3 .v3-offer__amount { font-weight: 700; line-height: 1.2; }
html[dir="rtl"] .doctiva-home-v3 .v3-offer__group strong { font-weight: 600; }
html[dir="rtl"] .doctiva-home-v3 .v3-faq__item summary { line-height: 1.6; }

/* Petits textes : 12 → 13 px, 14 → 15 px (lisibilité de l'arabe, points et hampes) */
html[dir="rtl"] .doctiva-home-v3 :is(.v3-field__label, .v3-search__help, .autosuggest-group-title, .lead-form__legal) { font-size: 13px; line-height: 1.5; }
html[dir="rtl"] .doctiva-home-v3 :is(.v3-note, .autosuggest-empty, .v3-profile__verified, .v3-stage figcaption, .v3-offer__promo, .v3-offer__until, .v3-offer__note, .v3-offer__action p, .v3-offer__group h4 span, .v3-offer__steps span, .v3-offer__small, .v3-contact__steps, .lead-form__label, .lead-form__help, .lead-form__error, .lead-form__error--global, .lead-form__patient, .v3-mobilebar__context) { font-size: 15px; }
html[dir="rtl"] .doctiva-home-v3 :is(.v3-note, .v3-stage figcaption, .v3-offer__action p, .v3-offer__small, .v3-contact__steps, .lead-form__help, .lead-form__error, .lead-form__patient) { line-height: 1.7; }

/* ---------- 1. Premier écran ---------- */
/* (1) Halo du côté de la carte, passée à gauche */
html[dir="rtl"] .doctiva-home-v3 .v3-hero::before {
  background: radial-gradient(55% 65% at 22% 46%, rgba(37, 99, 235, .30), rgba(37, 99, 235, 0) 70%);
}
/* (11) Espace entre le lien « Vous êtes médecin ? » et sa flèche */
html[dir="rtl"] .doctiva-home-v3 .v3-hero__doctor .hs-arrow { margin-inline: 6px 0; }

/* Recherche : (3) étiquettes, (4) réserve du chevron, (5) chevron, (6-8) champ nom et loupe */
html[dir="rtl"] .doctiva-home-v3 .v3-field__label { inset-inline: 14px auto; }
html[dir="rtl"] .doctiva-home-v3 .v3-field .v3-field__control { padding-inline: 14px 30px; }
html[dir="rtl"] .doctiva-home-v3 select.v3-field__control { background-position: left 10px center; }
html[dir="rtl"] .doctiva-home-v3 .v3-field--name .v3-field__label { inset-inline: 40px auto; }
html[dir="rtl"] .doctiva-home-v3 .v3-field--name .v3-field__control { padding-inline: 40px 14px; }
html[dir="rtl"] .doctiva-home-v3 .v3-search__icon { inset-inline: 14px auto; }

/* Suggestions : (9) animation depuis le coin de départ, (10) liseré de sélection du côté du début de ligne */
html[dir="rtl"] .doctiva-home-v3 .autosuggest-results { transform-origin: top right; }
html[dir="rtl"] .doctiva-home-v3 .autosuggest-item--active { box-shadow: inset -3px 0 0 var(--v3-focus); }
/* Surlignage par mot entier (autosuggest.js) : couleur et graisse sur le mot complet, liaisons conservées */
html[dir="rtl"] .doctiva-home-v3 .autosuggest-item strong { font-weight: 600; }

/* ---------- Puces : (12-13) listes communes, (14-15) groupes de l'offre ---------- */
html[dir="rtl"] .doctiva-home-v3 .v3-points li { padding-inline: 22px 0; }
html[dir="rtl"] .doctiva-home-v3 .v3-offer__group li { padding-inline: 22px 0; }
html[dir="rtl"] .doctiva-home-v3 :is(.v3-points, .v3-offer__group) li::before { inset-inline: 2px auto; }

/* ---------- 3. Annuaire : (16) soulignement des villes qui pousse depuis le début de ligne ---------- */
html[dir="rtl"] .doctiva-home-v3 .v3-dir .v3-city__name a { background-position: 100% 100%; }

/* ---------- 6. Cabinets : capture Doctiva Pro (interface FR en LTR) ouverte sur son bord gauche ---------- */
/* Sous 600 px, l'écran défile horizontalement : en RTL il s'ouvrirait sur le bord droit de la capture (onglets
   masqués). La zone défilante reste en LTR ; la légende (figcaption, hors de la zone) reste en RTL. */
html[dir="rtl"] .doctiva-home-v3 .v3-stage__screen { direction: ltr; }

/* ---------- 7. Formulaire : (19) chevron de la liste des spécialités ---------- */
html[dir="rtl"] .doctiva-home-v3 .lead-form__select {
  padding-inline: 14px 40px;
  background-position: left 14px center;
}
/* Pot de miel du formulaire (inc/class-lead-medecin.php, style en ligne « left:-9999px ») : en RTL, un débordement
   à gauche élargit la zone défilable (body.scrollWidth 11 256 px à 1440, captures pleine page de 10 000 px de large).
   Déplacé hors champ du côté de fin de ligne (droite), qui ne crée pas de défilement en RTL. Reste invisible et hors tabulation. */
html[dir="rtl"] .doctiva-home-v3 .lead-form div[aria-hidden="true"][style*="-9999px"] { left: auto !important; right: -9999px; }
/* Téléphone en LTR isolé (règle générale de rtl-overrides.css), aligné sur le début de ligne arabe */
html[dir="rtl"] .doctiva-home-v3 .lead-form input[type="tel"] { direction: ltr; unicode-bidi: isolate; text-align: right; }

/* ---------- Barre cabinets mobile : jamais de débordement (libellés arabes plus longs) ---------- */
html[dir="rtl"] .doctiva-home-v3 .v3-mobilebar__context { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 479px) {
  html[dir="rtl"] .doctiva-home-v3 .v3-mobilebar__context { display: none; }
  html[dir="rtl"] .doctiva-home-v3 .v3-mobilebar__button { flex: 1 1 auto; min-width: 0; }
}
@media (max-width: 359px) {
  html[dir="rtl"] .doctiva-home-v3 .v3-mobilebar__button { white-space: normal; text-align: center; }
  html[dir="rtl"] .doctiva-home-v3 .v3-btn { max-width: 100%; white-space: normal; }
  html[dir="rtl"] .doctiva-home-v3 .v3-hero__title { font-size: 1.875rem; }
  html[dir="rtl"] .doctiva-home-v3 .v3-city__name { font-size: 2rem; }
}

/* ---------- Mises en page larges ---------- */
@media (min-width: 900px) {
  /* (2) Carte jusqu'au bord gauche (colonne de gauche en RTL), jamais sous le panneau de recherche */
  html[dir="rtl"] .doctiva-home-v3 .v3-hero__art {
    margin: 0 0 0 calc((min(1152px, 100vw - 2 * var(--v3-gutter)) - 100vw) / 2 + 24px);
  }
  /* (17-18) Motif réseau des services : le trait part du début de ligne (droite) et s'estompe vers la gauche */
  html[dir="rtl"] .doctiva-home-v3 .v3-services__list::before {
    right: 24px;
    left: 0;
    background: linear-gradient(270deg, rgba(6, 182, 212, .55), rgba(6, 182, 212, .35) 70%, rgba(6, 182, 212, 0));
  }
  html[dir="rtl"] .doctiva-home-v3 .v3-service::before { right: 20px; left: auto; }
}

/* ---------- Mouvement : (20) les villes entrent dans le sens de lecture (depuis la droite) ---------- */
html[dir="rtl"].v3-io .doctiva-home-v3 .v3-city[data-v3-reveal]:not(.is-in) { transform: translateX(24px); }
@media (prefers-reduced-motion: reduce) {
  html[dir="rtl"].v3-io .doctiva-home-v3 .v3-city[data-v3-reveal]:not(.is-in) { transform: none; }
}
