/* ==========================================================================
   TOLACIER — polish.css  ·  v1.1 · octobre 2026 (menu ☰ jusqu'à 1199 px)
   --------------------------------------------------------------------------
   Couche ADDITIVE, chargée APRÈS style.css. Elle ne remplace rien :
   si ce fichier manque, le site garde son apparence d'origine.

   Principes appliqués (interfaces « fluides » façon Apple) :
     • Réponse immédiate à l'appui (pas seulement au survol)
     • Matériau translucide pour l'en-tête, séparation douce au défilement
     • Menu mobile qui part du bouton ☰ et y retourne, interruptible
     • Typographie arabe dédiée, sans approche (letter-spacing) parasite
     • Préférences système respectées : mouvement réduit, transparence
       réduite, contraste élevé

   Sommaire
     1.  Robustesse (sans JS, ancres sous l'en-tête)
     2.  En-tête — matériau translucide
     3.  Menu mobile — ancré au bouton, interruptible
     4.  Sélecteur de langue — libellés texte
     5.  Retour tactile à l'appui / survol réservé à la souris
     6.  Cartes produits de l'accueil — carte entière cliquable
     7.  Focus clavier visible
     8.  Lien de la page courante
     9.  Apparitions au défilement — courbe et cascade
     10. Formulaires — erreurs en ligne, bouton « Envoi… »
     11. Page 404
     12. Arabe — typographie et sens de lecture
     13. Préférences d'accessibilité
   ========================================================================== */

:root {
  --tl-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);   /* sortie douce, sans rebond */
  --tl-header-h: 76px;
  --tl-error: #B42318;
}


/* 1. ROBUSTESSE ------------------------------------------------------------ */

/* Sans JavaScript (ou si main.js ne charge pas), rien ne doit rester
   invisible : les blocs .fade-up ne sont masqués que si le JS tourne. */
html:not(.js) .fade-up {
  opacity: 1;
  transform: none;
}

/* Les liens d'ancre (products.html#tubes…) ne finissent plus cachés
   sous l'en-tête collant. */
html { scroll-padding-top: calc(var(--tl-header-h) + 16px); }


/* 2. EN-TÊTE — MATÉRIAU TRANSLUCIDE ----------------------------------------- */

.site-header {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* Tout en haut de page : pas de filet. Le séparateur n'apparaît que
   lorsque du contenu passe réellement sous l'en-tête. */
.site-header.is-at-top {
  border-bottom-color: transparent;
}
.site-header:not(.is-at-top) {
  box-shadow: 0 10px 28px -22px rgba(10, 14, 26, 0.45);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header { background: rgba(255, 255, 255, 0.97); }
}


/* 3. MENU MOBILE — ANCRÉ AU BOUTON, INTERRUPTIBLE ---------------------------- */

@media (max-width: 1199px) {
  /* style.css passe de display:none à display:flex : aucune animation
     possible. On garde le panneau en place et on anime opacité + échelle
     depuis le coin du bouton ☰. Une transition CSS repart toujours de
     l'état affiché : un second appui en cours d'animation l'inverse
     sans saut. */
  .nav__list {
    display: flex;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    pointer-events: none;
    max-height: calc(100vh - var(--tl-header-h));
    max-height: calc(100dvh - var(--tl-header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    transition:
      opacity 0.16s ease,
      transform 0.22s var(--tl-ease-out),
      visibility 0s linear 0.22s;
  }
  .nav__list.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition:
      opacity 0.18s ease,
      transform 0.32s var(--tl-ease-out),
      visibility 0s;
  }
  html[dir="rtl"] .nav__list { transform-origin: top left; }

  /* Zone tactile du bouton ☰ agrandie à ~46 px sans prendre de place
     dans l'en-tête */
  .nav-toggle { position: relative; }
  .nav-toggle::before {
    content: "";
    position: absolute;
    inset: -6px;
  }

  /* En-tête mobile : écarts resserrés pour que logo + ☰ + langues
     tiennent dès 360 px de large */
  .site-header__inner { gap: var(--space-3); }
}

/* Voile derrière le menu ouvert (créé par polish.js). Un appui dessus
   referme le menu. */
.tl-scrim {
  position: fixed;
  inset: 0;
  z-index: 99;                       /* juste sous l'en-tête (100) */
  background: rgba(10, 14, 26, 0.32);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
html.tl-nav-open .tl-scrim {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.22s ease, visibility 0s;
}
html.tl-nav-open,
html.tl-nav-open body { overflow: hidden; }

/* 3b. Tablette et petit portable (769–1199 px) : menu ☰ aussi.
   Logo + 5 liens + bouton devis + langues demandent ~1 140 px en
   français : en dessous, l'en-tête débordait et la page défilait de
   côté. style.css ne prévoit le menu ☰ que jusqu'à 768 px ; on reprend
   ici ses règles mobiles pour cette plage. */
@media (min-width: 769px) and (max-width: 1199px) {
  /* Logo à gauche ; langues + ☰ groupés à droite (à gauche en arabe) */
  .site-header__inner > .nav { order: 3; }
  .site-header__inner > .lang-switch { margin-inline-start: auto; }
  .nav-toggle { display: flex; }

  /* Panneau en carte, ancré sous le bouton ☰ : il s'ouvre depuis le
     bouton (transform-origin défini plus haut) */
  .nav__list {
    position: fixed;
    top: 72px;
    right: clamp(1.25rem, 4vw, 2.5rem);
    left: auto;
    width: 340px;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-4) var(--space-5) var(--space-5);
    gap: 0;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
  }
  html[dir="rtl"] .nav__list {
    right: auto;
    left: clamp(1.25rem, 4vw, 2.5rem);
  }
  .nav__link {
    display: block;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 1.05rem;
  }
  .nav__list .btn {
    width: 100%;
    justify-content: center;
    margin-top: var(--space-4);
  }

  /* polish.js n'active le voile qu'en dessous de 768 px : :has() prend
     le relais dans cette plage */
  html:has(.nav__list.is-open) .tl-scrim {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.22s ease, visibility 0s;
  }
  html:has(.nav__list.is-open),
  html:has(.nav__list.is-open) body { overflow: hidden; }
}

@media (min-width: 1200px) {
  .tl-scrim { display: none; }
  /* Menu complet : chaque lien reste sur une ligne (« À propos ») */
  .nav__link,
  .nav__list .btn { white-space: nowrap; }
}


/* 4. SÉLECTEUR DE LANGUE — LIBELLÉS TEXTE ------------------------------------ */

/* Les drapeaux s'affichent en lettres « FR GB DZ » sous Windows, et un
   drapeau désigne un pays, pas une langue. On affiche FR · EN · عربي. */
.lang-switch__btn {
  position: relative;
  width: auto;
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--navy-900);
  opacity: 0.62;
  -webkit-tap-highlight-color: transparent;
}
.lang-switch__btn[lang="ar"] {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}
.lang-switch__btn.is-active {
  opacity: 1;
  transform: none;
}
/* Zone de toucher agrandie sans changer le dessin */
.lang-switch__btn::after {
  content: "";
  position: absolute;
  inset: -7px -2px;
}

@media (max-width: 768px) {
  .lang-switch { gap: 2px; margin-left: 0; }
  .lang-switch__btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    font-size: 10.5px;
    letter-spacing: 0.02em;
  }
  .lang-switch__btn[lang="ar"] { font-size: 12px; }
}


/* 5. RETOUR TACTILE À L'APPUI / SURVOL RÉSERVÉ À LA SOURIS ------------------- */

.btn,
.filter-btn,
.nav-toggle,
.product-card__cta {
  -webkit-tap-highlight-color: transparent;
}

/* L'appui répond tout de suite (70 ms) ; le relâchement revient à la
   vitesse normale du bouton. */
.btn:active:not([aria-busy="true"]) {
  transform: scale(0.97);
  transition-duration: 70ms;
}
.filter-btn:active,
.lang-switch__btn:active,
.nav-toggle:active {
  transform: scale(0.94);
  transition-duration: 70ms;
}

/* Sur écran tactile, :hover « colle » après un appui : le bouton reste
   soulevé ou inversé. On neutralise ces états là où il n'y a pas de
   souris. */
@media (hover: none) {
  .btn-primary:hover { background: var(--lime); border-color: var(--lime); transform: none; box-shadow: none; }
  .btn-dark:hover { background: var(--navy-900); border-color: var(--navy-900); transform: none; }
  .btn-whatsapp:hover { background: #25D366; border-color: #25D366; transform: none; }
  .btn-outline:hover { background: transparent; color: var(--navy-900); }
  .btn-outline--light:hover { background: transparent; color: var(--white); border-color: rgba(255, 255, 255, 0.3); }
  .btn:hover .btn__arrow { transform: none; }

  .product-card:hover { transform: none; box-shadow: none; border-color: var(--border-light); }
  .product-card:hover .product-card__cta::after { transform: none; }
  .service-card:hover { box-shadow: none; border-color: var(--border-light); }
  .service-card:hover::before { transform: scaleX(0); }
  .lang-switch__btn:hover { background: transparent; }
  .lang-switch__btn.is-active:hover { background: var(--lime); }
}


/* 6. CARTES PRODUITS DE L'ACCUEIL — CARTE ENTIÈRE CLIQUABLE ------------------ */

/* Sur téléphone, viser le petit lien « Voir le détail » est pénible :
   toute la carte devient la zone de clic (le lien reste unique pour les
   lecteurs d'écran). Classe ajoutée uniquement aux 6 cartes de l'accueil. */
.product-card--link { cursor: pointer; }
.product-card--link .product-card__cta { position: static; }
.product-card--link .product-card__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.product-card--link:active {
  transform: scale(0.985);
  transition-duration: 80ms;
}
.product-card--link:has(.product-card__cta:focus-visible) {
  outline: 2px solid var(--navy-900);
  outline-offset: 3px;
}
.product-card--link .product-card__cta:focus-visible { outline: none; }


/* 7. FOCUS CLAVIER VISIBLE --------------------------------------------------- */

/* currentColor : l'anneau prend la couleur du texte, donc il contraste
   toujours avec le fond (clair ou marine). */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}
.btn:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 3px; }
:where(.hero, .cta-band, .site-footer) .btn:focus-visible { outline-color: var(--lime); }


/* 8. LIEN DE LA PAGE COURANTE ------------------------------------------------- */

/* Même rendu que .is-active de main.js, mais posé aussi par polish.js
   (aria-current) — l'onglet courant reste marqué même si main.js manque. */
.nav__link[aria-current="page"] { color: var(--navy-900); }
.nav__link[aria-current="page"]::after { width: 100%; }


/* 9. APPARITIONS AU DÉFILEMENT — COURBE ET CASCADE ---------------------------- */

/* Courbe de sortie douce + léger décalage entre cartes voisines
   (--tl-delay, posé par polish.js, retiré une fois l'apparition finie). */
.fade-up {
  transition-timing-function: var(--tl-ease-out);
  transition-delay: var(--tl-delay, 0ms);
}

/* Une fois apparues, les cartes retrouvent une réponse rapide au survol
   (sinon le survol hérite des 0,7 s de l'apparition). */
.fade-up.tl-revealed {
  transition:
    transform 0.28s var(--tl-ease-out),
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background-color 0.28s ease,
    opacity 0.28s ease;
}

/* La bande défilante s'arrête quand elle n'est pas à l'écran. */
.marquee-band.is-paused .marquee-band__track { animation-play-state: paused; }


/* 10. FORMULAIRES — ERREURS EN LIGNE, BOUTON « ENVOI… » ------------------------ */

.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"],
.form-textarea[aria-invalid="true"] {
  border-color: var(--tl-error);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.tl-field-error {
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--tl-error);
}

.btn[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.85;
}
.tl-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tl-spin 0.7s linear infinite;
}
@keyframes tl-spin { to { transform: rotate(360deg); } }

/* Champ anti-spam : masqué par découpage (et non par left:-9999px, qui
   crée un défilement horizontal en arabe / RTL). */
.tl-hp {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* 11. PAGE 404 ------------------------------------------------------------------ */

.tl-404 .hero__title { max-width: 16ch; }
.tl-404__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
}
.tl-404__links a {
  color: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 2px;
}
.tl-404__links a:hover { color: var(--lime); border-color: var(--lime); }


/* 12. ARABE — TYPOGRAPHIE ET SENS DE LECTURE ------------------------------------ */

/* Manrope et Archivo Black n'ont pas de lettres arabes : le navigateur
   prenait n'importe quelle police système. On charge Noto Sans Arabic
   (téléchargée seulement quand du texte arabe s'affiche) et on la place
   juste après la police latine : le latin (TOLACIER, références) garde
   sa police, l'arabe prend Noto. */
html[lang="ar"] {
  --font-body: 'Manrope', 'Noto Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-display: 'Archivo Black', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  /* Libellés « techniques » (sur-titres, badges, sous-titre du logo) :
     sans cela l'arabe tombe sur Courier New → lettres détachées */
  --font-mono: 'JetBrains Mono', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

/* L'espacement entre lettres casse la liaison des lettres arabes :
   on le met à zéro partout (sauf le logotype latin). */
html[lang="ar"] body *:not(.brand__name):not(.footer-brand-name) {
  letter-spacing: 0 !important;
}

/* Titres : vraie graisse arabe, pas d'italique ni de capitales simulées,
   interlignage adapté aux hampes arabes. font-synthesis:none empêche le
   navigateur de « grossir » artificiellement Archivo Black. */
html[lang="ar"] :is(h1, h2, h3, .hero__title, .section-title, .cta-band__title,
  .feature-callout__title, .product-card__title, .service-card__title,
  .process-step__title, .display-3, .marquee-band__track) {
  font-style: normal;
  font-weight: 800;
  font-synthesis: none;
  text-transform: none;
}
html[lang="ar"] .hero__title { line-height: 1.25; }
html[lang="ar"] :is(h2, h3, .cta-band__title, .feature-callout__title) { line-height: 1.35 !important; }
html[lang="ar"] body { line-height: 1.75; }

/* Chiffres « +7 », « 10+ », « −8 % » : gardés dans l'ordre latin
   (sinon l'arabe affiche « 7+ ») */
[dir="rtl"] :is(.hero__meta-value, .feature-callout__metric-value) {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: right;
}

/* Les flèches → doivent pointer dans le sens de lecture (vers la gauche)
   et glisser vers la gauche au survol. */
[dir="rtl"] .btn__arrow { transform: scaleX(-1); }
@media (hover: hover) {
  [dir="rtl"] .btn:hover .btn__arrow { transform: scaleX(-1) translateX(4px); }
  [dir="rtl"] .product-card:hover .product-card__cta::after { transform: scaleX(-1) translateX(4px); }
}


/* 13. PRÉFÉRENCES D'ACCESSIBILITÉ ------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  /* Bande défilante figée */
  .marquee-band__track { animation: none; transform: none; }

  /* Apparitions : simple fondu, sans glissement ni cascade */
  .fade-up {
    transform: none !important;
    transition: opacity 0.3s linear !important;
  }

  /* Pas de soulèvement au survol ni d'échelle à l'appui : on garde un
     léger assombrissement comme retour */
  .btn:hover, .btn-primary:hover, .btn-dark:hover, .btn-whatsapp:hover,
  .product-card:hover, .product-card--link:active { transform: none; }
  .btn:hover .btn__arrow { transform: none; }
  [dir="rtl"] .btn__arrow,
  [dir="rtl"] .btn:hover .btn__arrow { transform: scaleX(-1); }
  .btn:active:not([aria-busy="true"]),
  .filter-btn:active, .lang-switch__btn:active, .nav-toggle:active {
    transform: none;
    filter: brightness(0.93);
  }

  /* Menu mobile : fondu seul */
  .nav__list,
  .nav__list.is-open {
    transform: none;
  }

  .tl-spinner { animation-duration: 1.8s; }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .tl-scrim { background: rgba(10, 14, 26, 0.55); }
}

@media (prefers-contrast: more) {
  .site-header {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--navy-900);
  }
  .site-header.is-at-top { border-bottom-color: var(--navy-900); }
  .lang-switch__btn { opacity: 1; }
  .tl-field-error { text-decoration: underline; }
}

/* Valeurs techniques (« 115 mm », « 0.85 / 0.9 mm ») : gardées dans l'ordre
   latin en arabe, sinon l'unité passe devant (« mm 115 »). */
.product-card__spec bdi { unicode-bidi: isolate; }
