/**
 * Shared styles for the layout editor: select, move, scale, rotate.
 * Use with scalem-editor.js on any template that has [data-editor-canvas] and [data-editor-object] or .object.
 */
[data-editor-canvas] .object,
[data-editor-canvas] [data-editor-object] {
  cursor: pointer;
  user-select: none;
}

[data-editor-canvas] .object.text-editing,
[data-editor-canvas] [data-editor-object].text-editing,
[data-editor-canvas] .object.text-editing *,
[data-editor-canvas] [data-editor-object].text-editing * {
  user-select: text;
  cursor: text;
}

[data-editor-canvas] .object.selected,
[data-editor-canvas] [data-editor-object].selected {
  outline: 2px solid #6d5efc;
  outline-offset: 2px;
  z-index: 10;
}

/* Ensure canvas can host absolute-positioned objects */
[data-editor-canvas] {
  position: relative;
}

.transform-box {
  position: absolute;
  border: 1px solid #6d5efc;
  border-style: dashed;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(109, 94, 252, 0.2);
  z-index: 20;
}

.drag-overlay {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: move;
  background: transparent;
  z-index: 0;
}

.handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #6d5efc;
  border-radius: 3px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.4);
  z-index: 2;
}

.handle:hover {
  background: #eef1ff;
}

.handle.nw, .handle.se { cursor: nwse-resize; }
.handle.ne, .handle.sw { cursor: nesw-resize; }
.handle.n, .handle.s   { cursor: ns-resize; }
.handle.e, .handle.w   { cursor: ew-resize; }
.handle.nw { left: 0%;   top: 0%; }
.handle.n  { left: 50%;  top: 0%; }
.handle.ne { left: 100%; top: 0%; }
.handle.w  { left: 0%;   top: 50%; }
.handle.e  { left: 100%; top: 50%; }
.handle.sw { left: 0%;   top: 100%; }
.handle.s  { left: 50%;  top: 100%; }
.handle.se { left: 100%; top: 100%; }

.angle-label {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85);
  color: #f9fafb;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 3;
}

.corner-rotate-zone {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: alias;
  z-index: 1;
}

.corner-rotate-zone.tl { left: 0%;   top: 0%;   transform: translate(-80%, -80%); }
.corner-rotate-zone.tr { left: 100%; top: 0%;   transform: translate(-20%, -80%); }
.corner-rotate-zone.bl { left: 0%;   top: 100%; transform: translate(-80%, -20%); }
.corner-rotate-zone.br { left: 100%; top: 100%; transform: translate(-20%, -20%); }

/* Layout CSS uses svg image { opacity: 0.3 } for template placeholders. Brand-kit bitmaps need
   full opacity so mix-blend-mode (set on the wrapper g in brand-colors.js) composites correctly. */
svg image[data-brand-clip] {
  opacity: 1;
}

/*
 * isolation:isolate on the root decorative svg prevented mix-blend-mode on clipped <image>/<g>
 * from compositing with sibling shapes (multiply looked like normal). Keep html copy above via z-index.
 */
.shapeSvg {
  isolation: auto;
}

svg g[data-brand-clip-container] {
  isolation: auto;
}

/* No !important: layout editor sets image opacity via inline style; !important would block it. */
svg image[data-brand-clip],
svg image.powerclip-image {
  opacity: 1;
}

/* Keep copy and UI chrome above the decorative SVG layer (z-index 0 in layout CSS). */
[data-editor-canvas] .company-name,
[data-editor-canvas] .headline,
[data-editor-canvas] .description {
  z-index: 3;
}

/*
 * Empty inline-block text has a 0×0 box — clicks miss the <p> and hit the full-bleed SVG behind it,
 * so double-click / inline edit never starts. Enforce a minimal hit target (scales with font-size).
 */
[data-editor-canvas] .company-name,
[data-editor-canvas] .headline,
[data-editor-canvas] .description,
[data-editor-canvas] .text-object {
  min-width: 2.5em;
  min-height: 1.2em;
}
