@use '../variables.scss' as *;

.page {
  max-width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  padding: 0 14px 0 14px;

  @include phone-portrait {
    flex-direction: column;
    padding: 0;
  }

  h2 {
    text-transform: uppercase;
    letter-spacing: 2px;

    @include phone-portrait {
      margin-left: var(--inventory-column-padding);
      margin-right: calc(var(--inventory-column-padding) - var(--item-margin));
    }
  }
}

.contents {
  flex: 1;
  width: 100%;
  box-sizing: border-box;

  @include desktop {
    margin-top: 12px; // 8px to match the menu, plus 4px to match the padding
  }
  h2:first-child {
    margin-top: 0;
  }
  :global(.issue-banner-shown) & {
    @include desktop {
      padding-bottom: $issue-banner-height;
    }
  }
}

.menu {
  --page-with-menu-menu-width: 230px;
  font-size: 14px;
  flex-shrink: 0;
  margin-right: 12px;
  margin-top: 8px;
  margin-left: -4px; // To undo the padding on the inner div
  position: sticky;
  top: calc(var(--header-height) + 8px);
  width: calc(var(--page-with-menu-menu-width) + 8px);
  overflow: hidden auto;
  overscroll-behavior: none;
  max-height: calc(var(--viewport-height) - var(--header-height) - 8px);

  @include phone-portrait {
    position: static;
    margin: 0;
    width: 100%;
    padding: 0;
    max-height: none;

    // On mobile, the inner div can be full size and we just allow scrollbars to
    // appear over the content.
    > div {
      width: 100% !important;
      padding: 0 !important;
    }
  }

  // This inner container div exists to keep the contents from changing widths,
  // while the outer .menu container may change size as the scrollbars appear
  // and disappear.
  > div {
    width: var(--page-with-menu-menu-width);
    padding: 4px; // To allow for the outline of the character selector to show
  }

  // Add in some width when a scrollbar is present!
  // It'd be cooler if https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-gutter existed.
  &.menuScrollbars {
    // Windows scrollbars are var(--scrollbar-size), then padding p
    width: calc(var(--page-with-menu-menu-width) + var(--scrollbar-size) + 8px);
  }

  ul {
    margin: 0;
    padding: 0;
  }
}

.menuHeader {
  margin-bottom: 4px;
  padding-bottom: 1px;
  margin-top: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 0.5px solid #666;
}

.menuButton {
  display: flex;
  text-decoration: none;
  flex-direction: row;
  align-items: center;
  margin-bottom: 4px;
  min-height: 24px;
  gap: 4px;

  @include phone-portrait {
    padding: 6px 10px;
    font-size: 16px;
  }

  @include interactive($hover: true, $focus: true) {
    color: var(--theme-accent-primary);

    :global(.app-icon) {
      color: var(--theme-accent-primary);
    }
  }

  img {
    height: 24px;
    width: 24px;
  }
  > span:not(:global(.app-icon)) {
    flex: 1;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
}
