/*
 * EdGEL page masthead
 * --------------------------------------------------
 */

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

.masthead {
  background: #fff;

  [class*="col-"] {
    margin-top: auto;
    margin-bottom: auto;
  }
}

.container-branding,
.container-topnav,
.container-masthead {
  @include edgel-container();
}

.container-masthead {
  position: relative;
  padding-top: $masthead-padding-xs;
  padding-bottom: $masthead-padding-xs;

  @include media-breakpoint-up(md) {
    padding-top: $masthead-padding;
    padding-bottom: $masthead-padding;
  }
}

.masthead-heading {
  padding-top: space(2);
  margin-top: 0;
  margin-bottom: 0;
  font-family: $headings-font-family;
  @include font-size($h2-font-size);
  font-style: $headings-font-style;
  font-weight: $headings-font-weight;
  line-height: $headings-line-height;
  color: $headings-color;
  text-align: right;
  border-bottom: none;
}

.masthead-text {
  margin: $masthead-padding-xs 0;
  text-align: right;

  .list-inline {
    margin-bottom: 0;
  }

  @include media-breakpoint-up(md) {
    margin: 0 0 #{$masthead-padding-xs * 1.25};
  }
}

.masthead-logo {
  width: 100%;
  max-width: 332px;
  height: auto;
  max-height: 79px;
  vertical-align: top;
}

/* Show/hide the search form */
.btn-masthead-search-toggler {
  @include button-variant($white, $black);
  position: absolute;
  top: 0;
  right: 0;
  width: auto;
  padding: 10px;
}

@include media-breakpoint-up(md) {
  .edgel-js {
    .masthead-search {
      display: block;
    }

    .btn-masthead-search-toggler {
      display: none;
    }
  }
}

/* Hero banner image and title container */
.masthead-hero {
  background-color: $brand-color;
}

.masthead-banner {
  position: relative;
  width: 100%;

  &::before {
    display: block;
    padding-top: (11 / 60 * 100%);
    content: "";
  }

  @include edgel-shadow();
}

.masthead-hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* This container uses absolute positioning for the overlay, rather than flex and margins, to be consistent with the ratio setting of the hero image */
.container-branding {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

/* Branding image has a top line */
.masthead-branding {
  @include edgel-topline(4px);
  @include edgel-shadow();
  @include edgel-scale(max-height, 81px, 245px); // 241px + 4px topline
  //object-fit: contain;
  //object-position: top right;
  @include edgel-scale(max-width, 131px, 241px);
  float: right;
}

/* Title block */
.masthead-title {
  @include edgel-container();
  @include edgel-scale(min-height, 70px, 120px);
  @include edgel-scale(padding-top, 12px, 41px);
  @include edgel-scale(padding-bottom, 9px, 36px);
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;

  h1,
  h2,
  .h1,
  .h2 {
    padding-bottom: 0;
    margin-bottom: 0;
    font-family: $font-family-serif;
    font-weight: $font-weight-normal;
    color: $brand-bg-text;
  }
  h1,
  .h1 {
    @include rfs(2.75rem);
    font-style: normal;
    line-height: 1;
    text-transform: uppercase;
    border-bottom: none;
  }
  h2,
  .h2 {
    @include rfs(2.4rem);
    @include edgel-scale(margin-bottom, 4px, 8px);
    font-style: italic;
  }

  a,
  a:visited {
    color: $brand-bg-text;
  }
}
