@use "./var";

/**
 * Text truncate.
 * Requires inline-block or block for proper styling.
 */
@mixin truncate {
  & {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/**
 * Multi-line text truncate
 * @see https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-line-clamp
 */
@mixin truncate-lines($lines: 1) {
  & {
    display: -webkit-box;
    -webkit-line-clamp: $lines;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/**
 * Use stretched-link on links to to make its containing block clickable via a ::after pseudo element.
 * In most cases, this means that an element with position: relative; that contains a link is clickable.
 */
@mixin stretched-link {
  &::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
  }
}

@mixin pre {
  font-family: var.default(--wy-font-monospace);
  word-break: break-word;
  white-space: pre-wrap;
  margin-block: var.default(--wy-gap);
}
