@import "../govuk/colours";
@import "helpers";

details {
  display: block;
  margin: $gutter-one-third 0;

  @include media(tablet) {
    margin: $gutter-half 0;
  }

  & > summary {
    cursor: pointer;
    display: block;
    position: relative;
    width: fit-content;
    padding-left: $gutter-two-thirds + 3px;


    &::-webkit-details-marker {
      display: none;
    }

    &:before {
      @include shape-arrow($direction: right, $base: 14px);

      color: $link-colour;
      content: "";
      position: absolute;

      top: -1px;
      bottom: 0;
      left: 0;

      margin: auto;
    }

    .summary {
      color: $link-colour;
      text-decoration: underline;
      text-decoration-thickness: max(1px, .05rem);
      text-underline-offset: 0.1578em;
    }

    &:hover {
      &:before {
        color: $link-hover-colour;
      }

      .summary {
        color: $link-hover-colour;
        text-decoration-thickness: max(3px, .15rem);
        text-decoration-skip-ink: none;
        text-decoration-skip: none;
      }
    }

    &:focus {
      @include focused-text;

      &:before {
        color: $text-colour;
      }

      .summary {
        color: $text-colour;
        text-decoration: none;
      }
    }
  }

  &[open] > summary {
    &:before {
      @include shape-arrow($direction: down, $base: 14px);
    }
  }

  .panel-indent {
    margin-top: $gutter-one-third;
    margin-bottom: 0;
  }
}
