/* Cohesif BTP — simulateurs 3D (toiture, façade, plaque BA13). Utilisé avec r3d-core.js */
.r3d, .r3d-section {
  --black: #0a0a0a; --white: #ffffff; --accent: #ea5b1f; --pill: 999px;
  --grey-50: #fafafa; --grey-100: #f5f5f5; --grey-200: #e5e5e5; --grey-300: #d4d4d4; --grey-500: #737373; --grey-700: #4a4a4a;
}
.r3d-section { scroll-margin-top: 70px; }
.r3d { border: 1px solid var(--grey-200); border-radius: 28px; background: var(--white); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.05); }
.r3d-modes { display: flex; gap: 6px; padding: 5px; background: var(--grey-100); border-radius: var(--pill); overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.r3d-modes::-webkit-scrollbar { display: none; }
.r3d-modes button {
  flex: 1 0 auto; padding: 11px 18px; border-radius: var(--pill); font-size: 14px; font-weight: 600; color: var(--grey-700);
  white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s;
}
.r3d-modes button:hover { color: var(--black); }
.r3d-modes button[aria-selected="true"] { background: var(--white); color: var(--black); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

.r3d-bar { min-height: 44px; margin-bottom: 14px; }
.r3d-ctl { display: none; flex-wrap: wrap; align-items: center; gap: 8px; }
.r3d[data-mode="pose"] .r3d-ctl[data-for="pose"],
.r3d[data-mode="demoussage"] .r3d-ctl[data-for="demoussage"],
.r3d[data-mode="fenetre"] .r3d-ctl[data-for="fenetre"],
.r3d[data-mode="coupe"] .r3d-ctl[data-for="coupe"] { display: flex; }
.r3d-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 1px solid var(--grey-300);
  border-radius: var(--pill); background: var(--white); font-size: 14px; font-weight: 600; color: var(--black);
  transition: border-color .15s, background .15s, color .15s;
}
.r3d-chip i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); }
.r3d-chip:hover { border-color: var(--black); }
.r3d-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(234,91,31,0.12); }
.r3d-chip-action { background: var(--black); color: var(--white); border-color: var(--black); }
.r3d-chip-action:hover { background: var(--accent); border-color: var(--accent); }
.r3d-range { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--grey-700); padding: 0 6px; }
.r3d-range input { width: 170px; accent-color: var(--accent); }
.r3d-swatches { display: inline-flex; gap: 8px; margin-left: auto; }
.r3d-swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15); transition: transform .15s, box-shadow .15s; }
.r3d-swatches button:hover { transform: scale(1.08); }
.r3d-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--accent); }
.r3d-hint-inline { font-size: 14px; color: var(--grey-500); }

.r3d-stage {
  position: relative; height: clamp(360px, 52vw, 560px); border-radius: 20px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 15%, #ffffff 0%, #f7f1ec 55%, #efe6de 100%);
  border: 1px solid #f1e6dd; cursor: grab; touch-action: pan-y;
}
.r3d-stage:active { cursor: grabbing; }
.r3d-stage canvas { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity .5s; }
.r3d-ready .r3d-stage canvas { opacity: 1; }
.r3d-labels { position: absolute; inset: 0; pointer-events: none; }
.r3d-label {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--black);
  background: rgba(255,255,255,0.94); border-radius: var(--pill); padding: 5px 11px 5px 9px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12); transition: opacity .25s; display: inline-flex; align-items: center; gap: 6px;
}
.r3d-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--black); }
.r3d-label-accent { background: var(--accent); color: var(--white); }
.r3d-label-accent::before { background: var(--white); }
.r3d-loading, .r3d-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 14px; font-weight: 600; color: var(--grey-500); text-align: center; padding: 24px;
}
.r3d-loading span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--grey-300); border-top-color: var(--accent); animation: r3dspin .8s linear infinite; }
@keyframes r3dspin { to { transform: rotate(360deg); } }
.r3d-ready .r3d-loading, .r3d-fail .r3d-loading { display: none; }
.r3d-fallback { display: none; }
.r3d-fail .r3d-fallback { display: flex; }
.r3d-fallback a { color: var(--accent); text-decoration: underline; margin-left: 4px; }
.r3d-drag {
  white-space: nowrap; position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: none; align-items: center; gap: 8px;
  background: rgba(10,10,10,0.78); color: var(--white); font-size: 12px; font-weight: 600; padding: 7px 14px; border-radius: var(--pill);
  pointer-events: none; transition: opacity .4s;
}
.r3d-drag svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.r3d-ready .r3d-drag { display: inline-flex; }
.r3d-touched .r3d-drag { opacity: 0; }
.r3d-caption { font-size: 13px; color: var(--grey-500); margin: 12px 4px 0; min-height: 20px; }

.r3d-info { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-top: 18px; padding: 28px; background: var(--grey-50); border-radius: 20px; }
.r3d-info-title { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 10px; }
.r3d-info-text { font-size: 15px; color: var(--grey-700); line-height: 1.65; margin-bottom: 18px; max-width: 760px; }
.r3d-specs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.r3d-spec { background: var(--white); border: 1px solid var(--grey-200); border-radius: 14px; padding: 12px 14px; }
.r3d-spec span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--grey-500); margin-bottom: 4px; }
.r3d-spec strong { font-size: 14px; font-weight: 700; line-height: 1.35; }
.r3d-points { list-style: none; display: grid; gap: 6px; }
.r3d-points li { font-size: 14px; color: var(--grey-700); padding-left: 22px; position: relative; line-height: 1.55; }
.r3d-points li::before { content: '✓'; position: absolute; left: 0; font-weight: 800; color: var(--accent); }
.r3d-note { font-size: 12px; color: var(--grey-500); margin-top: 14px; }
.r3d-cta { background: var(--black); color: var(--white); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 10px; align-self: start; }
.r3d-cta-title { font-size: 19px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.2; }
.r3d-cta p:not(.r3d-cta-title) { font-size: 14px; color: rgba(255,255,255,0.72); line-height: 1.55; margin-bottom: 6px; }
.r3d-cta .bq-btn { width: 100%; white-space: normal; }
.r3d-cta .btn { width: 100%; white-space: normal; text-align: center; padding: 13px 18px; font-size: 15px; }
.r3d-cta .btn-outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.3); }
.r3d-cta .btn-outline:hover { border-color: var(--white); }

@media (max-width: 1024px) {
  .r3d-info { grid-template-columns: 1fr; }
  .r3d-specs { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .r3d { padding: 10px; border-radius: 22px; margin: 0 -6px; }
  .r3d-modes { border-radius: 16px; }
  .r3d-modes button { padding: 10px 14px; font-size: 13px; }
  .r3d-ctl { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .r3d-ctl::-webkit-scrollbar { display: none; }
  .r3d-chip { flex: 0 0 auto; padding: 9px 14px; font-size: 13px; }
  .r3d[data-mode="demoussage"] .r3d-ctl[data-for="demoussage"] { flex-wrap: wrap; }
  .r3d-range { flex: 1 1 100%; padding: 4px 4px 0; }
  .r3d-range input { flex: 1; width: auto; }
  .r3d-swatches { margin-left: 0; }
  .r3d-hint-inline { display: none; }
  .r3d-stage { height: 400px; border-radius: 16px; }
  .r3d-label { font-size: 11px; padding: 4px 9px 4px 7px; }
  .r3d-info { padding: 20px 16px; }
  .r3d-specs { grid-template-columns: 1fr 1fr; gap: 8px; }
}

.r3d-steps { display: inline-flex; gap: 6px; margin-left: 6px; }
.r3d-steps i { width: 26px; height: 6px; border-radius: 3px; background: var(--grey-200); transition: background .3s; }
.r3d-steps i.on { background: var(--accent); }
