/* copy_field: a value people copy (a token, key, URL, DNS record or embed
   code; RULES §7.7). The value is text in the code type on a quiet well,
   never an input's box. Its Copy button is at the end of the line. Code that
   runs to several lines scrolls inside its box. A row of the form block, or
   on its own with its label hidden (a table cell). */
.block_copy_field {
  --block-copy-field-well: var(--color-surface-soft);
  --block-copy-field-height: calc(var(--ui-space-12) * 6);

  min-width: 0;
}

/* A value named by its column or heading: no label column. */
.block_copy_field[data-label-hidden],
.block_fields .block_copy_field[data-label-hidden],
#main .block_fields .block_copy_field[data-label-hidden] {
  display: block;
  margin: 0;
}

.block_copy_field_row {
  display: flex;
  align-items: flex-start;
  gap: var(--ui-space-2);
  min-width: 0;
  max-width: var(--block-field-control-width, 100%);
}

.block_copy_field_value {
  display: block;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-width: 0;
  min-height: var(--ui-control-height-compact);
  padding: var(--ui-space-1) var(--ui-space-2);
  overflow: hidden;
  color: var(--color-text);
  font-family: var(--ui-font-family-code);
  font-size: var(--ui-font-size-code);
  line-height: var(--ui-line-height-control);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--block-copy-field-well);
  border-radius: var(--ui-radius-control);
  -webkit-user-select: all;
  user-select: all;
}

/* Several lines (embed code, a style sheet): kept as written, wrapped, and
   scrolling inside a box of its own height. */
.block_copy_field_value[data-multiline] {
  max-height: var(--block-copy-field-height);
  overflow: auto;
  text-overflow: clip;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.block_copy_field_row > .button {
  flex: none;
  margin: 0;
}

.button.with_icon.copy span::before {
  content: var(--ui-icon-copy) var(--ui-icon-alt,);
}

/* While the button says Copied it shows a tick. */
.button.with_icon.copy[data-state='copied'] span::before {
  content: var(--ui-icon-check) var(--ui-icon-alt,);
}

/* Copy is a compact utility beside its value; feedback changes the glyph,
   accessible name and tooltip without changing the row width. */
.block_copy_field_row > .button[data-icon-only] {
  width: var(--ui-control-height-compact);
  min-width: var(--ui-control-height-compact);
}

@media (any-pointer: coarse) {
  .block_copy_field_row > .button[data-icon-only] {
    width: var(--ui-touch-target);
    min-width: var(--ui-touch-target);
  }
}
