/* Shared image kit (client/image-kit.js, views/_image-kit.cjs), 2026-10-11. Used by every image tool; owner: the kit.
 * .vt-ik-drop       drop zone (label wrapping the hidden file input); .vt-ik-over while a file is dragged over it;
 *                    add .vt-ik-drop-compact once files are in, so it shrinks to one row and the work area moves up
 * .vt-ik-mini       small copy of the preview next to the controls, visible only when the page is one column
 * .vt-ik-sources    table of sizes with their sources (rows become stacked cards on a phone)
 * .vt-ik-list/item  picked files: thumbnail, name, "before -> after" sizes, remove button (VT.imageKit.row)
 * .vt-ik-stage      preview box with a checkerboard, so transparent areas are visible; holds a canvas or an img
 * .vt-ik-surface    element the visitor drags or pinches (touch-action none: the page does not scroll under the finger)
 * .vt-ik-range      label + slider + live value;  .vt-ik-color  colour input;  .vt-ik-opt  block of options
 * Borders are 1px hairlines everywhere. */
#visu-tools .vt-ik-drop { display: grid; justify-items: center; gap: 10px; padding: 30px 18px; border: 1px dashed var(--vt-line-2); border-radius: 16px;
  background: var(--vt-bg); text-align: center; color: var(--vt-muted); cursor: pointer; transition: border-color .15s, background-color .15s; }
#visu-tools .vt-ik-drop:hover, #visu-tools .vt-ik-drop.vt-ik-over, #visu-tools .vt-ik-drop:focus-within { border-color: var(--vt-accent-text); background: var(--vt-tint); }
#visu-tools .vt-ik-drop-text { font-size: 15.5px; color: var(--vt-ink); max-width: 34ch; }
#visu-tools .vt-ik-drop-compact { grid-template-columns: auto 1fr auto; justify-items: start; align-items: center; text-align: left; padding: 14px 16px; }
#visu-tools .vt-ik-drop-compact .vt-ik-drop-btn { min-height: 40px; padding: 8px 14px; }
#visu-tools .vt-ik-private { margin-top: 10px !important; display: flex; gap: 8px; align-items: flex-start; }
#visu-tools .vt-ik-private::before { content: ""; flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 4px; border: 1px solid var(--vt-ok);
  background: linear-gradient(var(--vt-ok), var(--vt-ok)) center 4px / 6px 1px no-repeat, linear-gradient(var(--vt-ok), var(--vt-ok)) center 7px / 6px 1px no-repeat; }

#visu-tools .vt-ik-list { list-style: none; display: grid; gap: 8px; margin-top: 14px !important; max-height: 318px; overflow-y: auto; overscroll-behavior: contain; }
#visu-tools .vt-ik-list[hidden] { display: none; }
#visu-tools .vt-ik-item { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 10px 8px 8px;
  border: 1px solid var(--vt-line); border-radius: 12px; background: #fff; }
#visu-tools .vt-ik-item[aria-current="true"] { border-color: var(--vt-accent-text); }
#visu-tools .vt-ik-thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--vt-bg); }
#visu-tools .vt-ik-thumb :is(canvas, img) { max-width: 100%; max-height: 100%; display: block; }
#visu-tools .vt-ik-meta { display: grid; gap: 2px; min-width: 0; }
#visu-tools .vt-ik-name { font-size: 14px; font-weight: 600; color: var(--vt-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#visu-tools .vt-ik-sizes { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 13px; color: var(--vt-muted); font-variant-numeric: tabular-nums; }
#visu-tools .vt-ik-after { color: var(--vt-ink); font-weight: 650; }
#visu-tools .vt-ik-note { color: var(--vt-warn); flex-basis: 100%; }
#visu-tools .vt-ik-remove { width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--vt-muted); font-size: 20px; line-height: 1; cursor: pointer; }
#visu-tools .vt-ik-remove:hover { border-color: var(--vt-line-2); color: var(--vt-ink); }
#visu-tools .vt-ik-item-btn { all: unset; display: contents; cursor: pointer; }
#visu-tools .vt-ik-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; font-size: 13.5px; color: var(--vt-muted); }
#visu-tools .vt-ik-bar[hidden] { display: none; }

#visu-tools .vt-ik-stage { position: relative; display: grid; place-items: center; min-height: 200px; padding: 12px; border: 1px solid var(--vt-line); border-radius: 14px; overflow: hidden;
  background: #fff conic-gradient(#eef1f5 25%, transparent 0 50%, #eef1f5 0 75%, transparent 0) 0 0 / 18px 18px; }
#visu-tools .vt-ik-stage :is(canvas, img) { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; border-radius: 4px; box-shadow: 0 1px 2px rgba(10, 19, 36, .12); }
#visu-tools .vt-ik-stage-empty { color: var(--vt-muted); font-size: 14.5px; text-align: center; max-width: 30ch; background: #fff; padding: 6px 10px; border-radius: 8px; }
/* .vt-ik-mini: a small copy of the preview placed next to the controls, shown only when the page is one column. */
#visu-tools .vt-ik-mini { display: none; min-height: 0; padding: 8px; }
@media (max-width: 860px) {
  #visu-tools .vt-ik-mini:not([hidden]) { display: grid; }
  #visu-tools .vt-ik-mini :is(canvas, img) { max-height: 200px; }
}
#visu-tools .vt-ik-surface { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#visu-tools .vt-ik-surface.vt-ik-grabbing { cursor: grabbing; }

#visu-tools .vt-ik-opt { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; }
#visu-tools .vt-ik-opt > * { min-width: 0; }
#visu-tools .vt-ik-opt[hidden] { display: none; }
#visu-tools .vt-ik-range { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; align-items: center; }
#visu-tools .vt-ik-range .vt-label { grid-column: 1; }
#visu-tools .vt-ik-range output { grid-column: 2; font-size: 13.5px; color: var(--vt-muted); font-variant-numeric: tabular-nums; }
#visu-tools .vt-ik-range input[type=range] { grid-column: 1 / -1; min-height: 40px; }
#visu-tools .vt-ik-color { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--vt-ink); }
#visu-tools .vt-ik-color input[type=color] { width: 46px; height: 46px; padding: 3px; border-radius: 12px; border: 1px solid var(--vt-line-2); background: #fff; flex: none; cursor: pointer; }
#visu-tools .vt-ik-color[hidden] { display: none; }
#visu-tools .vt-ik-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
#visu-tools .vt-ik-row > .vt-field { flex: 1 1 140px; }
#visu-tools .vt-ik-out-actions { display: grid; gap: 10px; }
#visu-tools .vt-ik-summary { font-size: 14.5px; color: var(--vt-ink); font-variant-numeric: tabular-nums; }
#visu-tools .vt-ik-results { list-style: none; display: grid; gap: 8px; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
#visu-tools .vt-ik-results[hidden] { display: none; }
#visu-tools .vt-ik-sources { width: 100%; border-collapse: collapse; font-size: 14.5px; }
#visu-tools .vt-ik-sources :is(th, td) { text-align: left; padding: 9px 12px 9px 0; border: 0; border-bottom: 1px solid var(--vt-line); vertical-align: top; background: none; }
#visu-tools .vt-ik-sources th { font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--vt-muted); }
#visu-tools .vt-ik-sources td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--vt-ink); font-weight: 600; }
#visu-tools .vt-ik-table-wrap { overflow-x: auto; }
#visu-tools .vt-ik-section { padding-top: 40px; display: grid; gap: 14px; }
#visu-tools .vt-ik-section h2 { font-size: 24px !important; font-weight: 700 !important; }
@media (max-width: 600px) {
  #visu-tools .vt-ik-drop { padding: 22px 14px; }
  #visu-tools .vt-ik-drop-compact { grid-template-columns: auto 1fr; }
  #visu-tools .vt-ik-drop-compact .vt-ik-drop-btn { grid-column: 1 / -1; justify-self: stretch; }
  #visu-tools .vt-ik-stage :is(canvas, img) { max-height: 380px; }
  /* Source tables become stacked cards: nothing to scroll sideways, the source link is always in view. */
  #visu-tools .vt-ik-sources, #visu-tools .vt-ik-sources :is(tbody, tr, td, th) { display: block; }
  #visu-tools .vt-ik-sources thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #visu-tools .vt-ik-sources tr { padding: 10px 0; border-bottom: 1px solid var(--vt-line); }
  #visu-tools .vt-ik-sources :is(td, th) { padding: 1px 0; border: 0; }
  #visu-tools .vt-ik-sources td:first-child { font-weight: 650; color: var(--vt-ink); }
  #visu-tools .vt-ik-sources td:last-child { font-size: 13.5px; }
  /* Options of an image tool wrap on a phone: a side-scrolling strip would hide choices. */
  #visu-tools .vt-ik-opt .vt-seg-items { flex-wrap: wrap; overflow-x: visible; margin: 0; padding: 0; }
  #visu-tools .vt-ik-opt .vt-seg-item span { min-height: 38px; padding: 7px 12px; font-size: 14px; }
}
