/* Nighty Design: the Inspect tab and the code views (public/assets/js/designer/code/). Calm like the Design tab:
   quiet labels, values in mono that copy with one click (they light up when copied), a box model for the distances,
   and code with soft colors. Every value is a button at least 24 px high on a computer and 44 px on a phone. */

/* ---------- the tab ---------- */
.dz-inspect {
  padding-bottom: 12px;
}

.dz-inspect-empty {
  margin-top: 12px;
}

.dz-inspect-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 10px;
  border-bottom: 1px solid var(--dz-line);
}

.dz-inspect-titles {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dz-inspect-name {
  overflow: hidden;
  margin: 0;
  color: var(--text);
  font: 650 13px/1.2 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-inspect-kind {
  overflow: hidden;
  margin: 0;
  color: var(--text-3);
  font: 500 10.5px/1.3 var(--font-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- values that copy ---------- */
.dz-inspect-value,
.dz-inspect-css,
.dz-inspect-content {
  min-width: 0;
  border: 0;
  border-radius: var(--dz-r-sm);
  background: transparent;
  color: var(--text);
  cursor: copy;
  transition: background-color var(--dz-fast) var(--dz-ease), color var(--dz-fast) var(--dz-ease);
}

.dz-inspect-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: var(--dz-h-sm);
  padding: 0 6px;
  font: 500 11.5px/1.3 var(--font-mono);
  text-align: left;
}

.dz-inspect-value.is-wide {
  width: 100%;
}

/* A shared style's name reads as a name, not a value. */
.dz-inspect-value.is-style {
  font-family: var(--font-body);
  font-weight: 650;
}

.dz-inspect-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:is(.dz-inspect-value, .dz-inspect-css, .dz-inspect-content):hover {
  background: var(--dz-hover-bg);
}

:is(.dz-inspect-value, .dz-inspect-css, .dz-inspect-content):active {
  background: var(--dz-press);
}

:is(.dz-inspect-value, .dz-inspect-css, .dz-inspect-content).is-done {
  background: rgba(98, 214, 151, 0.12);
  color: var(--ok);
}

.dz-inspect-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.dz-inspect-label {
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--dz-fs-sm);
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-inspect-values {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-left: -6px;
}

.dz-inspect-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 10px;
}

.dz-inspect-grid .dz-inspect-row {
  grid-template-columns: 44px minmax(0, 1fr);
}

.dz-inspect-list,
.dz-inspect-css-list,
.dz-inspect-stops {
  display: grid;
  gap: 2px;
}

.dz-inspect-sub {
  margin: 4px 0 0;
  color: var(--text-2);
  font-size: var(--dz-fs-sm);
  font-weight: 700;
}

/* A CSS declaration: property in a soft color, then the value. Long values wrap. */
.dz-inspect-css {
  display: block;
  width: calc(100% + 6px);
  padding: 3px 6px;
  margin-left: -6px;
  font: 500 11.5px/1.5 var(--font-mono);
  text-align: left;
  overflow-wrap: anywhere;
}

.dz-inspect-prop {
  color: var(--dzt-code-property, #8fd0ff);
}

.dz-inspect-colon {
  color: var(--text-3);
}

.dz-inspect-val {
  color: var(--text);
}

/* The text of a text layer. */
.dz-inspect-content {
  display: block;
  width: 100%;
  max-height: 96px;
  padding: 6px 8px;
  overflow: hidden;
  background: var(--dz-field);
  color: var(--text-2);
  font-size: var(--dz-fs);
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- swatches, gradients, pictures ---------- */
.dz-inspect-swatch {
  flex: none;
  position: relative;
  width: 14px;
  height: 14px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--dz-checker);
}

.dz-inspect-swatch-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--swatch, transparent);
  box-shadow: 0 0 0 1px rgba(var(--dzt-fg-rgb, 255, 255, 255), 0.18) inset;
}

.dz-inspect-fill {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dz-inspect-gradient-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dz-inspect-gradient {
  flex: 1;
  height: 16px;
  border-radius: 4px;
  background: var(--dz-checker);
  box-shadow: 0 0 0 1px rgba(var(--dzt-fg-rgb, 255, 255, 255), 0.14) inset;
}

.dz-inspect-gradient::after {
  content: "";
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--swatch, transparent);
}

.dz-inspect-image-row,
.dz-inspect-asset {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dz-inspect-thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  overflow: hidden;
  border-radius: var(--dz-r-sm);
  background: var(--dz-checker);
  box-shadow: 0 0 0 1px rgba(var(--dzt-fg-rgb, 255, 255, 255), 0.12) inset;
  color: var(--text-2);
}

.dz-inspect-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.dz-inspect-asset-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.dz-inspect-image-name {
  overflow: hidden;
  color: var(--text);
  font-size: var(--dz-fs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-inspect-dim {
  color: var(--text-3);
  font: 500 10.5px/1.3 var(--font-mono);
}

.dz-inspect-effect {
  display: grid;
  gap: 2px;
}

.dz-inspect-effect + .dz-inspect-effect {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--dz-line);
}

/* ---------- the box model: the parent's edges, the layer, its padding ---------- */
.dz-inspect-model {
  position: relative;
  display: grid;
  grid-template-columns: minmax(28px, auto) minmax(0, 1fr) minmax(28px, auto);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px dashed var(--dz-line-strong);
  border-radius: var(--dz-r);
}

.dz-inspect-model.is-top {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto;
  border: 0;
  padding: 0;
}

.dz-inspect-model-label {
  position: absolute;
  top: 5px;
  left: 8px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 650;
  pointer-events: none;
}

.dz-inspect-dist.is-top {
  grid-column: 2;
  grid-row: 1;
}

.dz-inspect-dist.is-left {
  grid-column: 1;
  grid-row: 2;
}

.dz-inspect-dist.is-right {
  grid-column: 3;
  grid-row: 2;
}

.dz-inspect-dist.is-bottom {
  grid-column: 2;
  grid-row: 3;
}

.dz-inspect-dist {
  color: var(--dzt-measure-ink, var(--dz-measure, #ff5ca8));
}

.dz-inspect-model-layer {
  grid-column: 2;
  grid-row: 2;
  justify-self: stretch;
  display: grid;
  grid-template-columns: minmax(24px, auto) minmax(0, 1fr) minmax(24px, auto);
  grid-template-rows: auto minmax(24px, 1fr) auto;
  align-items: center;
  justify-items: center;
  min-height: 64px;
  padding: 2px;
  border: 1px solid rgba(78, 168, 255, 0.55);
  border-radius: var(--dz-r-sm);
  background: rgba(78, 168, 255, 0.07);
}

.dz-inspect-model.is-top .dz-inspect-model-layer {
  grid-column: 1;
  grid-row: 1;
}

.dz-inspect-pad {
  color: var(--dzt-code-tag, #7cc7ff);
}

.dz-inspect-pad.is-top {
  grid-column: 2;
  grid-row: 1;
}

.dz-inspect-pad.is-left {
  grid-column: 1;
  grid-row: 2;
}

.dz-inspect-pad.is-right {
  grid-column: 3;
  grid-row: 2;
}

.dz-inspect-pad.is-bottom {
  grid-column: 2;
  grid-row: 3;
}

.dz-inspect-size {
  grid-column: 2;
  grid-row: 2;
  font-weight: 650;
}

/* ---------- section heads: color format and code language ---------- */
.dz-inspect-format,
.dz-inspect-language {
  width: auto;
  height: var(--dz-h-sm);
  font-size: var(--dz-fs-sm);
}

.dz-inspect-format {
  min-width: 66px;
}

.dz-inspect-language {
  min-width: 92px;
}

.dz-inspect-react,
.dz-inspect-scope,
.dz-codeview-react {
  width: 100%;
}

.dz-inspect-page {
  margin-top: 2px;
}

/* ---------- code ---------- */
.dz-codeview {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dz-codeview-files {
  display: flex;
  max-width: 100%;
  overflow-x: auto;
}

.dz-codeview-files > button {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-weight: 500;
}

.dz-codeview-block {
  position: relative;
  min-width: 0;
  border: 1px solid var(--dz-line);
  border-radius: var(--dz-r);
  background: rgba(var(--dzt-well-rgb, 6, 5, 9), 0.6);
}

.dz-codeview-block pre {
  max-height: 320px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  color: var(--text);
  font: 11.5px/1.6 var(--font-mono);
  white-space: pre;
  tab-size: 2;
  -webkit-user-select: text;
  user-select: text;
}

.dz-codeview-block.is-tall pre {
  max-height: min(60vh, 560px);
  font-size: 12px;
}

.dz-codeview-block pre:focus-visible {
  outline: none;
  box-shadow: var(--dz-ring);
  border-radius: var(--dz-r);
}

.dz-codeview-copy {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(var(--dzt-bar-rgb, 20, 17, 28), 0.85);
}

.dz-codeview-copy:hover {
  background: rgba(var(--dzt-bar-hover-rgb, 40, 35, 52), 0.95);
}

/* Quiet colors for the code. */
.dz-tok-comment {
  color: var(--text-3);
  font-style: italic;
}

.dz-tok-string {
  color: var(--dzt-code-string, #a6e3b8);
}

.dz-tok-number,
.dz-tok-color {
  color: var(--dzt-code-number, #ffbf80);
}

.dz-tok-keyword {
  color: var(--dzt-code-keyword, #ff8fc8);
}

.dz-tok-tag {
  color: var(--dzt-code-tag, #7cc7ff);
}

.dz-tok-attr,
.dz-tok-member {
  color: var(--dzt-code-attr, #c9a8ff);
}

.dz-tok-property {
  color: var(--dzt-code-property, #8fd0ff);
}

.dz-tok-selector {
  color: var(--dzt-code-selector, #ffd27a);
}

.dz-tok-type {
  color: var(--dzt-code-type, #6fe3f2);
}

/* ---------- the code window ---------- */
.dz-codeview-window {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.dz-codeview-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.dz-codeview-langs {
  flex: 1 1 auto;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

/* Every language keeps its whole name: on a narrow screen the row scrolls instead. */
.dz-codeview-langs > button {
  flex: 1 0 auto;
}

.dz-codeview-react {
  flex: 0 1 auto;
  width: auto;
}

/* ---------- phones: bigger targets, a shorter code block ---------- */
.designer[data-layout="phone"] .dz-inspect-value {
  min-height: 44px;
  font-size: 13px;
}

.designer[data-layout="phone"] .dz-inspect-css {
  min-height: 44px;
  padding: 10px 6px;
  font-size: 12.5px;
}

.designer[data-layout="phone"] .dz-inspect-row {
  grid-template-columns: 96px minmax(0, 1fr);
}

.designer[data-layout="phone"] .dz-inspect-grid .dz-inspect-row {
  grid-template-columns: 52px minmax(0, 1fr);
}

.designer[data-layout="phone"] :is(.dz-inspect-format, .dz-inspect-language) {
  height: 44px;
  font-size: 13px;
}

.designer[data-layout="phone"] .dz-inspect-thumb {
  width: 44px;
  height: 44px;
}

.designer[data-layout="phone"] .dz-codeview-block pre {
  max-height: 38vh;
  font-size: 12.5px;
}

.designer[data-layout="phone"] .dz-codeview-copy {
  width: 44px;
  height: 44px;
}

@media (pointer: coarse) {
  .designer:not([data-layout="phone"]) .dz-inspect-value,
  .designer:not([data-layout="phone"]) .dz-inspect-css {
    min-height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dz-inspect-value,
  .dz-inspect-css,
  .dz-inspect-content {
    transition: none;
  }
}
