/* -------------------------------- 

File#: _1_banner
Title: Banner
Descr: A CTA banner containing text + media
Usage: codyhouse.co/license

-------------------------------- */

/* reset */
*, *::after, *::before {
  box-sizing: border-box;
}

* {
  font: inherit;
  margin: 0;
  padding: 0;
  border: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: hsl(0, 0%, 100%);
  font-family: system-ui, sans-serif;
  color: hsl(230, 7%, 23%);
  font-size: 1.125rem; /* 18px */
  line-height: 1.4;
}

h1, h2, h3, h4 {
  line-height: 1.2;
  color: hsl(230, 13%, 9%);
  font-weight: 700;
}

h1 {
  font-size: 2.5rem; /* 40px */
}

h2 {
  font-size: 2.125rem; /* 34px */
}

h3 {
  font-size: 1.75rem; /* 28px */
}

h4 {
  font-size: 1.375rem; /* 22px */
}

ol, ul, menu {
  list-style: none;
}

button, input, textarea, select {
  background-color: transparent;
  border-radius: 0;
  color: inherit;
  line-height: inherit;
  -webkit-appearance: none;
          appearance: none;
}

textarea {
  resize: vertical;
  overflow: auto;
  vertical-align: top;
}

a {
  color: hsl(250, 84%, 54%);
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

img, video, svg {
  display: block;
  max-width: 100%;
}

/* -------------------------------- 

Component 

-------------------------------- */

.banner {
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  background-color: hsl(0, 0%, 100%);
  box-shadow: 0 0 0 1px hsla(230, 13%, 9%, 0.05),
              0 0.3px 0.4px hsla(230, 13%, 9%, 0.02),
              0 0.9px 1.5px hsla(230, 13%, 9%, 0.045),
              0 3.5px 6px hsla(230, 13%, 9%, 0.09);
  border-radius: 0.375em;
  transition: 0.3s;
}

.banner__grid {
  display: flex;
  flex-direction: column;
}

.banner__grid > * {
  min-width: 0;
}

.banner__link {
  position: relative;
  text-decoration: none;
  color: hsl(250, 84%, 54%);
  display: inline-block;
  transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform-origin: left bottom;
}

.banner__link i { /* label */
  position: relative;
  z-index: 2;
  display: inline-block;
  transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.banner__link::after { /* animated border */
  content: "";
  background-color: currentColor;
  height: 2px;
  width: 100%;
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  -webkit-clip-path: inset(0% round 0.1875em);
          clip-path: inset(0% round 0.1875em);
  opacity: 0.15;
  transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.banner__figure {
  height: 0;
  width: 100%;
  padding-bottom: 50%;
  transition: 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
}

.banner__text {
  padding: 1.5rem;
}

.banner__link-wrapper {
  margin-top: 1rem;
}

.banner:hover {
  box-shadow: 0 0 0 1px hsla(230, 13%, 9%, 0.05),
              0 0.9px 1.25px hsla(230, 13%, 9%, 0.025),
              0 3px 5px hsla(230, 13%, 9%, 0.05),
              0 12px 20px hsla(230, 13%, 9%, 0.09);
}

.banner:hover .banner__link {
  transform: scale(1.3);
}

.banner:hover .banner__link i { /* reverse parent transformation */
  transform: scale(0.7);
}

.banner:hover .banner__link::after {
  height: 100%;
}

.banner:hover .banner__figure {
  transform: scale(1.05);
}

@media (min-width: 64rem) {
  .banner__grid {
    flex-direction: row-reverse;
  }

  .banner__grid > * {
    width: 50%;
  }

  .banner__figure {
    height: 100%;
    padding-bottom: 0;
    -webkit-clip-path: polygon(100px 0%, 100% 0%, 100% 100%, 50px 100%);
            clip-path: polygon(100px 0%, 100% 0%, 100% 100%, 50px 100%);
  }

  .banner__text {
    padding: 3rem;
  }

  .banner__link-wrapper {
    margin-top: 2rem;
  }

  .banner--invert .banner__grid {
    flex-direction: row;
  }

  .banner--invert .banner__figure {
    -webkit-clip-path: polygon(0% 0%, calc(100% - 100px) 0%, calc(100% - 50px) 100%, 0% 100%);
            clip-path: polygon(0% 0%, calc(100% - 100px) 0%, calc(100% - 50px) 100%, 0% 100%);
  }

  .banner--invert .banner__text {
    text-align: right;
  }

  .banner--invert .banner__link {
    transform-origin: right bottom;
  }

  .banner:hover .banner__figure {
    -webkit-clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
            clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
  }
}