:root {
  --theme-color: var(--bg-primary);
}

.container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;

  @media (min-width: 1024px) {
    padding-left: 64px;
    padding-right: 64px;
  }
}

.layout-container {
  background: var(--theme-color);
  color: var(--text-primary);

  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  align-items: stretch;
}

.layout-container:has(.donation-page) {

  & header,
  & footer {
    display: none;
  }

  & .layout-main-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  & .layout-main-wrapper__inner {
    width: 100%;
  }
}

.layout-header {
  position: sticky;
  --header-height: 80px;

  @media (min-width: 1024px) {
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

.layout-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  position: relative;

  @media (min-width: 1024px) {
    --header-height: auto;
  }

  & .region--header {
    display: inline-flex;
    align-items: center;
  }
}

.layout-header__desktop-menu {
  display: none;

  @media (min-width: 1024px) {
    display: block;
  }
}

.layout-header__mobile-menu {
  @media (min-width: 1024px) {
    display: none;
  }
}

.layout-header__mobile-menu__dialog:popover-open {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: stretch;

  @media (min-width: 1024px) {
    display: none;
  }
}

.layout-header__mobile-menu__dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-grow: 0;
  flex-shrink: 0;
  flex-basis: var(--header-height);
  padding: 0 20px;
}

.layout-header__mobile-menu__dialog__content {
  flex-grow: 1;
  padding: 20px;
  position: relative;

  & .region--mobile-menu {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 64px;
    justify-content: space-between;
  }

  &::before {
    content: "";
    position: absolute;
    left: 0;
    inset: 0;
    background-image: url("../../images/assets/river-silhouette.svg");
    background-repeat: no-repeat;
    background-position: top left;
    background-size: calc(100% - 20px) auto;
    pointer-events: none;
  }
}

.layout-main-wrapper {
  flex-grow: 1;
  width: 100%;

  &:not(.is-front) {
    padding: 20px;

    @media (min-width: 1024px) {
      padding: 24px 64px;
    }
  }
}

@media (min-width: 1440px) {
  .layout-main-wrapper {
    position: relative;
  }
}

.layout-main-wrapper:has(.donation-page) {
  max-width: 100%;
  padding: 0;
}

.layout-prefix {
  margin-bottom: 24px;
}

.layout-main-wrapper__inner {
  align-items: start;
  display: flex;
  gap: 120px;
}

.layout-sidebar {
  display: none;
  anchor-name: --anchor-sidebar;
}

.layout-sidebar,
.node--type-document_page .layout-sidebar {
  @media (min-width: 1024px) {
    position: relative;
    width: auto;
    display: block;
    flex-shrink: 0;
    flex-basis: 300px;
    align-self: stretch;

    &::before {
      content: "";
      position: absolute;
      left: 0;
      right: anchor(--anchor-sidebar right);
      top: anchor(--anchor-sidebar top);
      bottom: anchor(--anchor-sidebar bottom);
      background-image: url("../../images/assets/river-silhouette.svg");
      background-repeat: no-repeat;
      background-position: top center;
      background-size: 100% auto;
      pointer-events: none;
      width: 455px;
      height: 100%;
      left: -30%;
    }
  }

  & .region--sidebar {
    display: flex;
    flex-direction: column;
    padding-top: 48px;
    padding-bottom: 48px;
    height: 100%;
    gap: 100px;
    position: relative;
  }
}

.node--type-document_page {
  & .layout-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    width: 100%;
    background-color: var(--bg-primary);
    z-index: 10;

    & .region--sidebar {
      padding: 24px 0 0 0;
      width: 100%;
    }
  }

  & .layout-main-wrapper__inner {
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  main {
    width: 100%;
  }

  @media (min-width: 1024px) {
    & .layout-sidebar {
      position: relative;
      top: 0;

      & .region--sidebar {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
      }
    }

    & .layout-main-wrapper__inner {
      flex-direction: row;
      justify-content: space-between;
    }

  }
}


.layout-main {
  flex-grow: 1;
  container: main / inline-size;
}

.layout-footer {
  position: relative;

  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent, var(--theme-color) 0);
    z-index: -1;
  }

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("../../images/assets/river-silhouette-footer-mobile.svg");
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: -1;

    @media (min-width: 1024px) {
      background-image: url(../../images/assets/river-silhouette-footer-expanded.svg);
      background-position: center 0;
      left: -650px;
      top: -910px;
    }

    @media (min-width: 4024px) {
      background-size: 100%;
      top: -1510px;
    }
  }
}

.layout-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-top: 64px;
  padding-bottom: 64px;

  @media (min-width: 1100px) {
    /* bleeds out on 1024 */
    padding-top: 112px;
  }
}

.layout-footer__sub_footer {
  display: flex;
  flex-direction: column;
  gap: 48px;

  @media (min-width: 1080px) {
    flex-direction: row;
    gap: 120px
  }
}

.layout-container__header-prefix {
  display: none;
  margin-bottom: 8px;

  @media (min-width: 1024px) {
    display: block;
  }
}

a#main-content,
.dialog-off-canvas-main-canvas,
.layout-container {
  position: relative;
  z-index: 10;
}
