/* ═══════════════════════════════════════════════════════════════
   D3D — LA VITRINE
   A l'arrivee l'eleve voit UN solide, seul, eclaire, qui tourne.
   L'atelier complet (barres, panneaux, proprietes) attend derriere
   le geste « ابنِ ». Tout ce fichier ne vit que sous body.vitrine,
   sauf le bouton de retour, qui ne vit que HORS de la vitrine.
═══════════════════════════════════════════════════════════════ */

/* ── 1. La vitrine eteint l'atelier ─────────────────────────────── */
body.vitrine .side,
body.vitrine .topbar,
body.vitrine .props,
body.vitrine .bottom-bar,
body.vitrine .step-line,
body.vitrine .floating-undo,
body.vitrine .delete-selected-float,
body.vitrine .workshop-hud,
body.vitrine .hud-mobile-toggle,
body.vitrine .scene-crosshair,
body.vitrine .history-panel,
body.vitrine .intersect-overlay,
body.vitrine #patron-ctrl,
body.vitrine #presentExit{display:none!important}

body.vitrine .app{display:block;width:100vw;height:100vh;height:100dvh;overflow:hidden}
body.vitrine .main{width:100vw;height:100vh;height:100dvh}
body.vitrine .module{height:100%;width:100%;animation:none}
body.vitrine .work-layout{display:block;height:100%;width:100%}
body.vitrine .scene-area{height:100%;width:100%;min-height:0;background:none}
body.vitrine .scene-host{min-height:0}

/* « .lbl3d » force display:inline-block en !important (D3D.html) : on ne peut
   masquer une etiquette que par une regle plus precise, elle aussi !important. */
body.vitrine .lbl3d.axis-lbl{display:none!important}
body.vt-sans-noms .lbl3d{display:none!important}
/* Les noms des sommets : plus gros, encre de la charte. */
body.vitrine .lbl3d.vertex-lbl{font-size:19px;color:#241a45;pointer-events:none!important;cursor:default}

/* Les etiquettes HTML des sommets etaient HORS CHAMP depuis toujours : le
   moteur de three.js les pose en position:absolute sans left/top, et dans une
   page RTL la position « naturelle » part du bord DROIT — chaque nom etait
   decale d'une largeur d'ecran. (D'ou les noms en image, flous, de l'atelier.)
   En vitrine on les remet a leur place : ce sont elles qu'on lit. */
body.vitrine .scene-host>div{direction:ltr}
body.vitrine .lbl3d{left:0;top:0}

/* Le crayon d'annotation flottant (ghali_annotations.js) tombait sur la barre
   des gestes : il monte sous les puces, en face de « كما في الكتاب ». */
body.vitrine #mp-float-annot{bottom:auto!important;top:118px!important;right:14px!important}

/* ── 2. Le calque de la vitrine ─────────────────────────────────── */
#vt{position:absolute;inset:0;z-index:40;pointer-events:none;display:none;
  font-family:Cairo,Arial,sans-serif;color:#241a45;direction:rtl}
body.vitrine #vt{display:block}
#vt button{font-family:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
#vt .vt-haut,#vt .vt-bas,#vt .vt-livre-btn{pointer-events:auto}

/* haut : le nom du solide et le choix des solides */
.vt-haut{position:absolute;top:0;left:0;right:0;padding:12px 14px 0;
  display:flex;flex-direction:column;gap:9px;z-index:3}
.vt-titre{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap}
.vt-labo{font-size:12px;font-weight:800;color:#667eea;letter-spacing:.2px}
.vt-nom{font-size:25px;font-weight:900;line-height:1.15;color:#241a45}
.vt-solides{display:flex;gap:7px;overflow-x:auto;padding:2px 0 8px;
  scrollbar-width:none;-webkit-overflow-scrolling:touch}
.vt-solides::-webkit-scrollbar{display:none}
.vt-puce{flex:0 0 auto;border:1.5px solid rgba(74,53,112,.16);background:rgba(255,255,255,.82);
  color:#4a3570;font-weight:800;font-size:13.5px;padding:7px 14px;border-radius:99px;
  box-shadow:0 2px 8px rgba(36,26,69,.07);backdrop-filter:blur(6px);
  transition:background .18s,color .18s,transform .18s,box-shadow .18s}
.vt-puce:hover{transform:translateY(-1px)}
.vt-puce.on{background:#4a3570;color:#fff;border-color:#4a3570;box-shadow:0 6px 16px rgba(74,53,112,.3)}

/* le bouton « كما في الكتاب » */
.vt-livre-btn{position:absolute;top:118px;left:14px;z-index:4;
  border:0;border-radius:14px;padding:9px 15px;font-size:14px;font-weight:900;
  background:#fff;color:#4a3570;box-shadow:0 6px 20px rgba(36,26,69,.16);
  display:flex;align-items:center;gap:7px;transition:transform .18s,background .18s,color .18s}
.vt-livre-btn:hover{transform:translateY(-1px)}
.vt-livre-btn.on{background:#241a45;color:#fff}

/* bas : la consigne, le panneau du geste, les quatre gestes */
.vt-bas{position:absolute;left:0;right:0;bottom:0;z-index:3;
  padding:0 12px calc(12px + env(safe-area-inset-bottom,0px));
  display:flex;flex-direction:column;align-items:center;gap:9px}
.vt-legende{max-width:560px;text-align:center;font-size:14.5px;font-weight:800;line-height:1.7;
  color:#3b2d63;background:rgba(255,255,255,.86);padding:6px 16px;border-radius:14px;
  box-shadow:0 3px 12px rgba(36,26,69,.08);backdrop-filter:blur(6px)}
.vt-legende:empty{display:none}

.vt-panneau{width:min(560px,100%);background:rgba(255,255,255,.95);border-radius:18px;
  box-shadow:0 10px 30px rgba(36,26,69,.16);padding:12px 14px;display:none;
  max-height:38vh;overflow-y:auto;backdrop-filter:blur(8px)}
.vt-panneau.on{display:block}

.vt-gestes{width:min(560px,100%);display:grid;grid-template-columns:repeat(5,1fr);gap:6px;
  background:rgba(255,255,255,.92);border-radius:22px;padding:8px;
  box-shadow:0 12px 34px rgba(36,26,69,.18);backdrop-filter:blur(8px)}
.vt-geste{border:0;background:transparent;border-radius:16px;padding:9px 4px 7px;
  display:flex;flex-direction:column;align-items:center;gap:3px;color:#4a3570;
  transition:background .18s,color .18s,transform .18s}
.vt-geste svg{width:26px;height:26px;stroke:currentColor;fill:none;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round}
.vt-geste b{font-size:15px;font-weight:900}
.vt-geste:hover{background:#eef2ff}
.vt-geste.on{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;
  box-shadow:0 6px 18px rgba(102,126,234,.4)}
.vt-geste:active{transform:scale(.96)}

/* ── 3. Le geste « انشر » : la glissiere du pliage ───────────────── */
.vt-pli{display:flex;align-items:center;gap:11px;direction:ltr}
.vt-pli-jouer{flex:0 0 auto;width:44px;height:44px;border:0;border-radius:50%;
  background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;font-size:17px;
  box-shadow:0 5px 14px rgba(102,126,234,.4)}
.vt-pli-bouts{font-size:12.5px;font-weight:800;color:#6b5d91;white-space:nowrap;direction:rtl}
.vt-pli input[type=range],.vt-dim input[type=range]{flex:1;min-width:0;height:28px;accent-color:#667eea;cursor:pointer}

/* ── 4. Le geste « قِس » : dimensions et volume ─────────────────── */
.vt-dim{display:flex;align-items:center;gap:10px;padding:2px 0}
.vt-dim label{flex:0 0 auto;min-width:118px;font-size:13.5px;font-weight:800;color:#4a3570}
.vt-dim output{flex:0 0 auto;min-width:38px;text-align:center;font-size:15px;font-weight:900;
  color:#241a45;background:#eef2ff;border-radius:9px;padding:2px 6px;direction:ltr}
.vt-dim input[type=range]{direction:ltr}
.vt-faits{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}
.vt-fait{background:#f5f3ff;color:#4a3570;border-radius:10px;padding:4px 11px;font-size:13px;font-weight:800}
.vt-fait b{font-size:15px;color:#241a45;margin-inline-start:4px}
.vt-volume{margin-top:9px;border-top:1.5px dashed #d9d4f0;padding-top:9px;font-size:14px;font-weight:800;
  line-height:2;color:#3b2d63}
/* Un calcul se lit de gauche a droite, meme au milieu d'une phrase arabe. */
.vt-calc{direction:ltr;unicode-bidi:isolate;display:inline-block;font-size:16px;font-weight:900;color:#241a45}
.vt-frac{display:inline-flex;flex-direction:column;vertical-align:middle;text-align:center;line-height:1.15;margin:0 2px}
.vt-frac i{font-style:normal;padding:0 4px}
.vt-frac i:first-child{border-bottom:2px solid currentColor}

/* ── 4 bis. Le geste « اكتشف » : les experiences ────────────────── */
.vt-exps{display:flex;flex-direction:column;gap:8px}
.vt-exp{position:relative;text-align:right;border:1.5px solid #e3e0f5;background:#fff;border-radius:14px;
  padding:10px 12px 10px 78px;display:flex;flex-direction:column;gap:2px;color:#241a45;
  transition:border-color .18s,transform .18s,box-shadow .18s}
.vt-exp:hover{border-color:#667eea;transform:translateY(-1px);box-shadow:0 6px 16px rgba(102,126,234,.18)}
.vt-exp b{font-size:15.5px;font-weight:900}
.vt-exp span{font-size:12.5px;font-weight:700;color:#6b5d91;line-height:1.6}
.vt-exp i{position:absolute;left:10px;top:50%;transform:translateY(-50%);font-style:normal;font-size:11.5px;
  font-weight:900;color:#4a3570;background:#eef2ff;border-radius:99px;padding:3px 9px;white-space:nowrap}
.vt-exp-tete{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px}
.vt-exp-tete b{font-size:15px;font-weight:900;color:#241a45}
.vt-exp-retour{border:0;background:#eef2ff;color:#4a3570;border-radius:10px;padding:5px 11px;font-size:12.5px;font-weight:900}
.vt-verdict{font-size:15.5px;font-weight:800;line-height:1.9;color:#241a45;margin:2px 0}
.vt-verdict b{color:#b45309}
.vt-note{font-size:13px;font-weight:700;line-height:1.85;color:#5b4d85;margin:2px 0}
.vt-fait.fait{background:#d1fae5;color:#065f46}
.vt-verse{display:flex;align-items:center;gap:12px;margin-top:8px}
.vt-btn{flex:1;border:0;border-radius:13px;padding:11px 14px;font-size:15px;font-weight:900;color:#fff;
  background:linear-gradient(135deg,#667eea,#764ba2);box-shadow:0 6px 16px rgba(102,126,234,.35)}
.vt-btn:disabled{opacity:.55;box-shadow:none}
.vt-compte{display:flex;gap:6px;direction:ltr}
.vt-compte i{width:16px;height:16px;border-radius:50%;border:2.5px solid #f5a623;background:transparent}
.vt-compte i.on{background:#f5a623}

/* ── 5. « كما في الكتاب » : la feuille de cahier ─────────────────── */
.vt-livre{position:absolute;inset:0;width:100%;height:100%;z-index:2;
  opacity:0;pointer-events:none;transition:opacity .55s ease}
#vt.livre .vt-livre{opacity:1;pointer-events:auto}
#vt.livre .vt-puce:not(.on){background:#fff}
.vt-livre .trait{stroke:#1f1740;stroke-width:2.6;fill:none;stroke-linecap:round;stroke-linejoin:round}
.vt-livre .cache{stroke:#4b3f72;stroke-width:2;fill:none;stroke-linecap:round;stroke-dasharray:7 7}
.vt-livre .face{fill:rgba(102,126,234,.09);stroke:none}
.vt-livre .nom{font-family:Cairo,Arial,sans-serif;font-size:19px;font-weight:900;fill:#1f1740;
  text-anchor:middle;dominant-baseline:central}
.vt-livre .centre{fill:#1f1740}

/* ── 6. Hors de la vitrine : le retour ──────────────────────────── */
.vt-retour{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;border:0;border-radius:12px;
  padding:8px 14px;font-family:Cairo,Arial,sans-serif;font-weight:900;font-size:13.5px;cursor:pointer;
  background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;box-shadow:0 5px 14px rgba(102,126,234,.35)}
body.vitrine .vt-retour{display:none}

/* ── 7. Theme sombre (choisi dans l'atelier, garde en vitrine) ──── */
body.dark.vitrine #vt{color:#eef2ff}
body.dark.vitrine .vt-nom{color:#eef2ff}
body.dark.vitrine .vt-labo{color:#a5b4fc}
body.dark.vitrine .lbl3d.vertex-lbl{color:#eef2ff}
body.dark.vitrine .vt-puce{background:rgba(30,36,60,.82);color:#dfe4ff;border-color:rgba(165,180,252,.22)}
body.dark.vitrine .vt-puce.on{background:#a5b4fc;color:#1a1640;border-color:#a5b4fc}
body.dark.vitrine #vt.livre .vt-nom{color:#241a45}
body.dark.vitrine #vt.livre .vt-labo{color:#667eea}

/* ── 8. Telephone ───────────────────────────────────────────────── */
@media(max-width:560px){
  .vt-haut{padding:10px 10px 0;gap:7px}
  .vt-nom{font-size:21px}
  .vt-livre-btn{top:104px;left:10px;font-size:13px;padding:8px 12px}
  body.vitrine #mp-float-annot{top:102px!important;right:10px!important}
  .vt-bas{padding:0 8px calc(8px + env(safe-area-inset-bottom,0px));gap:7px}
  .vt-legende{font-size:13px;padding:5px 12px}
  .vt-geste b{font-size:13px}
  .vt-geste{padding:8px 2px 6px}
  .vt-gestes{padding:6px;gap:3px}
  .vt-exp{padding-left:74px}
  .vt-dim label{min-width:96px;font-size:12.5px}
  .vt-panneau{max-height:42vh;padding:10px 11px}
}
@media(max-height:480px){
  .vt-legende{display:none}
  .vt-geste svg{display:none}
  .vt-panneau{max-height:44vh}
}
@media(prefers-reduced-motion:reduce){
  .vt-livre,.vt-puce,.vt-geste,.vt-livre-btn{transition:none}
}
