/* ECW – shared 3D view (Product Gallery and Product 3D View widgets).
 *
 * A stage shows a poster image with an open button; once the model has loaded
 * the viewer fades in over it. Widgets set the colours through these
 * variables: --ecw-3d-bg, --ecw-3d-btn-bg, --ecw-3d-btn-fg, --ecw-3d-btn-hover
 * and --ecw-3d-accent (loading spinner and focus ring).
 */

.ecw-3d{position:relative;overflow:hidden;cursor:pointer}
.ecw-3d.is-3d-active{cursor:auto}
.ecw-3d[hidden]{display:none!important}
.ecw-3d.ecw-3d img.ecw-3d__poster{transition:opacity .3s}
.ecw-3d.ecw-3d.is-3d-ready img.ecw-3d__poster{opacity:0}
.ecw-3d .ecw-3d__model{position:absolute;inset:0;display:block;width:100%;height:100%;background:var(--ecw-3d-bg,#fff);opacity:0;transition:opacity .3s;--poster-color:transparent}
.ecw-3d.is-3d-ready .ecw-3d__model{opacity:1}

/* Open button (strong selectors: themes style every <button>). */
.ecw-3d.ecw-3d .ecw-3d__open{position:absolute;z-index:2;top:50%;left:50%;display:flex;align-items:center;gap:8px;min-width:0;min-height:0;max-width:calc(100% - 24px);margin:0;padding:10px 18px;border:0;border-radius:999px;background:var(--ecw-3d-btn-bg,rgba(255,255,255,.92));color:var(--ecw-3d-btn-fg,var(--e-global-color-text,#333));font-size:14px;font-weight:600;line-height:1.2;letter-spacing:0;text-transform:none;white-space:nowrap;box-shadow:0 2px 10px rgba(0,0,0,.15);transform:translate(-50%,-50%);cursor:pointer;transition:color .2s}
.ecw-3d.ecw-3d .ecw-3d__open:hover,.ecw-3d.ecw-3d .ecw-3d__open:focus-visible{background:var(--ecw-3d-btn-bg,rgba(255,255,255,.92));color:var(--ecw-3d-btn-hover,var(--e-global-color-accent,#222))}
.ecw-3d .ecw-3d__open:focus-visible{outline:2px solid var(--ecw-3d-accent,var(--e-global-color-accent,#222));outline-offset:2px}
.ecw-3d .ecw-3d__open svg{display:block;flex:0 0 auto;width:20px;height:20px}
.ecw-3d .ecw-3d__open span{overflow:hidden;text-overflow:ellipsis}
.ecw-3d.is-3d-active .ecw-3d__open{display:none}

/* Loading and error messages. */
.ecw-3d .ecw-3d__status{position:absolute;z-index:2;left:50%;top:calc(50% + 34px);max-width:calc(100% - 24px);padding:4px 10px;border-radius:999px;background:var(--ecw-3d-btn-bg,rgba(255,255,255,.92));color:var(--ecw-3d-btn-fg,var(--e-global-color-text,#333));font-size:13px;font-weight:600;line-height:1.4;text-align:center;transform:translateX(-50%);pointer-events:none}
.ecw-3d .ecw-3d__status:empty{display:none}
.ecw-3d.is-3d-error .ecw-3d__status{top:calc(50% + 30px)}
.ecw-3d.is-3d-loading::after{content:"";position:absolute;z-index:2;top:50%;left:50%;width:40px;height:40px;margin:-20px 0 0 -20px;border:3px solid rgba(0,0,0,.12);border-top-color:var(--ecw-3d-accent,var(--e-global-color-accent,#222));border-radius:50%;animation:ecw-3d-spin .8s linear infinite;pointer-events:none}
@keyframes ecw-3d-spin{to{transform:rotate(360deg)}}

/* Popup: the 3D view large (native <dialog>; the page behind does not scroll). */
html.ecw-3d-open{overflow:hidden}
.ecw-3d-pop{position:fixed;inset:0;width:min(1200px,calc(100vw - 40px));height:min(860px,calc(100vh - 40px));max-width:none;max-height:none;margin:auto;padding:0;border:0;border-radius:16px;background:#fff;color:var(--e-global-color-text,#333);box-shadow:0 24px 70px rgba(0,0,0,.28);overflow:hidden}
.ecw-3d-pop::backdrop{background:rgba(0,0,0,.55)}
.ecw-3d-pop .ecw-3d-pop__stage{position:absolute;inset:0;cursor:auto;--ecw-3d-bg:#fff}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__close{position:absolute;z-index:3;top:14px;right:14px;display:flex;align-items:center;justify-content:center;width:44px;height:44px;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:50%;background:rgba(255,255,255,.92);color:var(--e-global-color-text,#333);box-shadow:0 1px 6px rgba(0,0,0,.15);line-height:1;cursor:pointer;transition:color .2s}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__close:hover,.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__close:focus-visible{background:rgba(255,255,255,.92);color:var(--e-global-color-accent,#222)}
.ecw-3d-pop .ecw-3d-pop__close:focus-visible{outline:2px solid var(--e-global-color-accent,#222);outline-offset:2px}
.ecw-3d-pop .ecw-3d-pop__close svg{display:block;width:24px;height:24px}
@media (max-width:767px){.ecw-3d-pop{width:100vw;height:100vh;height:100dvh;border-radius:0}}

/* Popup bar: how-to hints (always visible) and control buttons. */
.ecw-3d-pop .ecw-3d-pop__bar{position:absolute;z-index:3;left:50%;bottom:20px;display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px 18px;max-width:calc(100% - 24px);padding:8px 10px 8px 18px;border-radius:999px;background:rgba(255,255,255,.95);color:var(--e-global-color-text,#333);box-shadow:0 2px 14px rgba(0,0,0,.14);transform:translateX(-50%)}
.ecw-3d-pop .ecw-3d-hint{display:flex;flex-wrap:wrap;justify-content:center;gap:6px 16px;font-size:14px;font-weight:600;line-height:1.3}
.ecw-3d-pop .ecw-3d-hint__item{display:flex;align-items:center;gap:7px;white-space:nowrap}
.ecw-3d-pop .ecw-3d-hint svg{display:block;flex:0 0 auto;color:var(--e-global-color-accent,#222)}
.ecw-3d-pop .ecw-3d-hint__drag{animation:ecw-3d-drag 1.6s ease-in-out 4}
.ecw-3d-pop .ecw-3d-hint__zoom{animation:ecw-3d-zoom 1.6s ease-in-out 4}
@keyframes ecw-3d-drag{0%,100%{transform:translateX(-4px)}50%{transform:translateX(4px)}}
@keyframes ecw-3d-zoom{0%,100%{transform:scale(.88)}50%{transform:scale(1.1)}}
.ecw-3d-pop .ecw-3d-pop__controls{display:flex;align-items:center;gap:4px}
.ecw-3d-pop .ecw-3d-pop__sep{display:block;width:1px;height:26px;margin:0 6px;background:rgba(0,0,0,.14)}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__ctl{display:flex;align-items:center;justify-content:center;width:42px;height:42px;min-width:0;min-height:0;margin:0;padding:0;border:1px solid rgba(0,0,0,.1);border-radius:50%;background:#fff;color:var(--e-global-color-text,#333);box-shadow:none;line-height:1;cursor:pointer;transition:color .2s,border-color .2s}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__ctl:hover,.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__ctl:focus-visible{background:#fff;border-color:currentColor;color:var(--e-global-color-accent,#222)}
.ecw-3d-pop .ecw-3d-pop__ctl:focus-visible{outline:2px solid var(--e-global-color-accent,#222);outline-offset:2px}
.ecw-3d-pop .ecw-3d-pop__ctl svg{display:block;width:22px;height:22px}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__ctl--reset{gap:6px;width:auto;white-space:nowrap;padding:0 16px 0 12px;border-radius:999px;font-size:14px;font-weight:600;line-height:1}
.ecw-3d-pop.ecw-3d-pop .ecw-3d-pop__ctl--reset svg{width:18px;height:18px}
.ecw-3d-pop .ecw-3d-pop__stage:not(.is-3d-ready) ~ .ecw-3d-pop__bar .ecw-3d-pop__controls{opacity:.4;pointer-events:none}
@media (max-width:767px){.ecw-3d-pop .ecw-3d-pop__bar{bottom:12px;padding:8px 10px;border-radius:18px}.ecw-3d-pop .ecw-3d-hint{font-size:13px}}
@media (prefers-reduced-motion:reduce){.ecw-3d-pop .ecw-3d-hint__drag,.ecw-3d-pop .ecw-3d-hint__zoom{animation:none}}
