// Name:                       Code
//
// Description:                Define style for code elements
//
// Modifiers:                  `.pre-scrollable`
//
// =============================================================================


/* ==========================================================================
   Component: Code
 ============================================================================ */

/* Inline and block code styles */

code,
kbd,
pre,
samp {
  font-family: @font-family-monospace;
}


/* Inline code */

code {
  padding: 2px 4px;
  font-size: @code-font-size;
  color: @code-color;
  background-color: @code-bg;
  white-space: nowrap;
  border-radius: @global-radius;
}


/* Code block */

pre {
  display: block;
  padding: 1rem;
  margin: 1rem  0;
  font-size: @code-font-size;
  line-height: @line-height-base;
  word-break: break-all;
  word-wrap: break-word;
  color: @pre-color;
  background-color: @pre-bg;
  border: @pre-border;
  border-radius: @global-radius;

  // Account for some code outputs that place code tags in pre tags
  code {
    padding: 0;
    font-size: inherit;
    color: inherit;
    white-space: pre-wrap;
    background-color: transparent;
    border-radius: 0;
  }
}


/* Enable scrollable blocks of code */

.@{ns}pre-scrollable {
  max-height: @pre-scrollable-max-height;
  overflow-y: scroll;
  .hook-pre-scrollable;
}


// Hooks
// =============================================================================

.hook-pre-scrollable() {}
