/* The Print Shop editor: element library, canvas and inspector. */
.ed { max-width: 1480px; margin: 0 auto 32px; display: flex; flex-direction: column; gap: 12px; }
.ed-loading, .ed-upsell { max-width: 640px; margin: 40px auto; text-align: center; padding: 28px; border-radius: 24px; }

/* top bar */
.ed-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border-radius: 22px; position: sticky; top: 8px; z-index: 5; animation: rise .4s var(--spring) both; }
.ed-tgroup { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ed-tgroup:nth-child(2) { margin-left: auto; }
.ed-tb { transition: transform .25s var(--spring), background .2s; }
.ed-tb:hover:not(:disabled) { transform: translateY(-2px) rotate(-4deg); }
.ed-tb:active:not(:disabled) { transform: scale(.88); }
.ed-tb:disabled { opacity: .35; }
.ed-tb[aria-pressed="true"] { background: var(--glass-strong); box-shadow: 0 0 0 2px var(--accent); }
.ed-sep { width: 1px; height: 22px; background: var(--glass-border); margin: 0 4px; }
.ed-name { min-width: 0; width: 14em; border: 1px solid var(--glass-border); border-radius: 12px; padding: 7px 10px; background: var(--glass-inset); color: var(--ink); font-weight: 800; font-size: .92rem; }
.ed-save { flex: none; }

/* body */
.ed-body { display: grid; grid-template-columns: 236px minmax(0, 1fr) 280px; gap: 12px; align-items: start; }
.ed-lib, .ed-inspect { border-radius: 22px; padding: 12px; max-height: calc(100vh - 120px); overflow: hidden auto; position: sticky; top: 72px; }
.ed-lib { animation: rise .45s .05s var(--spring) both; }
.ed-inspect { animation: rise .45s .1s var(--spring) both; }
.ed-h { margin: 0 0 4px; font-size: 1rem; font-weight: 900; }
.ed-hint { margin: 0 0 8px; }
.ed-group h4, .ed-sec h4 { margin: 10px 0 6px; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
.ed-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 14px; border: 1px solid var(--glass-border); background: var(--glass-inset); font-size: .72rem; font-weight: 800; line-height: 1.15; text-align: center; color: var(--ink); cursor: grab; touch-action: none; user-select: none; transition: transform .3s var(--spring), box-shadow .2s, background .2s; }
.ed-tile:hover { transform: translateY(-3px) scale(1.03); background: var(--glass-strong); box-shadow: 0 10px 22px -12px rgba(30, 50, 110, .5); }
.ed-tile:hover .ed-thumb { animation: bob .9s ease-in-out infinite; }
.ed-tile:active { transform: scale(.94); cursor: grabbing; }
.ed-thumb { display: grid; place-items: center; width: 100%; height: 42px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05); }
.ed-thumb svg { max-width: 92%; max-height: 38px; width: auto; height: auto; }
.ed-thumb.sm { width: 44px; height: 30px; flex: none; }
.ed-thumb.sm svg { max-height: 26px; }
.ed-ghost { position: fixed; left: 0; top: 0; z-index: 1000; width: 84px; pointer-events: none; padding: 6px; border-radius: 14px; background: var(--glass-strong); box-shadow: 0 18px 36px -12px rgba(20, 40, 100, .55); animation: pop-in .2s var(--spring) both; }

/* the canvas */
.ed-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ed-stage { height: calc(100vh - 170px); min-height: 440px; overflow: auto; border-radius: 22px; background: repeating-conic-gradient(rgba(120, 140, 190, .08) 0 25%, transparent 0 50%) 0 0 / 22px 22px, var(--glass-inset); border: 1px solid var(--glass-border); display: flex; padding: 16px; }
.ed-paper { position: relative; margin: auto; flex: none; box-shadow: 0 18px 40px -18px rgba(20, 40, 100, .55); border-radius: 2px; transition: box-shadow .25s, transform .3s var(--spring); }
.ed-paper.is-blade { box-shadow: none; filter: drop-shadow(0 14px 22px rgba(20, 40, 100, .35)); }
.ed-paper.is-drop { transform: scale(1.01); box-shadow: 0 0 0 3px var(--accent), 0 18px 40px -18px rgba(20, 40, 100, .55); }
.ed-art, .ed-art svg, .ed-over { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-over { touch-action: none; cursor: default; overflow: visible; }
.ed-safe { fill: none; stroke: rgba(26, 127, 216, .35); pointer-events: none; }
.ed-guides { pointer-events: none; }
.ed-sel rect:first-child { fill: rgba(26, 127, 216, .06); stroke: var(--accent); pointer-events: none; }
.ed-sel.ed-pop { animation: ed-pop .45s var(--spring) both; transform-box: view-box; }
@keyframes ed-pop { from { opacity: 0; transform: scale(.7); } }
.ed-handle { fill: #fff; stroke: var(--accent); cursor: nwse-resize; }
.ed-handle[data-h="tc"], .ed-handle[data-h="bc"] { cursor: ns-resize; }
.ed-handle[data-h="ml"], .ed-handle[data-h="mr"] { cursor: ew-resize; }
.ed-handle[data-h="tr"], .ed-handle[data-h="bl"] { cursor: nesw-resize; }
.ed-pages { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-weight: 800; font-size: .86rem; }

/* inspector */
.ed-insp-head { display: flex; align-items: center; gap: 8px; animation: pop-in .3s var(--spring) both; }
.ed-sec { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 10px; border-bottom: 1px solid var(--glass-border); animation: rise .35s var(--spring) both; }
.ed-sec:last-child { border-bottom: 0; }
.ed-f { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: .74rem; font-weight: 800; color: var(--ink-soft); }
.ed-f-row { flex-direction: row; align-items: center; justify-content: space-between; }
.ed-f input[type="text"], .ed-f input[type="number"], .ed-f textarea { width: 100%; box-sizing: border-box; min-width: 0; border: 1px solid var(--glass-border); border-radius: 10px; padding: 7px 8px; background: var(--glass-strong); color: var(--ink); font: inherit; font-weight: 700; font-size: .86rem; }
.ed-f textarea { resize: vertical; }
.ed-f input[type="color"] { width: 46px; height: 32px; border: 1px solid var(--glass-border); border-radius: 10px; padding: 2px; background: var(--glass-strong); }
.ed-xywh { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ed-aligns { display: flex; gap: 2px; flex-wrap: wrap; }
.ed-aligns .icon-btn svg { width: 18px; height: 18px; }
.ed-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 8px; }
.ed-shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.ed-shape { aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; background: var(--glass-inset); display: grid; place-items: center; padding: 3px; transition: transform .25s var(--spring); }
.ed-shape:hover { transform: scale(1.08) rotate(-3deg); }
.ed-shape.is-on { border-color: var(--accent); background: var(--glass-strong); }
.ed-shape svg { width: 100%; height: 100%; }
.ed-pics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ed-pic { aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; background: #fff; overflow: hidden; padding: 0; display: grid; place-items: center; cursor: pointer; }
.ed-pic img { width: 100%; height: 100%; object-fit: contain; }
.ed-pic.is-on { border-color: var(--accent); }
.ed-upload { background: var(--glass-inset); color: var(--ink-soft); border: 2px dashed var(--glass-border); }
.ed-upload svg { width: 22px; height: 22px; }
.ed-licence p { margin: 0; }

/* template and design pickers */
.ed-dlg .ed-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.ed-tpl { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border-radius: 16px; border: 2px solid transparent; background: var(--glass-inset); font-size: .8rem; text-align: center; color: var(--ink); animation: deal .45s calc(var(--i, 0) * 40ms) var(--spring) both; transition: transform .3s var(--spring), background .2s; }
button.ed-tpl:hover, .ed-tpl:hover { transform: translateY(-4px) rotate(-1deg); background: var(--glass-strong); }
.ed-tpl.is-on { border-color: var(--accent); }
.ed-tpl-open { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; color: inherit; font: inherit; padding: 0; }
.ed-tpl-acts { display: flex; gap: 2px; }
.ed-prev { display: block; max-width: 100%; }
.ed-prev svg { width: 100%; height: auto; display: block; border-radius: 3px; box-shadow: 0 6px 14px -8px rgba(20, 40, 100, .45); }
.st-edit { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: .74rem; }
.st-edit svg { width: 13px; height: 13px; }

@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 200px minmax(0, 1fr); }
  .ed-inspect { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 760px) {
  .ed-body { grid-template-columns: minmax(0, 1fr); }
  /* the library becomes one row to swipe through; drag a tile down onto the page */
  .ed-lib { position: static; max-height: none; display: flex; gap: 12px; overflow: auto hidden; padding: 10px; scroll-snap-type: x proximity; }
  .ed-lib > .ed-h, .ed-lib > .ed-hint { display: none; }
  .ed-group { flex: none; scroll-snap-align: start; }
  .ed-group h4 { margin-top: 0; }
  .ed-tiles { display: flex; gap: 6px; }
  .ed-tile { width: 76px; flex: none; touch-action: pan-x; }
  .ed-stage { height: 70vh; min-height: 360px; padding: 10px; }
  .ed-top { position: static; }
  .ed-name { width: 10em; }
}
@media (prefers-reduced-motion: reduce) {
  .ed-tile:hover .ed-thumb, .ed-sel.ed-pop, .ed-tpl, .ed-top, .ed-lib, .ed-inspect, .ed-sec { animation: none; }
}
