/*
 * Copyright (c) 2019-present Sonatype, Inc.
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/.
 */
@use '../scss-shared/nx-header-variables';
@use '../scss-shared/nx-container-helpers';
@use '../scss-shared/nx-button-helpers';
@use '../scss-shared/nx-dark-mode-helpers';

// You will see many one-off sizes for top-margins throughout this file. This is intentional in order
// to accomplish a subjectively pleasing "centered" look amongst the header's parts. Actually centering them
// does not look as good. At this point all of the one-off sizes are measured in the same way (from the top
// of the component) so things don't get too confusing

.nx-page-header {
  box-sizing: content-box;

  background-color: var(--nx-color-page-header-background);
  border-bottom: 1px solid var(--nx-color-page-header-border);
  grid-area: old-header; // see nx-page's grid template
  height: nx-header-variables.$main-header-height;
}

.nx-page-header__inner {
  align-items: flex-start;
  box-sizing: border-box;
  display: flex;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--nx-spacing-6x);
  width: 100%;
  max-width: var(--nx-width-page-max);

  @include nx-container-helpers.container-horizontal;
}

.nx-page-header__links {
  margin: 26px var(--nx-spacing-16x) 0 var(--nx-spacing-16x);
  @include nx-container-helpers.container-horizontal;
}

.nx-page-header__link {
  border-bottom: 2px solid transparent;

  color: var(--nx-color-page-header-link);
  display: inline-block;
  font-size: var(--nx-font-size-s);
  margin-right: var(--nx-spacing-6x);
  padding-bottom: var(--nx-spacing-base);
  position: relative;
  text-align: center;
  text-decoration: none;

  &:hover {
    font-weight: 600;
  }

  &.nx-page-header__link--current {
    &, .nx-page-header__link-sizing-text {
      font-weight: 600;
    }
  }

  &:active, &.nx-page-header__link--current {
    border-color: var(--nx-color-link);
  }

  // a hidden copy of the text, always at semi-bold weight, to enfore consistent element width
  &::before {
    display: block;
    content: attr(data-text);
    font-weight: 600;
    height: 0;
    overflow: hidden;
    visibility: hidden;
  }
}

.nx-page-header__extra-content {
  align-items: center;
  align-self: stretch;
  display: flex;
  margin-left: auto;

  .nx-btn--icon-only {
    @include nx-button-helpers.small-icon-btn;
  }

  @include nx-container-helpers.container-horizontal;
}

.nx-product {
  display: contents;
}

.nx-product__home-link {
  display: block;
}

.nx-product__logo {
  margin-top: 25px;
}

.nx-product__logo-image {
  height: 21px;

  &--dark {
    display: none;
    @include nx-dark-mode-helpers.dark-mode {
      display: block
    }
  }
  
  &--light {
    display: block;
    @include nx-dark-mode-helpers.dark-mode {
      display: none
    }
  }
}
.nx-product__divider {
  color: var(--nx-color-page-header-divider);
  font-size: 21px;
  line-height: 1;
  margin-top: 21px;
  margin-left: var(--nx-spacing-3x);
  margin-right: var(--nx-spacing-3x);
}

.nx-product__name {
  align-items: flex-start;
  color: var(--nx-color-page-header-product-name-text);
  display: flex;
  font-size: 26px;
  margin-top: 13px;
  text-transform: lowercase;
}

.nx-product__version {
  display: block;
  font-size: var(--nx-font-size-xs);
  margin-top: 27px;
  margin-left: var(--nx-spacing-3x);
}
