/*
 * Expérience au défilement — compagnon de assets/js/immersive.js.
 * Tout état masqué dépend de .is-immersive (posé par le script) : sans
 * JavaScript, ou avec « réduire les animations », la page reste intacte.
 */

:root { --ease-out: cubic-bezier(.2, .75, .15, 1); }

/* ── Barre de progression de lecture ────────────────────────────────────── */
.scroll-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 200;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transform: scaleX(0); transform-origin: 0 50%; pointer-events: none;
}
.site-header { transition: box-shadow .3s ease; }
.site-header.is-scrolled { box-shadow: 0 8px 30px rgba(18, 33, 43, .08); }

/* ── Intro du héros ─────────────────────────────────────────────────────── */
.is-immersive .hero-copy h1 .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
/* Les enveloppes de ligne ne doivent pas hériter de la couleur d'accent que
   site.css donne à « .hero-copy h1 span » : seule la dernière phrase est en couleur. */
.is-immersive .hero-copy h1 .line,
.is-immersive .hero-copy h1 .line-inner { color: inherit; }
.is-immersive .hero-copy h1 .line-inner {
  display: block; transform: translate3d(0, 108%, 0);
  transition: transform 1.1s var(--ease-out) calc(.15s + var(--i, 0) * .12s);
}
.is-immersive.is-ready .hero-copy h1 .line-inner { transform: none; }

.is-immersive .hero-copy .eyebrow,
.is-immersive .hero-copy .lead,
.is-immersive .hero-actions,
.is-immersive .hero-reassurance {
  opacity: 0; transform: translate3d(0, 18px, 0);
  transition: opacity .9s ease, transform .9s var(--ease-out);
}
.is-immersive .hero-copy .lead { transition-delay: .55s; }
.is-immersive .hero-actions { transition-delay: .7s; }
.is-immersive .hero-reassurance { transition-delay: .85s; }
.is-immersive.is-ready .hero-copy .eyebrow,
.is-immersive.is-ready .hero-copy .lead,
.is-immersive.is-ready .hero-actions,
.is-immersive.is-ready .hero-reassurance { opacity: 1; transform: none; }

/* L'image se dévoile depuis un cadre, puis suit le défilement (parallaxe). */
.is-immersive .property-scene .hero-building {
  clip-path: inset(10% 14% 10% 14% round 90px 12px 12px 12px);
  transform: translate3d(0, var(--py, 0px), 0) scale(1.12);
  transition: clip-path 1.5s var(--ease-out) .2s, transform 1.6s var(--ease-out) .2s;
}
.is-immersive.is-ready .property-scene .hero-building {
  clip-path: inset(0 0 0 0 round 90px 12px 12px 12px);
  transform: translate3d(0, var(--py, 0px), 0) scale(1);
}
.is-immersive .property-scene .floating-card,
.is-immersive .property-scene .scene-tag,
.is-immersive .property-scene .scene-caption {
  opacity: 0; translate: 0 26px;
  transition: opacity .9s ease, translate 1s var(--ease-out);
}
.is-immersive .property-scene .scene-tag { transition-delay: 1s; }
.is-immersive .property-scene .compliance-card { transition-delay: 1.1s; }
.is-immersive .property-scene .received-card { transition-delay: 1.3s; }
.is-immersive .property-scene .scene-caption { transition-delay: 1.5s; }
.is-immersive.is-ready .property-scene .floating-card,
.is-immersive.is-ready .property-scene .scene-tag,
.is-immersive.is-ready .property-scene .scene-caption { opacity: 1; translate: 0 0; }

/* ── Apparitions au défilement ──────────────────────────────────────────── */
.is-immersive [data-reveal] {
  opacity: 0; translate: 0 34px;
  transition:
    opacity .9s ease calc(var(--reveal-i, 0) * 90ms),
    translate 1s var(--ease-out) calc(var(--reveal-i, 0) * 90ms);
}
.is-immersive [data-reveal].is-revealed { opacity: 1; translate: 0 0; }

/* Les visuels s'ouvrent et se posent, au lieu de simplement monter. */
.is-immersive .portfolio-art[data-reveal] { clip-path: inset(8% 8% 8% 8% round 20px); transition-property: opacity, translate, clip-path; transition-duration: .9s, 1s, 1.3s; }
.is-immersive .portfolio-art[data-reveal].is-revealed { clip-path: inset(0 0 0 0 round 20px); }
.is-immersive .portfolio-art img { transform: translate3d(0, var(--py, 0px), 0) scale(1.1); }

/* ── Bandeau des contrôles, entraîné par le défilement ──────────────────── */
.keyword-band { overflow: hidden; padding: 34px 0; background: var(--ink, #12212b); }
.keyword-track {
  display: flex; gap: 0; width: max-content;
  translate: var(--shift, 0px) 0;
  animation: sgv-marquee 120s linear infinite;
}
.keyword-track span {
  display: inline-flex; align-items: center; gap: 34px; padding-right: 34px;
  font-family: var(--font-display, inherit); font-size: clamp(1.6rem, 3.2vw, 2.8rem);
  letter-spacing: -.03em; line-height: 1.1; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(255, 255, 255, .55);
}
.keyword-track span:nth-child(3n + 1) { color: #fff; -webkit-text-stroke: 0; }
.keyword-track span::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--primary); flex: none;
}
@keyframes sgv-marquee { to { transform: translateX(-50%); } }

/* ── Étapes épinglées (bureau) ──────────────────────────────────────────── */
@media (min-width: 901px) {
  .is-immersive .onboarding-section.is-pinned { height: 260vh; padding-block: 0; }
  .is-immersive .onboarding-section.is-pinned > .container {
    position: sticky; top: 84px; min-height: calc(100vh - 84px);
    display: flex; flex-direction: column; justify-content: center; padding-block: 56px;
  }
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li {
    position: relative; opacity: .32; translate: 0 18px;
    transition: opacity .6s ease, translate .8s var(--ease-out);
    border-top-color: transparent;
  }
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li::before,
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li::after {
    content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  }
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li::before { background: #cfd5c8; }
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li::after {
    background: var(--primary); transform: scaleX(var(--step, 0)); transform-origin: 0 50%;
  }
  .is-immersive .onboarding-section.is-pinned .onboarding-steps li.is-active { opacity: 1; translate: 0 0; }
}

/* ── Halo sous le curseur, dernier appel à l'action ─────────────────────── */
.cta-band > .container { position: relative; z-index: 1; }
.is-immersive .cta-band::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(13, 161, 166, .28), transparent 62%);
  opacity: var(--spot, 0); transition: opacity .5s ease;
}
.is-immersive .cta-band .btn { transition: transform .35s var(--ease-out), background-color .15s, color .15s; }
.is-immersive .cta-band .btn:hover { transform: translateY(-3px); }

/* ── Mobile : effets allégés ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .is-immersive [data-reveal] { translate: 0 22px; }
  .is-immersive .property-scene .hero-building { clip-path: inset(6% 6% 6% 6% round 60px 10px 10px 10px); }
  .is-immersive.is-ready .property-scene .hero-building { clip-path: inset(0 0 0 0 round 60px 10px 10px 10px); }
  .keyword-band { padding: 22px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress, .is-immersive .cta-band::before { display: none; }
  .keyword-track { translate: none; }
}

/* ── Visuels photographiques ──────────────────────────────────────────────
   Styles de base, visibles avec ou sans JavaScript ; la parallaxe ne fait
   que déplacer l'image (--py) dans un cadre qui la recadre. */
.image-band { position: relative; height: min(78vh, 720px); overflow: hidden; background: #0e2a33; }
.image-band img {
  position: absolute; inset: -8% 0 auto 0; width: 100%; height: 116%;
  object-fit: cover; transform: translate3d(0, var(--py, 0px), 0);
}
.image-band::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14, 42, 51, 0) 38%, rgba(14, 42, 51, .82) 100%);
}
.image-band-caption { position: absolute; left: 0; right: 0; bottom: 56px; z-index: 1; }
.image-band-title {
  margin: 0; max-width: 20ch; color: #fff;
  font-family: var(--font-display, inherit); font-size: clamp(1.8rem, 3.6vw, 3.2rem);
  line-height: 1.08; letter-spacing: -.03em;
}

.audience-card { overflow: hidden; }
.audience-photo { display: block; margin: -27px -22px 22px; aspect-ratio: 4 / 3; overflow: hidden; }
.audience-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease-out); }
.audience-card:hover .audience-photo img { transform: scale(1.05); }
.audience-card .audience-photo ~ h3 { margin-top: 12px; }

.security-media { position: relative; margin: 0; min-height: 400px; overflow: hidden; border-radius: 120px 120px 10px 10px; background: #0e2a33; }
.security-media img {
  position: absolute; inset: -6% 0 auto 0; width: 100%; height: 112%;
  object-fit: cover; transform: translate3d(0, var(--py, 0px), 0);
}
.security-media figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 24px 26px; text-align: center;
  color: #fff; font: 10px/1.8 var(--font-mono, monospace); letter-spacing: .14em;
  background: linear-gradient(180deg, rgba(14, 42, 51, 0), rgba(14, 42, 51, .78));
}

.page-hero-media { margin-top: 52px; position: relative; z-index: 1; }
.page-hero-media > div { overflow: hidden; border-radius: 18px; aspect-ratio: 21 / 8; box-shadow: 0 30px 70px rgba(18, 43, 44, .14); }
.page-hero-media img { width: 100%; height: 114%; object-fit: cover; transform: translate3d(0, var(--py, 0px), 0); }

@media (max-width: 900px) {
  .image-band { height: 62vh; }
  .image-band-caption { bottom: 34px; }
  .security-media { min-height: 300px; border-radius: 80px 80px 10px 10px; }
  .page-hero-media > div { aspect-ratio: 16 / 10; }
}

/* ── Façade annotée : la logique de l'outil sur un vrai bâtiment ───────── */
.facade { position: relative; margin: 0; perspective: 1400px; }
.facade-frame {
  position: relative; border-radius: 20px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(18, 43, 44, .16);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .7s var(--ease-out);
}
.facade-frame > img { display: block; width: 100%; height: auto; }
.facade-tag {
  position: absolute; left: 18px; top: 18px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px;
  background: #fff; border-radius: 7px; font-size: 11px; color: var(--ink, #12212b);
  box-shadow: 0 10px 30px rgba(18, 43, 44, .14);
}
.facade-tag .icon { width: 15px; color: var(--primary-dark); }
.facade-pins { list-style: none; margin: 0; padding: 0; }

.pin-dot {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  font: 600 12px/1 var(--font-mono, monospace); color: #fff; background: var(--pin, var(--primary));
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .55), 0 8px 18px rgba(0, 0, 0, .22);
}
.pin-ok { --pin: #1f7a4d; }
.pin-warn { --pin: #b7791f; }
.pin-info { --pin: #1d5fa8; }
.pin-pending { --pin: #0a7f83; }
.pin-card {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 11px; min-width: 0;
  background: #fff; border-radius: 10px; box-shadow: 0 18px 40px rgba(18, 43, 44, .18);
}
.pin-card small { font: 9px/1.4 var(--font-mono, monospace); letter-spacing: .03em; color: var(--muted); }
.pin-card strong { font-size: 12.5px; line-height: 1.3; color: var(--ink, #12212b); }
.pin-card em { font-style: normal; font-size: 11px; font-weight: 600; color: var(--pin); }

@media (min-width: 901px) {
  .facade-pins { position: absolute; inset: 0; }
  .pin { position: absolute; left: var(--x); top: var(--y); }
  .pin-dot { position: absolute; transform: translate(-50%, -50%); }
  .pin-dot::after {
    content: ""; position: absolute; inset: -5px; border-radius: 50%;
    border: 2px solid var(--pin, var(--primary)); opacity: 0;
    animation: sgv-pin-pulse 2.6s ease-out infinite; animation-delay: calc(var(--i, 0) * .6s);
  }
  .pin-card { position: absolute; width: max-content; max-width: 190px; transition: opacity .3s ease, translate .4s var(--ease-out); }
  .pin-right-down .pin-card { left: 24px; top: -12px; }
  .pin-left-down .pin-card { right: 24px; top: -12px; }
  .pin-left-up .pin-card { right: 24px; bottom: -12px; }
  /* Survol d'un repère : les autres s'effacent un peu. */
  .facade-pins:hover .pin:not(:hover) .pin-card { opacity: .45; }
  .pin:hover { z-index: 3; }
}
@keyframes sgv-pin-pulse {
  0% { opacity: .8; transform: scale(1); }
  70%, 100% { opacity: 0; transform: scale(1.9); }
}

/* Apparition : les repères se posent un à un quand la façade entre à l'écran. */
.is-immersive .facade .pin-dot,
.is-immersive .facade .pin-card { opacity: 0; scale: .6; transition: opacity .5s ease, scale .6s var(--ease-out); }
.is-immersive .facade .pin-dot { transition-delay: calc(.4s + var(--i, 0) * .25s); }
.is-immersive .facade .pin-card { scale: 1; translate: 0 10px; transition-delay: calc(.6s + var(--i, 0) * .25s); }
.is-immersive .facade.is-revealed .pin-dot { opacity: 1; scale: 1; }
.is-immersive .facade.is-revealed .pin-card { opacity: 1; translate: 0 0; }

@media (max-width: 900px) {
  .facade-frame { overflow: visible; box-shadow: none; border-radius: 0; }
  .facade-frame > img { border-radius: 16px; box-shadow: 0 20px 50px rgba(18, 43, 44, .14); }
  .facade-pins { display: grid; gap: 10px; margin-top: 18px; }
  .pin { display: flex; align-items: center; gap: 12px; }
  .pin-card { flex: 1; min-width: 0; box-shadow: 0 6px 18px rgba(18, 43, 44, .1); }
}
