/**
 * Base theme styles
 * This file contains theme base styles.
 *
 * For example:
 * - WYSIWYG styles and layouts
 * - Images and Videos
 * - Tables
 */

html {
  font-size: 16px;

  @media (min-width: $break-large) {
    font-size: 16px;
  }
}

div:focus,
thead:focus {
  outline: 2px solid $color-black;
  outline-offset: 4px;
}

body {
  font-family: $font-acumen;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;

  @include fontsize(16px);
  line-height: 24px;
  font-weight: 400;

  @media (min-width: $break-medium) {
    line-height: 26px;
    font-weight: 500;
  }

  @media (min-width: $break-large) {
    @include fontsize(18px);
    line-height: 29px;

    &.sticky-header {
      display: unset;
    }
  }

  //** Fixed class to prevent scrolling
  &.js-fixed {
    overflow: hidden;
  }
}

html,
body {
  overflow-x: clip;
  scroll-behavior: smooth;

  &.main-menu-active {
    overflow: hidden;
  }
}

// WYSIWYG styles
.wysiwyg {
  @media (min-width: $break-medium) {
    p, h1, h2, h3, h4, h5, h6, ol, ul, form {
      max-width: 690px;
    }
  }
}

// // WYSIWYG styles with sidebar
nav.section-nav + div.container {
  .wysiwyg {
    @media (min-width: $break-large) {
      padding-left: 87px;
      ol, ul {
        padding-left: 100px;
        margin-left: -87px;
      }
    }

    figure.img-inline--full {
      @include is-full-width();
    }
    .vid-inline--full {
      @include is-full-width();
    }
    .quote--full {
      @include is-full-width();
    }
    .table-block__wrapper {
      @include is-full-width();
    }
  }
}

//## Remove margin on last elements
* > {
  p:last-child,
  ul:last-child,
  ol:last-child {
    margin-bottom: 0;
  }
}

//## Visually hidden
.visually-hidden {
  @include element-invisible;
}

//## Skip to content
a.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  color: $color-black;

  &.visually-hidden {
    @include element-focusable;

    &:focus {
      background-color: $color-white;
      padding: 3px 10px;
      position: absolute !important;
      z-index: 10000;
    }
  }
}

//## Floated content
.float-right {
  float: right;
}

.float-left {
  float: left;
}

//## Links
  a {
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
    transition: 300ms ease;
    color: $color-green;
    position: relative;

    &:not(.cta, .alert__cta, .last-word-wrap, .parent-page, .main-menu__link, .logo-link):before {
      content: '';
      position: absolute;
      width: 100%;
      height: 1px;
      left: 0;
      bottom: 2px;
      background-color: $color-green;
      transition: all 300ms ease;
    }

    &:hover {
      color: $color-green-dark;

      &:before {
        background-color: $color-green-dark;
        bottom: -1px;
      }
    }

    &:focus {
      outline: 2px solid $color-black;
      outline-offset: 2px;
    }

    &.cta--button-primary {
      @include cta(primary, dark);
    }

    &.cta--button-secondary {
      @include cta(secondary, light);
    }

    &.cta--button-arrow {
      @include cta-arrow($border-color: $color-green-light, $fill-color: $color-green-light, $font-color: $color-green-dark, $hover-border: $color-green-dark, $hover-fill: $color-green-dark, $hover-font: $color-green-light)
    }
  }

.cta--button-submit {
  @include cta(primary, dark);
}

//## No wrap and last word overrides
a.arrow-icon {
  display: inline-block;
  span.last-word:after {
    content: '';
    position: absolute;
    right: -5px;
    bottom: 3px;
    width: 16px;
    height: 15px;
    background-image: url("data:image/svg+xml,%3Csvg width='30' height='22' viewBox='0 0 30 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.4936 0L30 11.0524L20.4936 22H16.1943L23.9809 12.9905H0V9.0619H23.9809L16.1943 0H20.4936Z' fill='#{str-replace(#{$color-green-light}, '#', '%23')}'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;

    @media (min-width: $break-medium) {
      right: -7px;
      bottom: 2px;
      width: 22px;
      height: 20px;
    }

    @media (min-width: $break-large) {
      right: -15px;
      bottom: 8px;
      width: 24px;
      height: 21px;
    }
  }

  &:hover span.last-word:after {
    background-image: url("data:image/svg+xml,%3Csvg width='30' height='22' viewBox='0 0 30 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.4936 0L30 11.0524L20.4936 22H16.1943L23.9809 12.9905H0V9.0619H23.9809L16.1943 0H20.4936Z' fill='#{str-replace(#{$color-white}, '#', '%23')}'/%3E%3C/svg%3E");
  }
}
a span.last-word {
  white-space: nowrap;
  position: relative;
  padding-right: 25px;
}

//## Main Content
.page-header {
  position: relative;
}
.section-nav {
  @media (min-width: $break-large) {
    max-width: 330px;
    width: 25%;
    margin-top: 1.5rem;
    float: left;
    position: sticky;
    top: 0;

    & + .container {
      width: calc(100% - 25%);
      float: right;
      padding: 0 40px;

      .narrow-block {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100%;
      }
    }
  }

  @media (min-width: $break-x-large) {
    width: 330px;
    
    & + .container {
      padding: 0 80px 0 40px;
      width: calc(100% - 330px);
    }
  }
}

#main {
  position: relative;

  & > .content-wrapper {
    // clearfix for pages with side-nav (prevent collapse of page content)
    &::after {
      content: '';
      display: block;
      width: 100%;
      clear: both;
    }
  }
}

//## Block quote styles
.quote {
  padding: 0;
  margin: 3rem 0;
  @include animate-border($color-blue-dark);

  &.js-active {
    .quote__copy::after {
      opacity: 1;
      transition: all 300ms;
    }
  }

  @media (min-width: $break-large) {
    margin: 5rem 0;
  }

  & > div {
    display: flex;
    flex-direction: column-reverse;
    padding: 20px;

    @media (min-width: $break-medium) {
      padding: 32px;
    }

    @media (min-width: $break-large) {
      padding: 40px 35px;
    }
  }

  &__copy {
    @include fontsize(16px);
    font-weight: 600;
    line-height: 1.40;
    color: $color-blue-dark;

    @media (min-width: $break-medium) {
      @include fontsize(18px);
    }

    @media (min-width: $break-large) {
      @include fontsize(24px);
    }
  }

  &__copy:before {
    display: block;
    content: "";
    width: 30px;
    height: 10px;
    background: white;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;

    @media (min-width: $break-medium) {
      width: 50px;
    }
  }

  &__copy:after {
    display: block;
    content: "";
    background: white;
    border: solid 2px $color-blue-dark;
    border-radius: 100px;
    height: 10px;
    width: 10px;
    position: absolute;
    top: -4px;
    right: -6px;
    z-index: 2;
    opacity: 0;

    @media (min-width: $break-medium) {
      height: 15px;
      width: 15px;
      right: -8px;
    }

    @media (min-width: $break-large) {
      height: 18px;
      width: 18px;
      right: -10px;
      border: solid 3px $color-blue-dark;
    }
  }

  &__footer {
    display: flex;
    margin-bottom: 1rem;
  }

  &__attr {
    font-weight: 600;
    margin-right: 16px;
    position: relative;

    &:after {
      content: '';
      position: absolute;
      top: 0.2em;
      right: -8px;
      width: 1.5px;
      height: 16px;
      background-color: $color-blue-dark;
    }
  }
}

//## Images
img {
  display: block;
  max-width: 100%;
  height: auto;
}

figure {
  margin: 0;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  a {
    color: $color-green-light;

    &:before {
      background-color: $color-green-light !important;
    }

    &:focus {
      @include focus-light();
    }

    &:hover {
      color: $color-white;
      &:before {
        background-color: $color-white;
      }
    }
  }
  img {
    border-radius: 8px;
    position: absolute ;
    min-height: 100%;
  }
  > figcaption {
    position: absolute;
    color: $color-white;
    @include fontsize(14px);
    line-height: 1.313rem;
    font-weight: 500;
    font-style: italic;
    padding: 30px 17px 17px;
    z-index: 2;
    width: 100%;

    &:before {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 200%;
      background: linear-gradient(359.62deg, rgba(0, 0, 0, 0.65) 12.85%, rgba(0, 0, 0, 0) 68.65%);
      z-index: 1;
      border-radius: 8px;
      z-index: -1;
    }

    a {
      color: $color-green-light;
      &:before {
        background-color: $color-green-light;
      }

      &:hover {
        color: $color-white;
        &:before {
          background-color: $color-white !important;
        }
      }
    }
  }
  @media (min-width: $break-medium) {
    &:before {
      background: linear-gradient(0deg, rgba(0, 0, 0, 0.65) 7.57%, rgba(0, 0, 0, 0) 23.28%);
    }
    > figcaption {
      padding: 30px 22px 13px;
    }
    &.img-inline--float {
      > figcaption {
        @include fontsize(16px);
        line-height: 1.5rem;
        padding: 30px 30px 18px;
      }
    }
  }

  @media (min-width: $break-large) {
    > figcaption {
      @include fontsize(16px);
      line-height: 1.5rem;
      padding: 30px 29px 17px;
    }
  }
}

figcaption {
  margin: 0.5rem 0 0;
  font-style: italic;
  font-size: 0.75rem;
  bottom: 0;
}

//## Inline images
.img-inline {
  &--full {
    margin: 2rem 0 3rem;
    position: relative;

    @media (min-width: $break-medium) {
      margin: 3rem 0 4rem;
    }

    @media (min-width: $break-large) {
      margin: 3rem 0 6rem;
    }

    img {
      width: 100%;
    }
  }

  img {
    object-fit: cover;
  }

  &--float {
    margin: 2rem 0 3rem;
    width: 290px;

    @media (min-width: $break-large) {
      width: 320px
    }

    img {
      width: 100%;
    }
    @media (max-width: $break-medium - 1px) {
      display: inline-block;
      float: none;
      width: 100%;
    }

    &.float-right {

      @media (min-width: $break-medium) {
        margin: 0.5rem  0 2rem 2rem;
      }

      @media (min-width: $break-large) {
        margin: 0.5rem  0 3rem 3rem;
      }

      @media (min-width: 1200px) {
        margin-right:  calc(100% - 690px);
      }
    }

    &.float-left {
      @media (min-width: $break-medium) {
        margin: 0.5rem 2rem 2rem 0;
      }

      @media (min-width: $break-large) {
        margin: 0.5rem 3rem 3rem 0;
      }
    }
  }
}

// quote line animation override

.quote.border-animate.js-active:after {
  animation: 0.2s 0s expanddown forwards;
}

.quote.border-animate.js-active > div:before {
  animation: 0.2s 0.2s expandleft forwards;
}

.quote.border-animate.js-active > div:before {
  animation: 0.2s 0.4s expandleft forwards;
}

.quote.border-animate.js-active > div:after {
  animation: 0.2s 0.6s expandup forwards;
}

.quote.border-animate.js-active:before {
  transition: width 0.2s 0.8s ease-out, height 0.02s 0.78s
}

//## Tables
table {
  clear: both;
  max-width: 100%;
  display: block;

  td,
  th {
    text-align: left;
    min-width: 250px;
    padding: 0 20px;
  }

  .table-scroller {
    overflow: auto;
    display: block;
    width: 100%;
  }

  thead {
    position: sticky;
    top: 0;
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
    background-color: $color-white;
    z-index: 100;

    /* Hide scrollbar for Chrome, Safari and Opera */
    &::-webkit-scrollbar {
      display: none;
    }
  }
}

.table-block {
  &__wrapper {
    position: relative;
    padding: 0;
    margin: 0 -20px 30px 0;
    @media (min-width: $break-medium) {
      margin: 30px 0;
      clear: both;
    }
  }
  &__prev,
  &__next {
    font-size: 0;
    line-height: 0;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 46px;
    height: 46px;
    border: none;
    background: none;
    padding: 0;
    &:after {
      content: '\e901';
      display: inline-block;
      vertical-align: top;
      color: $color-red;
      font-family: 'icomoon';
      font-size: 26px;
      line-height: 1;
    }
    &:focus {
      @include focus-dark();
    }
  }
  &__next {
    left: auto;
    right: 0;
    @media (min-width: $break-medium) {
      right: 8px;
    }
  }
  &__prev {
    &:after {
      content: '\e901';
      transform: rotate(180deg);
    }
  }
}

#main {
  max-width: 1800px;
  margin: 0 auto;
}

.homepage #main {
  max-width: inherit;
}