/* Engraving builder (assets/js/engrave.js): used by the shop (inc/layout.php) and Admin → Engraving's sample design. */
.eg{display:grid;gap:14px}
.eg-preview{max-width:380px}
.eg-stage{position:relative;border-radius:10px;overflow:hidden;background:#222;container-type:inline-size}
.eg-stage > img{display:block;width:100%;height:auto}
/* The engraving area: lines and images sit at their own spots (left/top = centre, in % of the area) and can be dragged. */
.eg-box{position:absolute;container-type:size;outline:1px dashed rgba(255,255,255,.45);outline-offset:2px;border-radius:4px;overflow:hidden;touch-action:none}
.eg-it{position:absolute;transform:translate(-50%,-50%);cursor:grab;user-select:none;-webkit-user-select:none;touch-action:none;border-radius:3px}
.eg-it:active{cursor:grabbing}
.eg-it:focus-visible{outline:2px solid var(--gold-2,#f3d27a);outline-offset:2px}
.eg-ln{white-space:nowrap;line-height:1.1;color:rgba(236,230,218,.92);text-shadow:0 1px 0 rgba(0,0,0,.55),0 -1px 0 rgba(255,255,255,.12)}
.eg-box.vertical .eg-ln{writing-mode:vertical-rl;transform:translate(-50%,-50%) rotate(180deg)}
.eg-im img{display:block;width:100%;height:auto;pointer-events:none;filter:grayscale(1) contrast(1.2) brightness(1.4);mix-blend-mode:screen;opacity:.9}
.eg-ghost{position:absolute;inset:0;display:grid;place-items:center;opacity:.45;font-family:'Cinzel',serif;font-size:12cqmin;color:rgba(236,230,218,.92);text-align:center;pointer-events:none}
.eg-hint{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
.eg-reset{font-weight:600;text-decoration:underline;text-underline-offset:3px;min-height:32px;color:inherit}
.eg-blank{aspect-ratio:3/4;background:radial-gradient(120% 90% at 30% 20%,#5a3d2b 0%,#3a2619 55%,#24170f 100%)}
.eg-filetag{font-size:11px;background:rgba(255,255,255,.85);color:#111;padding:2px 6px;border-radius:4px}
.eg-cap{font-size:12px;color:#666;margin-top:6px}
.eg-form{display:grid;gap:12px}
.eg-tabs{display:flex;flex-wrap:wrap;gap:6px}
.eg-tabs button{min-height:36px;padding:0 12px;border-radius:999px;border:1px solid rgba(0,0,0,.2);font-size:13px}
.eg-tabs button[aria-selected="true"]{background:var(--ink,#0a0a0a);color:#fff;border-color:var(--ink,#0a0a0a)}
.eg-f{display:grid;gap:6px;font-size:14px}
.eg-f select,.eg-line input{min-height:44px;border:1px solid rgba(0,0,0,.2);border-radius:8px;padding:0 10px;font:inherit;font-size:16px;background:#fff;color:var(--ink,#0a0a0a);width:100%}
.eg-lbl{font-weight:600}
.eg-lbl small,.eg-f > small{font-weight:400;color:#555}
.eg-line{display:flex;align-items:center;gap:6px}
.eg-count{font-size:12px;color:#777;min-width:40px;text-align:right;font-variant-numeric:tabular-nums}
.eg-x{width:32px;height:32px;border-radius:6px;color:#555;flex:none}
.eg-x:hover{background:rgba(0,0,0,.07)}
.eg-add,.eg-more,.eg-rmspot{justify-self:start;font-size:14px;font-weight:600;text-decoration:underline;text-underline-offset:3px;min-height:32px}
.eg-rmspot{color:#b42318;font-weight:500}
.eg-fonts{display:flex;flex-wrap:wrap;gap:6px}
.eg-font{position:relative}
.eg-font input{position:absolute;opacity:0;inset:0;cursor:pointer}
.eg-font span{display:grid;place-items:center;min-height:44px;padding:0 14px;border:1px solid rgba(0,0,0,.2);border-radius:8px;font-size:19px;background:#fff}
.eg-font input:checked + span{border-color:var(--ink,#0a0a0a);box-shadow:0 0 0 1px var(--ink,#0a0a0a)}
.eg-font input:focus-visible + span{outline:2px solid var(--gold,#c9a227);outline-offset:2px}
.eg-upload{position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 16px;border:1.5px dashed rgba(0,0,0,.35);border-radius:8px;font-weight:600;font-size:14px;cursor:pointer;justify-self:start}
.eg-upload input{position:absolute;inset:0;opacity:0;cursor:pointer}
.eg-upload:focus-within{outline:2px solid var(--gold,#c9a227);outline-offset:2px}
.eg-upload.busy{opacity:.6}
.eg-file{display:flex;align-items:center;gap:6px;font-size:14px;background:#fff;border:1px solid rgba(0,0,0,.15);border-radius:8px;padding:4px 4px 4px 10px;justify-self:start}
.eg-err{color:#b42318;font-size:13px}
.eg-err:empty{display:none}
.eg-price{font-size:15px}
.eg-price small{color:#666}
.eg-meta{font-size:12px;color:#555}
.eg-note textarea{width:100%;min-height:76px;border:1px solid rgba(0,0,0,.2);border-radius:8px;padding:10px;font:inherit;font-size:16px;line-height:1.4;background:#fff;color:var(--ink,#0a0a0a);resize:vertical}
.eg-note .eg-count{justify-self:end}
.eg-fee{display:block;font-family:var(--body, inherit);font-size:12px;font-weight:400;color:#555}
.eg-it:hover{outline:1px solid rgba(243,210,122,.7);outline-offset:2px}
/* The selected item's frame: corners resize evenly, sides stretch. */
.eg-frame{position:absolute;outline:1.5px solid #f3d27a;pointer-events:none;z-index:2}
.eg-frame i{position:absolute;width:14px;height:14px;margin:-7px 0 0 -7px;background:#f3d27a;border:2px solid #111;border-radius:3px;pointer-events:auto;touch-action:none}
.eg-frame .h-nw{left:0;top:0;cursor:nwse-resize}.eg-frame .h-n{left:50%;top:0;cursor:ns-resize}.eg-frame .h-ne{left:100%;top:0;cursor:nesw-resize}
.eg-frame .h-e{left:100%;top:50%;cursor:ew-resize}.eg-frame .h-se{left:100%;top:100%;cursor:nwse-resize}.eg-frame .h-s{left:50%;top:100%;cursor:ns-resize}
.eg-frame .h-sw{left:0;top:100%;cursor:nesw-resize}.eg-frame .h-w{left:0;top:50%;cursor:ew-resize}
.eg-frame .h-n,.eg-frame .h-s,.eg-frame .h-e,.eg-frame .h-w{border-radius:50%}
@media (pointer:coarse){.eg-frame i{width:22px;height:22px;margin:-11px 0 0 -11px}}
.eg-box{overflow:visible}
.eg-stage{overflow:hidden}
/* Arrange toolbar: align the selected item (or the whole design) in the zone, and Auto fit. */
.eg-tools{display:grid;gap:6px;margin-top:10px}
.eg-tools-what{font-size:12px;color:#555;min-height:1.2em}
.eg-tools-row{display:flex;flex-wrap:wrap;gap:6px}
.eg-tools button{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:40px;min-height:40px;padding:0 8px;border:1px solid rgba(0,0,0,.2);border-radius:8px;background:#fff;color:#111;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.eg-tools button:hover:not(:disabled){border-color:#111}
.eg-tools button:focus-visible{outline:2px solid var(--gold,#c9a227);outline-offset:2px}
.eg-tools button:disabled{opacity:.4;cursor:default}
.eg-tools svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linejoin:round}
.eg-tools .eg-fit{padding:0 12px}
