/* Studio inspector: in the website editor's frame, the outline around the
   block under the mouse while the editor's inspect switch is on, and around
   the block open in the editor, each with its name on a tab above it
   (look-preview). It is the editor's, not the shop's, so it keeps one colour
   on every theme and never takes a click. */
.studio-inspector {
  --inspector-color: oklch(0.6 0.2 260);

  block-size: var(--inspector-height);
  border: 2px solid var(--inspector-color);
  border-radius: var(--radius-xs);
  inline-size: var(--inspector-width);
  inset-block-start: var(--inspector-top);
  inset-inline-start: var(--inspector-left);
  pointer-events: none;
  position: fixed;
  z-index: var(--z-overlay);

  &[data-kind="hover"] {
    background: color-mix(in oklab, var(--inspector-color) 10%, transparent);
    border-style: dashed;
  }

  &[hidden] {
    display: none;
  }
}

.studio-inspector__label {
  background: var(--inspector-color);
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  color: oklch(1 0 0);
  font-family: var(--font-body);
  font-size: var(--step--2);
  font-weight: var(--weight-semibold);
  inset-block-end: 100%;
  inset-inline-start: -2px;
  line-height: var(--leading-snug);
  max-inline-size: 100%;
  overflow: hidden;
  padding: 0.125rem var(--space-2xs);
  position: absolute;
  text-overflow: ellipsis;
  white-space: nowrap;

  &:empty {
    display: none;
  }

  /* A block at the top of the window shows its name inside the outline */
  .studio-inspector[data-near-top] & {
    border-radius: 0 0 var(--radius-xs) 0;
    inset-block: 0 auto;
    inset-inline-start: 0;
  }
}

/* Pointing at the page: the mouse says so, and hovered links don't look clickable */
:root[data-studio-inspecting],
:root[data-studio-inspecting] * {
  cursor: crosshair !important;
}

/* While pointing, the inspector's outline is the only one: a block's own
   hint that it can be picked (page-block) steps back */
:root[data-studio-inspecting] .page-block[data-studio-block]:hover {
  outline-color: transparent;
}
