/*
 * Module CMS — hero plein écran (carrousel) de l'accueil et des pages de rubrique, bandeau d'engagements.
 * Uniquement les jetons du design system (rhema.css).
 */

/* ---------------------------------------------------------------- Hero plein écran
   Diapositives superposées : la diapositive active est visible, les autres sont masquées
   (visibility: hidden → leurs liens ne reçoivent pas le focus). Sans JavaScript, seule la première
   s'affiche. Effets : fondu enchaîné, zoom lent de la photo (Ken Burns), texte révélé en cascade,
   barre de progression par diapositive (sa fin déclenche la suivante, voir cms.js). */
.hx { --hx-interval: 7s; position: relative; isolation: isolate; min-height: clamp(560px, 86vh, 800px); display: grid; background: var(--ink); color: #DCE5EE; overflow: hidden; }
.hx-slides { position: relative; display: grid; }
.hx-slide { grid-area: 1 / 1; position: relative; display: grid; align-items: center; min-height: clamp(560px, 86vh, 800px); visibility: hidden; opacity: 0; transition: opacity 1.1s var(--ease), visibility 0s linear 1.1s; }
.hx-slide.is-active { visibility: visible; opacity: 1; transition: opacity 1.1s var(--ease), visibility 0s; z-index: 1; }

.hx-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.hx-media img { width: 100%; height: 100%; object-fit: cover; object-position: 70% center; transform: scale(1.04); }
.hx-slide.is-active .hx-media img { animation: hx-zoom calc(var(--hx-interval) + 2s) linear both; }
@keyframes hx-zoom { from { transform: scale(1.14); } to { transform: scale(1.02); } }

/* Voile : lisibilité du texte à gauche, trame technique, fondu vers les commandes en bas */
.hx-slide::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(90deg, rgba(10,15,22,.94) 0%, rgba(10,15,22,.80) 34%, rgba(10,15,22,.35) 64%, rgba(10,15,22,.10) 100%),
    linear-gradient(0deg, rgba(10,15,22,.85) 0%, rgba(10,15,22,0) 32%); }
.hx-slide::after { content: ""; position: absolute; inset: 0; z-index: -1; background-image: var(--grid-dark); background-size: var(--grid-size);
  -webkit-mask: linear-gradient(90deg, #000 0%, rgba(0,0,0,.6) 45%, transparent 75%); mask: linear-gradient(90deg, #000 0%, rgba(0,0,0,.6) 45%, transparent 75%); }

.hx-content { position: relative; padding-block: clamp(3rem, 8vw, 6rem) clamp(7rem, 12vw, 8.5rem); max-width: var(--container); }
.hx-content > * { max-width: 44rem; }
.hx-kicker { display: flex; align-items: center; gap: .75rem; margin: 0 0 1.25rem; font-family: var(--font-mono); font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: #9FB3C6; }
.hx-num { color: var(--gold); }
.hx-sep { width: 42px; height: 1px; background: var(--gold); }
.hx-title { font-family: var(--font-display); font-size: clamp(2.1rem, 5vw, 4rem); font-weight: 800; line-height: 1.05; letter-spacing: -.03em; color: #fff; margin: 0 0 1.25rem; text-wrap: balance; }
.hx-lead { font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.6; color: #C6D3DF; margin: 0 0 2rem; max-width: 38rem; }
.hx-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }

/* Texte révélé en cascade à l'arrivée de chaque diapositive */
html.motion .hx-slide .hx-content > * { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.motion .hx-slide.is-active .hx-content > * { opacity: 1; transform: none; }
html.motion .hx-slide.is-active .hx-content > :nth-child(1) { transition-delay: .25s; }
html.motion .hx-slide.is-active .hx-content > :nth-child(2) { transition-delay: .4s; }
html.motion .hx-slide.is-active .hx-content > :nth-child(3) { transition-delay: .55s; }
html.motion .hx-slide.is-active .hx-content > :nth-child(4) { transition-delay: .7s; }

/* Commandes : onglets numérotés avec barre de progression, précédent / pause / suivant */
.hx-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; border-top: 1px solid rgba(255,255,255,.1); background: linear-gradient(0deg, rgba(10,15,22,.6), rgba(10,15,22,.2)); backdrop-filter: blur(6px); }
.hx-controls .container { display: flex; align-items: stretch; gap: 1rem; }
.hx-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); flex: 1; min-width: 0; }
.hx-tab { position: relative; display: grid; grid-template-columns: auto 1fr; gap: .15rem .75rem; align-items: center; text-align: left; padding: 1rem 1rem 1.15rem 0; margin-right: 1rem; border: 0; background: none; color: #8FA3B6; cursor: pointer; font: inherit; min-height: var(--tap); }
.hx-tab-num { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; letter-spacing: .08em; }
.hx-tab-label { font-size: .82rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hx-tab:hover, .hx-tab[aria-selected="true"] { color: #fff; }
.hx-tab[aria-selected="true"] .hx-tab-num { color: var(--gold); }
.hx-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.hx-bar { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: rgba(255,255,255,.14); overflow: hidden; }
.hx-bar i { display: block; height: 100%; width: 100%; background: var(--gold); transform: scaleX(0); transform-origin: left; }
.hx-tab[aria-selected="true"] .hx-bar i { transform: scaleX(1); }
html.motion .hx.is-playing .hx-tab[aria-selected="true"] .hx-bar i { animation: hx-progress var(--hx-interval) linear both; }
html.motion .hx.is-paused .hx-tab[aria-selected="true"] .hx-bar i { animation-play-state: paused; }
@keyframes hx-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.hx-nav { display: flex; align-items: center; gap: .4rem; flex: none; }
.hx-btn { display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 1px solid rgba(255,255,255,.22); border-radius: var(--radius-md); background: rgba(10,15,22,.35); color: #fff; cursor: pointer; transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.hx-btn:hover { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.hx-pause { width: 12px; height: 14px; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }
.hx-btn[aria-pressed="true"] .hx-pause { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; }

.hx-single .hx-content { padding-bottom: clamp(3rem, 8vw, 6rem); }

@media (max-width: 900px) {
  .hx, .hx-slide { min-height: clamp(520px, 78vh, 680px); }
  .hx-slide::before { background: linear-gradient(0deg, rgba(10,15,22,.96) 0%, rgba(10,15,22,.78) 55%, rgba(10,15,22,.45) 100%); }
  .hx-slide { align-items: end; }
  .hx-tab-label { display: none; }
  .hx-tab { padding-right: 0; margin-right: .5rem; }
}
@media (max-width: 480px) {
  .hx-cta .btn { width: 100%; }
  .hx-nav .hx-btn[data-hero-prev], .hx-nav .hx-btn[data-hero-next] { display: none; }
}

/* ---------------------------------------------------------------- Hero de rubrique
   Composant rubric-hero (catalogue, services, contact…) : même carrousel, moins haut, fil d'Ariane
   fixe au-dessus des diapositives, filet or comme l'en-tête compact .page-hero. */
.hx-page { border-bottom: 3px solid var(--gold); }
.hx-page, .hx-page .hx-slide { min-height: clamp(440px, 64vh, 600px); }
.hx-page .hx-content { padding-block: clamp(4.5rem, 9vw, 6rem) clamp(6.5rem, 10vw, 7.5rem); }
.hx-page.hx-single .hx-content { padding-bottom: clamp(3rem, 6vw, 4.5rem); }
.hx-page .hx-title { font-size: clamp(1.9rem, 4.2vw, 3.2rem); }
.hx-crumbs { position: absolute; top: 0; left: 0; right: 0; z-index: 3; padding-top: 1.1rem; }
.hx-crumbs .breadcrumb { padding: 0; color: #9FB3C8; }
.hx-crumbs .breadcrumb a { color: #C9D6E2; }
.hx-crumbs .breadcrumb a:hover { color: var(--gold); }
@media (max-width: 900px) {
  .hx-page, .hx-page .hx-slide { min-height: clamp(480px, 74vh, 620px); }
}

/* ---------------------------------------------------------------- Bandeau d'engagements
   Bande graphite accolée au hero : quatre blocs séparés par des filets, pictogrammes en cadres. */
.trustbar { background: var(--graphite-2); border-bottom: 3px solid var(--gold); }
.trustbar > .container { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.trustbar > .container > div { display: flex; gap: var(--space-4); align-items: center; padding: 1.35rem 1.25rem; font-size: var(--fs-sm); color: #9FB0C1; border-left: 1px solid rgba(255,255,255,.08); }
.trustbar > .container > div:first-child { border-left: 0; padding-left: 0; }
.trustbar > .container strong { display: block; color: #fff; font-family: var(--font-display); margin-bottom: .1rem; }
.trustbar > .container small { color: #8FA2B4; line-height: 1.45; }
.trust-icon { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border: 1px solid rgba(242,177,52,.45); border-radius: var(--radius-md); color: var(--gold); background: rgba(242,177,52,.06); }
.trust-icon .icon { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .trustbar > .container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trustbar > .container > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .trustbar > .container > div:nth-child(n+3) { border-top: 1px solid rgba(255,255,255,.08); }
}
@media (max-width: 560px) {
  .trustbar > .container { grid-template-columns: minmax(0, 1fr); }
  .trustbar > .container > div { border-left: 0; padding-left: 0; }
  .trustbar > .container > div + div { border-top: 1px solid rgba(255,255,255,.08); }
}

/* Aperçu d'image dans le formulaire de bannière (back-office) */
.banner-preview { width: 100%; max-width: 480px; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--line); }
