/* Full Width classes and mixins
-----------------------------------------------------------
*/

@mixin full-width {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw !important;
  margin-right: -50vw !important;
  max-height: inherit;
}

.full-width {
  @include full-width;
}

/* Full Width Background
-----------------------------------------------------------
  Extends background color edge to edge without extending the actual container
*/

@mixin fullwidth-background($color: "whitesmoke") {
  border-image: conic-gradient($color 0 0) fill 0 / / 0 100vw;
}

.full-width-background {
  @include fullwidth-background();
    // light text for dark backgrounds
  &-primary,
  &-danger {
    color: white;
  }
  &-white {
    @include fullwidth-background(white);
  }
}

@each $colorname, $color in $theme-colors {
  .full-width-background-#{$colorname} {
    @include fullwidth-background($color);
  }
}

/* Menu flex
-----------------------------------------------------------
  Use this to apply to block config to allow menus to be flex-row
*/

.block-menu-flex {
  ul.menu {
    display: flex;
    flex-direction: row;
    gap: 1rem;
  }
}


/* Sticky Header
-----------------------------------------------------------
  Sticks things to the top of page, but showing admin menu
*/
.sticky-header {
  --sticky-header-offset: calc(var(--gin-toolbar-secondary-height, 0) + var(--gin-toolbar-height, 0) );
  position: sticky;
  top: var(--gin-toolbar-height, 0);
  z-index: 99;
}

// Make 'edit view' and 'edit content' contextual links both work at the same time.
.contextual-region .contextual-region > .contextual {
  right: -2rem;
}
.contextual-region .contextual-region .contextual-region > .contextual {
  right: 2rem;
}

// Circled character

.circled-character {
  --circle-size: 2em;
  border: 1px solid black;
  border-radius: 50%;
  width: var(--circle-size);
  height: var(--circle-size);
  padding: .25em;
  display: inline-flex;
  align-content: center;
  justify-content: center;
  line-height: 1.5em;
  font-size: .5em;
  top: .35em;

  .full-width-background-primary &,
  .bg-primary &,
  .full-width-background-danger &,
  .bg-danger & {
    border: 0 solid #fff;
    background-color: #fff;

    @media (width > 1440px) {
      position: initial;
    }
  }

  .full-width-background-primary & {
    color: $primary;
  }
  .full-width-background-danger & {
    color: $danger;
  }

  .text-primary &,
  &.text-primary {
    border: 1px solid $primary;
  }

  @media (width > 1440px) {
    position: absolute;
    left: -2.5em;
  }
}

p,
h1,
h2,
h3,
h4 {
  &:has(.circled-character){
    position: relative;
    display: flex;
    gap: 1rem;
    align-items: center;
  }
}

/* Paragraph spacer classes
-----------------------------------------------------------
These classes replace margins from class above on the element following the spacer

Used in spacer paragraph.

    <div class="paragraph-spacer-5">
    ... gets a height of 5rem
    </div>
    <div class="image-block">
    ... looses its default top margin
    </div>

*/

$spacer-sizes: 0, 1, 2, 3, 4, 5, 10, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15;

@each $size in $spacer-sizes {
  .paragraph-spacer-#{$size} {
    @media (min-width: 800px) {
      height: #{$size}rem;
      margin-top: -1px !important;
      
      &+* {
        margin-top: -1px !important;
      }
    }
  }
}

.separator {
  &_light {
    border-top: 1px solid var(--bs-gray);
  }

  &_dark {
    border-top: 1px solid var(--bs-black);
  }
}

/* Leaf background style
-----------------------------------------------------------
*/

.bg-leaf {
  background-repeat: no-repeat;
  background-size: cover;
  background-image: url(../images/leaf.png), linear-gradient($light-green, $light-green) ;
}
