@import "govuk_publishing_components/individual_component_support";

.gem-c-document-list {
  margin: 0;
  padding: 0;
  @include govuk-text-colour;
  @include govuk-font(19);
}

.gem-c-document-list__item {
  margin-top: govuk-spacing(5);
  padding-top: govuk-spacing(2);
  border-top: 1px solid $govuk-border-colour;
  list-style: none;

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

.gem-c-document-list__item-title {
  display: inline-block;
  @include govuk-font($size: 19, $weight: bold);
}

.gem-c-document-list--no-top-border {
  .gem-c-document-list__item {
    border-top: none;
  }
}

.gem-c-document-list--no-top-border-first-child {
  .gem-c-document-list__item:first-child {
    border-top: none;
  }
}

.gem-c-document-list--equal-item-spacing {
  .gem-c-document-list__item {
    margin-top: govuk-spacing(3);
    padding-top: govuk-spacing(3);
  }
}

.gem-c-document-list__item-title--context {
  margin-right: govuk-spacing(2);

  .direction-rtl & {
    margin-right: 0;
    margin-left: govuk-spacing(2);
  }
}

.gem-c-document-list__item-context {
  color: govuk-colour("dark-grey");
}

.gem-c-document-list__item-description {
  margin: govuk-spacing(1) 0;
  @include govuk-text-colour;
}

.gem-c-document-list__subtext {
  margin: 0;
}

.gem-c-document-list__item-description,
.gem-c-document-list__subtext {
  @include govuk-font($size: 16, $line-height: 1.5);
}

.gem-c-document-list__item-description--full-size {
  @include govuk-font($size: 19);
}

.gem-c-document-list__item-metadata {
  padding: 0;
}

.gem-c-document-list__attribute {
  display: inline-block;
  list-style: none;
  padding-right: govuk-spacing(4);
  @include govuk-text-colour;
  @include govuk-font(16);

  & { // stylelint-disable-line no-duplicate-selectors
    // overriding govuk-text-colour mixin
    color: $govuk-secondary-text-colour;
  }

  .direction-rtl & {
    padding-right: 0;
    padding-left: govuk-spacing(4);
  }
}

.gem-c-document-list__item--highlight {
  border: 1px solid govuk-colour("mid-grey");
  padding: govuk-spacing(6);
  margin-bottom: govuk-spacing(6);

  .gem-c-document-list__item-title {
    @include govuk-font(24, bold);
  }
}

.gem-c-document-list__highlight-text {
  margin: 0 0 govuk-spacing(3) 0;
  @include govuk-font(16, bold);
}

.gem-c-document-list__children {
  margin-bottom: 0;
  padding-left: 0;
  list-style-type: none;

  @include govuk-media-query($from: desktop) {
    margin-left: govuk-spacing(4);
    margin-top: govuk-spacing(4);

    @supports (display: grid) {
      display: grid;
      grid-template-columns: 1fr 1fr;
      column-gap: govuk-spacing(3);
    }
  }
}

.gem-c-document-list-child {
  position: relative;
  padding-left: govuk-spacing(5);
  padding-top: govuk-spacing(2);
  @include govuk-font($size: 16);

  &::before {
    content: "";
    position: absolute;
    left: 0;
    width: govuk-spacing(3);
    overflow: hidden;
    border-top: solid 1px $govuk-text-colour;
    transform: translate(0, 0.5em);
  }

  @include govuk-media-query($from: desktop) {
    padding: 0;
    padding-bottom: govuk-spacing(2);

    &::before {
      display: none;
    }
  }
}

.gem-c-document-list-child__heading {
  @include govuk-media-query($from: tablet) {
    @include govuk-typography-weight-bold;
  }
}

.gem-c-document-list-child__description {
  margin-top: govuk-spacing(1);
  margin-bottom: govuk-spacing(1);
  @include govuk-text-colour;

  @include govuk-media-query($until: tablet) {
    display: none;
  }
}

@include govuk-media-query($media-type: print) {
  .gem-c-document-list__item {
    break-inside: avoid;

    * {
      color: $govuk-print-text-colour;
    }
  }

  .gem-c-document-list__item-context {
    display: block;
  }
}
