/* Sculpt panel (UX pass 2026-11-20): icon brush palette, state chips, collapsible sections. Colour = tokens only;
   amber marks the live state (active brush, toggled chips). */

#sculpt-dock .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sculpt-panel { gap: var(--space-2); }

/* ---- state chips (Invert, Dyntopo, X / Y / Z) ---- */
.sculpt-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.sculpt-chip { position: relative; display: inline-flex; cursor: pointer; }
.sculpt-chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.sculpt-chip span {
  min-width: 40px;
  height: var(--control-h-sm, 24px);
  padding: 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: background var(--motion-fast, 120ms) var(--ease-out, ease), color var(--motion-fast, 120ms) var(--ease-out, ease), border-color var(--motion-fast, 120ms) var(--ease-out, ease);
  user-select: none;
}
.sculpt-chip:hover span { color: var(--color-text-primary); border-color: var(--color-border-strong); }
.sculpt-chip input:checked + span {
  background: var(--color-accent-muted);
  color: var(--color-text-primary);
  border-color: var(--color-accent);
}
.sculpt-chip input:focus-visible + span { outline: 2px solid var(--color-accent); outline-offset: 1px; }

.sculpt-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
}

/* ---- brush palette: flat grid, every group starts a new row ---- */
.brush-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 40px);
  gap: var(--space-1);
  justify-content: start;
}
.brush-tile {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: var(--color-bg-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--motion-fast, 120ms) var(--ease-out, ease), color var(--motion-fast, 120ms) var(--ease-out, ease), border-color var(--motion-fast, 120ms) var(--ease-out, ease);
}
.brush-tile.group-start { grid-column-start: 1; margin-top: var(--space-1); }
.brush-tile.group-start:first-child { margin-top: 0; }
.brush-tile:hover { background: var(--color-hover); color: var(--color-text-primary); border-color: var(--color-border-strong); }
.brush-tile.active {
  background: var(--color-accent-muted);
  color: var(--color-text-primary);
  border-color: var(--color-accent);
}
.brush-tile:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.brush-glyph { width: 24px; height: 24px; pointer-events: none; }
.brush-key {
  position: absolute;
  top: 2px;
  right: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  color: var(--color-text-muted);
  pointer-events: none;
}
.brush-tile.active .brush-key { color: var(--color-text-secondary); }

.brush-readout {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: var(--leading-tight, 1.25);
  min-height: 2.5em;
}
.brush-readout strong { color: var(--color-text-primary); font-weight: var(--weight-medium, 500); }
.brush-readout span { display: block; }

.sculpt-fields { display: flex; flex-direction: column; gap: var(--space-2); }
.sculpt-fields:empty { display: none; }
#sculpt-brush-fields .scrub label { min-width: 64px; }

/* ---- collapsible sections ---- */
.sculpt-sec {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-1);
}
.sculpt-sec > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--control-h-sm, 24px);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium, 500);
  color: var(--color-text-secondary);
  user-select: none;
}
.sculpt-sec > summary::-webkit-details-marker { display: none; }
.sculpt-sec > summary::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-right: var(--space-1);
  border-right: 1.5px solid var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform var(--motion-fast, 120ms) var(--ease-out, ease);
}
.sculpt-sec[open] > summary::before { transform: rotate(45deg); }
.sculpt-sec > summary:hover { color: var(--color-text-primary); }
.sculpt-sec > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; border-radius: var(--radius-sm); }
.sculpt-sec[open] { display: flex; flex-direction: column; gap: var(--space-2); }

.alpha-thumb {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: #000;
}
.alpha-thumb[hidden] { display: none; }

.falloff-curve { display: block; width: 100%; max-width: 160px; height: auto; color: var(--color-accent, currentColor); background: var(--color-surface-2, transparent); border: 1px solid var(--color-border); border-radius: var(--radius-sm); margin: var(--space-1) 0; }
.subtool-row { display: flex; align-items: center; gap: var(--space-1); cursor: default; }
.subtool-row .obj-label { flex: 1; cursor: pointer; }
