/* Graverolaser : studio de création plein écran. */
html.gls-open { overflow: hidden; }
.gls {
	--b: #9A5823; --bd: #7A4417; --soft: #F6ECE1; --ink: #1F1B17; --muted: #5F5850; --field: #D9D2C7; --line: #E3DDD4;
	position: fixed; inset: 0; z-index: 100000; background: #EFEBE5; color: var(--ink); display: flex; flex-direction: column;
	font-family: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 14px; outline: none;
}
.gls[hidden] { display: none; }
.gls *, .gls *::before { box-sizing: border-box; }
.gls [hidden] { display: none !important; }
.gls button, .gls label.gls-ghost {
	font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1; min-height: 40px; padding: 0 12px; border-radius: 6px; cursor: pointer;
	border: 1.5px solid var(--field); background: #fff; color: var(--ink); box-shadow: none; text-transform: none; letter-spacing: normal;
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.gls button:hover, .gls label.gls-ghost:hover { background: #FAF7F3; color: var(--ink); box-shadow: none; }
.gls button:disabled { opacity: .4; cursor: default; }
.gls button:focus-visible, .gls input:focus-visible, .gls textarea:focus-visible, .gls label.gls-ghost:focus-within { outline: 2px solid var(--b); outline-offset: 2px; }
.gls .gls-primary, .gls .gls-primary:hover { background: var(--b); border-color: var(--b); color: #fff; }
.gls .gls-primary:hover { background: var(--bd); border-color: var(--bd); }
.gls .gls-danger { color: #8A1A12; }
.gls .is-on, .gls .is-on:hover { border: 2px solid var(--b); background: var(--soft); }

.gls-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gls-top strong { font-size: 16px; }
.gls-dim { color: var(--muted); margin-right: 12px; }
.gls-top [data-zoom] { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.gls-state { margin-left: auto; color: var(--muted); font-size: 13px; }

.gls-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.gls-panel { background: #fff; border-right: 1px solid var(--line); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.gls-add { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gls-add input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gls-block { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.gls-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.gls-muted { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.gls-warn { margin: 0; font-size: 13px; line-height: 1.45; color: #7A3E00; background: #FFF4E0; border-radius: 6px; padding: 8px 10px; }
.gls textarea, .gls input[type=number] {
	width: 100%; border: 1.5px solid var(--field); border-radius: 6px; padding: 8px 10px; font-family: inherit; font-size: 16px; font-weight: 400;
	background: #fff; color: var(--ink); min-height: 40px;
}
.gls textarea { resize: vertical; }
.gls-presets, .gls-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gls-fonts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gls-fonts button { font-size: 17px; font-weight: 400; min-height: 44px; }
.gls-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: end; }
.gls-seg { display: flex; margin-top: 6px; }
.gls-seg button { flex: 1; border-radius: 0; margin-left: -1.5px; padding: 0 6px; }
.gls-seg button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.gls-seg button:last-child { border-radius: 0 6px 6px 0; }
.gls-seg .is-on { position: relative; z-index: 1; }
.gls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gls-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.gls-check { display: flex; gap: 8px; align-items: center; font-size: 14px; min-height: 40px; }
.gls-check input { width: 18px; height: 18px; accent-color: var(--b); }
.gls-layer { display: flex; align-items: center; gap: 4px; border: 1.5px solid var(--field); border-radius: 6px; margin-bottom: 6px; padding: 2px; }
.gls-layer.is-on { border: 2px solid var(--b); background: var(--soft); }
.gls-layer button { border: none; background: none; min-height: 36px; padding: 0 8px; font-weight: 400; font-size: 13px; }
.gls-layer .gls-layer__name { flex: 1; justify-content: flex-start; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; display: block; text-align: left; }

.gls-stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 16px 24px; gap: 8px; position: relative; }
.gls-scroll { flex: 1; min-height: 0; overflow: auto; display: flex; }
.gls-scroll svg { width: 100%; height: 100%; margin: auto; flex: none; touch-action: none; user-select: none; -webkit-user-select: none; filter: drop-shadow(0 10px 18px rgba(31, 27, 23, .18)); }
.gls-scroll svg [data-id] { cursor: move; }
.gls-tick { stroke: #8A8178; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.gls-num { font: 2.1px 'Figtree', system-ui, sans-serif; fill: #5F5850; }
.gls-safe { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.gls-guide { stroke: #E0218A; stroke-width: 1px; vector-effect: non-scaling-stroke; pointer-events: none; }
.gls-box { fill: none; stroke: #2F7BF6; stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.gls-box.is-lock { stroke-dasharray: 5 4; stroke: #8A8178; }
.gls-handle { fill: #fff; stroke: #2F7BF6; stroke-width: 1.5px; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.gls-handle--rot { cursor: grab; fill: #2F7BF6; }
.gls-hint { margin: 0; text-align: center; color: var(--muted); font-size: 13px; }
.gls-loading { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); margin: 0; background: #fff; border-radius: 6px; padding: 8px 14px; font-weight: 600; box-shadow: 0 6px 18px -8px rgba(31, 27, 23, .4); }

@media (max-width: 900px) {
	.gls-body { grid-template-columns: 1fr; grid-template-rows: minmax(200px, 42vh) minmax(0, 1fr); }
	.gls-stage { order: -1; padding: 8px; }
	.gls-panel { border-right: none; border-top: 1px solid var(--line); }
	.gls-hint, .gls-dim { display: none; }
	.gls-top { padding: 8px; gap: 6px; }
	.gls-state { width: 100%; order: 9; margin: 0; }
}

.gls-crop { display: flex; flex-direction: column; gap: 6px; border: 1.5px solid var(--field); border-radius: 6px; padding: 10px; }
.gls-crop label { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.gls-crop input[type=range] { accent-color: var(--b); height: 28px; width: 100%; }
.gls-cropdim { fill: rgba(239, 235, 229, .8); pointer-events: none; }
.gls-cropbox { fill: none; stroke: #E0218A; stroke-width: 1.5px; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; pointer-events: none; }

/* Vue 3D */
.gls-panel.is-off { opacity: .45; pointer-events: none; }
.gls-3d { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; perspective: 1400px; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.gls-3d:active { cursor: grabbing; }
.gls-3d__card { position: relative; width: min(520px, 60%); transform-style: preserve-3d; --sh: 50%; }
.gls-3d__card > i { position: absolute; inset: 0; border-radius: inherit; background: #0E0D0F; transform: translateZ(var(--z)); }
.gls-3d__face { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.gls-3d__front { transform: translateZ(1.8px); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset; }
.gls-3d__front img { width: 100%; height: 100%; display: block; pointer-events: none; }
.gls-3d__front::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent calc(var(--sh) - 30%), rgba(255, 255, 255, .13) var(--sh), transparent calc(var(--sh) + 30%)); pointer-events: none; }
.gls-3d__back { transform: rotateY(180deg) translateZ(1.8px); background: linear-gradient(135deg, #2A2224, #1B1A1D 55%, #2A2224); }

.gls-views { display: flex; margin-left: 8px; }
.gls .gls-views button { min-height: 44px; padding: 0 18px; font-size: 15px; font-weight: 700; border-radius: 0; margin-left: -1.5px; }
.gls .gls-views button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.gls .gls-views button:last-child { border-radius: 0 6px 6px 0; }
.gls .gls-views .is-on, .gls .gls-views .is-on:hover { background: var(--ink); border-color: var(--ink); color: #fff; position: relative; z-index: 1; }
.gls .gls-fab, .gls .gls-fab:hover { position: absolute; right: 28px; bottom: 64px; min-height: 48px; padding: 0 20px; font-size: 15px; font-weight: 700; background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 10px 22px -10px rgba(31, 27, 23, .6); z-index: 2; }
.gls .gls-fab:hover { background: #3E3832; border-color: #3E3832; }
@media (max-width: 900px) { .gls .gls-fab { right: 12px; bottom: 12px; min-height: 44px; } .gls-views { margin-left: 0; } }

.gls-band { fill: rgba(255, 255, 255, .86); pointer-events: none; }
.gls-safe--photo { stroke: #fff; stroke-width: 1.5px; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .7)); }
.gls-3d__card.is-cut .gls-3d__face { overflow: visible; border-radius: 0; }
.gls-3d__card.is-cut .gls-3d__front { box-shadow: none; transform: translateZ(1px); }
.gls-3d__card.is-cut .gls-3d__front::after { display: none; }
.gls-3d__card.is-cut .gls-3d__back { background: none; transform: rotateY(180deg) translateZ(1px); }
.gls-3d__card.is-cut .gls-3d__back img { width: 100%; height: 100%; display: block; filter: brightness(.62); pointer-events: none; }
.gls-3d .gls-3d__card.is-tall { height: min(480px, 74%); width: auto; }
.gl-3dstage .gls-3d__card.is-tall { height: 80%; width: auto; }
.gl-3dstage.is-flat { cursor: default; touch-action: auto; }

/* Carte 3D sur la fiche produit */
.gl-3dstage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; perspective: 1200px; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gl-3dstage:active { cursor: grabbing; }
.gl-3dstage .gls-3d__card { width: 72%; }
.gl-3d-badge { position: absolute; left: 14px; top: 14px; background: #1F1B17; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 7px 10px; border-radius: 4px; pointer-events: none; }
.gl-3d-hint { position: absolute; left: 12px; right: 12px; bottom: 14px; margin: 0; text-align: center; font-size: 13px; color: #3E3832; pointer-events: none; }

/* Fiche produit en mode studio */
.gl-studio-preview { position: absolute; left: 8%; top: 50%; width: 84%; height: auto; transform: translateY(-50%) rotate(-6deg); filter: drop-shadow(0 22px 18px rgba(20, 25, 35, .35)); }
.gl-studio-box { border: 1px solid var(--gl-line-2, #E3DDD4); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: #fff; }
.gl-studio-box p { margin: 0; font-size: 14px; line-height: 1.5; color: #3E3832; }
.gl-3dstage[hidden] { display: none; }

/* Vrai volume (WebGL) : remplace la découpe à plat quand il est prêt */
.gls-3d { position: relative; }
.gls-3d__gl { position: absolute; inset: 0 0 56px 0; pointer-events: none; }
.gl-3dstage .gls-3d__gl { inset: 34px 0 40px 0; }
.is-gl > .gls-3d__card { visibility: hidden; }
