/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

:host {
  --page-nav-button-border-radius: var(--button-border-radius);
  --page-nav-button-text-color: var(--button-text-color-ghost);
  --page-nav-button-text-color-hover: var(--button-text-color-ghost-hover);
  --page-nav-button-text-color-active: var(--button-text-color-ghost-active);
  --page-nav-button-background-color: var(--button-background-color-ghost);
  --page-nav-button-background-color-hover: var(--button-background-color-ghost-hover);
  --page-nav-button-background-color-active: var(--button-background-color-ghost-active);
  --page-nav-button-background-color-selected: color-mix(in srgb, currentColor 8%, transparent);
  --page-nav-button-padding: var(--space-small) var(--space-medium);
  --page-nav-margin-top: 72px;
  --page-nav-margin-bottom: 36px;
  --page-nav-gap: var(--space-large);
  --page-nav-button-gap: var(--space-xsmall);
  --page-nav-border-color: var(--border-color);
  --page-nav-focus-outline-inset: var(--focus-outline-inset);
  --page-nav-header-logo-size: calc(var(--icon-size-default) + var(--space-small));
  --page-nav-width: 240px;
  --page-nav-hr-color: #CFCFD8;
  margin-inline-start: 42px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: block;
  width: var(--page-nav-width);

  @media (prefers-reduced-motion) {
    /* (See Bug 1610081) Setting border-inline-end to add clear differentiation between side navigation and main content area */
    border-inline-end: 1px solid var(--page-nav-border-color);
  }

  @media (max-width: 52rem) {
    grid-template-rows: 1fr auto;
    --page-nav-width: fit-content;
    --page-nav-button-padding: var(--space-small);
  }
}

nav {
  display: grid;
  grid-template-rows: repeat(3, min-content);
  gap: var(--page-nav-gap);
  margin-block: var(--page-nav-margin-top) var(--page-nav-margin-bottom);
  height: calc(100% - var(--page-nav-margin-top) - var(--page-nav-margin-bottom));
}

.page-nav-header-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-small);

  > .logo {
    display: inline-block;
    height: var(--page-nav-header-logo-size);
    width: var(--page-nav-header-logo-size);
    background: image-set(url("chrome://branding/content/about-logo.png"), url("chrome://branding/content/about-logo@2x.png") 2x) no-repeat center;
    background-size: auto;
    background-size: var(--page-nav-header-logo-size);
    /* Header logo should be centered above button icons */
    margin-inline-start: calc(var(--space-medium) - ((var(--page-nav-header-logo-size) - var(--icon-size-default)) / 2));

    @media (max-width: 52rem) {
      margin-inline: auto;
    }
  }

  > .page-nav-header {
    /* Align the header text/icon with the page nav button icons */
    margin-inline-start: var(--page-nav-button-padding);
    font-size: var(--font-size-xlarge);
    font-weight: var(--font-weight-bold);
    margin-block: 0;

    @media (max-width: 52rem) {
      display: none;
    }
  }
}

.primary-nav-group,
#secondary-nav-group {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: min-content;
  gap: var(--page-nav-button-gap);

  @media (max-width: 52rem) {
    justify-content: center;
  }
}

hr {
  width: 100%;
  margin: 0;
  height: 1px;
  border: 0;
  background-color: var(--page-nav-hr-color);
}

@media (prefers-contrast) {
  .primary-nav-group {
    gap: var(--space-small);
  }
}
