/**
 * Copyright (c) HashiCorp, Inc.
 * SPDX-License-Identifier: MPL-2.0
 */

/* Note: consumes from theme.module.css, as marked */

.root {
  position: sticky;
  top: -1px;
  z-index: 900;
  background: var(--background-color); /* from theme.module.css */
  border-top: 1px solid var(--border-color); /* from theme.module.css */
  border-bottom: 1px solid transparent;
  transition: border-bottom-color 0.8s;

  &.isSticky {
    border-bottom-color: var(--border-color); /* from theme.module.css */
  }

  /*
    * About this selector:
    * `& ~ *` finds all elements after the navigation.
    * `:target` finds the active permalink on the page.
    *
    * About this style:
    * `scroll-margin-top` adjusts the vertical scroll of a permalink.
    * `64px` adjusts the scroll to account for the navigation.
    * `0.5em` further adjusts the scroll to give the permalink breathing room.
    *
    * See: https://developer.mozilla.org/en-US/docs/Web/CSS/:target
    * See: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-margin-top
    */
  & ~ * :target {
    scroll-margin-top: calc(64px + 0.5em);
  }

  @media print {
    display: none;
  }
}

.subnavInner {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  height: 62px;

  &.hasOverflow {
    display: flex;
  }

  &.notConstrained {
    padding: 0 24px;

    @media (--medium-up) {
      padding: 0 32px;
    }
  }
}
