/* Image Inspector — leans on ../css/protium-ui.css tokens. */

.nav-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.ins-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 340px;
}

/* Canvas ---------------------------------------------------------------- */
.canvas-container {
  position: relative;
  background: var(--bg);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}

.canvas-wrapper {
  position: relative;
  cursor: crosshair;
  box-shadow: var(--shadow-pop);
  /* Checkerboard so transparent pixels read as transparent. */
  background-image:
    linear-gradient(45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-2) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-2) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.canvas-wrapper.hidden { display: none; }
.canvas-wrapper.inspecting { cursor: none; }

#mainCanvas { display: block; image-rendering: pixelated; }

/* Empty state ----------------------------------------------------------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 32px;
}
.empty-state.hidden { display: none; }
.empty-icon { width: 46px; height: 46px; color: var(--text-faint); }
.empty-state h2 { font-family: var(--font-display); font-size: 20px; }
.empty-state p { font-size: 14px; color: var(--text-muted); max-width: 42ch; }
.empty-state .pt-btn { margin-top: 6px; }
.empty-note { font-size: 12.5px; color: var(--text-faint); }

/* Crosshair ------------------------------------------------------------- */
.crosshair { position: absolute; pointer-events: none; display: none; z-index: 10; }
.crosshair.active { display: block; }
.crosshair-line { position: absolute; background: var(--accent); opacity: 0.6; }
/* The crosshair lives inside the zoomed (CSS-scaled) wrapper. --inv is
   1/zoom (set by inspect.js) so the lines and ring keep the same on-screen
   size at every zoom level instead of shrinking/thickening with the image. */
.crosshair-horizontal { height: calc(1px * var(--inv, 1)); width: calc(200vw * var(--inv, 1)); left: calc(-100vw * var(--inv, 1)); top: 0; }
.crosshair-vertical { width: calc(1px * var(--inv, 1)); height: calc(200vh * var(--inv, 1)); top: calc(-100vh * var(--inv, 1)); left: 0; }
.crosshair-center {
  position: absolute; width: calc(20px * var(--inv, 1)); height: calc(20px * var(--inv, 1));
  border: calc(2px * var(--inv, 1)) solid var(--accent); border-radius: 50%;
  left: calc(-10px * var(--inv, 1)); top: calc(-10px * var(--inv, 1)); background: var(--accent-soft);
}

/* Magnifier — positioned from viewport coordinates by inspect.js. -------- */
.magnifier {
  position: fixed; width: 200px; height: 200px;
  border: 2px solid var(--accent); border-radius: 50%;
  pointer-events: none; display: none; z-index: 100;
  box-shadow: var(--shadow-pop);
  background: var(--surface); overflow: hidden;
}
.magnifier.active { display: block; }
.magnifier canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.magnifier::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 10px; height: 10px; border: 2px solid var(--accent);
  transform: translate(-50%, -50%); background: var(--accent-soft);
}

/* Zoom controls --------------------------------------------------------- */
.zoom-controls {
  position: absolute; right: 14px; bottom: 14px;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  background: var(--elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 6px; box-shadow: var(--shadow);
}
.zoom-btn {
  width: 30px; height: 28px;
  background: var(--surface-2); border: 1px solid var(--border-faint);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 14px; cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.zoom-btn:hover { background: var(--surface); border-color: var(--border-strong); }
.zoom-display {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted);
  text-align: center; padding: 2px 0;
}

/* Sidebar -------------------------------------------------------------- */
.sidebar {
  background: var(--nav); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px;
}
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 14px;
}
.panel-head { margin-bottom: 12px; }
.panel-head h3 { font-size: 13px; font-weight: 600; }
.panel-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 10px; }
.panel-note code {
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--surface-2); padding: 1px 5px; border-radius: 5px;
}

/* Colour readout ------------------------------------------------------- */
.color-preview-large {
  height: 66px; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 10px;
}
.color-fill { width: 100%; height: 100%; }

.color-values-grid { display: flex; flex-direction: column; gap: 5px; }
.color-value-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-faint);
  border-radius: var(--r-md); padding: 7px 10px; cursor: pointer;
  transition: background var(--t), border-color var(--t);
}
.color-value-row:hover { background: var(--field); border-color: var(--border-strong); }
.color-value-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase; flex: none; /* --text-faint was ~2.9:1 in light mode */
}
.color-value-text {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  overflow: hidden; white-space: nowrap;
}
.copy-icon {
  font-family: var(--font-sans); font-size: 10.5px; color: var(--text-faint);
  opacity: 0; transition: opacity var(--t); flex: none;
}
.color-value-row:hover .copy-icon { opacity: 1; }

/* Stats ---------------------------------------------------------------- */
.ins-stats { display: grid; gap: 8px; }
.ins-stats.two { grid-template-columns: 1fr 1fr; }
.ins-stats > div {
  background: var(--surface-2); border: 1px solid var(--border-faint);
  border-radius: var(--r-md); padding: 8px 10px;
}
.ins-stats dt { font-size: 10.5px; color: var(--text-muted); /* --text-faint was ~2.8:1 */ text-transform: uppercase; letter-spacing: 0.05em; }
.ins-stats dd { font-family: var(--font-mono); font-size: 14px; font-weight: 500; margin-top: 3px; }

/* Toggles -------------------------------------------------------------- */
.toggle-group { display: flex; flex-direction: column; gap: 2px; }
.toggle-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-md); cursor: pointer;
  font-size: 13px; color: var(--text-muted);
  transition: background var(--t);
}
.toggle-item:hover { background: var(--surface-2); }
.toggle-item input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

/* Toast — inspect.js sets `toast show [success]`. ----------------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--status-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  padding: 10px 16px;
  background: var(--elevated); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  color: var(--text); font-size: 13px;
  opacity: 0; pointer-events: none; z-index: 200;
  transition: opacity var(--t), transform var(--t);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--ok-border); }

@media (max-width: 900px) {
  /* Stacked: give the image a real height and let the page area scroll to the
     panels below (with "1fr auto" the sidebar took all the room and the image
     area collapsed to 0 px). */
  .ins-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(55vh, 1fr) auto; overflow-y: auto; }
  .sidebar { border-left: none; border-top: 1px solid var(--border); overflow-y: visible; }
  .nav-tools .pt-btn span, #theme-label { display: none; }
}
@media (max-width: 480px) {
  .pt-nav-inner > .pt-badge { display: none; }
  .nav-tools { min-width: 0; overflow-x: auto; gap: 6px; }
  /* the zoom panel's fit button does the same job; frees room so the theme toggle stays on screen */
  #resetBtn { display: none; }
}
