.news-event {
  $component-name: ".news-event";
  $news-event-content-image-margin: -1;
  $news-event-first-image-margin-bottom: 0;
  $news-event-first-image-margin-top: spacing($news-event-content-image-margin, $subtract: -1px, $add: line-height("multiple", $include-calc: false, $times: 4)); //margin above image, + 4 line heights + 1px to make it just above 4 linies otherwise only three lines will wrap
  $news-event-first-image-padding-top: spacing($news-event-content-image-margin, $subtract: -1px, $add: line-height("multiple", $include-calc: false, $times: 4)); //safari bug with shape-outside, we need to use padding-top instead of margin-top on .news-item__image to fix this issue
  $news-event-margin-between-images: 0;
  $news-event-image-caption-margin: -5;
  $news-event-info-box-padding: -1;
  $news-event-info-box-class: ".frame-layout-news-info-box";
  $news-event-image-max-height: 90vh;
  $news-event-floated-element-max-width-on-medium: "50% - #{spacing($news-event-content-image-margin)}";
  $news-event-floated-video-width-on-medium: "#{math.div($line-width-max, 2)} - #{spacing($news-event-content-image-margin)}";
  $news-event-floated-element-max-width-on-wide: "#{$news-event-content-max-width} - #{$line-width-max} - #{spacing($news-event-content-image-margin)}";
  $news-event-floated-element-min-width: "#{$news-event-content-max-width} / 2 - #{$line-width-max} / 2 - #{spacing($news-event-content-image-margin)}";
  $news-event-floated-element-margin-vertical: "#{line-height("multiple", $times: .5)} - #{font-size(0)} * .5";
  $news-event-one-column-gallery-max-width: "#{$news-event-content-max-width} - #{spacing(1, $times: 2)}";
  $news-event-force-min-width: "min(100%, #{$line-width-max})"; //Sass does not understand the css min-function, thinks it is its own min(), so we need to wrap it in a string variable
  $news-event-min-width-one-column-galleries: "min(100%, #{math.div(16rem * $size-rem-delphinus, $typo3-size-rem)})"; //16rem = 256px

  //reset to block, so flexbox order has no effect on wider displays
  //float images
  @mixin floated-images {
    display: block;

    & .news-event__image {
      float: right;
      clear: right;
      width: auto;
      max-width: calc(#{$news-event-content-max-width} - #{$line-width-max} - #{spacing($news-event-content-image-margin)});
      min-width: calc(#{$news-event-floated-element-min-width});
      margin-left: spacing($news-event-content-image-margin);

      &:first-of-type {
        shape-outside: content-box;
        shape-margin: spacing($news-event-content-image-margin);
        padding-top: $news-event-first-image-padding-top; //Safari fix, it should be margin-top, if safari ever fixes its stuff
        margin-bottom: 0;
        background-color: transparent;
        margin-top: 0; //Safari fix, it should be margin-top, if safari ever fixes its stuff
      }

      &:last-of-type {
        margin-bottom: spacing($news-event-content-image-margin);
      }
    }

    & .news-event__content__text {
      margin-left: auto;
      margin-right: auto;
    }
  }

  //prevent hero-image from going edge-to-edge on screen
  @mixin constrain-hero-image {
    img {
      max-width: 100%;
    }

    .news-event__hero-image__video-wrap {
      @include responsive-video;
    }

    figcaption {
      padding-left: 0;
      padding-right: 0;

      & > * {
        margin-right: 0;

        &:first-child {
          margin-right: spacing($news-event-content-image-margin);
        }
      }
    }
  }

  @mixin floated-galleries {
    //we only alow for floating galleries of 1 column
    .ce-gallery[data-ce-columns="1"] {
      min-width: calc(#{$news-event-floated-element-min-width});
      max-width: calc(#{$news-event-floated-element-max-width-on-medium});

      .video {
        width: calc(#{$news-event-floated-video-width-on-medium});
      }
    }

    &.ce-right {
      //we only alow for floating galleries of 1 column
      .ce-gallery[data-ce-columns="1"] {
        float: right;
        margin: calc(#{$news-event-floated-element-margin-vertical}) 0 calc(#{$news-event-floated-element-margin-vertical}) spacing($news-event-content-image-margin);
      }
    }

    &.ce-left {
      .ce-gallery[data-ce-columns="1"] {
        float: left;
        margin: calc(#{$news-event-floated-element-margin-vertical}) spacing($news-event-content-image-margin) calc(#{$news-event-floated-element-margin-vertical}) 0;
      }
    }
  }

  @mixin wide-floated-galleries {
    .ce-gallery[data-ce-columns="1"] {
      max-width: calc(#{$news-event-floated-element-max-width-on-wide});

      .video {
        width: calc(#{$news-event-floated-element-max-width-on-wide});
      }
    }
  }

  @mixin floated-info-box {
    max-height: none; //unconstain the height
    overflow: visible; //show everything

    //box centers by defult with the same width as the text
    margin-left: auto;
    margin-right: auto;
    max-width: $line-width-max;

    //NOTE Because Typo3 is unable to add two classes, left and right classes are not named as modifieres with double dashes, because they also contain all the style for the infobox.
    //float the box left or right
    &-right,
    &-left {
      margin-top: calc(#{$news-event-floated-element-margin-vertical});
      min-width: calc(#{$news-event-floated-element-min-width});
      max-width: calc(#{$news-event-floated-element-max-width-on-medium});
    }

    &-right {
      float: right;
      clear: right;
      margin-left: spacing($news-event-content-image-margin);
    }

    &-left {
      float: left;
      clear: left;
      margin-right: spacing($news-event-content-image-margin);
    }

    //hide the fading gradient, when box is collapsed and remove all the other stuff for collapsing the box.
    &::after {
      content: none;
    }

    &-collapse-wrapper {
      margin-bottom: 0;

      &__toggle {
        display: none;
      }

      &--is-expanded {
        #{$news-event-info-box-class} {
          padding-bottom: spacing($news-event-info-box-padding)
        }
      }
    }
  }

  @mixin wide-floated-info-box {
    max-width: calc(#{$news-event-floated-element-max-width-on-wide});
  }

  @mixin wide-video {
    width: spacing($page-padding-side, $times: -2, $add: 100vw);
  }

  @mixin two-column-galleries {
    //if gallery is set to more than 1 column, always use two columns
    &:not([data-ce-columns="1"]) {
      --num-columns: 2;
    }
  }

  @mixin multi-column-galleries {
    //set the maximum number of columns
    &:not([data-ce-columns="1"]) {
      --num-columns: 4;
    }

    //if less than 4 columns, set the exact number
    @for $i from 1 through 3 {
      &[data-ce-columns="#{$i}"] {
        --num-columns: #{$i};
      }
    }
  }

  //standard "youtube responsive"
  @mixin responsive-video($unit: 1%) {
    position: relative;
    padding-bottom: 56.25 * $unit; /* 16:9 */
    height: 0;
    width: 100 * $unit;

    iframe,
    video {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }
  }

  display: flex;
  flex-direction: column;
  align-items: center;

  blockquote {
    @include content-container; //included since typo3 may add p-tags within blockquotes. This removes any starting or ending margins on elements inside the blockquote
    @include set-font(1, "multiple", $max-width: "default");
    color: color("foreground");

    & p {
      @include set-font(1, "multiple", $max-width: "default");
      color: color("foreground");
    }
  }

  //tables creates by the typo3 editor gets class .contenttable, thank you typo3 :)
  .contenttable {
    //TODO: .table isn't fully extendable due to the use a sass-variable containing the class name. The basics are extened though. !optional prevents an error to be shown when file is compiled.
    @extend .table !optional;
  }

  a:not(.button) {
    @extend .a--text-link;
  }

  pre {
    @include content-container;
    white-space: normal;
  }

  img {
    //restrict hieght of images to a a percentage of the viewport hieght in order to prevent images for becoming too heigh on small screens.
    max-height: $news-event-image-max-height;
    width: auto !important;
  }

  &__header {
    @include content-container;
    margin-bottom: spacing(0);
    width: 100%;
    max-width: calc(#{$news-event-content-max-width});

    h1 {
      @include set-font($typography-h1-fontsize, "single", $weight: "bold", $max-width: $typography-h1-fontsize - 1);
    }

    //actually this is a little bit of a cheat, as it will allow the line to become wider than the prefered 35em for legiabillity. But alas, this time alignment wins. Also the with does not go the the full extend of the fontsize 2 width, as the news has a general width constrain that is less wide
    .text--intro {
      @include max-line-width($typography-h1-fontsize - 1);
    }
  }

  &__hero-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: spacing($news-event-first-image-margin-bottom);

    figure {
      $min-width: "min(100%, calc(#{$news-event-content-max-width}))";
      min-width: #{$min-width};
      //add background behind hero image
      background-image: linear-gradient(color("background-secondary"), color("background-secondary"));
      background-repeat: no-repeat;
      //limit the background behind the image to be no wider than the header - i.e. only show when using an image narrower than the header
      background-size: calc(#{$news-event-content-max-width}) 100%;
      background-position: center center;

      img {
        max-width: 100vw;

        //crop the hero image on the sides, so it is at least 16:9 ratio, reset to follow image dimension in medium breakpoint
        min-height: 56.25vw; //16:9
        object-fit: cover;
        object-position: center center;

        @include breakpoint("medium") {
          min-height: 0;
          //contrain the hero image from becoming heigher than af 3:2 ratio or 90% of the viewport height
          max-height: #{"min(#{$news-event-image-max-height}, calc(#{$news-event-content-max-width} * (2/3)))"};
        }
      }

      & figcaption {
        width: 0px;
        min-width: 100%;

        padding-left: spacing($page-padding-side);
        padding-right: spacing($page-padding-side, $subtract: spacing($news-event-content-image-margin));

        & > * {
          margin-right: spacing($news-event-content-image-margin);
        }
      }

      .layout14 &,
      .layout15 &,
      .layout17 & {
        @include breakpoint("medium") {
          @include constrain-hero-image;
        }
      }

      @include breakpoint("max-width") {
        @include constrain-hero-image;
      }

      //prevent hero image from bleeding over the edges of the page when nearing the max-width of the page.
      .universe.layout16 &,
      .aarhus-bss.layout16 &,
      .omnibus.layout16 &, .omnibus.layout24 &, .layout24 & {
        @media (min-width: #{$typo3-framed-sites-max-width * (math.div($typo3-size-rem, $size-rem-delphinus))}) {
          @include constrain-hero-image;
        }
      }
    }

    //when hero image is present move all other images below the text on mobile
    & + .news-event__content .news-event__image:first-of-type {
      order: unset;
      margin-bottom: 0;
      margin-top: spacing($news-event-margin-between-images);
    }

    &__video-wrap {
      @include responsive-video(1vw);
    }
  }

  .text--byline {
    order: -2;
    margin-top: 0;
    width: 100%;
    padding-left: calc((100% - #{math.div($line-width-max, 1em)}  * #{font-size(0)}) / 2);
    padding-right: calc((100% - #{math.div($line-width-max, 1em)}  * #{font-size(0)}) / 2);
  }

  &__content {
    @include content-container;
    display: flex; //used to control order of stuff on mobile
    flex-direction: column;
    align-items: center; //center align images shown below text on mobile
    max-width: calc(#{$news-event-content-max-width});
    width: 100%;

    h1
    h2,
    h3,
    h4,
    blockquote {
      //magic trick for avoiding orphans when an image is floated arround text
      overflow: hidden;
    }

    h5,
    h6 {
      @extend h4;
    }

    &__text {
      @include content-container;
      max-width: $line-width-max; //constrain width so headers can't be wider than p-tags
      order: -1; //move text before images on mobile

      & > a {
        margin: spacing(-1) 0;
      }
    }

    .news-event__image {
      //move the first image before the text on mobile
      &:first-of-type {
        order: -4;
        margin-bottom: spacing($news-event-first-image-margin-bottom);
        background-color: color("background-secondary");
        width: 100%;
      }

      & figcaption {
        flex-direction: column;
      }
    }

    .layout14 & {
      @include breakpoint("max-width") {
        @include floated-images;
      }
    }

    .layout15 &,
    .layout17 & {
      @include breakpoint("wide") {
        @include floated-images;
      }
    }

    .layout16 &, .layout24 & {
      @include breakpoint("medium") {
        @include floated-images;
      }
    }
  }

  &__image {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: color("foreground-secondary");
    margin: 0; //reset browser default margin on figure
    min-width: calc(#{$news-event-min-width-one-column-galleries});

    // //add a background behind the image, that shows when the image is narrower than the figuge container
    // background-image: linear-gradient(color("background-secondary"), color("background-secondary"));
    // background-repeat: no-repeat;

    figcaption {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      justify-content: space-between;
      width: 0px;
      min-width: 100%;
      max-width: calc(#{$news-event-content-max-width});
      padding-top: spacing(-3, $subtract: spacing($news-event-image-caption-margin));
      background-color: color("background");
    }

    &__caption {
      margin-top: spacing($news-event-image-caption-margin);
      @include set-font(-1, "single", $max-width: "default");
    }

    &__credits {
      display: block;
      margin-top: spacing($news-event-image-caption-margin);
      @include set-font(-1, "single", $max-width: "default");
    }

    & + .news-event__image {
      margin-top: spacing($news-event-margin-between-images);
    }
  }

  &__info {
    @include content-container;
    padding: spacing(-1);
    order: -3;
    margin-bottom: spacing($news-event-first-image-margin-bottom);

    display: flex;
    flex-wrap: wrap;

    &__item {
      margin-bottom: spacing(-2);
      margin-right: spacing(0);

      &:first-of-type,
      &:last-of-type {
        margin-right: 0;
      }

      &__header {
        margin-top: 0;
      }

      &__content {
        line-height: line-height("single");
        p {
          margin: 0;
          line-height: line-height("single");
        }
      }

      &--time {
        width: 100%;
        margin-bottom: spacing(-1);

        & .news-event__info__item__content {
          @include set-font(1, "single");
        }

        & + .news-event__info__signup {
          margin-top: 0;
        }
      }

      &--start-end {
        display: flex;
        flex-wrap: wrap;
        margin-bottom: 0;
        margin-left: spacing(-1, $times: -0.5);
        margin-right: spacing(-1, $times: -0.5);

        & > * {
          margin-left: spacing(-1, $times: .5);
          margin-right: spacing(-1, $times: .5);
          margin-bottom: spacing(-1);
        }
      }
    }

    &__signup {
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      width: 100%;
      margin-top: spacing(0, $subtract: spacing(-2));

      .button {
        margin-right: spacing(-2);
      }

      &__registration {
        margin-top: spacing(-4);
        line-height: line-height("single");
        color: color("foreground-secondary");
      }
    }
  }

  //highlight bold links, italic as "Læs også"-links
  &__content-elements,
  &__content__text {
    $spacing-icon: -3;

    p:has(a > em > strong) {
      padding-left: spacing($spacing-icon, $add: line-height("multiple", $include-calc: false));
    }
    a > em > strong {
      all: inherit; 
      font-style: normal;
      position: relative;
      font-weight: $font-weight-normal;


        &::before {
          content: "Læs også:";
          display: inline-block;
          height: line-height("multiple");
          font-weight: $font-weight-bold;
          @include set-colors("background");
          text-shadow: none;
          border-right: .3em solid color("background");

          html:not([lang*="da"]) & {
            content: "Related story:";
          }
        }

        @include icon-style($position: "after") {
          @include set-icon("next");
          display: block;
          position: absolute;
          top: -0.25em;
          left: spacing($spacing-icon, $times: -1, $subtract: line-height("multiple", $include-calc: false));
          @include set-colors("theme");
          width: line-height("multiple");
          height: line-height("multiple");
          border-radius: 50%;
          text-align: center;
          z-index: $z-index-just-above-static;
          text-shadow: none;
        }
    }

    strong > em,
    em > strong {
      display: block;
      font-style: normal;
      padding-left: spacing($spacing-icon, $add: line-height("multiple", $include-calc: false));

      > a {
        position: relative;
        left: spacing($spacing-icon, $times: -1, $subtract: line-height("multiple", $include-calc: false));
        font-weight: $font-weight-normal;
        border-left: spacing($spacing-icon, $add: line-height("multiple", $include-calc: false)) solid color("background");

        &:hover {
          &::before {
            color: color("foreground-theme");
          }

          &::after {
            background-color: color("theme-hover");
          }
        }

        &::before {
          content: "Læs også:";
          display: inline-block;
          height: line-height("multiple");
          font-weight: $font-weight-bold;
          @include set-colors("background");
          text-shadow: none;
          border-right: .3em solid color("background");

          html:not([lang*="da"]) & {
            content: "Related story:";
          }
        }

        @include icon-style($position: "after") {
          @include set-icon("next");
          display: block;
          position: absolute;
          top: -0.25em; //tried to calculate as: top: calc((#{line-height("multiple", $include-calc: false)} - #{font-size(0)}) * -0.5); but didn't align well for Passata font. This number works for Passata. Overwriting with other value for font used in omnibus at the bottom of this file.
          left: spacing($spacing-icon, $times: -1, $subtract: line-height("multiple", $include-calc: false));
          @include set-colors("theme");
          width: line-height("multiple");
          height: line-height("multiple");
          border-radius: 50%;
          text-align: center;
          z-index: $z-index-just-above-static;
          text-shadow: none;
        }
      }
    }
  }

  //CONTENT ELEMENTS
  &__content-elements {
    width: 100%;
    max-width: calc(#{$news-event-content-max-width});

    //center align stuff in text frames and bodytext that are in frames with galleries (.ce-bodytext)
    .frame-type-text:not(#{$news-event-info-box-class}),
    .frame-type-html,
    .ce-bodytext,
    .csc-header {
      & > * {
        margin-left: auto;
        margin-right: auto;
      }

      table,
      .contenttable {
        min-width: #{$news-event-force-min-width};
        width: fit-content;
        max-width: calc(#{$news-event-one-column-gallery-max-width});
      }

      //restrict the width of a h1, h2, blockquote to that of a p-tag
      h1,
      h2,
      h3,
      blockquote {
        max-width: calc(#{math.div($line-width-max, 1em)} * #{font-size(0)});
      }

      //restrict the width of a hr to that of a p-tag
      hr {
        max-width: $line-width-max;
      }
    }

    //set a min width, that prevents frames, bodytext and 1-column galleries from being narrower than a p-tag
    .text--byline,
    .frame,
    .ce-bodytext,
    .ce-gallery[data-ce-columns='1'] {
      min-width: #{$news-event-force-min-width};
    }

    .text--byline {
      //align byline with text
      max-width: none;
      width: 100%;

      //remove top margin from the first element, that has vertical margin, in the first .frame after the byline - except when .frame is an infobox, then skip to the next .frame
      //also top margin is not removed on multi column galleries in medium wide viewports and above
      //also this won't work if the article start with two infobox - but why would you do that, when you should not even start it with an infobox to begin with?
      //NOTE: Breakpoints adhear to layout16 (full width). Will be suboptimal for other layouts if first frame is a multi-column gallery or a floated gallery
      & + .frame,
      & + #{$news-event-info-box-class} + .frame,
      & + #{$news-event-info-box-class}-collapse-wrapper + .frame {
        &.frame-type-text {
          & > *:first-child {
            margin-top: 0;
          }
        }

        &.frame-type-image {
          .ce-gallery[data-ce-columns="1"] {
            margin-top: 0;
          }
        }

        &.frame-type-textpic,
        &.frame-type-textmedia {
          .ce-above {
            @include breakpoint("medium", $mobile-last: true) {
              .ce-gallery {
                margin-top: 0;
              }
            }

            .ce-gallery[data-ce-columns="1"] {
              margin-top: 0;
            }
          }

          .ce-below {
            .ce-bodytext {
              & > *:first-child {
                margin-top: 0;
              }
            }
          }

          .ce-intext {
            @include breakpoint("medium", $mobile-last: true) {
              .ce-gallery {
                margin-top: 0;
              }
            }

            @include breakpoint("medium") {
              .ce-gallery[data-ce-columns="1"] + .ce-bodytext {
                & > *:first-child {
                  margin-top: 0;
                }
              }
            }
          }

          .ce-above,
          .ce-below,
          .ce-intext {
            .ce-bodytext:only-child {
              & > *:first-child {
                margin-top: 0;
              }
            }
          }
        }
      }
    }

    //content element headings - i.e. headings that are added as a seperate part of the content element, and not part of the content element it self. We remove top-margin of the first element in the content, as we would either have both the bottom h-tag and and the top heading of the first element in the content - as the h-tag is wrapped in the .csc-header div, causing margins not to collapse.
    .csc-header {
      & + p,
      & + ul,
      & + ol,
      & + table.table,
      & + dl.dl,
      & + .ce-textpic > .ce-gallery {
        margin-top: 0;
      }
    }

    figure {
      display: flex;
      flex-direction: column;
      align-items: center;

      // //add a background behind figures, that will only show on the sides, if the images is less wide than a p-tag
      // background-image: linear-gradient(color("background-secondary"), color("background-secondary"));
      // background-repeat: no-repeat;
      // background-size: $line-width-max 100%;
      // background-position: center center;

      //if there'a an a-tag arrond the image make is the same width as the image
      & > a {
        width: fit-content;
      }

      figcaption {
        @include set-font(-1, "single", $max-width: "default");
        padding-top: spacing(-3);
        color: color("foreground-secondary");
        background-color: color("background");

        //align caption with text, when image is wider than text
        max-width: none;
        width: 100%;
        padding-left: calc((100% - #{math.div($line-width-max, 1em)}  * #{font-size(0)}) / 2);
        padding-right: calc((100% - #{math.div($line-width-max, 1em)}  * #{font-size(0)}) / 2);
      }

      //overwrite typo3 inline width and height attributes on images
      img {
        width: auto;
        height: auto;
      }

      &.video {
        max-width: calc(#{$news-event-one-column-gallery-max-width});
        background-color: color("background-secondary");


        //force non 16:9 videos to flow over the edges of the text
        .layout15 &,
        .layout17 & {
          @include breakpoint("max-width"){
            @include wide-video;
          }
        }

        .layout16 &, .layout24 & {
          @include wide-video;
        }

        .video-embed {
          @include responsive-video;
        }
      }
    }

    .ce-gallery {
      //add spacing around galleries and center align in their frame
      margin: spacing($news-event-margin-between-images) auto;

      //fit galleries to their content
      width: fit-content;

      //always one column in narrow viewports
      --num-columns: 1;

      display: grid;
      grid-template-columns: repeat(var(--num-columns), 1fr);
      grid-column-gap: spacing($news-event-content-image-margin);
      grid-row-gap: spacing($news-event-margin-between-images);

      //skip every wrapper div, that is not a .ce-column, so that .ce-column will act as child of the grid, hope 5 wrappers are enough...
      //NOTE: Safari prior til 15.4 has a accesibillity bug with display: contents; https://caniuse.com/?search=display%3A%20contents
      & > div:not(.ce-column){
        display: contents;

        & > div:not(.ce-column){
          display: contents;

          & > div:not(.ce-column){
            display: contents;

            & > div:not(.ce-column){
              display: contents;

              & > div:not(.ce-column){
                display: contents;
              }
            }
          }
        }
      }


      &[data-ce-columns="1"] {
        max-width: calc(#{$news-event-one-column-gallery-max-width});
      }

      //set the number of allowed columns in galleries
      .layout14 &{
        @include breakpoint("max-width") {
          @include two-column-galleries;
        }
      }

      .layout15 &,
      .layout17 & {
        @include breakpoint("wide") {
          @include two-column-galleries;
        }

        @include breakpoint("max-width") {
          @include multi-column-galleries;
        }
      }

      .layout16 &, .layout24 & {
        @include breakpoint("medium") {
          @include two-column-galleries;
        }

        @include breakpoint("wide") {
          @include multi-column-galleries;
        }
      }
    }

    //floated galleries
    .ce-intext {

      .layout14 & {
        @include breakpoint("max-width") {
          @include floated-galleries;
        }
      }

      .layout15 &,
      .layout17 & {
        @include breakpoint("wide") {
          @include floated-galleries;
        }

        @include breakpoint("max-width") {
          @include wide-floated-galleries;
        }
      }

      .layout16 &, .layout24 & {
        @include breakpoint("medium") {
          @include floated-galleries;
        }

        @include breakpoint("wide") {
          @include wide-floated-galleries;
        }
      }
    }

    //set min width of one column galleries
    .ce-above,
    .ce-below {
      .ce-gallery[data-ce-columns="1"] {
        text-align: center;

        figure:not(.video) {
          display: inline-block; //makes the figure the same width as the image
          text-align: center;
          min-width: #{$news-event-min-width-one-column-galleries};

          //makes the caption no wider than the image, even if it need to wrap onto multiple lines
          figcaption {
            width: 0px;
            min-width: 100%;
          }
        }

        //the gallery is center aligned, so we set the caption back to being left aligned
        figcaption {
          text-align: left;
        }
      }
    }

    //floated infobox
    #{$news-event-info-box-class} {
      //only set background-color on not omnibus sites
      body:not(.omnibus) & {
        @include set-colors("background-secondary", $rewrite-css-vars: true);
      }

      @include content-container;
      position: relative;
      padding: spacing($news-event-info-box-padding);
      border-top: $width-border-utility solid color("border-theme");
      margin-top: spacing($news-event-content-image-margin);
      margin-bottom: spacing($news-event-content-image-margin);

      //constrain height of infobox in narrow viewport
      max-height: spacing($news-event-info-box-padding, $add: "#{line-height("multiple", $times: 6, $include-calc: false)} + #{$width-border-utility} + #{spacing($typography-margin-bottom-h3)}"); //top-border + infobox-padding + 6 lines (where on is assumed to be a h3)
      overflow: hidden; //hide the rest

      //remove vertical margins when using the element header field in an infobox
      .csc-header {
        @include content-container;

        //and adjust margin bellow the header
        + * {
          margin-top: spacing($typography-margin-bottom-h3);
        }
      }


      //scale down heading in infobox
      h1,
      h2,
      h3 {
        @include set-font(0, "single", $weight: "bold");
      }

      .layout14 & {
        @include breakpoint("max-width") {
          @include floated-info-box;
        }
      }

      .layout15 &,
      .layout17 & {
        @include breakpoint("wide") {
          @include floated-info-box;
        }

        @include breakpoint("max-width") {
          @include wide-floated-info-box;
        }
      }

      .layout16 &, .layout24 & {
        @include breakpoint("medium") {
          @include floated-info-box;
        }

        @include breakpoint("wide") {
          @include wide-floated-info-box;
        }
      }

      &--is-overflown {
        //hack for safari being unable to fade from a color into a transperant version of the same color, without setting that transperant color explicitly. Othervise things will fade through black in safaro
        //NOTE: This will not work in theme--dark mode in Safari. For this to work the below must be expanded to also include background-secondary from the dark themes
        --transparent: transparent;
        //this @media + @support only affects safari browsers: https://www.codegrepper.com/code-examples/css/Safari+only+CSS+hack
        @media not all and (min-resolution:.001dpcm) {
          @supports (-webkit-appearance:none) {
            @each $theme-name, $color in $color-brands {

              $color: get-hexcode($color-default-brand, "background-secondary");
              $red: red($color);
              $green: green($color);
              $blue: blue($color);

              --transparent: rgba(#{$red}, #{$green}, #{$blue}, 0);
            }
          }
        }

        &::after {
          content: "";
          position: absolute;
          bottom: 0;
          left: 0;
          z-index: $z-index-just-above-static;
          width: 100%;
          height: spacing(-1, $add: line-height("multiple", $times: 2, $include-calc: false));
          background-image: linear-gradient(0deg, color("background-secondary") spacing($news-event-info-box-padding), var(--transparent));
        }
      }

      &-collapse-wrapper {
        position: relative;
        margin-bottom: spacing($button-padding-vertical, $subtract: line-height("single", $times: -0.5, $include-calc: false), $add: spacing($news-event-content-image-margin));

        &__toggle {
          position: absolute;
          bottom: spacing($button-padding-vertical, $times: -1, $subtract: line-height("single", $times: .5, $include-calc: false));
          left: spacing($button-padding-vertical, $times: -1, $add: 50%, $subtract: line-height("single", $times: .5, $include-calc: false));
          z-index: $z-index-just-above-static + 1;

          @include icon-style {
            @include set-icon("expand");
          }
        }

        &--is-expanded {
          #{$news-event-info-box-class} {
            max-height: none;
            overflow: visible;
            padding-bottom: spacing($news-event-info-box-padding, $add: spacing($button-padding-vertical), $subtract: line-height("single", $times: -0.5, $include-calc: false));

            &::after {
              content: none;
            }
          }

          button {
            @include set-icon("collapse", $include-pseudo: "before");
          }
        }
      }
    }

    //NOTE Because Typo3 is unable to add two classes to the content element, we have three classes extending the infobox style for center, left and right alignement. Alignment is controlled with addtional style added in the floated-info-box mixin.
    #{$news-event-info-box-class}-center,
    #{$news-event-info-box-class}-right,
    #{$news-event-info-box-class}-left {
      @extend #{$news-event-info-box-class};
    }

    //specail stuff for html frames
    .frame-type-html {
      @include content-container;

      //constrain the witdth to that of a single column gallery
      max-width: calc(#{$news-event-one-column-gallery-max-width});

      //center align the frame and set vertical margins to that of a gallery
      margin: spacing($news-event-margin-between-images) auto;

      width: 100%;
      overflow-x: scroll;
      -webkit-overflow-scrolling: touch;

      iframe {
        //iframes are inline by default
        display: block;
        //overwrite potentential margins set by plugin, that prevents the iframe for center aligning. E.g. instragram does this.
        margin-left: auto !important;
        margin-right: auto !important;
        background: color("background");
      }
    }
  }

  //special stuff for omnibus site
  .omnibus & {

    .frame-type-html {
      overflow-x: hidden;

      iframe {
        max-width: 35em;
      }
    }
    .news-event__hero-image figure img {
      max-width: 100%;
    }
    img {
      height: auto;
    }

     .au_box_1 {
       padding: 1rem;
       overflow-x: auto
     } 
     p, li {
       font-family: $omnibus-font-string;
     }
     .news-event__content__text {
       padding-bottom: var(--spacing-p2)
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      font-family: $omnibus-font-string-headings;
      font-weight: $omnibus-font-weight-headings;
      text-transform: uppercase;
    }

    .text--stamp {
      font-family: $omnibus-font-string-headings;
      font-weight: $omnibus-font-weight-headings;
    }

    .text--byline {
      font-family: $omnibus-font-string-headings;
      font-weight: $omnibus-font-weight-headings;
      text-transform: uppercase;
      color: color("foreground-theme");
    }


    figcaption, 
    .news-event__image__caption,
    .news-event__image__credits {
      color: color("foreground");
    }

    .contenttable {
      caption {
        font-family: $omnibus-font-string-headings;
        font-weight: $omnibus-font-weight-headings;
        text-transform: uppercase;
      }

      thead {
        th {
          font-family: $omnibus-font-string-headings;
          font-weight: $omnibus-font-weight-headings;
          text-transform: uppercase;
        }
      }

      tbody, 
      tbody tr {
        border-color: color("border-theme");
      }
    }
    
    hr {
      border-color: color("border-theme");
    }

    blockquote {
      border-left-width: $width-border * 2;
    }

    &__content-elements,
    &__content__text {

      $spacing-icon: -3;

      strong > em,
      em > strong,
      a > em > strong {
        > a::before,
        &::before {
          font-family: $omnibus-font-string-headings;
          font-weight: $omnibus-font-weight-headings;
          text-transform: uppercase;
        }
      }
    }

    //Super annoying hack for links in small fontsize on omnibus site, where the default, otherwise 2px, underlining can't be forced to render below baseline of text. So we set it to 1px only where the small fontsize is used.
    figcaption,
    .text--byline {
      a {
        background-size: 50% $width-border-slim, 50% $width-border-slim;

        &:hover {
          background-size: 0% $width-border-slim, 0% $width-border-slim;
        }
      }
    }

    #{$news-event-info-box-class},
    #{$news-event-info-box-class}--left,
    #{$news-event-info-box-class}--right {
      border: $width-border solid color("border-theme");
      border-top-width: $width-border-utility;
      @include breakpoint("wide") { 
        width: 20rem;
      }
    }

    #{$news-event-info-box-class}--is-overflown {
      &::after {
        background-image: linear-gradient(0deg, color("background") spacing($news-event-info-box-padding), var(--transparent));
      }
    }
  }
}
