/*
 * image-color-picker.css — per-tool styles for the eyedropper canvas, magnifier
 * loupe and colour swatches. Tokens only; no inline styles (CSP: style-src 'self').
 * Swatch/loupe colours are set at runtime via the CSSOM (element.style), which CSP allows.
 */

.icp-dropzone-icon { color: var(--text-muted); }

/* Canvas stage --------------------------------------------------------- */
.icp-stage { margin-top: var(--space-4); }

.icp-canvas-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;   /* JS tightens this to the image's natural pixel width */
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--neutral-50);
  background-image:
    linear-gradient(45deg, var(--neutral-100) 25%, transparent 25%),
    linear-gradient(-45deg, var(--neutral-100) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--neutral-100) 75%),
    linear-gradient(-45deg, transparent 75%, var(--neutral-100) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.icp-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;   /* let pointermove drive the loupe on touch */
}
.icp-canvas:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }

/* Magnifier loupe ------------------------------------------------------ */
.icp-loupe {
  position: absolute;
  pointer-events: none;
  width: 132px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 2px solid var(--surface, #fff);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  background: var(--surface, #fff);
  z-index: 3;
}
.icp-loupe-canvas {
  display: block;
  width: 132px;
  height: 132px;
  image-rendering: pixelated;
}
.icp-loupe-hex {
  display: block;
  padding: 3px 6px;
  font: 600 12px/1.4 var(--font-mono, monospace);
  text-align: center;
  color: #fff;
  background: rgba(0, 0, 0, .78);
  letter-spacing: .02em;
}

/* Picked colour readout ------------------------------------------------ */
.icp-current {
  display: flex;
  gap: var(--space-4);
  align-items: stretch;
}
.icp-current-swatch {
  flex: 0 0 auto;
  width: 84px;
  align-self: stretch;
  min-height: 84px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--neutral-100);
}
.icp-current-swatch.is-set { border-color: rgba(0, 0, 0, .18); }
.icp-current-values {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.icp-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.icp-row-label {
  flex: 0 0 auto;
  width: 3rem;
  font: 600 12px/1.4 var(--font-sans);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.icp-row-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-mono, monospace);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--neutral-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Swatch grids (history + palette) ------------------------------------- */
.icp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.icp-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 76px;
}
.icp-swatch-chip {
  width: 76px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform .1s ease, box-shadow .1s ease;
}
.icp-swatch-chip.is-light { border-color: var(--border); }
.icp-swatch-chip:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.icp-swatch-chip:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
.icp-swatch-label {
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: var(--text-secondary);
}
.icp-swatch-remove {
  color: var(--text-muted);
  line-height: 0;
}
.icp-swatch-remove:hover { color: var(--red-600, #dc2626); }

@media (max-width: 480px) {
  .icp-current { flex-direction: column; }
  .icp-current-swatch { width: 100%; min-height: 56px; }
}
