@import '../../_global/styles/mixins';
@import '../../_global/styles/vars';

.teaser {
  --hero-background: var(--theme-color-white);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  font-size: var(--font-size-small);

  &::before {
    content: '';
    @include full-size;
    margin: -6px;
    border-radius: var(--border-radius-xs);
    transition: 0.2s ease;
  }

  &:focus {
    outline: none;
  }
  &.focus-visible:focus::before {
    @include focus-standalone;
  }
  &:focus-visible::before, &.-moz-focusring::before {
    @include focus-standalone;
  }

  &.text {
    margin-bottom: 0;
  }

  .image-box {
    position: relative;
    display: block;
    border-radius: var(--border-radius-xs);
    background-color: var(--theme-color-primary-dimmed-04);
    overflow: hidden;
    flex-grow: 0;
    flex-shrink: 0;

    &::before {
      content: "";
      position: relative;
      display: block;
      padding-top: 66.6667%;
      margin-bottom: 7px;
    }

    &::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      display: block;
      height: 8px;
      background-color: var(--theme-color-secondary);
      transition: 0.3s ease;
      z-index: 1;
      border-bottom-right-radius: 4px;
      border-bottom-left-radius: 4px;
    }

    &.chart {
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(130deg, var(--theme-color-gradient-01) 10%, var(--theme-color-gradient-02) 90%, var(--theme-color-gradient-03) 160%);
    }
  }

  img {
    position: absolute;
    top: 0;
    left: 0;
    max-width: 100%;
    width: 100%;
    height: calc(100% - 7px);
    object-fit: cover;
    opacity: 1;
    transition: 0.3s linear;

    &.loading {
      opacity: 0;
    }
  }

  .copyright {
    @include copyright;
  }

  .chart-title {
    @include h3;
    display: block;
    font-weight: 700 !important;
    padding: 30px;
    margin: 0 0 0.4em;
    color: var(--theme-color-background) !important;
    text-decoration-color: transparent !important;
    text-align: center;

    @media(max-width: 999px) {
      font-size: 28px;
      margin-bottom: 0;
      padding: 20px;
    }
  }

  .kicker + .text-box {
    margin-top: 0.1em;
    border-top: 8px solid var(--theme-color-secondary);
  }

  .text-box {
    position: relative;

    &:not(:last-child) {
      padding-bottom: 20px;

      > *:last-child {
        margin-bottom: 0;

        &::after {
          content: '';
          position: relative;
          float: right;
          height: 0.75em;
          display: inline-block;
          width: 150px;
        }
      }
    }
  }

  .title {
    text-decoration: underline;
    text-underline-offset: 0.07em;
    text-decoration-thickness: 0.08em;
    margin: 0.5em 0;
  }

  &:hover {
    .image-box::after {
      height: var(--border-width-hover);
    }
  }
}

[date-type='hero'], .teaser.hero {
  .image-box ~ .text-box {
    padding-top: 0.9em;

    .title {
      position: absolute;
      bottom: 100%;
      z-index: 1;
      background-color: var(--hero-background);
      margin-right: 40px;
      padding-top: 0.4em;
      padding-right: 0.8em;
      margin-bottom: -0.05em;
    }
  }
}

.col.extern, .col.download, .col.intranet, .col.extranet,
.teaser.extern, .teaser.download, .teaser.intranet, .teaser.extranet {
  &:before {
    display: none;
  }

  .title:after {
    @include icon-small-stern;
    font-family: 'Icons', sans-serif;
    position: relative;
    font-size: var(--icon-size-small);
    line-height: 1;
    text-decoration: none;
    display: inline-block;
    vertical-align: top;
    margin-left: 0.2em;
  }
}

.col.extern .title:after,
.teaser.extern .title:after {
  @include icon-small-link-external;
}

.col.download .title:after,
.teaser.download .title:after {
  @include icon-small-download;
}

.col.intranet .title:after,
.teaser.intranet .title:after {
  @include icon-small-schloss;
}

@media(min-width: 568px) {
  [date-type='fullwidth'], .teaser.fullwidth {
    display: block;

    &::after {
      content: '';
      display: block;
      clear: both;
    }

    .title {
      @include h2;
      margin-top: 0.25em;
    }

    .image-box {
      float: left;
    }

    .kicker, .text-box {
      float: right;
    }

    &[data-image-size='small'] {
      .copyright {
        width: 100%;
      }

      .image-box::before {
        padding-top: 100%;
      }
    }

    &[data-image-size='large'] {
      .copyright {
        width: 55%;
      }

      .image-box::before {
        padding-top: 55%;
      }
    }

    @media(max-width: 999px) {
      .kicker, .text-box, .image-box {
        width: calc(50% - var(--col-padding));
      }
    }

    @media(min-width: 1000px) {
      &[data-image-size='small'] {
        .image-box {
          width: calc((100% + var(--col-padding) * 2) / 12 * 5 - var(--col-padding) * 2);
        }

        .kicker, .text-box {
          width: calc((100% + var(--col-padding) * 2) / 12 * 7 - var(--col-padding) * 2);
        }
      }

      &[data-image-size='medium'] {
        .image-box, .kicker, .text-box {
          width: calc(50% - var(--col-padding));
        }
      }

      &[data-image-size='large'] {
        .image-box {
          width: calc((100% + var(--col-padding) * 2) * 2 / 3 - var(--col-padding) * 2);
        }

        .kicker, .text-box {
          width: calc((100% + var(--col-padding) * 2) / 3 - var(--col-padding) * 2);
        }
      }
    }
  }
}

[data-background='lightblue'] .teaser {
  --hero-background: var(--theme-color-primary-dimmed-04);

  .image-box {
    background-color: rgba(#fff, 0.4);
  }
}