@import "govuk_publishing_components/individual_component_support";

$thumbnail-width: 99px;
$thumbnail-height: 140px;
$thumbnail-border-width: 5px;
$thumbnail-background: govuk-colour("white");
$thumbnail-border-colour: rgba(11, 12, 12, .1);
$thumbnail-shadow-colour: rgba(11, 12, 12, .4);
$thumbnail-shadow-width: 0 2px 2px;
$thumbnail-icon-border-colour: govuk-colour("mid-grey");

.gem-c-attachment {
  position: relative;
  @include govuk-font(19);
  @include govuk-clearfix;
}

.gem-c-attachment__thumbnail {
  position: relative;
  width: auto;
  padding: $thumbnail-border-width;
  float: left;
}

.gem-c-attachment__thumbnail-image {
  display: block;
  width: auto; // for IE8
  max-width: calc($thumbnail-width / 1.5);
  height: calc($thumbnail-height / 1.5);
  border: $thumbnail-border-colour; // for IE9 & IE10
  outline: $thumbnail-border-width solid $thumbnail-border-colour;
  background: $thumbnail-background;
  box-shadow: $thumbnail-shadow-width $thumbnail-shadow-colour;
  fill: $thumbnail-icon-border-colour;
  stroke: $thumbnail-icon-border-colour;

  @include govuk-media-query($from: tablet) {
    max-width: $thumbnail-width;
    height: $thumbnail-height;
  }
}

.gem-c-attachment__details {
  padding-left: calc(($thumbnail-width + $thumbnail-border-width * 2 + govuk-spacing(5)) / 1.5);

  @include govuk-media-query($from: tablet) {
    padding-left: $thumbnail-width + $thumbnail-border-width * 2 + govuk-spacing(5);
  }

  .gem-c-details {
    margin-top: govuk-spacing(3);
    word-break: break-word;
    word-wrap: break-word;
  }
}

.gem-c-attachment__title {
  margin: 0 0 govuk-spacing(3);
  @include govuk-font($size: 27);
}

.gem-c-attachment__link {
  line-height: 1.29;
}

.gem-c-attachment__metadata {
  margin: 0 0 govuk-spacing(3);
  color: $govuk-secondary-text-colour;
  @include govuk-font($size: 19);
  @include govuk-text-break-word;

  &:last-of-type {
    margin-bottom: 0;
  }
}

.govspeak,
.gem-c-govspeak {
  .gem-c-attachment__title {
    margin: 0 0 govuk-spacing(3) 0;
    @include govuk-font($size: 27, $weight: regular);
  }

  .gem-c-attachment__metadata {
    margin: 0 0 govuk-spacing(3) 0;
  }
}

.gem-c-attachment__metadata--compact {
  margin-bottom: 0;
}

.gem-c-attachment__abbr {
  text-decoration: none;
  cursor: help;
}

@include govuk-media-query($media-type: print) {
  .gem-c-attachment__details {
    padding: 0;
  }

  .gem-c-attachment__metadata {
    color: $govuk-print-text-colour;
  }

  .gem-c-attachment__metadata,
  .gem-c-attachment__metadata .govuk-link::after {
    font-size: 12pt;
  }

  .gem-c-attachment__link.govuk-link {
    word-break: break-word;

    &::after {
      font-size: 12pt;
      line-height: 1 !important; // stylelint-disable-line declaration-no-important
    }
  }
}
