/* ═══════════════════════════════════════════
   Calculateur 3D — s'ouvre au défilement (accueil)
   Rendu WebGL chargé à la demande (js/ecu3d.js + js/ecu3d-scene.js).
   Sans JS, sans WebGL ou en mouvement réduit : simple liste de textes.
═══════════════════════════════════════════ */
.ecu3d {
  position: relative; background: var(--ink-deep); color: var(--dx);
  border-top: 1px solid var(--ink-line); padding: 84px 0;
}
.e3-pin { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.ecu3d .section-title { color: var(--dx); font-size: clamp(2.5rem, 5.4vw, 4.25rem); margin-bottom: 0; }
.e3-stage { display: none; }
.e3-caps { display: grid; gap: 28px; margin-top: 40px; max-width: 520px; }
.e3-num {
  font-size: .6875rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--orange); margin-bottom: 8px;
}
.e3-cap h3 { font-size: 2rem; color: var(--dx); margin-bottom: 8px; }
.e3-cap p { font-size: 1rem; color: var(--dx-2); line-height: 1.7; }
.e3-cap .btn { margin-top: 18px; }
.e3-rail { display: none; }

/* ─── Mode animé (classe posée par ecu3d.js) ─── */
.ecu3d.e3-on { height: 420vh; padding: 0; }
.e3-on .e3-pin {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  padding-top: var(--nav-h); padding-bottom: 28px;
  display: grid; column-gap: 32px;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "head stage" "caps stage";
}
.e3-on .e3-head { grid-area: head; align-self: end; padding-bottom: 30px; }
.e3-on .e3-caps { grid-area: caps; align-self: start; margin-top: 0; gap: 0; }
.e3-on .e3-cap {
  grid-area: 1 / 1; opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.e3-on .e3-cap.is-on { opacity: 1; transform: none; pointer-events: auto; }
.e3-on .e3-rail {
  display: block; position: absolute; left: 32px; right: 32px; bottom: 14px; height: 2px;
  background: var(--ink-line);
}
.e3-rail i { display: block; height: 100%; width: 100%; background: var(--orange); transform-origin: 0 50%; transform: scaleX(0); }

.e3-on .e3-stage { display: block; grid-area: stage; position: relative; min-height: 0; }
.e3-glow {
  position: absolute; left: 50%; top: 50%; width: 620px; height: 620px; margin: -310px 0 0 -310px;
  background: radial-gradient(closest-side, rgba(245,130,52,.17), rgba(245,130,52,0));
  pointer-events: none;
}
/* Rendu WebGL : le canevas est créé par ecu3d-scene.js et apparaît en fondu une fois prêt */
.e3-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; pointer-events: none; transition: opacity .7s var(--ease); }
.e3-ready .e3-canvas { opacity: 1; }
/* bords du canevas fondus : en gros plan, l'image se dissout dans le fond au lieu d'être coupée net */
.e3-canvas {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 89%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 89%, transparent);
  mask-composite: intersect;
}
.e3-stage::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 2px solid var(--ink-line); border-top-color: var(--orange); border-radius: 50%;
  animation: e3-spin .9s linear infinite; transition: opacity .3s;
}
.e3-stage.e3-ready::after { opacity: 0; animation: none; }
@keyframes e3-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .e3-pin { padding: 0 22px; }
  .e3-on .e3-pin {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "head" "stage" "caps"; padding-bottom: 34px;
  }
  .e3-on .e3-head { align-self: start; padding: 18px 0 0; }
  .e3-on .e3-head .label { margin-bottom: 10px; }
  .ecu3d.e3-on .section-title { font-size: clamp(2.1rem, 9vw, 3rem); }
  .e3-on .e3-cap h3 { font-size: 1.65rem; margin-bottom: 4px; }
  .e3-on .e3-cap p { font-size: .9375rem; line-height: 1.55; }
  .e3-on .e3-cap .btn { margin-top: 12px; }
  .e3-on .e3-rail { left: 22px; right: 22px; }
  .e3-glow { width: 440px; height: 440px; margin: -220px 0 0 -220px; }
  .e3-canvas {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 91%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 91%, transparent);
  }
}
/* Sous 768px, la barre fixe « Prendre RDV / WhatsApp » occupe le bas de l'écran */
@media (max-width: 768px) {
  .e3-on .e3-pin { padding-bottom: 96px; }
  .e3-on .e3-rail { bottom: 78px; }
  .e3-on .e3-cap .btn { display: none; }
}
