@use "../../core/settings" as *;
@use "../../core/tools" as *;
@use "../../core/helpers" as *;

////
/// Inset text component
///
/// 1. Removes top margin from first element and bottom margin from last,
///    to ensure correct spacing within the component.
/// 2. Restricts the width of the text to optimise the line length for
///    readability.
///
/// @group components/inset-text
////

@include nhsuk-exports("nhsuk/components/inset-text") {
  .nhsuk-inset-text {
    box-sizing: border-box;
    border-left: $nhsuk-border-width-inset-text solid $nhsuk-brand-colour;

    @include nhsuk-reading-width; // [2]
    @include nhsuk-top-and-bottom; // [1]

    @include nhsuk-responsive-margin(6, "bottom");
    @include nhsuk-responsive-padding(4);

    :first-child:empty + & {
      margin-top: 0;
    }

    &:not(:first-child) {
      @include nhsuk-responsive-margin(6, "top");
    }

    @media print {
      border-color: $nhsuk-print-text-colour;
    }
  }
}
