/* ════════════════════════════════════════════════════════════════════════
   STITCHA — DESKTOP GELATO CUSTOMISER + MOCKUP PREVIEW (opt-in)
   Styles for the #yhmDesk shell (yh-desk.js) and the #yhmMockRoot preview
   modal (yh-mockup.js). Everything is scoped under those ids / the
   body.yhm-gelato-desk class — zero effect unless the variant is active.
   ════════════════════════════════════════════════════════════════════════ */

#yhmDesk { position: fixed; inset: 0; z-index: 320; display: none;
  flex-direction: column; background: #fafafa; font-family: 'DM Sans', sans-serif; }

/* top bar */
#yhmDesk .yhd-top { display: flex; align-items: center; gap: 1rem;
  height: 56px; padding: 0 1rem; background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.1); }
#yhmDesk .yhd-back { border: 0; background: transparent; font-size: 13px;
  font-weight: 600; cursor: pointer; padding: 0.5rem 0.4rem; }
#yhmDesk .yhd-title { font-size: 14px; font-weight: 700; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#yhmDesk .yhd-price { margin-left: auto; font-size: 14px; font-weight: 700; }
#yhmDesk .yhd-continue { min-height: 40px; padding: 0 1.2rem; border: 0;
  border-radius: 8px; background: #1a1d23; color: #fff; font-size: 13px;
  font-weight: 700; cursor: pointer; }

/* tools row */
#yhmDesk .yhd-tools { display: flex; align-items: center; gap: 0.3rem;
  height: 44px; padding: 0 0.8rem; background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.08); }
#yhmDesk .yhd-tools button { min-width: 38px; min-height: 34px; border: 0;
  border-radius: 8px; background: transparent; font-size: 14px;
  cursor: pointer; padding: 0 0.6rem; }
#yhmDesk .yhd-tools button:disabled { opacity: 0.3; }
#yhmDesk .yhd-tools button.on { background: #1a1d23; color: #fff; }
#yhmDesk #yhdLink { font-size: 11px; }
#yhmDesk #yhdLink:not(.on) { opacity: 0.55; text-decoration: line-through; }
#yhmDesk .yhd-gap { flex: 1; }

/* main: rail + panel + canvas */
#yhmDesk .yhd-main { flex: 1; display: flex; min-height: 0; }
#yhmDesk .yhd-rail { width: 68px; background: #fff;
  border-right: 1px solid rgba(0,0,0,0.08); display: flex;
  flex-direction: column; padding-top: 0.4rem; }
#yhmDesk .yhd-rail-btn { border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0.65rem 0.2rem; font-size: 9.5px; font-weight: 600; color: #333; }
#yhmDesk .yhd-rail-btn.on { background: #f1f0ee; }
#yhmDesk .yhd-rail-ic { font-size: 17px; font-weight: 700; }
#yhmDesk .yhd-panel { width: 270px; background: #fff;
  border-right: 1px solid rgba(0,0,0,0.08); overflow-y: auto;
  padding: 1rem 0.9rem 1.2rem; }
#yhmDesk .yhd-panel h3 { margin: 0 0 0.8rem; font-size: 17px; }
#yhmDesk .yhd-big { display: flex; align-items: center; gap: 0.55rem;
  width: 100%; min-height: 46px; margin-bottom: 0.55rem;
  border: 1.5px solid #e3e1dd; border-radius: 10px; background: #fff;
  color: #1a1d23; font-size: 13px; font-weight: 600; padding: 0 0.85rem;
  cursor: pointer; }
#yhmDesk .yhd-big:hover { background: #f6f5f3; }
#yhmDesk .yhd-lib { display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem; margin-top: 0.8rem; }
#yhmDesk .yhd-logo { aspect-ratio: 1; border: 1.5px solid #e9e7e3;
  border-radius: 8px; background: #fff; cursor: pointer; padding: 4px;
  display: flex; align-items: center; justify-content: center; }
#yhmDesk .yhd-logo:hover { border-color: #1a1d23; }
#yhmDesk .yhd-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
#yhmDesk .yhd-empty { font-size: 12px; color: #888; }
#yhmDesk .yhd-prow { display: flex; align-items: center; gap: 0.6rem;
  width: 100%; min-height: 56px; border: 0; background: transparent;
  border-bottom: 1px solid rgba(0,0,0,0.06); cursor: pointer;
  font-size: 12.5px; text-align: left; padding: 0.35rem 0.2rem; }
#yhmDesk .yhd-prow img { width: 42px; height: 42px; object-fit: cover;
  border-radius: 7px; background: #f4f4f4; }
#yhmDesk .yhd-prow span { flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
#yhmDesk .yhd-prow span small { display: block; color: #888; font-size: 10.5px; }
#yhmDesk .yhd-prow b { font-size: 9.5px; color: #9c7f43; }
#yhmDesk .yhd-prow.on { background: #f6f5f3; }

/* canvas host — adopted #mCanvasWrap lives here */
#yhmDesk .yhd-canvas { flex: 1; position: relative; overflow: hidden;
  background: #f2f1ef; }
#yhmDesk .yhd-canvas #mCanvasWrap { position: absolute; inset: 0;
  overflow: hidden; background: transparent; }

/* re-enable native canvas interaction + selection chrome (the preset-only
   block disables them site-wide; the desktop drag/resize handlers in
   canvas-editor.js are intact and simply come back to life) */
body.yhm-gelato-desk #mCanvas,
body.yhm-gelato-desk .modal-canvas-stage canvas { pointer-events: auto !important; }
/* (the #mOverlaySvg ancestor is required — the preset-only block hides via
   '#mOverlaySvg #mSelRect' at two-id specificity) */
body.yhm-gelato-desk #mOverlaySvg #mSelRect,
body.yhm-gelato-desk #mOverlaySvg #mDragArea,
body.yhm-gelato-desk #mOverlaySvg #mhTL,
body.yhm-gelato-desk #mOverlaySvg #mhTR,
body.yhm-gelato-desk #mOverlaySvg #mhBL,
body.yhm-gelato-desk #mOverlaySvg #mhBR,
body.yhm-gelato-desk #mOverlaySvg .rh,
body.yhm-gelato-desk #mOverlaySvg #mSizeTip {
  display: inline !important; visibility: visible !important; }
body.yhm-gelato-desk #yhFullViewBtn,
body.yhm-gelato-desk .p3-cvs-arrow,
body.yhm-gelato-desk #undoRedoContainer { display: none !important; }
body.yhm-gelato-desk #mCanvas { max-width: none !important; max-height: none !important; }

/* bottom view strip — floating card, Gelato-style */
#yhmDesk .yhd-strip { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 18px; display: flex; gap: 0.5rem; padding: 0.55rem 0.7rem;
  background: #fff; border-radius: 12px;
  box-shadow: 0 4px 22px rgba(0,0,0,0.13); z-index: 5; }
#yhmDesk .yhd-thumb { border: 1.5px solid transparent; border-radius: 8px;
  background: transparent; cursor: pointer; padding: 3px 4px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
#yhmDesk .yhd-thumb img { width: 56px; height: 54px; object-fit: cover;
  object-position: 50% 24%; background: #f7f6f4; border-radius: 5px; }
#yhmDesk .yhd-thumb span { font-size: 10px; font-weight: 600; color: #444; }
#yhmDesk .yhd-thumb.on { border-color: #1a1d23; }

/* zoom bar bottom-right */
#yhmDesk .yhd-zoom { position: absolute; right: 18px; bottom: 18px;
  display: flex; align-items: center; gap: 0.2rem; background: #fff;
  border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,0.13);
  padding: 0.25rem; z-index: 5; }
#yhmDesk .yhd-zoom button { width: 36px; height: 36px; border: 0;
  border-radius: 8px; background: transparent; font-size: 17px; cursor: pointer; }
#yhmDesk .yhd-zoom button:hover { background: #f1f0ee; }
#yhmDesk .yhd-zoom span { min-width: 48px; text-align: center;
  font-size: 12px; font-weight: 600; }

/* ── mockup preview modal (shared with the phone variant later) ───────── */
#yhmMockRoot { position: fixed; inset: 0; z-index: 10005; display: none;
  align-items: center; justify-content: center;
  font-family: 'DM Sans', sans-serif; }
#yhmMockRoot .yhmk-scrim { position: absolute; inset: 0;
  background: rgba(12, 16, 22, 0.55); }
#yhmMockRoot .yhmk-modal { position: relative; width: min(1080px, 94vw);
  height: min(720px, 92vh); background: #fff; border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 18px 60px rgba(0,0,0,0.35); }
#yhmMockRoot .yhmk-hd { display: flex; align-items: center;
  justify-content: space-between; padding: 0.8rem 1.1rem;
  border-bottom: 1px solid rgba(0,0,0,0.08); font-size: 15px; font-weight: 700; }
#yhmMockRoot .yhmk-x { border: 0; background: transparent; font-size: 16px;
  cursor: pointer; min-width: 40px; min-height: 40px; }
#yhmMockRoot .yhmk-body { flex: 1; display: flex; min-height: 0; }
#yhmMockRoot .yhmk-stage { flex: 1; display: flex; align-items: center;
  gap: 0.4rem; padding: 1rem; min-width: 0; }
#yhmMockRoot .yhmk-canvas-wrap { flex: 1; height: 100%; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #f6f5f3; border-radius: 10px; overflow: hidden; }
#yhmMockRoot #yhmkCanvas { max-width: 100%; max-height: 100%; }
#yhmMockRoot .yhmk-spin { position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center; font-size: 13px;
  color: #555; background: rgba(246, 245, 243, 0.75); }
#yhmMockRoot .yhmk-note { position: absolute; left: 10px; bottom: 8px;
  font-size: 11px; color: #777; }
#yhmMockRoot .yhmk-arrow { width: 40px; height: 40px; border: 0;
  border-radius: 50%; background: #efeeec; font-size: 18px; cursor: pointer; }
#yhmMockRoot .yhmk-rail { width: 300px; border-left: 1px solid rgba(0,0,0,0.08);
  padding: 1rem; overflow-y: auto; }
#yhmMockRoot .yhmk-rail h4 { margin: 0 0 0.8rem; font-size: 13.5px; }
#yhmMockRoot .yhmk-grid { display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.6rem; }
#yhmMockRoot .yhmk-thumb { border: 1.5px solid #e7e5e1; border-radius: 9px;
  background: #fff; cursor: pointer; padding: 4px;
  display: flex; flex-direction: column; gap: 3px; }
#yhmMockRoot .yhmk-thumb.on { border-color: #1a1d23; }
#yhmMockRoot .yhmk-thumb img { width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 6px; background: #f6f5f3; }
#yhmMockRoot .yhmk-thumb span { font-size: 9.5px; color: #555;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#yhmMockRoot .yhmk-ft { display: flex; justify-content: flex-end; gap: 0.6rem;
  padding: 0.8rem 1.1rem; border-top: 1px solid rgba(0,0,0,0.08); }
#yhmMockRoot .yhmk-keep { min-height: 42px; padding: 0 1.1rem;
  border: 1.5px solid #d9d7d3; border-radius: 999px; background: #fff;
  font-size: 13px; font-weight: 600; cursor: pointer; }
#yhmMockRoot .yhmk-go { min-height: 42px; padding: 0 1.2rem; border: 0;
  border-radius: 999px; background: #1a1d23; color: #fff; font-size: 13px;
  font-weight: 700; cursor: pointer; }

/* ✎ Tune mode (dev-gated): drag the print-area box on the mockup photo */
#yhmMockRoot .yhmk-hd-tools { display: flex; align-items: center; gap: 0.4rem; }
#yhmMockRoot .yhmk-tune { border: 1.5px solid #d9d7d3; border-radius: 999px;
  background: #fff; font-size: 11.5px; font-weight: 600; cursor: pointer;
  min-height: 34px; padding: 0 0.8rem; }
#yhmMockRoot .yhmk-tune.on { background: #1a1d23; color: #fff; border-color: #1a1d23; }
#yhmkTuneBox { position: absolute; border: 2px dashed #2f7fe8; cursor: move;
  background: rgba(47, 127, 232, 0.07); z-index: 4; }
#yhmkTuneHandle { position: absolute; right: -7px; bottom: -7px; width: 14px;
  height: 14px; border-radius: 3px; background: #2f7fe8; cursor: nwse-resize; }
#yhmMockRoot .yhmk-add { display: flex; gap: 0.4rem; margin-top: 0.8rem; }
#yhmMockRoot .yhmk-add input { flex: 1; min-width: 0; border: 1.5px solid #e3e1dd;
  border-radius: 8px; padding: 0.45rem 0.6rem; font-size: 12px; }
#yhmMockRoot .yhmk-add button { border: 0; border-radius: 8px; background: #1a1d23;
  color: #fff; font-size: 12px; font-weight: 600; padding: 0 0.9rem; cursor: pointer; }

/* dev toolbar gear was sitting on the desktop view strip — park it left of
   the zoom bar */
body.yhm-gelato-desk #yhrdFab, body.yhm-gelato-desk .hpb-bar-fab {
  left: auto !important; right: 170px !important; bottom: 18px !important; }

/* phones get a stacked layout if the modal is ever opened there */
@media (max-width: 560px) {
  #yhmMockRoot .yhmk-modal { width: 100%; height: 100dvh; border-radius: 0; }
  #yhmMockRoot .yhmk-body { flex-direction: column; }
  #yhmMockRoot .yhmk-rail { width: auto; border-left: 0;
    border-top: 1px solid rgba(0,0,0,0.08); }
  #yhmMockRoot .yhmk-grid { grid-template-columns: repeat(3, 1fr); }
}
