/* ReInk: from designer-preview/css/workspace.css @ 827d893 (oldDesigner-redesign). Everything below this line is that file,
   unchanged. When the prototype changes it, carry the change across: docs/syncing.md. */
/*
	designer-preview/css/workspace.css

	The design area (behaviour in js/workspace.js). Loaded after the other stylesheets.
	Every rule is scoped to html.sm-ws, which js/workspace.js sets once it has wired everything up,
	so if the script fails the designer keeps its original rulers layout.

	  - The rulers are hidden. The design sits centred in a calm workspace with room around it, its
	    width and height shown as size lines below and left of it, the IN / MM / PX switch where the
	    lines meet, and a Guides chip above its top-right corner. All of them sit OUTSIDE the canvas
	    (offset from its edge), so they never cover the design or its bleed; the lines span the trim.
	  - #canvasParent's padding is the space they need (the chips above, the size line and the zoom bar
	    below): the fit (js/workspace.js) never makes the design bigger than the padded area.
	  - A very short workspace (a phone held sideways) gets main.sm-ws-compact: small padding and no
	    frame, so the design keeps a usable size.
	  - The zoom bar is a compact bar centred at the bottom of the workspace.
	  - Add To Cart is the red button at the right end of the top bar (css/topbar.css; it left the save
	    bar, which keeps Save, Undo and Redo). Toasts appear bottom right, clear of the chips.

	Colours come from the facelift's tokens (--sm-*), or from the premium layer's (--sp-*) when it is
	loaded. Everything here works with the side panel open or closed and in the 700px stacked layout.
*/

/* ===== Rulers hidden: the ruler row (with the unit corner) and the left ruler cell ===== */
html.sm-ws .rulerTable tr:first-child,
html.sm-ws #leftRulerContainer { display: none; }

/* ===== The workspace: the design centred, scrolling only when zoomed past the workspace ===== */
/* Out of the table flow, so a zoomed canvas can never stretch the table (or the workspace the fit measures) */
html.sm-ws #canvasParent { position: absolute; top: 0; left: 0; display: flex; box-sizing: border-box; padding: 72px 88px 104px; }   /* top: the chips (26px, 12px above the design) and air; bottom: the size line and the zoom bar */
html.sm-ws main.sm-ws-compact #canvasParent { padding: 32px 16px 72px; }   /* room for the unit switch above the design; clear of the zoom bar (starts 64px up) */
html.sm-ws #canvdim { flex: none; margin: auto; }   /* auto margins centre it, and collapse to 0 when it is larger, so it scrolls from its top-left */
/* the premium layer's inset edge was for where the rulers met the workspace; with them hidden it would double the panel edge */
html.sm-ws #canvasParent { box-shadow: none; scroll-padding: 16px 0 72px; }   /* keyboard focus scrolls clear of the zoom bar */
html.sm-ws #canvasParent:focus-visible { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: -2px; }   /* Firefox makes the zoomed workspace a Tab stop */

/* ===== Frame around the design (Guides chip, size lines, unit switch) ===== */
html.sm-ws #smDesignFrame {
  --sm-ws-line: rgb(134 137 144);
  --sm-ws-label: var(--sp-ink-3, var(--sm-ink-3, rgb(84 87 92)));
  --sm-ws-bg: var(--sp-workspace, var(--sm-workspace, rgb(243 244 246)));
  --sm-ws-chip-edge: rgb(218 220 224);
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; z-index: 3;
  pointer-events: none; text-align: left; color: var(--sm-ws-label);
  font: 12px/16px Arial, Helvetica, sans-serif; letter-spacing: 0.01em; -webkit-user-select: none; user-select: none; }
html.sm-ws #smDesignFrame[hidden] { display: none; }
html.sm-ws main.sm-ws-compact #smDesignFrame > :not(.smUnitSlot):not(.smTrimMask) { display: none; }   /* compact: no lines or chips, but the unit switch and the Finished view stay */
html.sm-ws .smVh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Each line is drawn in two pieces either side of its label (flex), so the label needs no box of its own over the workspace and
   the artboard's shadow; a soft halo in the workspace colour keeps it legible */
html.sm-ws .smSize { position: absolute; box-sizing: border-box; display: flex; align-items: center; }
html.sm-ws .smSize::before, html.sm-ws .smSize::after { content: ""; flex: 1 1 0; }
html.sm-ws .smSizeLabel { white-space: nowrap; text-shadow: 0 0 2px var(--sm-ws-bg), 0 0 3px var(--sm-ws-bg), 0 0 4px var(--sm-ws-bg); }
/* width: 18px below the canvas, spanning the trim, end caps on both sides, label centred on the line */
html.sm-ws .smSizeW { left: var(--sm-bleed-left, 0px); right: var(--sm-bleed-right, 0px); top: calc(100% + 18px); height: 9px;
  border-left: 1px solid var(--sm-ws-line); border-right: 1px solid var(--sm-ws-line); }
html.sm-ws .smSizeW::before, html.sm-ws .smSizeW::after { height: 0; border-top: 1px solid var(--sm-ws-line); }
html.sm-ws .smSizeW .smSizeLabel { padding: 0 8px; }
/* height: 34px left of the canvas (room for a centred label in any unit), spanning the trim; the label reads horizontally
   across the line */
html.sm-ws .smSizeH { top: var(--sm-bleed-top, 0px); bottom: var(--sm-bleed-bottom, 0px); right: calc(100% + 34px); width: 9px; flex-direction: column;
  border-top: 1px solid var(--sm-ws-line); border-bottom: 1px solid var(--sm-ws-line); }
html.sm-ws .smSizeH::before, html.sm-ws .smSizeH::after { width: 0; border-left: 1px solid var(--sm-ws-line); }
html.sm-ws .smSizeH .smSizeLabel { padding: 6px 0; }

/* guides on: the key under the width line (what the trim, safe-area and bleed lines are). It keeps its
   place with the guides off (invisible), and the workspace keeps room for it above the zoom bar
   (js/workspace.js placeKey sets its left, its width and --sm-key-room) */
html.sm-ws .smGuideKey { position: absolute; left: var(--sm-bleed-left, 0px); top: calc(100% + 38px); display: flex; flex-wrap: wrap; gap: 3px 16px; width: max-content; max-width: 640px;
  font-size: 11px; line-height: 15px; text-shadow: 0 0 2px var(--sm-ws-bg), 0 0 3px var(--sm-ws-bg); }
html.sm-ws .smGuideKey[hidden] { display: none; }
html.sm-ws .smGuideKey.smGuideKeyOff { visibility: hidden; }
html.sm-ws main.sm-ws-keyroom:not(.sm-ws-compact) #canvasParent { padding-bottom: max(104px, var(--sm-key-room, 104px)); }
html.sm-ws main.sm-ws-compact .smGuideKey { display: none; }
@media (max-width: 700px) { html.sm-ws .smGuideKey { display: none; } }   /* a phone: no key, as no rulers */
html.sm-ws .smKeySwatch { display: inline-block; width: 16px; height: 0; margin: 0 6px 3px 0; vertical-align: middle; border-top: 2px solid rgb(128 128 128); }
html.sm-ws .smKey-trim .smKeySwatch { border-top-style: dashed; border-top-color: rgb(139 0 0); }   /* the engine's darkred dashed cut line */
html.sm-ws .smKey-safe .smKeySwatch { border-top-color: rgb(0 128 0); }                              /* the engine's green safe outline */
html.sm-ws .smKey-bleed .smKeySwatch { border-top-color: rgb(128 128 128); }                         /* the engine's grey bleed cover */

/* the engine's IN / MM / PX switch, moved here from the hidden ruler corner: centred under the height line, level with the width line */
html.sm-ws .smUnitSlot { position: absolute; left: -38.5px; top: calc(100% + 12.5px); width: 0; height: 20px; pointer-events: auto; }
html.sm-ws main.sm-ws-compact .smUnitSlot { left: 20px; top: -28px; }   /* compact: above the design's top-left */

/* ===== Finished view (Dave's review): guides off shows the trimmed product =====
   With the guides off, the bleed is covered in the workspace colour and the artboard's edge moves to the trim, so the
   page reads as the finished card, not as artwork running past it. The lines, chips and unit switch move in with it.
   Only a product with a bleed, or a round one, changes (js/workspace.js sets .sm-finished); a rectangular stamp's finished size is its design.
   Everything here is outside the canvas: proofs and production files are untouched. */
html.sm-ws #smDesignFrame { --sm-ws-trim-shadow: 0 1px 1px rgb(4 0 0 / 0.08), 0 3px 12px rgb(4 0 0 / 0.07); }
html.sm-ws .smTrimMask { display: none; }
html.sm-ws #smDesignFrame.sm-finished .smTrimMask { display: block; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
/* the lines, chips and unit switch move into the bleed zone in this view: above the cover */
html.sm-ws #smDesignFrame.sm-finished :is(.smChips, .smSize, .smUnitSlot) { z-index: 1; }
html.sm-ws .smTrimMaskPart, html.sm-ws .smTrimMaskRound { position: absolute; background-color: var(--sm-ws-bg); }
html.sm-ws .smTrimMaskTop { top: 0; left: 0; right: 0; height: var(--sm-bleed-top, 0px); }
html.sm-ws .smTrimMaskBottom { bottom: 0; left: 0; right: 0; height: var(--sm-bleed-bottom, 0px); }
html.sm-ws .smTrimMaskLeft { top: 0; bottom: 0; left: 0; width: var(--sm-bleed-left, 0px); }
html.sm-ws .smTrimMaskRight { top: 0; bottom: 0; right: 0; width: var(--sm-bleed-right, 0px); }
html.sm-ws .smTrimMaskRound { display: none; }
html.sm-ws .smTrimEdge { position: absolute; top: var(--sm-bleed-top, 0px); right: var(--sm-bleed-right, 0px); bottom: var(--sm-bleed-bottom, 0px); left: var(--sm-bleed-left, 0px);
  box-shadow: var(--sm-ws-trim-shadow); }
/* round products: one cover with the trim ellipse cut out of it, and the edge (with the artboard's shadow) round: the edge sits
   above the cover and an outer box-shadow is drawn only outside its box, so the shadow rings the cut circle */
html.sm-ws #smDesignFrame.sm-finished.sm-round .smTrimMaskPart { display: none; }
html.sm-ws #smDesignFrame.sm-finished.sm-round .smTrimEdge { border-radius: 50%; }
/* (the trim ellipse's radii and centre are plain px lengths set by js/workspace.js: Chromium takes no calc() in a gradient's size) */
html.sm-ws #smDesignFrame.sm-finished.sm-round .smTrimMaskRound { display: block; top: 0; right: 0; bottom: 0; left: 0;
  -webkit-mask-image: radial-gradient(ellipse var(--sm-trim-rx, 50%) var(--sm-trim-ry, 50%) at var(--sm-trim-cx, 50%) var(--sm-trim-cy, 50%), transparent calc(100% - 0.5px), rgb(0 0 0) 100%);
  mask-image: radial-gradient(ellipse var(--sm-trim-rx, 50%) var(--sm-trim-ry, 50%) at var(--sm-trim-cx, 50%) var(--sm-trim-cy, 50%), transparent calc(100% - 0.5px), rgb(0 0 0) 100%); }
/* round products: the face that prints, painted under the canvas up to the trim circle (a one-ink round product's canvas
   is clear outside the engine's border disc, so the ring between them would show the workspace; a CSS background on the
   engine's background canvas never reaches a proof or a production file) */
html.sm-ws #canvdim.sm-finished-round #canvasBackground { background-image: radial-gradient(ellipse var(--sm-trim-rx, 50%) var(--sm-trim-ry, 50%) at var(--sm-trim-cx, 50%) var(--sm-trim-cy, 50%), rgb(255 255 255) calc(100% - 0.5px), transparent 100%); }
/* the artboard's own shadow sits around the bleed (or a round product's square): off while the trim edge carries it
   (html.sm-finished: rectangles; #canvdim.sm-finished-round: round products) */
html.sm-finished #canvasBackground, html.sm-ws #canvdim.sm-finished-round #canvasBackground { filter: none; }
/* the lines, the chips and the unit switch follow the trim */
html.sm-ws #smDesignFrame.sm-finished .smSizeW { top: calc(100% - var(--sm-bleed-bottom, 0px) + 18px); }
html.sm-ws #smDesignFrame.sm-finished .smSizeH { right: calc(100% - var(--sm-bleed-left, 0px) + 34px); }
html.sm-ws #smDesignFrame.sm-finished .smChips { right: var(--sm-bleed-right, 0px); bottom: calc(100% - var(--sm-bleed-top, 0px) + 12px); }
html.sm-ws #smDesignFrame.sm-finished .smUnitSlot { left: calc(var(--sm-bleed-left, 0px) - 38.5px); top: calc(100% - var(--sm-bleed-bottom, 0px) + 12.5px); }
html.sm-ws main.sm-ws-compact #smDesignFrame.sm-finished .smUnitSlot { left: calc(var(--sm-bleed-left, 0px) + 20px); top: calc(var(--sm-bleed-top, 0px) - 28px); }
html.sm-ws #smDesignFrame #changeRulerUnitButton {
  display: block; box-sizing: border-box; height: 20px; min-width: 30px; margin: 0; padding: 0 6px; transform: translateX(-50%);
  font: 700 10px/18px Arial, Helvetica, sans-serif; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: var(--sp-ink-2, var(--sm-ink-2, rgb(31 28 28))); background-color: var(--sp-surface, var(--sm-surface, rgb(255 255 255)));
  border: 1px solid var(--sm-ws-chip-edge); border-radius: 6px; border-image: none; box-shadow: none; cursor: pointer; }
html.sm-ws #smDesignFrame #changeRulerUnitButton:hover { color: var(--sp-ink, var(--sm-ink, rgb(4 0 0))); border-color: var(--sp-line-hover, var(--sm-ws-line)); background-color: var(--sp-fill-hover, rgb(241 242 245)); }
html.sm-ws #smDesignFrame #changeRulerUnitButton:active { background-color: var(--sp-fill-press, rgb(229 231 235)); }
html.sm-ws #smDesignFrame #changeRulerUnitButton .mui-ripple { background-color: rgb(16 24 40 / 0.2); }
html.sm-ws #smDesignFrame #changeRulerUnitButton:focus { outline: none; }
html.sm-ws #smDesignFrame #changeRulerUnitButton:focus-visible { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: 2px; }
html.sm-ws #smDesignFrame #changeRulerUnitButton .mui-btn__ripple-container { border-radius: 6px; }

/* Snap chip and the Guides / Finished switch, in a row 12px above the canvas's top-right corner */
html.sm-ws .smViewSwitch { display: inline-flex; }
html.sm-ws .smViewSwitch > button + button { margin-left: -1px; }   /* one shared edge */
html.sm-ws .smViewSwitch > button:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
html.sm-ws .smViewSwitch > button:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
html.sm-ws .smViewSwitch > button[aria-pressed="true"] { position: relative; z-index: 1; }   /* its edge over the neighbour's */
html.sm-ws .smChips { position: absolute; right: 0; bottom: calc(100% + 12px); display: flex; gap: 8px; pointer-events: auto; }
html.sm-ws :is(#smGuidesChip, #smFinishedChip) {
  position: relative; flex: none;
  box-sizing: border-box; height: 26px; margin: 0; padding: 0 11px 0 28px;
  font: 12px/24px Arial, Helvetica, sans-serif; color: var(--sp-ink-2, var(--sm-ink-2, rgb(31 28 28))); white-space: nowrap;
  background: rgb(255 255 255) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2' y='2' width='12' height='12' rx='2' fill='none' stroke='%2354575C' stroke-width='1.5' stroke-dasharray='2.6 2'/%3E%3C/svg%3E") 10px center / 13px 13px no-repeat;
  border: 1px solid var(--sm-ws-chip-edge); border-radius: 13px; cursor: pointer; }
html.sm-ws :is(#smGuidesChip, #smFinishedChip):hover { border-color: var(--sp-line-hover, var(--sm-ws-line)); background-color: var(--sp-fill-hover, rgb(241 242 245)); color: var(--sp-ink, var(--sm-ink, rgb(4 0 0))); }
html.sm-ws :is(#smGuidesChip, #smFinishedChip):active { background-color: var(--sp-fill-press, rgb(229 231 235)); }
html.sm-ws :is(#smGuidesChip, #smFinishedChip)[aria-pressed="true"] {
  color: var(--sp-red-text, var(--sm-red-text, rgb(207 0 36))); border-color: var(--sp-red, var(--sm-red, rgb(234 0 41)));
  background-color: var(--sp-red-tint, var(--sm-red-tint, rgb(253 236 238))); box-shadow: inset 0 0 0 1px var(--sp-red, var(--sm-red, rgb(234 0 41)));   /* 2px red ring, as on Studio Pro's checked chips */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='2' y='2' width='12' height='12' rx='2' fill='none' stroke='%23CF0024' stroke-width='1.5' stroke-dasharray='2.6 2'/%3E%3C/svg%3E"); }
html.sm-ws :is(#smGuidesChip, #smFinishedChip)[aria-pressed="true"]:hover { color: var(--sp-red-press, var(--sm-red-press, rgb(176 0 31))); background-color: var(--sp-red-tint-strong, var(--sm-red-tint-strong, rgb(250 214 220))); }
html.sm-ws :is(#smGuidesChip, #smFinishedChip):focus { outline: none; }
html.sm-ws :is(#smGuidesChip, #smFinishedChip):focus-visible { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: 2px; }

/* ===== Add To Cart, at the right end of the top bar (css/topbar.css places it) ===== */
/* the review window has its own Add To Cart: no second, dimmed one behind it */
html:has(#mui-overlay) #smTopActions { visibility: hidden; }
html.sm-ws #smAddToCart, html.sm-ws #smAddToCart:focus, html.sm-ws #smAddToCart:hover, html.sm-ws #smAddToCart:active {
  display: inline-flex; align-items: center; box-sizing: border-box; height: 40px; margin: 0; padding: 0 18px 0 14px;
  font: 700 14px/40px Arial, Helvetica, sans-serif; letter-spacing: 0.01em; text-transform: none; white-space: nowrap;
  border: 0; border-radius: 8px; border-image: none;   /* flat red with 8px corners, like Studio Pro's red primaries */
  box-shadow: 0 1px 2px rgb(184 0 32 / 0.24), 0 4px 12px -4px rgb(16 24 40 / 0.18); }
html.sm-ws #smAddToCart .material-icons {
  width: 20px; height: 20px; margin-right: 8px; overflow: hidden; font-size: 20px; color: transparent; text-shadow: none;
  background: url("../icons/cart-add-white.svg") center / 20px 20px no-repeat; }
html.sm-ws #smAddToCart .mui-btn__ripple-container { border-radius: 8px; }
/* white, ink, white: the ring shows over any design behind the button (dark or reverse stamps when zoomed) */
html.sm-ws #smAddToCart:focus-visible { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: 2px; border-image: none;
  box-shadow: 0 0 0 2px rgb(255 255 255), 0 0 0 6px rgb(255 255 255); }
/* toasts bottom right, clear of the chips */
html.sm-ws #toast-container.toast-top-right { top: auto; bottom: 80px; right: 24px; }

/* ===== Zoom bar: a compact bar centred at the bottom of the workspace ===== */
html.sm-ws #floatingMenu { width: max-content; bottom: 24px; left: calc(400px + (100vw - 400px) / 2); transform: translateX(-50%);
  align-items: center; padding: 5px 9px; }   /* buttons centred in the pill, with room at the caps for hover tiles and focus rings */
html.sm-ws #zoomPercent { display: block; line-height: 22px; }
html.sm-ws #pageSelectButtonContainer > label { background-position: 1px 1px; }
/* the page chips' radios (display:none in site.app.css) become keyboard-reachable, visually hidden; arrows switch pages */
html.sm-ws #pageSelectButtonContainer input[type="radio"] { display: inline-block; visibility: visible; position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
html.sm-ws #pageSelectButtonContainer input[type="radio"]:focus-visible + label { outline: 2px solid var(--sm-focus, rgb(4 0 0)); outline-offset: -2px; }
/* Now that the bar is only as wide as its buttons, the bar itself is the glass pill, in every browser. The premium layer's
   two stand-ins for a full-width bar (an anchored pseudo-element of the bar's cell, and a Firefox pseudo-element with
   viewport-fixed gradients at the bar's old position) would no longer line up with a centred bar, so they are switched off. */
html.sm-ws .rulerTable tr:last-child td:last-child::after,
html.sm-ws #floatingMenu::after { content: none; display: none; }
html.sm-ws #floatingMenu { overflow: visible; border-radius: 20px;
  background-color: var(--sp-glass, rgb(255 255 255 / 0.9)); -webkit-backdrop-filter: blur(16px) saturate(1.6); backdrop-filter: blur(16px) saturate(1.6);
  box-shadow: var(--sp-shadow-pill, 0 0 0 1px rgb(218 220 224), 0 1px 2px rgb(16 24 40 / 0.06), 0 8px 24px -8px rgb(16 24 40 / 0.18)); }
@media not all and (max-width: 700px) {
  html.sm-ws body.sm-panel-collapsed #floatingMenu { left: calc(var(--sm-rail-w, 60px) + (100vw - var(--sm-rail-w, 60px)) / 2); }
  /* the closed rail's save bar: Save on top, Undo and Redo below (simple mode: Save alone) */
  html.sm-ws body.sm-panel-collapsed #saveBar ul li:first-child { grid-column: 1 / -1; justify-self: center; }
}
@media (max-width: 700px) {
  html.sm-ws #floatingMenu { left: 50%; bottom: calc(40% + 16px); }   /* the workspace is the top 60% here */
  html.sm-ws main.sm-ws-compact #canvasParent { padding: 32px 16px 60px; }   /* here the zoom bar starts 56px up */
  html.sm-ws #toast-container.toast-top-right { top: calc(var(--sm-top-h, 48px) + 12px); bottom: auto; right: 12px; }   /* the bottom 40% is the panel */
}

/* ===== Windows High Contrast ===== */
@media (forced-colors: active) {
  html.sm-ws .smSize, html.sm-ws .smSize::before, html.sm-ws .smSize::after { border-color: CanvasText; }
  html.sm-ws .smSizeLabel { color: CanvasText; text-shadow: none; }
  html.sm-ws :is(#smGuidesChip, #smFinishedChip) { border-color: ButtonText; }
  html.sm-ws :is(#smGuidesChip, #smFinishedChip)[aria-pressed="true"] { border: 2px solid Highlight; }
  html.sm-ws #smAddToCart, html.sm-ws #smAddToCart:focus, html.sm-ws #smAddToCart:hover, html.sm-ws #smAddToCart:active { border: 1px solid ButtonText; }
  html.sm-ws #smAddToCart .material-icons { background-image: none; color: ButtonText; }   /* the glyph draws in ButtonText instead */
  html.sm-ws :is(#smGuidesChip, #smFinishedChip):focus-visible, html.sm-ws #smDesignFrame #changeRulerUnitButton:focus-visible, html.sm-ws #smAddToCart:focus-visible { outline-color: CanvasText; }   /* not Highlight, which marks "on" */
  html.sm-ws #floatingMenu { outline: 1px solid CanvasText; }   /* the pill's edge (box-shadows are dropped here) */
}
