/* "Run on Compiler Explorer" link injected by hooks/compiler_explorer.py */
.ce-run-link {
  display: inline-block;
  margin-top: -0.75rem;
  margin-bottom: 1rem;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--md-default-fg-color--light);
  background: var(--md-code-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-top: none;
  border-radius: 0 0 0.2rem 0.2rem;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.ce-run-link:hover {
  color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
  background: var(--md-default-bg-color);
}

/* Spoiler: a solution that stays blurred until clicked.
   Paired with a collapsible "Show solution" block, revealing the answer
   takes two deliberate clicks: expand, then un-blur. */
.spoiler {
  cursor: pointer;
  filter: blur(5px);
  user-select: none;
  -webkit-user-select: none;
  border-radius: 0.2rem;
  transition: filter 0.15s ease;
}

/* The answer is meant to be read and re-typed, not copied — the exercises
   ask students to type solutions into CLion themselves. Suppress text
   selection (above, kept even when revealed) and hide Material's code "copy"
   button inside solutions, which would otherwise copy the text via JS and
   bypass the blur entirely. */
.spoiler .md-clipboard {
  display: none;
}

/* Only the still-blurred spoiler reacts to hover. Once revealed, this
   selector stops matching, so `.spoiler--revealed { filter: none }` wins
   instead of being overridden by `:hover` (which is more specific). */
.spoiler:not(.spoiler--revealed):hover {
  filter: blur(3.5px);
}

.spoiler--revealed {
  filter: none;
  cursor: auto;
}

/* Mermaid diagrams render left-aligned by default; center them on the page.
   text-align handles an inline-level SVG; margin:auto handles a block-level one. */
.mermaid {
  text-align: center;
}

.mermaid svg {
  margin: 0 auto;
}
