/*
------------------------------------------------------------------------------------------------------
civic-code-copy-button.css
This is the CSS for the copy button that shows up in code blocks.
From: https://www.roboleary.net/2022/01/13/copy-code-to-clipboard-blog
------------------------------------------------------------------------------------------------------
*/

/* Header sticks to top of pre code blocks  */
pre header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
}

/* Code blocks */
pre:has(code) {
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5rem;
  max-height: 30rem;

  /* Add scrollbars if there is horizontal or vertical overflow */
  overflow-y: auto;
  overflow-x: auto;

  padding-inline: 0.5rem;
  padding-block-end: 0.5rem;
  margin: 0.5rem 0;
}

/* The copy button */
pre:has(code) button {
  /* Occupy full line */
  display: block;

  position: sticky;
  top: 0;
  left: 0;

  font-family: Source Sans Pro Web, Helvetica Neue, Helvetica, Roboto, Arial, sans-serif;
  font-size: 1.06rem;
  line-height: 0.9;
  color: white;
  background-color: #4D8157;
  appearance: none;
  align-items: center;
  border: 0;
  border-radius: 0.25rem;
  cursor: pointer;
  column-gap: 0.5rem;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1.25rem;
  text-align: center;
  text-decoration: none;
  width: 100%;
}

/* Optional hover style for the copy button */
pre:has(code) button:hover {
  background-color: #B2C9B7;
}