@use '../../_global/styles/mixins' as *;
@use '../../_global/styles/vars' as *;

section.marketingheader {
  margin-top: 0;

  &.miniinfoteaser {
    .kicker {
      //color: var(--swatches-secondary-500);
    }

    .mini-teaser {
      .category {
        color: var(--color-decoration);
      }
    }

    .text-only .kicker {
      //color: var(--swatches-neutrals-white);
    }
  }

  .rotation {
    .slider {
      @media(min-width: 1000px) {
        height: 100%;
        .slide-overflow {
          height: 100% !important;
        }
        .slide-wrapper, .slide, .outer {
          height: 100%;
        }
      }

      .outer {
        @media(max-width: 999px) {
          max-height: none;
          height: auto;
        }
      }

      .image-box {
        picture {
          width: 100%;
          @media(max-width: 999px) {
            position: static;
            left: auto;
            top: auto;
          }
        }
      }

      .copyright {
        @media(max-width: 999px) {
          left: calc(100% - 30px);
        }
        @media(max-width: 767px) {
          left: calc(100% - 20px);
        }
      }
    }
  }

  .text-box {
    .btn.has-icon.icon-small-arrow-right-simple {
      bottom: auto;
    }
  }

  .search {
    position: relative;
    overflow: hidden;
    margin: 0;
    background-color: var(--color-background);
    height: 100px;
    transition: all .6s ease-in-out;
    background-size: cover;
    @media (max-width: 767px) {
      max-height: 78px;
    }

    .artwork-left .foreground,
    .artwork-left .background,
    .artwork-left + .artwork .foreground,
    .artwork-left + .artwork .background {
      height: 100%;
      min-height: 437px;
    }

    .sc.container {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      width: 100%;
      max-width: 100%;
      @media (max-width: 767px) {
        top: auto;
        bottom: 0;
        .close-search {
          position: relative !important;
          right: 0 !important;
          top: 0 !important;
          float: right;
          margin-bottom: 15px;
        }
      }

      .close-search {
        display: none;
        position: absolute;
        right: 30px;
        top: 33px;
        left: auto;
        cursor: pointer;
        transition: 0.3s ease;
        border: 1px solid var(--color-surface-inset);
        border-radius: 10px;
        height: 34px;
        width: 34px;
        background-color: var(--color-button-primary-background);
        @include focus-visible;
        z-index: 2;

        &:before, &:after {
          content: "";
          position: absolute;
          top: 50%;
          left: 50%;
          width: 17px;
          height: 1.5px;
          border-radius: 2px;
          background-color: var(--color-button-primary-text);
          transform: translate(-50%, -50%) rotate(45deg);
          transition: 0.3s ease;
        }

        &:after {
          transform: translate(-50%, -50%) rotate(-45deg);
        }
      }
    }

    &.open {
      height: 390px;
      @media (max-width: 767px) {
        height: 385px;
        max-height: 385px;
      }
      @media (max-width: 567px) {
        height: 509px;
        max-height: 509px;
      }

      &.has-button-wrapper {
        height: 460px;
        @media (max-width: 767px) {
          height: 395px;
          max-height: 395px;
        }
        @media (max-width: 567px) {
          height: 519px;
          max-height: 519px;
        }
      }

      .close-search {
        display: block !important;
      }

      .tiles {
        top: 0;
        padding-bottom: 9px;
        @media screen and (max-width: 767px) {
          padding-bottom: 0;
        }
      }

      .all-button-wrapper {
        top: 0;
      }

      form {
        max-width: 580px;
      }
    }

    form {
      border-radius: 24px;
      box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.25) !important;
      overflow: hidden;
      font-size: 22px;
      max-width: 360px;
      margin: 20px auto !important;
      transition: 0.3s ease;
      @media(max-width: 767px) {
        font-size: 18px;
        margin: 15px auto !important;
        border-radius: 18px;
      }
      @media(max-width: 399px) {
        max-width: 250px;
      }
    }

    + section, + #toclist > section:first-child {
      @media(min-width: 768px) {
        margin-top: 0;
      }
    }

    input#search-term {
      border-color: var(--swatches-neutrals-white) !important;
      height: 60px;
      border-top-left-radius: 24px;
      border-bottom-left-radius: 24px;
      font-size: 22px;
      @media(max-width: 767px) {
        font-size: 18px;
        height: 48px;
        border-top-left-radius: 18px;
        border-bottom-left-radius: 18px;
      }

      &::placeholder {
        color: var(--color-text) !important;
      }
    }

    button.search-submit {
      background-color: var(--color-button-primary-background) !important;
      color: var(--color-button-primary-text);
      border-radius: 0 !important;
      height: 60px;
      width: 60px;
      font-size: 22px;
      @media(max-width: 767px) {
        font-size: 18px;
        height: 48px;
        width: 48px;
      }

      &:before {
        width: 30px;
        height: 30px;
        font-size: 30px;
        @media(max-width: 767px) {
          width: 24px;
          height: 24px;
          font-size: 24px;
        }
      }
    }

    .container {
      position: relative;
      z-index: 1;

      .row {
        @media(max-width: 567px) {
          min-height: 0;
        }

        > .col {
          margin-top: 0;
          padding-top: 0;
          padding-bottom: 0;
        }
      }
    }

    .artwork {
      @media(max-width: 420px) {
        top: 30px;
        right: -20px;
      }
      @media(max-width: 340px) {
        top: 40px;
        right: -30px;
      }

    }

    form {
      position: relative;
      margin: 0 0 16px;

      @media(max-width: 567px) {
        margin-top: 20px;
      }
    }

    h1 {
      margin-left: 0;
      margin-top: 0;

      @media(max-width: 567px) {
        font-size: 24px;
        margin: 0;
      }
    }

    .tiles {
      margin: 0 -8px 0 -8px;
      position: relative;
      top: 100px;
      display: flex;
      flex-wrap: wrap;
      font-family: "Korb", sans-serif;
      transition: all 0.3s ease-in;
      padding-bottom: 0;

      .tile {
        position: relative;
        display: flex;
        padding: 8px;
        flex: 1 1 33.3333%;
        max-width: 33.3333%;
        margin-top: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 16px !important;

        &::before {
          position: absolute;
          top: 8px;
          right: 8px;
          margin: 10px 8px;
          font-family: Icons, sans-serif;
          font-size: 18px;
          line-height: 1;
          text-align: center;
          pointer-events: none;
          z-index: 1;
        }

        &[data-type="download"]::before {
          @include icon-small-download;
        }

        &[data-type="external"]::before {
          @include icon-small-link-external;
        }

        @media(max-width: 567px) {
          flex: 1 1 50%;
          max-width: 50%;
        }

        &:nth-child(3) ~ .tile {
          z-index: 1;
        }

        &.downloads, &.a-z, &.events {
          order: 1;
          background-color: transparent;

          &::before {
            font-family: "Icons", sans-serif;
            position: absolute;
            font-size: 24px;
            line-height: 1;
            right: 0;
            top: 0;
            margin: 11px 10px;
            z-index: 1;
            background-color: var(--color-background);
            padding: 7px 6px 5px;
            border-top-right-radius: 8px;
            border-bottom-left-radius: 8px;

            @media(max-width: 767px) {
              margin: 18px;
              font-size: 24px;
            }
          }

          .outer {
            background-color: var(--color-surface-inset);
          }

          p {
            margin-bottom: 0.4em;
          }
        }

        &.downloads::before {
          @include icon-suche-datei;
        }

        &.a-z::before {
          @include icon-suche-az;
        }

        &.events::before {
          @include icon-suche-veranstaltung;
        }
      }

      .tile > a, .outer {
        position: relative;
        display: flex;
        align-items: flex-end;
        width: 100%;
        height: 108px;
        max-height: 108px;
        padding: 10px 24px 18px 24px;
        border-radius: var(--border-radius-md);
        box-shadow: 0 4px 20px -5px rgba(#000, 0.25);
        transition: 0.25s ease;
        line-height: 1.2;
        background-color: var(--color-background);
        overflow: hidden;
        @include focus-visible();

        @media(max-width: 767px) {
          font-size: 16px;
          padding: 10px 10px 15px;
          min-height: 84px;
        }

        &:before {
          content: "";
          position: absolute;
          display: block;
          bottom: 0;
          left: 0;
          right: 0;
          height: var(--border-width);
          background-color: var(--color-decoration);
          transition: 0.25s $easeOutQuad;
        }

        &:hover {
          color: var(--color-text-accent);

          &:before {
            height: var(--border-width-hover);
          }
        }
      }

      .tile > a {
        .item-title {
          text-decoration: underline;
        }
      }

      .outer {
        background-color: var(--color-surface-inset);
        padding: 14px 20px 18px;
        border: 4px solid var(--color-background);

        &::after, &::before {
          display: none;
        }
      }

      .inner {
        display: block;
        max-width: 100%;
      }

      .kicker {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 100%;
        display: block;
        text-decoration: none;
      }

      ul {
        list-style: none;
        padding: 0;
        font-size: 16px;
        max-width: 100%;
        margin: 0;

        li {
          margin-top: 5px;
        }

        a {
          display: block;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          transition: 0.2s ease;
          font-weight: 500;

          &:hover {
            color: var(--color-text-accent);
          }
        }
      }

      .proposals {
        flex: 1 1 100%;
        padding: 10px 12px 0;
        order: 2;

        a {
          margin: 0 0.3em 0 0.1em;
        }

        p {
          margin-bottom: 0;
        }
      }

      .all-button-wrapper {
        padding: 16px 8px;
        display: block;
        flex: 1 1 100%;
        order: 3;

        .btn {
          transition: 0.2s ease;

          .count {
            margin-left: 0.3em;

            &::before {
              content: '(';
            }

            &::after {
              content: ')';
            }
          }
        }
      }
    }

    &.background-image {
      &:after {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        z-index: 0;
        content: "";
        opacity: 0.6;
        background: linear-gradient(87deg, #036 12.55%, rgba(1, 40, 81, 0.86) 56.52%, rgba(0, 51, 102, 0.00) 94.05%);
        background-blend-mode: overlay;
      }

      .artwork-wrapper {
        display: none;
      }
    }

    &.picto-image {
      background-position: 50% 0;
      background-size: auto 100%;
      background-repeat: repeat-x;
      @media (max-width: 767px) {
        background-size: auto 78px;
      }

      .artwork-wrapper {
        display: none;
      }
    }

    .all-button-wrapper {
      display: block;
      padding-top: 10px;
      position: relative;
      top: 100px;
      transition: all 0.3s ease-in;
    }
  }

  &.infoteaser {
    border-radius: 4px;

    .slide-overflow {
      border-radius: 4px;
    }

    .outer {
      @media(max-width: 999px) {
        max-height: none;
        height: auto;
      }
    }

    .rotation {
      padding: 0;
      @media screen and (max-width: 999px) {
        .slide:not(.text-only) .text-box {
          //padding: 16px 0;
        }
        .slide .image-box :not(.context-box--image) img {
          position: static;
          height: 300px;
        }
        .slider-tabs {
          top: 0;
          height: auto;
          bottom: auto;
          margin-top: 15px;
        }
      }
      @media screen and (max-width: 999px) {
        .slider .image-box {
          padding-left: var(--container-padding);
          padding-right: var(--container-padding);
        }
        .slider .text-box:first-child::after {
          display: none;
        }
      }

      .text-box {
        min-height: 0;
      }
    }

    .outer {
      border-radius: 4px;

      .image-box picture img {
        border-radius: 4px;
      }
    }

    .image-box {
      @media(min-width: 1000px) {
        min-height: 427px;
        height: 100%;
      }

      picture {
        @media(min-width: 1000px) {
          min-height: 427px;
          height: 100%;
        }
        img {
          object-position: right;
          @media(min-width: 1000px) {
            min-height: 427px;
            height: 100%;
          }
        }
      }
    }

    .mainstage {
      @media screen and (max-width: 999px) {
        padding: 14px 0 0 0;
      }
      @media screen and (max-width: 767px) {
        padding-top: 4px;
      }

      .row {
        margin: 16px 0;
        @media screen and (min-width: 1000px) {
          margin: 30px -8px 0;
        }

        .col {
          flex: 1 1 100%;
          max-width: 100%;

          @media screen and (min-width: 1000px) {
            padding: 0 8px;
            flex: 1 1 calc(100% - 322px);
            max-width: calc(100% - 322px);
          }

          + .col {
            flex: 1 1 100%;
            max-width: 100%;
            display: flex;
            flex-flow: column;
            justify-content: space-between;
            margin: 0;
            padding: 0 var(--container-padding);
            @media screen and (min-width: 1000px) {
              flex: 1 1 322px;
              max-width: 322px;
              padding: 0 8px;
              margin: -8px 0;
            }

            .mt {
              height: 100%;
              padding: 8px 0;
              @media screen and (max-width: 575px) {
                padding: 4px 0;
              }

              .mini-teaser {
                height: 100%;

                .text-box {
                  height: 100%;
                  flex-flow: column;
                  justify-content: space-between;

                  .btn {
                    height: fit-content;
                  }
                }
              }
            }
          }
        }
      }
    }

  }

  &.hero-fullwidth {
    .mainstage.container {
      /*max-width: 1920px;*/
      width: 100%;
      padding: 30px 0 0 0;
      @media (max-width: 767px) {
        padding-top: 20px;
      }

      > .row {
        margin: 0;
      }
    }

    .rotation {
      margin: 0 !important;
      padding: 0 !important;
      width: 100%;

      .outer {
        margin: 0 !important;
        position: relative;
        justify-content: center;
        @media (min-width: 1000px) {
          max-height: 566px;
        }
      }

      .copyright {
        left: 100%;
      }

      .slide-wrapper,
      .slide,
      .outer {
        height: 100%;
      }

      .slider {
        background-color: transparent;

        .image-box {
          &:before {
            display: none;
          }
          :not(.context-box--image) img {
            @media (max-width: 999px) {
              min-height: calc(18vw + 300px) !important;
            }
          }
          .context-box {
            right: 0;
            @media (max-width: 999px) {
              top: 72px;
            }
            @media (max-width: 767px) {
              top: 64px;
            }
          }
        }

        .slide:not(.text-only) .image-box {
          @media (max-width: 999px) {
            margin: 0 30px;
            width: auto;
            height: auto;
            &:after {
              border-radius: 4px;
            }
            picture img {
              border-radius: 4px;
              min-height: auto !important;
            }
          }
          @media (max-width: 767px) {
            margin: 0 20px;
          }
        }

        .controls {
          right: 35px;
        }

        .slide.text-only {
          .image-box {
            &:after {
              display: none;
            }
          }
          @media (min-width: 1000px) {
            .text-box {
              display: flex;
              height: auto;
              min-height: auto;
              top: 50%;
              transform: translate(0,-50%);
            }
          }
          @media (min-width: 1000px) {
            .text-in-image-box {
              p {
                display: none;
              }
            }
          }

          @media (min-width: 1000px) {
            .image-box:has(.icon) ~ .text-box {
              padding-left: 176px;
            }
            .image-box {
              .text-in-image-box {
                width: auto;
                left: 36px;
                transform: translate(0, -50%);
                margin-top: 36px;
                @media (min-width: 1230px) {
                  left: 50%;
                  margin-left: -580px;
                }
                @media (min-width: 1340px) {
                  margin-left: -695px;
                }
                @media (min-width: 1340px) {
                  margin-left: -47.5vw;
                }
                @media (min-width: 1460px) {
                  margin-left: -695px;
                }
              }
              .icon {
                width: 120px;
                height: 120px;
                &:before {
                  font-size: 120px;
                }
              }
            }
          }
        }

        .slide.text-only.current {
          //background: linear-gradient(-10deg, var(--theme-color-gradient-01) 10%, var(--theme-color-gradient-02) 55%, var(--theme-color-gradient-03) 90%);
        }

        .slide-overflow {
          height: 100% !important;
        }
      }
    }


    .image-box {
      width: 100%;
      flex: 1 1 100%;
      max-width: 100%;
      position: relative;
      padding-right: 0 !important;
      @media (min-width: 1000px) {
        max-height: 566px;
      }

      &:after {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
        z-index: 0;
        content: "";
        opacity: 0.6;
        background: linear-gradient(87deg, #036 12.55%, rgba(1, 40, 81, 0.86) 56.52%, rgba(0, 51, 102, 0.00) 94.05%);
        background-blend-mode: overlay;

        &:before {
          display: none;
        }
      }

      picture {
        position: static;
      }

      :not(.context-box--image) img {
        object-fit: cover;
        z-index: -1;
        left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        position: static;
      }
    }

    .text-box {
      height: 100%;
      width: var(--container-width);
      max-width: 100%;
      margin: 0 auto;
      @media (min-width: 1000px) {
        position: absolute;

        * {
          color: var(--color-text);
        }
      }

      .btn {
        @media (min-width: 1000px) {
          background-color: var(--color-button-primary-background) !important;
          color: var(--color-button-primary-text) !important;
        }

        &:hover:after {
          box-shadow: 0 0 0 var(--button-hover-shadow-size) var(--color-button-primary-background) !important;
        }
      }

      * {
        max-width: 580px;
      }

      &:after {
        display: none;
      }

      &:before {
        display: none;
      }
    }

    .slide.text-only {
      //@media screen and (max-width: 900px) {
      //  padding: 16px var(--container-padding) 0;
      //}
      //
      //.text-box {
      //  width: auto;
      //  @media (max-width: 999px) {
      //    min-height: calc(18vw + 300px) !important;
      //  }
      //  @media screen and (max-width: 900px) {
      //    padding-left: 0;
      //    padding-right: 0;
      //  }
      //}
    }

    .controls {
      width: var(--container-width);
      padding: 0 var(--container-padding);
      max-width: 100%;
      margin: 0 auto;
      position: relative;

      .slider-tabs {
        right: -10px;
      }
    }
  }

  .rotation .slider {
    border-bottom: 0;

    background-color: var(--swatches-neutrals-white);

    h3, .like-h2 {
      margin-top: 4px;
      margin-bottom: 8px;
      line-height: 1.1;
    }

    .kicker {
      margin-bottom: 0;
    }

    p {
      margin-bottom: 0.4em;
    }

    .btn {
      margin-top: 0.4em;
    }

    &.ishovered .slider-tabs li.active button.btn::before {
      animation-play-state: paused;
    }

    &.btnanimation {
      .slider-tabs {
        li.active {
          button.btn::before {
            animation: fillgrey 7s linear forwards;
          }
        }
      }
    }

    .slider-tabs {
      li:first-child:last-child {
        display: none;
      }

      li.active {
        button.btn {
          background-blend-mode: overlay;
          overflow: hidden;
        }
      }

      li {
        button.btn {
          position: relative;
          border-radius: var(--border-radius-lg);
        }

        button.btn::before {
          width: 0;
          background-color: var(--swatches-primary-100);
          content: "";
          z-index: 0;
          height: 100%;
          position: absolute;
          top: 0;
          bottom: 0;
          right: 0;
          left: 0;
          display: block;
          background-blend-mode: multiply;
        }
      }
    }

    .slide.text-only.current {
      //background: none;
      //
      //.outer {
      //  background: linear-gradient(-10deg, var(--theme-color-gradient-01) 10%, var(--theme-color-gradient-02) 55%, var(--theme-color-gradient-03) 90%);
      //
      //  .text-box {
      //    justify-content: center;
      //    max-width: 580px;
      //  }
      //}
    }

    .text-box {
      color: var(--swatches-primary-500);
      padding: 30px 20px 24px 20px;
      display: flex;
      flex-flow: column;
      justify-content: center;
      min-width: 324px;
      @media(min-width: 1000px) {
        padding-left: 36px;
        padding-right: 36px;
      }
      @media(max-width: 999px) {
        padding: 16px 30px 24px 30px;
      }
      @media(max-width: 767px) {
        padding-left: 20px;
        padding-right: 20px;
      }

      &:not(:first-child)::before {
        background-color: var(--swatches-primary-100);
      }

      .btn {
        background-color: var(--swatches-primary-500);
        color: var(--swatches-neutrals-white);

        &:hover:after {
          box-shadow: 0 0 0 var(--button-hover-shadow-size) var(--swatches-primary-500);
        }
      }
    }

    .text-only {
      container-type: inline-size;

      .image-box {
        @include gradient;
        @media (max-width: 999px) {
          width: calc(100vw - (2 * var(--container-padding)));
          height: calc((100vw - (2 * var(--container-padding))) * 2 / 3);
          flex: auto;
          margin: 0 auto;
          border-radius: 4px;
        }
        .text-in-image-box {
          position: absolute;
          left: 50%;
          top: 50%;
          width: 80%;
          transform: translate(-50%, -50%);
          color: var(--swatches-neutrals-white);
          text-align: center;
          .icon {
            width: 100px;
            height: 100px;
            overflow: hidden;
            position: relative;
            margin: 0 auto;
            &:before {
              display: block;
              position: absolute;
              left: 0;
              top: 0;
              font-family: "Pictograms",sans-serif;
              color: var(--swatches-neutrals-white);
              font-size: 90px;
              line-height: 1;
            }
          }
          p {
            font-size: 36px;
            line-height: 43.20px;
            @media (max-width: 767px) {
              font-size: 24px;
              line-height: 28.80px;
            }
          }
        }
      }
      .text-box {
        display: block;
        //color: var(--swatches-neutrals-white);
      }
    }
  }

  .rotation {
    margin: 0;
    @media (max-width: 1339px) {
      .rotation .slider .text-box {
        min-width: 324px;
      }
    }
    @media (min-width: 1000px) {
      .slider .text-box:not(:first-child)::before {
        border-top-right-radius: 16% 50% !important;
        border-bottom-right-radius: 16% 50% !important;
        margin: -15% -8% -15% 20px;
      }
    }
    @media (max-width: 999px) {
      .slider {
        background-color: var(--swatches-neutrals-white);


        .text-box:not(:first-child)::before {
          display: none;
        }

        .image-box {
          order: 0;
          height: auto;
          //max-height: none !important;

          :not(.context-box--image) img {
            aspect-ratio: 3 / 2;
            height: auto !important;
            max-height: none !important;
            min-height: 177px !important;
            position: static;
          }

          &:before {
            display: none;
          }
        }
      }
    }
    @media screen and (max-width: 999px) {
      .slider {
        margin-bottom: 20px;

        .slide:not(.text-only) {
          .text-box {
            //padding: 16px var(--container-padding) 0;
          }
        }

        .slide.text-only {
          //padding-left: var(--container-padding);
          //padding-right: var(--container-padding);
        }

        .controls {
          position: absolute;
          right: 26px;
          top: 10px;
          width: auto;
          padding: 0;
          @media screen and (min-width: 768px) {
            right: 36px;
          }
        }

        .slider-tabs {
          position: relative;
          right: auto;
          top: auto;
          padding: 0;
          margin: 0;

          .btn {
            margin-top: 0 !important;
          }
        }
      }
    }
    @media screen and (max-width: 767px) {
      .slider {
        .slide:not(.text-only) .text-box {
          //padding: 16px var(--container-padding);
        }
      }
    }
    @media screen and (max-width: 567px) {
      .slider {
        margin: 0;
        margin-bottom: 8px;
      }
    }

    .image-box .context-box {
      @media screen and (max-width: 999px) {
        top: 74px;
        &.context-box--image {
          right: 30px;
        }
      }
      @media screen and (max-width: 767px) {
        top: 64px;
        &.context-box--image {
          right: 20px;
        }
      }
    }
  }
}

@keyframes fillgrey {
  0% {
    width: 0;
  }
  100% {
    width: 100%
  }
}
