@import '../../styles/common';
@import './variables';

$icon-size: rem(20px);
$page-left-alignment-breakpoint-max: 1268px;
$context-control-extra-spacing: rem(40px);
$context-control-expand-after: 1400px;

.TopBar {
  position: relative;
  display: flex;
  height: top-bar-height();
  background-color: var(--top-bar-background);
  &::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 100%;
    border-bottom: 1px solid transparent;
  }
}

.LogoContainer {
  display: none;
  @include breakpoint-after(nav-min-window-corrected()) {
    display: flex;
    flex: 0 0 layout-width(nav);
    align-items: center;
    height: 100%;
    padding: 0 spacing(tight) 0 spacing(base);
    @include safe-area-for(flex-basis, layout-width(nav), left);
    @include safe-area-for(padding-left, spacing(), left);
  }
}

.ContextControl {
  display: none;
  @include breakpoint-after(nav-min-window-corrected()) {
    width: layout-width(nav);
    display: block;
  }

  @include breakpoint-after($context-control-expand-after) {
    width: layout-width(nav) + $context-control-extra-spacing;
  }
}

.Logo,
.LogoLink {
  display: block;
}

.NavigationIcon {
  @include unstyled-button;
  position: relative;
  align-self: center;
  margin-left: spacing(tight) + rem(2px);
  margin-right: spacing(tight);
  padding: spacing(tight);
  border-radius: border-radius();
  &.focused {
    background-color: rgba(color('white'), 0.16);
  }
  &.focused:active {
    background-color: rgba(color('black'), 0.28);
  }
  &:hover {
    background-color: rgba(color('white'), 0.08);
  } // This increases hit point size.
  &::after {
    content: '';
    position: absolute;
    top: spacing(tight) * -1;
    left: spacing(tight) * -1;
    width: calc(100% + #{spacing(loose)});
    height: calc(100% + #{spacing(loose)});
  }
  @include breakpoint-after(nav-min-window-corrected()) {
    display: none;
  }
}

.Contents {
  z-index: z-index(content, $stacking-order);
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  height: 100%;

  @include breakpoint-after($not-condensed-content) {
    position: relative;
  }
}

.SearchField {
  @include page-layout;
  width: 100%;
  margin: 0;
  max-width: none;
  margin-left: calc((100% - #{$page-max-width}) / 2);

  @include breakpoint-after($context-control-expand-after) {
    margin-left: calc(
      (100% - #{$page-max-width + $context-control-extra-spacing}) / 2
    );
  }

  @media (max-width: $page-left-alignment-breakpoint-max) {
    margin-left: 0;
  }

  @include breakpoint-after($not-condensed-content) {
    position: relative;
  }
}

.SecondaryMenu {
  @include breakpoint-before(layout-width(page-with-nav), false) {
    display: none;
  }
}
