/* BLOC eb/viewer-3d — la machine en 3D sur la fiche modèle.
 * Section anthracite : scène 3D encadrée des crochets à gauche, organe actif en grand à droite ;
 * carte reliée au repère actif par un trait coudé orange. */

.eb-v3d {
	--v3d-nuit: #262625;
	--v3d-papier: #f2f1ee;
	--v3d-ligne: var(--eb-line-on-dark, rgba(236, 235, 231, 0.12));
	--v3d-muted: var(--eb-muted-on-dark, #9ea0a2);
	background:
		radial-gradient(1100px 480px at 12% 0%, color-mix(in srgb, var(--eb-accent) 8%, transparent), transparent 60%),
		var(--wp--preset--color--anthracite);
	color: var(--eb-ink-on-dark, #ecebe7);
}
.eb-v3d__in { width: 100%; }
.eb-v3d button { font: inherit; color: inherit; }
.eb-v3d :focus-visible { outline: 2px solid var(--eb-accent); outline-offset: 3px; }

/* ---------- En-tête ---------- */
.eb-v3d__entete {
	display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.2rem 2.5rem; align-items: end;
	margin-bottom: var(--wp--preset--spacing--50, 2.5rem);
}
.eb-v3d__titres > * { margin-block: 0; }
.eb-v3d__titres .eb-lede { margin-top: 0.9rem; max-width: 58ch; color: var(--v3d-muted); }
.eb-v3d__config { display: grid; gap: 0.5rem; justify-items: end; }
.eb-v3d__config-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--v3d-muted); }
.eb-v3d__seg { display: inline-flex; background: var(--v3d-nuit); border: 1px solid var(--v3d-ligne); border-radius: 999px; padding: 4px; }
.eb-v3d__seg button {
	border: 0; background: transparent; border-radius: 999px; padding: 0.5rem 1.15rem; cursor: pointer;
	font-family: var(--wp--preset--font-family--goldman); font-size: 0.95rem; color: var(--v3d-muted);
	display: inline-flex; align-items: center; gap: 0.5rem;
}
.eb-v3d__seg button svg { width: 18px; height: 18px; }
.eb-v3d__seg button[aria-pressed="true"] { background: var(--v3d-papier); color: var(--wp--preset--color--anthracite); }
.eb-v3d__seg button:hover:not([aria-pressed="true"]) { color: var(--eb-ink-on-dark, #ecebe7); }
.eb-v3d__note { margin: 0; font-size: 0.8rem; color: var(--v3d-muted); text-align: right; max-width: 34ch; }

.eb-v3d__grille { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: clamp(1.5rem, 3vw, 2.75rem); align-items: start; }

/* ---------- Scène ---------- */
.eb-v3d__cadre { position: relative; --eb-bracket: var(--eb-accent); }
.eb-v3d__scene {
	position: relative; border-radius: 22px; overflow: hidden;
	aspect-ratio: 16 / 11; max-width: 100%;
	background:
		radial-gradient(circle at 50% 58%, rgba(255, 255, 255, 0.06), transparent 62%),
		radial-gradient(rgba(236, 235, 231, 0.16) 1.1px, transparent 1.4px) 0 0 / 18px 18px,
		linear-gradient(180deg, #2b2b29, #232321);
	border: 1px solid var(--v3d-ligne);
	isolation: isolate; outline: none;
}
.eb-v3d__cadre:fullscreen { background: var(--wp--preset--color--anthracite); display: grid; padding: 2vh 2vw; }
.eb-v3d__cadre:fullscreen .eb-v3d__scene { aspect-ratio: auto; height: 96vh; }
.eb-v3d model-viewer {
	position: absolute; inset: 0; width: 100%; height: 100%;
	--poster-color: transparent; --progress-bar-color: transparent; background: transparent;
}

/* Repères */
.eb-v3d__rep {
	--t: 34px; position: relative;
	width: var(--t); height: var(--t); border-radius: 50%; padding: 0; cursor: pointer;
	border: 1.5px solid rgba(255, 255, 255, 0.75);
	background: rgba(31, 31, 30, 0.72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
	font-family: var(--wp--preset--font-family--goldman); font-size: 13px; line-height: 1; color: #fff;
	display: grid; place-items: center;
	transition: background-color 0.2s, transform 0.2s, opacity 0.2s, border-color 0.2s;
}
.eb-v3d__rep:hover { border-color: var(--eb-accent); }
.eb-v3d__rep[data-visible="false"] { opacity: 0.3; }
.eb-v3d__rep.is-active { background: var(--eb-accent); border-color: var(--eb-accent); transform: scale(1.12); }
.eb-v3d__rep.is-active::after {
	content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 1.5px solid var(--eb-accent);
	animation: eb-v3d-pouls 1.8s ease-out infinite;
}
@keyframes eb-v3d-pouls { from { opacity: 0.9; transform: scale(0.85); } to { opacity: 0; transform: scale(1.5); } }

/* Carte reliée par un trait coudé */
.eb-v3d__calque { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.eb-v3d__calque svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.eb-v3d__calque path { fill: none; stroke: var(--eb-accent); stroke-width: 1.5; }
.eb-v3d__calque circle { fill: var(--eb-accent); }
.eb-v3d__carte {
	position: absolute; left: 0; top: 0; z-index: 1; width: min(290px, 46%);
	background: var(--v3d-papier); color: var(--wp--preset--color--anthracite);
	border-radius: 16px; padding: 14px 16px 15px;
	display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px; align-items: start;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
	opacity: 0; transition: opacity 0.25s; pointer-events: none;
}
.eb-v3d__carte.is-on { opacity: 1; }
.eb-v3d__carte-ico { grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; background: var(--eb-accent); color: #fff; display: grid; place-items: center; }
.eb-v3d__carte-ico svg { width: 20px; height: 20px; }
.eb-v3d__carte-titre { font-family: var(--wp--preset--font-family--goldman); font-size: 1rem; line-height: 1.15; margin: 2px 0 0; }
.eb-v3d__carte-texte { font-size: 0.82rem; line-height: 1.45; margin: 0; color: #4a4a48; }

/* Surcouches */
.eb-v3d__ov { position: absolute; z-index: 2; margin: 0; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--v3d-muted); pointer-events: none; }
.eb-v3d__ov--hg { top: 22px; left: 26px; line-height: 1.5; }
.eb-v3d__ov--hg b { color: var(--eb-ink-on-dark, #ecebe7); font-weight: 600; }
.eb-v3d__ov--bg { left: 26px; bottom: 26px; display: flex; align-items: center; gap: 10px; }
.eb-v3d__ok { width: 22px; height: 22px; border-radius: 50%; background: var(--eb-accent); display: grid; place-items: center; flex: none; }
.eb-v3d__ok svg { width: 12px; height: 12px; color: #fff; }
.eb-v3d__ctrl { position: absolute; z-index: 3; right: 22px; bottom: 18px; display: flex; align-items: center; gap: 6px; }
.eb-v3d__ctrl button {
	width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--v3d-ligne); padding: 0;
	background: rgba(31, 31, 30, 0.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer; display: grid; place-items: center;
}
.eb-v3d__ctrl button:hover { border-color: var(--v3d-muted); }
.eb-v3d__ctrl button[aria-pressed="true"] { border-color: var(--eb-accent); color: var(--eb-accent); }
.eb-v3d__ctrl svg { width: 17px; height: 17px; }
.eb-v3d__num { margin: 0; font-family: var(--wp--preset--font-family--goldman); font-size: 0.9rem; min-width: 62px; text-align: center; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.eb-v3d__num b { font-weight: 400; }
.eb-v3d__num > span { color: var(--v3d-muted); }

.eb-v3d__chargement { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; transition: opacity 0.4s; }
.eb-v3d__chargement > div { display: grid; gap: 10px; justify-items: center; }
.eb-v3d__chargement.is-done { opacity: 0; pointer-events: none; }
.eb-v3d__pc { font-family: var(--wp--preset--font-family--goldman); font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.eb-v3d__barre { width: 180px; height: 3px; background: var(--v3d-ligne); border-radius: 3px; overflow: hidden; }
.eb-v3d__barre i { display: block; height: 100%; width: 0; background: var(--eb-accent); transition: width 0.2s; }
.eb-v3d__ch-t { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--v3d-muted); }

/* ---------- Panneau organes ---------- */
.eb-v3d__panneau { display: grid; gap: 1.4rem; padding-top: 0.5rem; }
.eb-v3d__actif { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.9rem 1.1rem; align-items: start; }
.eb-v3d__actif-num {
	width: 58px; height: 58px; border-radius: 50%; background: var(--eb-accent); color: #fff;
	font-family: var(--wp--preset--font-family--goldman); font-size: 1.25rem; display: grid; place-items: center; font-variant-numeric: tabular-nums;
}
.eb-v3d__actif-titre { font-family: var(--wp--preset--font-family--goldman); font-weight: 700; font-size: clamp(1.6rem, 2.7vw, 2.35rem); line-height: 1.05; margin: 0.25rem 0 0; text-wrap: balance; color: inherit; }
.eb-v3d__actif-texte { grid-column: 2; margin: 0; max-width: 46ch; }
.eb-v3d__chiffre {
	grid-column: 2; justify-self: start; margin-top: 0.3rem;
	background: var(--eb-accent); color: #fff; border-radius: 18px; padding: 1rem 1.25rem 0.9rem; min-width: 190px;
	display: grid; gap: 2px;
}
.eb-v3d__chiffre[hidden] { display: none; }
.eb-v3d__chiffre-v { font-family: var(--wp--preset--font-family--goldman); font-size: 2.35rem; line-height: 1; letter-spacing: -0.01em; }
.eb-v3d__chiffre-l { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }

.eb-v3d__liste { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--v3d-ligne); }
.eb-v3d__liste li { border-bottom: 1px solid var(--v3d-ligne); margin: 0; }
.eb-v3d__liste button {
	width: 100%; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
	border: 0; background: transparent; padding: 0.75rem 0.25rem; cursor: pointer; text-align: left;
	font-size: 0.95rem; font-weight: 600;
}
.eb-v3d__liste button span:first-child { font-family: var(--wp--preset--font-family--goldman); font-weight: 400; font-size: 0.8rem; color: var(--v3d-muted); }
.eb-v3d__liste button svg { width: 14px; height: 14px; color: var(--v3d-muted); transition: transform 0.2s; }
.eb-v3d__liste button:hover svg { transform: translateX(3px); color: var(--eb-accent); }
.eb-v3d__liste button[aria-current="true"],
.eb-v3d__liste button[aria-current="true"] span:first-child { color: var(--eb-accent); }
.eb-v3d__ensemble {
	justify-self: start; border: 1px solid var(--v3d-ligne); background: transparent; border-radius: 999px;
	padding: 0.55rem 1.1rem; cursor: pointer; font-size: 0.875rem; font-weight: 600; display: inline-flex; gap: 0.5rem; align-items: center;
}
.eb-v3d__ensemble:hover { border-color: var(--eb-ink-on-dark, #ecebe7); }
.eb-v3d__ensemble svg { width: 15px; height: 15px; }

/* ---------- Petits écrans ---------- */
@media (max-width: 960px) {
	.eb-v3d__grille,
	.eb-v3d__entete { grid-template-columns: minmax(0, 1fr); }
	.eb-v3d__config { justify-items: start; }
	.eb-v3d__note { text-align: left; }
}
@media (max-width: 640px) {
	.eb-v3d__scene { aspect-ratio: 4 / 5; }
	.eb-v3d__ov--hg { top: 16px; left: 18px; font-size: 0.62rem; }
	.eb-v3d__ov--bg { display: none; }
	.eb-v3d__ctrl { right: 12px; bottom: 12px; }
	.eb-v3d__ctrl button { width: 36px; height: 36px; }
	.eb-v3d__carte { width: auto; left: 12px !important; right: 12px; top: auto !important; bottom: 62px; transform: none !important; }
	.eb-v3d__rep { --t: 30px; }
	.eb-v3d__actif-num { width: 48px; height: 48px; font-size: 1.05rem; }
	.eb-v3d__chiffre-v { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
	.eb-v3d__rep.is-active::after { animation: none; }
	.eb-v3d__carte, .eb-v3d__rep, .eb-v3d__chargement { transition: none; }
}

/* Éditeur : aperçu sans 3D (le viewer n'est pas chargé dans l'éditeur) */
.editor-styles-wrapper .eb-v3d__chargement { display: none; }

/* ---------- Version intégrée à « <Modèle> en détail » (colonne gauche, à la place de la photo à repères) ---------- */
.eb-v3d--detail { background: none; color: inherit; display: grid; gap: 1rem; }
.eb-v3d__outils { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; }
.eb-v3d__outils .eb-v3d__seg button { padding: 0.45rem 1rem; font-size: 0.9rem; }
.eb-v3d--detail .eb-v3d__cadre { margin-top: 0.4rem; }
.eb-v3d--detail .eb-v3d__scene { aspect-ratio: 4 / 3; }
.eb-v3d--detail .eb-v3d__carte { width: min(320px, 56%); }
.eb-v3d__carte-chiffre { grid-column: 2; justify-self: start; margin: 0.4rem 0 0; background: var(--eb-accent); color: #fff; border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.72rem; font-weight: 600; }
.eb-v3d__carte-chiffre b { font-family: var(--wp--preset--font-family--goldman); font-weight: 400; font-size: 0.85rem; }
.eb-v3d__carte-chiffre[hidden] { display: none; }
.eb-v3d__photo { position: relative; margin-top: 0.4rem; } /* repères de la photo (eb-point) positionnés en % de la photo */
.eb-v3d__photo[hidden] { display: none; }
.eb-v3d__puces { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.45rem; }
.eb-v3d__puces[hidden] { display: none; }
.eb-v3d__puces li { margin: 0; }
.eb-v3d__puces button {
	display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer;
	border: 1px solid var(--v3d-ligne); border-radius: 999px; background: rgba(31, 31, 30, 0.55);
	padding: 0.3rem 0.85rem 0.3rem 0.3rem; font-size: 0.8rem; font-weight: 600; line-height: 1.2;
}
.eb-v3d__puces button span:first-child {
	width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; display: grid; place-items: center;
	font-family: var(--wp--preset--font-family--goldman); font-weight: 400; font-size: 0.68rem;
}
.eb-v3d__puces button:hover { border-color: var(--v3d-muted); }
.eb-v3d__puces button[aria-current="true"] { border-color: var(--eb-accent); color: var(--eb-accent); }
.eb-v3d--detail .eb-v3d__note { text-align: left; max-width: none; }
.eb-v3d--detail .eb-v3d__note[hidden] { display: none; }
@media (max-width: 640px) {
	.eb-v3d--detail .eb-v3d__scene { aspect-ratio: 4 / 5; }
	.eb-v3d--detail .eb-v3d__carte { width: auto; }
}

/* Bascule de version Start / Pro (fiches « Modèle en I / en T ») : nom + sous-titre */
.eb-v3d__seg--versions button { flex-direction: column; gap: 0.1rem; line-height: 1.15; }
.eb-v3d__outils .eb-v3d__seg--versions button { padding: 0.4rem 1.15rem; }
.eb-v3d__seg--versions b { font-weight: 700; }
.eb-v3d__seg--versions small { font-size: 0.7rem; font-weight: 500; opacity: 0.75; }

/* Bouton × de la carte : retour à la position neutre (02/11/2026) */
.eb-v3d__fermer { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--wp--preset--color--anthracite); cursor: pointer; pointer-events: none; transition: background-color 0.2s; }
.eb-v3d__carte.is-on .eb-v3d__fermer { pointer-events: auto; }
.eb-v3d__fermer:hover, .eb-v3d__fermer:focus-visible { background: color-mix(in srgb, var(--wp--preset--color--anthracite) 10%, transparent); }
.eb-v3d__fermer svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.eb-v3d__carte-titre { padding-right: 1.8rem; }

/* ---- Variante pleine largeur hors fiche modèle (bloc eb/viewer-3d avec l'attribut « fiche », page Easy Vrac, 05/11/2026) ----
   Même viewer que « <Modèle> en détail », mais titre et intro au-dessus et scène sur toute la largeur de la section. */
.eb-mdetail--large .eb-mdetail__texte { max-width: 760px; margin-bottom: var(--wp--preset--spacing--50); }
.eb-mdetail--large .eb-mdetail__visuel { position: relative; top: 0; }
.eb-mdetail--large .eb-v3d--detail .eb-v3d__scene { aspect-ratio: 21 / 9; }
.eb-mdetail--large .eb-v3d--detail .eb-v3d__carte { width: min(340px, 34%); }
@media (max-width: 900px) {
	.eb-mdetail--large .eb-v3d--detail .eb-v3d__scene { aspect-ratio: 16 / 10; }
	.eb-mdetail--large .eb-v3d--detail .eb-v3d__carte { width: min(320px, 56%); }
}
@media (max-width: 640px) {
	.eb-mdetail--large .eb-v3d--detail .eb-v3d__scene { aspect-ratio: 4 / 5; }
	.eb-mdetail--large .eb-v3d--detail .eb-v3d__carte { width: auto; }
}
