/* The icon in the header of the code blocks that label-code-blocks.mjs names "host" or "sandbox",
   on the Simspace sites (the root and simspace/). The runtime gives a block with a filename= a
   file icon: a host block gets back the terminal icon, a sandbox block gets a box (a sandbox).
   The icons are ligatures of the runtime's Material Symbols font, drawn by ::before because the
   runtime owns the icon's text. pages.yaml checks that these class names still exist. */
.code-block-label:has(> span[title="host"]) > .code-block-label-icon,
.code-block-label:has(> span[title="sandbox"]) > .code-block-label-icon {
  font-size: 0;
}
.code-block-label:has(> span[title="host"]) > .code-block-label-icon::before,
.code-block-label:has(> span[title="sandbox"]) > .code-block-label-icon::before {
  font-size: calc(var(--cb-fs-label, 0.72rem) * 1.4);
}
.code-block-label:has(> span[title="host"]) > .code-block-label-icon::before {
  content: "terminal";
}
.code-block-label:has(> span[title="sandbox"]) > .code-block-label-icon::before {
  content: "deployed_code";
}
/* A yaml block is a file to read: it keeps the file icon, wherever it is */
.code-block:has(code.language-yaml) .code-block-label:has(> span[title="host"]) > .code-block-label-icon::before {
  content: "draft";
}

/* A Dockerfile gets the Docker logo: the site's own docker.svg (the header logo, next to this
   file), as a mask painted in the icon's colour. Last, so it wins over the rules above. */
.code-block:has(code.language-dockerfile) .code-block-label > .code-block-label-icon {
  font-size: 0;
}
.code-block:has(code.language-dockerfile) .code-block-label > .code-block-label-icon::before {
  content: "";
  display: inline-block;
  width: calc(var(--cb-fs-label, 0.72rem) * 1.4);
  height: calc(var(--cb-fs-label, 0.72rem) * 1.4);
  background: currentColor;
  -webkit-mask: url("docker.svg") center / contain no-repeat;
  mask: url("docker.svg") center / contain no-repeat;
}

/* A sandbox block's header is blue, so you see at a glance that the command runs in the sandbox
   (same colours as labspace-local/theme.css) */
.code-block-header:has(> .code-block-label > span[title="sandbox"]) {
  background: rgba(37, 96, 255, 0.24);
  border-bottom-color: rgba(110, 150, 255, 0.25);
}
.code-block-label:has(> span[title="sandbox"]),
.code-block-label:has(> span[title="sandbox"]) > .code-block-label-icon {
  color: #b7caff;
}
