/* mod_model3d_j6 : visionneuse 3D. Couleurs des boutons surchargeables par le template :
   --m3dj6-btn-bg, --m3dj6-btn-fg, --m3dj6-btn-active-bg, --m3dj6-btn-active-fg */
.m3dj6-viewer {
  display: block;
  width: 100%;
  /* jamais plus haut que l'ecran d'un telephone, sinon on ne peut plus faire defiler la page */
  height: min(var(--m3dj6-h, 480px), 75svh);
  background: var(--m3dj6-bg, #EEF1F3);
  border-radius: var(--m3dj6-r, 8px);
  --poster-color: var(--m3dj6-bg, #EEF1F3);
}

.m3dj6-stage {
  position: relative;
}

/* Lignes de cote : calque SVG au-dessus de la visionneuse, redessine a chaque mouvement de camera */
.m3dj6-cotes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--m3dj6-r, 8px);
}

.m3dj6-cotes[hidden] { display: none; }

.m3dj6-cotes path {
  fill: none;
  stroke: var(--m3dj6-cote, #1F2328);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.m3dj6-cotes rect {
  fill: var(--m3dj6-bg, #EEF1F3);
  fill-opacity: 0.88;
}

.m3dj6-cotes text {
  fill: var(--m3dj6-cote, #1F2328);
  font: 600 12px/1 system-ui, sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
}

/* points d'accroche 3D des cotes : invisibles, model-viewer les deplace avec la camera */
.m3dj6-hp {
  display: block;
  position: absolute;
  width: 1px;
  height: 1px;
  pointer-events: none;
  opacity: 0;
}

.m3dj6-cotes-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font: inherit;
  font-size: 0.85em;
  line-height: 1.2;
  padding: 0.4rem 0.8rem;
  min-height: 36px;
  border: 1px solid var(--m3dj6-btn-active-bg, #1F2328);
  border-radius: 999px;
  background: var(--m3dj6-btn-bg, rgba(255, 255, 255, 0.85));
  color: var(--m3dj6-btn-fg, #1F2328);
  cursor: pointer;
}

.m3dj6-cotes-btn[hidden] { display: none; }

.m3dj6-cotes-btn[aria-pressed="true"] {
  background: var(--m3dj6-btn-active-bg, #1F2328);
  color: var(--m3dj6-btn-active-fg, #FFFFFF);
}

.m3dj6-viewer:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.m3dj6-variants,
.m3dj6-teintes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.m3dj6-variant,
.m3dj6-teinte {
  font: inherit;
  font-size: 0.95em;
  line-height: 1.2;
  padding: 0.5rem 1rem;
  min-height: 44px;
  border: 1px solid var(--m3dj6-btn-active-bg, #1F2328);
  border-radius: 999px;
  background: var(--m3dj6-btn-bg, transparent);
  color: var(--m3dj6-btn-fg, #1F2328);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.m3dj6-variant[aria-pressed="true"],
.m3dj6-teinte[aria-pressed="true"] {
  background: var(--m3dj6-btn-active-bg, #1F2328);
  color: var(--m3dj6-btn-active-fg, #FFFFFF);
}

.m3dj6-curseur-bloc {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 520px;
  margin: 0.75rem auto 0;
  padding: 0 1rem;
}

.m3dj6-curseur-texte {
  flex: 0 0 auto;
  font-size: 0.95em;
}

.m3dj6-curseur {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;             /* cible tactile confortable */
  accent-color: var(--m3dj6-btn-active-bg, #1F2328);
  cursor: grab;
}

.m3dj6-curseur:active {
  cursor: grabbing;
}

.m3dj6-legende {
  margin: 0.6rem 0 0;
  text-align: center;
  font-weight: 600;
  font-size: 1.05em;
}

@media (prefers-reduced-motion: reduce) {
  .m3dj6-variant,
  .m3dj6-teinte { transition: none; }
}
