/* Example Ui · rbx.css
 * Styles for the in-browser Roblox GUI renderer (js/rbxui.js).
 * Colours of the generated UI come from the spec; only the editor chrome (wireframe, selection) is themed here. */

.rbx-viewport {
  --rbx-select: #2f9bff;   /* selection box, like a selected Frame in Studio */
  --rbx-wire: #7fd0ff;     /* wireframe pass */
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.rbx {
  position: absolute;
  box-sizing: border-box;
  transition: opacity .3s ease;
}

/* its own stacking context, so ZIndex inside a UI never competes with the editor layers around it */
.rbx-root { left: 0; top: 0; z-index: 1; isolation: isolate; }

.rbx-skin,
.rbx-text,
.rbx-image {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity .5s cubic-bezier(.2, .7, .2, 1);
}

.rbx-text {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  line-height: 1.05;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.rbx-text--stroke { stroke-linejoin: round; }

.rbx-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.rbx-image svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.rbx-button { cursor: pointer; }

/* --- generation states: pending (not placed) -> wire (placed as a wireframe) -> styled ------------------ */
.rbx.is-pending { opacity: 0; }

.rbx.is-wire > .rbx-skin,
.rbx.is-wire > .rbx-text,
.rbx.is-wire > .rbx-image { opacity: 0 !important; }

.rbx.is-wire {
  outline: 1px dashed var(--rbx-wire);
  outline-offset: -1px;
}

.rbx.is-wire.rbx-root { outline: none; }

/* --- draft: the same tree drawn as a blueprint (outlines, hollow type, crossed image boxes) ------------ */
.rbx-viewport--draft { --rbx-wire: #d9f0ff; }

.rbx-viewport--draft .rbx {
  outline: 1px solid color-mix(in srgb, var(--rbx-wire) 62%, transparent);
  outline-offset: -.5px;
}
.rbx-viewport--draft .rbx-root,
.rbx-viewport--draft .rbx.is-pending { outline-color: transparent; }
.rbx-viewport--draft .rbx-TextLabel { outline-style: dashed; outline-color: color-mix(in srgb, var(--rbx-wire) 26%, transparent); }

.rbx-viewport--draft .rbx-skin { opacity: 0 !important; }
.rbx-viewport--draft .rbx-text--stroke { display: none; }
.rbx-viewport--draft .rbx-text {
  color: transparent !important;
  background-image: none !important;
  -webkit-text-stroke: .9px color-mix(in srgb, var(--rbx-wire) 92%, transparent);
}
.rbx-viewport--draft .rbx-image svg { display: none; }
.rbx-viewport--draft .rbx-image {
  opacity: 1 !important;
  background:
    linear-gradient(to top right, transparent calc(50% - .55px), var(--rbx-wire) calc(50% - .55px) calc(50% + .55px), transparent calc(50% + .55px)),
    linear-gradient(to bottom right, transparent calc(50% - .55px), var(--rbx-wire) calc(50% - .55px) calc(50% + .55px), transparent calc(50% + .55px));
  opacity: .55 !important;
}

/* --- editor overlay --------------------------------------------------------------------------------- */
.rbx-overlay {
  position: absolute;
  inset: 0;
  z-index: 999;
  pointer-events: none;
}

.rbx-hoverbox {
  position: absolute;
  box-sizing: border-box;
  outline: 1.5px solid var(--rbx-select);
  outline-offset: 0;
  opacity: .55;
}

.rbx-selbox {
  position: absolute;
  box-sizing: border-box;
  outline: 2px solid var(--rbx-select);
  transition: left .35s cubic-bezier(.2, .8, .2, 1), top .35s cubic-bezier(.2, .8, .2, 1),
    width .35s cubic-bezier(.2, .8, .2, 1), height .35s cubic-bezier(.2, .8, .2, 1);
}

.rbx-selbox > i {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  box-sizing: border-box;
  background: #fff;
  border: 1.5px solid var(--rbx-select);
}

.rbx-selbox > i:nth-child(1) { left: 0; top: 0; }
.rbx-selbox > i:nth-child(2) { left: 50%; top: 0; }
.rbx-selbox > i:nth-child(3) { left: 100%; top: 0; }
.rbx-selbox > i:nth-child(4) { left: 100%; top: 50%; }
.rbx-selbox > i:nth-child(5) { left: 100%; top: 100%; }
.rbx-selbox > i:nth-child(6) { left: 50%; top: 100%; }
.rbx-selbox > i:nth-child(7) { left: 0; top: 100%; }
.rbx-selbox > i:nth-child(8) { left: 0; top: 50%; }

.rbx-sellabel {
  position: absolute;
  left: -2px;
  bottom: calc(100% + 8px);
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--rbx-select);
  color: #fff;
  font: 500 11px/1 "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0;
  white-space: nowrap;
}

.rbx-selbox--below .rbx-sellabel {
  bottom: auto;
  top: calc(100% + 8px);
}

.rbx-selbox--left .rbx-sellabel { left: auto; right: -2px; }

/* on a very small screen the label would cover the UI it describes */
.rbx-viewport--small .rbx-sellabel { display: none; }
.rbx-viewport--small .rbx-selbox > i { width: 6px; height: 6px; margin: -3px 0 0 -3px; }

@media (prefers-reduced-motion: reduce) {
  .rbx,
  .rbx-skin,
  .rbx-text,
  .rbx-image,
  .rbx-selbox { transition: none; }
}

/* --- Luau syntax colours (set the six --lx-* variables on the code block to theme them) ------------- */
.lx-c { color: var(--lx-comment, #7c8696); font-style: italic; }
.lx-s { color: var(--lx-string, #a8e08f); }
.lx-n { color: var(--lx-number, #ffc66d); }
.lx-k { color: var(--lx-keyword, #ff8fb1); }
.lx-g { color: var(--lx-global, #7fd0ff); }
.lx-f { color: var(--lx-function, #ffe08a); }
.lx-p { color: var(--lx-property, inherit); }
.lx-o { color: var(--lx-operator, #9aa4b5); }
