/* ═══════════════════════════════════════════════════════════════
   Imahe — the FREE Edit studio (public/js/editor/*)
   Stage on top, tool row under the thumb, drawer under that.
   Everything is sized for one-handed use: no handle smaller than 30px,
   no control that needs a second finger.
   ═══════════════════════════════════════════════════════════════ */

.ed2 { display: flex; flex-direction: column; gap: 12px; }

/* ── empty state ── */
.ed2-empty {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 14px; font-size: 14px; color: var(--ink-soft);
  font-family: var(--f-body);
}
.ed2-empty-art { font-size: 26px; line-height: 1; }

/* ── stage ── */
.ed2-stagewrap { display: flex; justify-content: center; }
.ed2-stage {
  position: relative; max-width: 100%;
  border: var(--border-ink); border-radius: 12px;
  background: var(--paper-sunk);
  box-shadow: var(--shadow-hard);
  /* The handles hang OUTSIDE the picture, so this must not clip them. */
  overflow: visible;
}
.ed2-canvas {
  display: block; border-radius: 10px;
  touch-action: none; cursor: crosshair;
}
.ed2-handles { position: absolute; inset: 0; pointer-events: none; }

/* ── selection box + handles ── */
.ed2-sel {
  position: absolute;
  border: 2px dashed var(--riso-blue);
  border-radius: 4px;
  pointer-events: none;
}
.ed2-h {
  position: absolute; pointer-events: auto;
  width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  background: var(--paper-2);
  color: var(--ink);
  border: 2.5px solid var(--ink-line);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--panel-shadow);
  transform: translate(-50%, -50%);
  touch-action: none;
}
.ed2-h:active { transform: translate(-50%, -50%) scale(0.92); }
.ed2-h--del { left: 0; top: 0; background: var(--riso-pink); color: #fff; }
.ed2-h--rot { left: 100%; top: 0; }
.ed2-h--size { left: 100%; top: 100%; background: var(--riso-blue); color: #fff; }
.ed2-h--wide { left: 100%; top: 50%; }
.ed2-h--tall { left: 50%; top: 100%; }
.ed2-h--tail {
  width: 26px; height: 26px;
  background: var(--riso-yellow); font-size: 10px;
}

/* ── tool row ── */
.ed2-tools {
  display: flex; gap: 6px;
  background: var(--paper-2);
  border: var(--border-ink); border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 6px;
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 6;
}
.ed2-tool {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px;
  background: transparent; border: 2px solid transparent; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.ed2-tool-g { font-size: 17px; line-height: 1; }
.ed2-tool.is-on {
  background: var(--ink); color: var(--paper-2); border-color: var(--ink-line);
}

/* ── drawer ── */
.ed2-drawer {
  background: var(--paper-2);
  border: var(--border-ink); border-radius: var(--radius);
  box-shadow: var(--shadow-hard);
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.ed2-drawer:empty { display: none; }
.ed2-drawer-t {
  font-family: var(--f-display); font-size: 17px; letter-spacing: 0.03em;
  color: var(--ink);
}
.ed2-hint { line-height: 1.45; }
.ed2-inspect-head { gap: 6px; flex-wrap: wrap; }

.ed2-row { display: flex; align-items: center; gap: 10px; }
.ed2-row-k {
  flex: 0 0 76px;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--newsprint-mute);
}
.ed2-row-v { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ed2-slider { flex: 1; min-width: 90px; accent-color: var(--riso-pink); }

.ed2-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.ed2-chips--wrap { flex-wrap: wrap; overflow: visible; }
.ed2-chip { flex: 0 0 auto; }
.ed2-chip.is-on, .chip.is-on {
  background: var(--ink); color: var(--paper-2); border-color: var(--ink-line);
}

/* ── swatches ── */
.ed2-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.ed2-sw {
  width: 30px; height: 30px; padding: 0;
  border: 2.5px solid var(--ink-line); border-radius: 50%;
  box-shadow: 1.5px 1.5px 0 var(--panel-shadow);
}
.ed2-sw.is-on {
  box-shadow: 0 0 0 2.5px var(--paper-2), 0 0 0 5px var(--riso-blue);
}
.ed2-sw--none {
  background:
    linear-gradient(45deg, transparent 44%, var(--riso-pink) 44%, var(--riso-pink) 56%, transparent 56%),
    var(--paper-sunk) !important;
}

/* ── palettes ── */
.ed2-grid { display: grid; gap: 8px; }
.ed2-grid--shape { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.ed2-grid--fx { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
.ed2-grid--font { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

.ed2-shape, .ed2-fx, .ed2-fontbtn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 4px;
  background: var(--paper); border: 2px solid var(--ink-line); border-radius: 10px;
  box-shadow: 2px 2px 0 var(--panel-shadow);
}
.ed2-shape:active, .ed2-fx:active, .ed2-fontbtn:active { transform: translate(1px, 1px); box-shadow: none; }
.ed2-shape-c { display: block; }
.ed2-shape-l, .ed2-fx-l {
  font-size: 10.5px; font-weight: 600; color: var(--ink-soft);
  text-align: center; line-height: 1.2;
}
.ed2-fx img {
  width: 100%; height: 58px; object-fit: contain;
  /* The stickers are black ink on transparent; on this cream panel that reads
     perfectly, which is the point of shipping them uncoloured. */
}
.ed2-fx--vec { background: var(--paper-sunk); }
.ed2-fx-vec { font-size: 30px; line-height: 58px; height: 58px; }
.ed2-fontbtn { font-size: 19px; padding: 12px 4px; color: var(--ink); }
.ed2-fxmount { display: flex; flex-direction: column; gap: 10px; }

.ed2-text { width: 100%; resize: vertical; }

/* ── layers ── */
.ed2-layers { display: flex; flex-direction: column; gap: 6px; }
.ed2-layer {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px;
  background: var(--paper); border: 2px solid var(--locked-hatch); border-radius: 10px;
}
.ed2-layer.is-on { border-color: var(--riso-blue); background: var(--paper-2); }
.ed2-layer-n {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  background: none; border: 0; padding: 4px 2px; text-align: left;
  font-size: 13px; color: var(--ink);
}
.ed2-layer-n .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed2-layer-t { font-size: 15px; }
.ed2-mini { padding: 4px 7px; font-size: 12px; }

/* ── actions ── */
.ed2-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed2-size { font-size: 11px; }

@media (min-width: 1024px) {
  .ed2-tools { position: static; }
  .ed2-grid--shape { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }
}
