$compontent-name: ".delphinus-gutters";

#{$compontent-name} {
  padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-default);
  padding-right: spacing($page-padding-side, $subtract: $typo3-gutter-default);
  padding-top: spacing($page-padding-top, $subtract: $typo3-padding-top-default);
  padding-bottom: spacing($page-padding-bottom);

  @include breakpoint("medium") {
    padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    padding-right: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    padding-top: spacing($page-padding-top, $subtract: $typo3-gutter-medium);
  }

  & + #{$compontent-name} {
    padding-top: 0 !important;
    margin-top: spacing($page-padding-bottom, $times: -1, $add: spacing($page-content-block-gap));
  }

  //left-menu and right-column
  .layout14 & {
    //when the typo3 left menu is hidden in narrow viewports it still takes up some vertical space, which we subtract from the default Delphinus top padding here.
    padding-top: spacing($page-padding-top, $subtract: #{$typo3-padding-top-default + $typo3-left-menu-hidden-height}, $add: #{$typo3-left-menu-margin-bottom * -1});

    //align with top of left menu, when it becomes visible
    @include breakpoint("medium") {
      padding-top: 0;
    }

    //horizontal space is limited in this layout, so we skip the vertical spacing
    @include breakpoint("wide") {
      padding-left: 0;
      padding-right: 0;
    }
  }

  //left-menu
  .layout15 & {
    //when the typo3 left menu is hidden in narrow viewports it still takes up some vertical space, which we subtract from the default Delphinus top padding here.
    padding-top: spacing($page-padding-top, $subtract: #{$typo3-padding-top-default + $typo3-left-menu-hidden-height}, $add: #{$typo3-left-menu-margin-bottom * -1});

    //align with top of left menu, when it becomes visible
    @include breakpoint("medium") {
      padding-top: 0;
    }

    //content extends all the way to the right edge of the page, when it becomes constrained by its max-width
    @include breakpoint("max-width") {
      padding-right: 0;
    }
  }

  //full-width
  .layout16 & {
    //theres no padding in typo3 stylesheet above at this breakpoint, so add the full vertical padding top from Delphinus
    @include breakpoint("medium") {
      padding-top: spacing($page-padding-top);
    }

    //content extends all the way to the edges of the page, when it becomes constrained by its max-width
    @include breakpoint("max-width") {
      padding-left: 0;
      padding-right: 0;
    }
  }

  //right-column
  .layout17 & {
    //align with top of right column, when it becomes visible
    @include breakpoint("medium") {
      padding-top: 0;
    }

    //content extends all the way to the left edge of the page, when it becomes constrained by its max-width
    @include breakpoint("max-width") {
      padding-left: 0;
    }
  }
}


//GUTTERS ON "FRAMED" SITES
body.universe,
body.omnibus,
body.aarhus-bss {
  & #{$compontent-name} {
    //in narrow viewports the framed sites have both a default gutter on the .main wrapper and a 1rem gutter on the out .row wrapper
    padding-left: spacing($page-padding-side, $subtract: #{$typo3-gutter-default + $typo3-gutter-framed-sites-mobile});
    padding-right: spacing($page-padding-side, $subtract: #{$typo3-gutter-default + $typo3-gutter-framed-sites-mobile});

    //in wieder viewport the outer .row wrapper has the same gutter as the .main wrapper
    @include breakpoint("medium") {
      padding-left: spacing($page-padding-side, $subtract: #{$typo3-gutter-medium * 2});
      padding-right: spacing($page-padding-side, $subtract: #{$typo3-gutter-medium * 2});
    }
  }

  //left-menu and right-column
  &.layout14 #{$compontent-name} {
    //when left menu become visible. Left menu have a right margin that we subtract.
    @include breakpoint("medium") {
      padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    }

    //horizontal space is limited in this layout, so we skip the vertical spacing
    @include breakpoint("wide") {
      padding-left: 0;
      padding-right: 0;
    }
  }

  //left-menu
  &.layout15 #{$compontent-name} {
    //when left menu become visible. Left menu have a right margin that we subtract.
    @include breakpoint("medium") {
      padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    }

    //because site is framed, we need some padding on the right as well, when the frame becomes visible
    @include breakpoint("max-width") {
      padding-right: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    }
  }


  //full-width
  &.layout16 #{$compontent-name} {
    //because site is framed, we need some padding on the sides, when the frame becomes visible
    @include breakpoint("max-width") {
      padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
      padding-right: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    }
  }

  //right-column
  &.layout17 #{$compontent-name} {
    //because site is framed, we need some padding on the left as well, when the frame becomes visible
    @include breakpoint("max-width") {
      padding-left: spacing($page-padding-side, $subtract: $typo3-gutter-medium);
    }
  }
}

//omnibus-site has and empty 22px heigh breadcrumb at the top of each page aboove the medium breakpoint
@include breakpoint("medium") {
  body.omnibus.layout16 #{$compontent-name} {
    padding-top: spacing($page-padding-top, $subtract: $typo3-empty-breadcrumb-height);
  }
}
