/* Dhole playground.
 *
 * One stylesheet for every playground on the wiki, as the Shader Lab's is. Colours come from the wiki's own variables where it
 * has them, so the playground sits in the page rather than on it; the picture keeps its theme's own background, because that is
 * part of what the theme draws.
 */

.dhole-playground {
  margin: 1.2rem 0 1.6rem;
  border: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  border-radius: var(--radius-lg, 6px);
  background: var(--panel-strong, #fff);
  overflow: hidden;
}

.dhole-playground__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  font-size: 0.85rem;
}

.dhole-playground__field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #5d6b82);
}

.dhole-playground__field select,
.dhole-playground__button {
  padding: 4px 8px;
  border: 1px solid var(--line-strong, rgba(15, 23, 42, 0.16));
  border-radius: 6px;
  background: #fff;
  color: var(--text, #132033);
  font: inherit;
}

.dhole-playground__actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

/* The wiki sets button { color: inherit }; these are on white, so they say their own colours. */
.dhole-playground__button {
  cursor: pointer;
}

.dhole-playground__button:hover {
  border-color: var(--brand, #3f6fff);
  color: var(--brand, #3f6fff);
}

.dhole-playground__button:disabled {
  opacity: 0.5;
  cursor: default;
}

.dhole-playground__panes {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  min-height: 420px;
}

.dhole-playground__text {
  width: 100%;
  min-height: 420px;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-right: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  background: #101725;
  color: #d9e4ff;
  font: 13px/1.55 ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
  resize: vertical;
  box-sizing: border-box;
}

.dhole-playground__text:focus {
  outline: 2px solid var(--brand, #3f6fff);
  outline-offset: -2px;
}

.dhole-playground__picture {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14px;
  overflow: auto;
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.035) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.035) 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, rgba(15, 23, 42, 0.035) 25%, transparent 25%, transparent 75%, rgba(15, 23, 42, 0.035) 75%) 8px 8px / 16px 16px;
}

/* A picture larger than its pane is drawn smaller rather than cut; the saved SVG keeps its own size. */
.dhole-playground__picture svg {
  display: block;
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 10px rgba(12, 18, 28, 0.12);
}

.dhole-playground__status {
  padding: 8px 12px;
  border-top: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  color: var(--muted, #5d6b82);
  font-size: 0.85rem;
}

.dhole-playground__problems {
  margin: 0;
  padding: 0 12px 10px;
  list-style: none;
}

.dhole-playground__problems:empty {
  display: none;
}

.dhole-playground__problem button {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 5px 9px;
  border: 0;
  border-left: 3px solid #e34948;
  border-radius: 0 6px 6px 0;
  background: rgba(227, 73, 72, 0.08);
  color: var(--text, #132033);
  font: 0.85rem/1.45 inherit;
  text-align: left;
  cursor: pointer;
}

.dhole-playground__problem--warning button {
  border-left-color: #eda100;
  background: rgba(237, 161, 0, 0.1);
}

.dhole-playground--unavailable {
  padding: 14px;
  color: var(--muted, #5d6b82);
}

@media (max-width: 820px) {
  .dhole-playground__panes {
    grid-template-columns: minmax(0, 1fr);
  }

  .dhole-playground__text {
    min-height: 260px;
    border-right: 0;
    border-bottom: 1px solid var(--line, rgba(15, 23, 42, 0.1));
  }

  .dhole-playground__actions {
    margin-left: 0;
  }
}

/* The workbench layout (the playground page's front matter says `layout: workbench`): the side panels become drawers, and the
   editor and the picture claim the window's height, so a long text and a large picture are both seen at once. */
html:not([data-focus="off"]) body[data-layout="workbench"] .dhole-playground__panes,
html:not([data-focus="off"]) body[data-layout="workbench"] .dhole-playground__text {
  height: var(--pres-viewport-h);
  min-height: 460px;
}

html:not([data-focus="off"]) body[data-layout="workbench"] .dhole-playground__panes {
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
}

/* The prose round the playground keeps a readable measure on a page given the window's width. */
html:not([data-focus="off"]) body[data-layout="workbench"] .doc-article__body > :not(.dhole-playground):not(pre):not(table) {
  max-width: 860px;
}
