@use "mixins/border-radius";
@use "mixins/box-shadow";
@use "variables";
@use "vendor/rfs";

// Inline code
code {
  @include rfs.font-size(variables.$code-font-size);
  color: variables.$code-color;
  word-wrap: break-word;

  // Streamline the style when inside anchors to avoid broken underline and more
  a > & {
    color: inherit;
  }
}

// User input typically entered via keyboard
kbd {
  padding: variables.$kbd-padding-y variables.$kbd-padding-x;
  @include rfs.font-size(variables.$kbd-font-size);
  color: variables.$kbd-color;
  background-color: variables.$kbd-bg;
  @include border-radius.border-radius(variables.$border-radius-sm);
  @include box-shadow.box-shadow(variables.$kbd-box-shadow);

  kbd {
    padding: 0;
    @include rfs.font-size(100%);
    font-weight: variables.$nested-kbd-font-weight;
    @include box-shadow.box-shadow(none);
  }
}

// Blocks of code
pre {
  display: block;
  @include rfs.font-size(variables.$code-font-size);
  color: variables.$pre-color;

  // Account for some code outputs that place code tags in pre tags
  code {
    @include rfs.font-size(inherit);
    color: inherit;
    word-break: normal;
  }
}

// Enable scrollable blocks of code
.pre-scrollable {
  max-height: variables.$pre-scrollable-max-height;
  overflow-y: scroll;
}
