/* Place Relearn's navigation and content over the shared header image. */
@media screen {
  body.site-with-banner {
    --site-banner-height: 9rem;
    --site-topbar-height: 3rem;
  }

  body.site-with-banner #R-body,
  body.site-with-banner #R-topbar,
  body.site-with-banner .topbar-wrapper,
  body.site-with-banner #R-header-wrapper {
    transition: none;
  }

  .site-banner {
    position: fixed;
    inset: 0 0 auto;
    height: var(--site-banner-height);
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
  }

  .site-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Tint the image once so overlapping theme surfaces cannot compound it. */
  .site-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--INTERNAL-MAIN-BG-color) 40%, transparent);
  }

  body.site-with-banner #R-sidebar {
    background: linear-gradient(to bottom,
      transparent var(--site-banner-height),
      var(--INTERNAL-MENU-SECTIONS-BG-color) var(--site-banner-height));
  }

  body.site-with-banner #R-header-wrapper {
    background: transparent;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--site-banner-height);
    flex: 0 0 var(--site-banner-height);
  }

  body.site-with-banner #R-body {
    background: transparent;
  }

  body.site-with-banner #R-body-inner {
    background: transparent;
  }

  .site-fixed-title .site-banner-title {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    height: calc(var(--site-banner-height) - var(--site-topbar-height));
    padding: 0 3.25rem;
    overflow: hidden;
    scrollbar-gutter: stable both-edges;
  }

  .site-banner-title :is(h1, h2) {
    position: relative;
    padding-inline-end: 2rem;
    margin-block: 0;
  }

  .site-banner-title :is(h1, h2):hover .anchor,
  .site-banner-title :is(h1, h2):focus-within .anchor {
    visibility: visible;
  }

  body.site-fixed-title #R-body-inner {
    min-height: 0;
    background: var(--INTERNAL-MAIN-BG-color);
    padding-top: 1rem;
  }

  @media (max-width: 59.999rem) {
    .site-banner-title h1 {
      font-size: 2.8rem;
    }

    .site-fixed-title .site-banner-title {
      padding-inline: 2rem;
    }
  }

  @media (max-width: 47.999rem) {
    body.site-with-banner > .site-banner {
      display: none;
    }

    .site-banner-title h1 {
      font-size: 2.5rem;
    }

    body.site-with-banner {
      --site-banner-height: 14rem;
    }

    .site-fixed-title .site-banner-title {
      height: auto;
      padding-block: 1rem;
      padding-inline: 1.25rem;
    }

    /* Scroll the title with the article; retain only the top bar above it. */
    body.site-with-banner.site-fixed-title #R-body {
      overflow-y: auto;
      overflow-x: hidden;
    }

    body.site-with-banner.site-fixed-title #R-body-inner {
      flex: 0 0 auto;
      overflow: visible;
    }

    body.site-with-banner.site-fixed-title #R-topbar {
      position: sticky;
      top: 0;
      background:
        linear-gradient(
          color-mix(in srgb, var(--INTERNAL-MAIN-BG-color) 40%, transparent),
          color-mix(in srgb, var(--INTERNAL-MAIN-BG-color) 40%, transparent)
        ),
        var(--site-header-image) center / cover no-repeat;
    }

    body.site-fixed-title.mobile-support.sidebar-flyout #R-body {
      overflow: hidden;
    }
  }

  body.site-with-banner #R-topbar {
    background: transparent;
    box-sizing: border-box;
    height: var(--site-topbar-height);
    flex: 0 0 var(--site-topbar-height);
  }

  body.site-with-banner #R-topbar > .topbar-wrapper {
    background: transparent;
  }

  body.site-with-banner #R-topbar {
    border-bottom-color: transparent;
  }

  body.site-with-banner #R-header-wrapper {
    border-inline-end-color: transparent;
  }

  body.site-with-banner #R-header-topbar,
  body.site-with-banner #R-topbar .topbar-sidebar-divider,
  body.site-with-banner #R-topbar .topbar-button {
    border-color: transparent;
  }
}

@media print {
  .site-banner {
    display: none;
  }
}
