/*
 * Main menu bar and its dropdowns.
 * Enjin drew image halves with empty "sliding door" divs; here they are ::before (left half) and
 * ::after (right half), kept underneath the content with z-index:-1 in an isolated box. The
 * 50.004% width is Enjin's: the halves overlap by a hair so no seam shows.
 */

.m_hmenu {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  height: 38px;
}

.m_hmenu::before,
.m_hmenu::after,
.m_hmenu .button::before,
.m_hmenu .button::after {
  content: '';
  position: absolute;
  top: 0;
  z-index: -1;
  width: 50.004%;
  height: 100%;
}

.m_hmenu::before,
.m_hmenu .button::before {
  left: 0;
  background-position: left top;
}

.m_hmenu::after,
.m_hmenu .button::after {
  right: 0;
  background-position: right top;
}

.m_hmenu::before,
.m_hmenu::after {
  background-image: url('/img/theme/menu-bar.png');
}

.m_hmenu .buttons {
  position: relative;
  top: 2px;
  padding-right: 0;
  padding-left: 3px;
}

/* Buttons float left; ones that don't fit wrap 100px down and out of view (the 2018 tenth item). */
.m_hmenu .button {
  position: relative;
  isolation: isolate;
  float: left;
  height: 34px;
  margin-bottom: 100px;
  padding-right: 21px;
  padding-left: 19px;
  font-size: 15px;
  font-weight: normal;
  line-height: 32px;
  color: #e7f5b8;
  background-color: transparent;
  cursor: pointer;
}

.m_hmenu .button::before,
.m_hmenu .button::after {
  background-image: url('/img/theme/menu-button.png');
}

.m_hmenu .button span {
  position: relative;
  bottom: 1px;
  margin-left: 6px;
  font-size: 60%;
}

.m_hmenu .button:hover,
.m_hmenu .button:focus {
  color: #fff;
  text-decoration: none;
}

.m_hmenu .button:hover::before,
.m_hmenu .button:hover::after,
.m_hmenu .button:focus::before,
.m_hmenu .button:focus::after {
  background-image: url('/img/theme/menu-button-hover.png');
}

.m_hmenu .button.first:hover::before,
.m_hmenu .button.first:hover::after,
.m_hmenu .button.first:focus::before,
.m_hmenu .button.first:focus::after {
  background-image: url('/img/theme/menu-button-hover-first.gif');
}

/* Dropdown popup (public/js/menu.js appends it to <body> under the hovered button). */
.element_popup {
  position: absolute;
  z-index: 100;
  border: 2px solid #000;
  border-radius: 2px;
}

.element_popup .inner {
  position: relative;
  padding: 8px 10px;
  border: 1px solid #4d4845;
  border-radius: 2px;
  color: #d1cab3;
  background-color: #0d0c0a;
}

.element_dropdown_menu.element_popup {
  margin-top: 1px;
  margin-left: -2px;
}

.element_dropdown_menu.element_popup .inner {
  padding: 5px 0;
}

.element_dropdown_menu.element_popup .menu-link {
  display: block;
  min-width: 110px;
  padding: 5px 24px 5px 10px;
  font:
    12px/12px Arial,
    Helvetica,
    sans-serif;
  color: #e9bd7f;
  white-space: nowrap;
}

.element_dropdown_menu.element_popup .menu-link:hover {
  color: #fff;
  text-decoration: underline;
}

/* Keyboard focus: menu buttons already light up with the 2018 hover image, so no outline there;
   dropdown entries keep theirs inside the entry. */
.m_hmenu .button:focus-visible {
  outline: none;
}

.element_dropdown_menu.element_popup .menu-link:focus-visible {
  outline-offset: -2px;
}

/* The phone nav and its More panel (src/views/partials/menu.njk; DECISIONS 85) only show below
   768px. */
.phone-nav,
.phone-more {
  display: none;
}

/*
 * Phones (below 768px; DECISIONS 85): the desktop menu bar gives way to a 52px nav drawn with the
 * same bar image, scaled to the height: tabs that scroll sideways, and "More" pinned right behind
 * the 2018 button divider. More opens the whole menu in the dropdown's colours (#0d0c0a, a 1px
 * #4d4845 inner and 2px black outer border). Square corners, no fades; every tap target is 44px
 * or taller. Also the shared phone buttons (.phone-btn) for the header and the homepage.
 */
@media (max-width: 767.98px) {
  .site-header .m_hmenu {
    display: none;
  }

  /* Buttons: an outline (Log in, Search) and a gold one (Join, Sign up). */
  .phone-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid #59534c;
    border-radius: 0;
    background: transparent;
    font-family: Arial;
    font-size: 14px;
    line-height: 1.2;
    color: #e7f5b8;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
  }

  .phone-btn:hover,
  .phone-btn:focus {
    color: #fff;
    text-decoration: none;
  }

  .phone-btn.phone-btn-primary {
    background-color: #e9bd7f;
    font-weight: bold;
    color: #0b0a08;
  }

  .phone-btn.phone-btn-primary:hover,
  .phone-btn.phone-btn-primary:focus {
    background-color: #fff;
    color: #0b0a08;
  }

  /* The nav bar: the desktop bar's halves, scaled from 38 to 52px. */
  .phone-nav {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: stretch;
    height: 52px;
  }

  .phone-nav::before,
  .phone-nav::after {
    content: '';
    position: absolute;
    top: 0;
    z-index: -1;
    width: 50.004%;
    height: 100%;
    background-image: url('/img/theme/menu-bar.png');
    background-size: auto 100%;
  }

  .phone-nav::before {
    left: 0;
    background-position: left top;
  }

  .phone-nav::after {
    right: 0;
    background-position: right top;
  }

  .phone-tabs {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
    margin-left: 6px;
    padding: 0 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .phone-tabs::-webkit-scrollbar {
    display: none;
  }

  .phone-tab {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0 10px;
    border-top: 2px solid transparent;
    border-bottom: 2px solid transparent;
    font-size: 15px;
    color: #e7f5b8;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
  }

  .phone-tab:hover,
  .phone-tab:focus {
    color: #fff;
    text-decoration: none;
  }

  .phone-tab[aria-current='page'] {
    border-bottom-color: #e9bd7f;
    font-weight: bold;
    color: #fff8c9;
  }

  .phone-tab:focus-visible {
    outline-offset: -3px;
  }

  /* A count: a small square gold box (Unread 3). */
  .phone-count {
    display: inline-block;
    box-sizing: border-box;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background-color: #e9bd7f;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
    color: #0b0a08;
    text-align: center;
  }

  /* More (a link to /menu, or the button phone-nav.js puts in its place), behind the divider
     the desktop buttons end with. Open, it takes the desktop buttons' hover image. */
  .phone-nav-more {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    /* Fits "More ▼" and "Close ▲" alike, so the strip doesn't shift when it opens. */
    min-width: 86px;
    margin: 0;
    padding: 0 15px 0 17px;
    border: 0;
    border-radius: 0;
    background: none;
    font-family: Arial;
    font-size: 15px;
    color: #e7f5b8;
    white-space: nowrap;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
  }

  .phone-nav-more::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background-image: url('/img/theme/menu-button.png');
    background-position: right top;
    background-size: auto 100%;
  }

  .phone-nav-more:hover,
  .phone-nav-more:focus {
    text-decoration: none;
  }

  /* Open: the hover image, scaled like the bar, from the divider to the bar's rounded end. */
  .phone-nav-more[aria-expanded='true'],
  .phone-nav-close {
    isolation: isolate;
    color: #fff;
  }

  .phone-nav-more[aria-expanded='true']::after,
  .phone-nav-close::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 5px;
    bottom: 3px;
    left: 6px;
    z-index: -1;
    background-image: url('/img/theme/menu-button-hover.png');
    background-position: left center;
    background-size: auto 100%;
  }

  /* White when open or under keyboard focus only, not on hover or focus: after a tap a phone
     keeps the button hovered and focused, and closed again it should look like the tabs. */
  .phone-nav-more:focus-visible {
    outline-offset: -4px;
    color: #fff;
  }

  .phone-nav-arrow {
    position: relative;
    bottom: 1px;
    font-size: 60%;
  }

  /* The More panel: right under the nav, in the dropdown's borders and colours. */
  .phone-more {
    display: block;
    border: 2px solid #000;
  }

  .phone-more[hidden] {
    display: none;
  }

  .phone-more-inner {
    border: 1px solid #4d4845;
    background-color: #0d0c0a;
  }

  .phone-more-search {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 12px;
    border-bottom: 1px solid #363224;
  }

  .phone-more-search input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid #59534c;
    border-radius: 0;
    background-color: #000;
    font-family: Arial;
    font-size: 16px;
    color: #d1cab3;
    -webkit-appearance: none;
    appearance: none;
  }

  .phone-more-search input::placeholder {
    color: #858176;
    opacity: 1;
  }

  .phone-more-list,
  .phone-more-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .phone-more-list > li {
    border-bottom: 1px solid #363224;
  }

  .phone-more-list:last-child > li:last-child {
    border-bottom: 0;
  }

  .phone-more-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 16px 0 14px;
    font-size: 16px;
    font-weight: bold;
    color: #e7f5b8;
    list-style: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  .phone-more-summary::-webkit-details-marker {
    display: none;
  }

  .phone-more-summary:hover {
    color: #fff;
  }

  .phone-more-arrow {
    font-size: 11px;
    color: #e9bd7f;
  }

  .phone-more-group[open] .phone-more-arrow {
    transform: rotate(180deg);
  }

  .phone-more-group ul {
    padding-bottom: 6px;
  }

  .phone-more-entry {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 14px 10px 28px;
    font-size: 15px;
    line-height: 20px;
    color: #e9bd7f;
    -webkit-tap-highlight-color: transparent;
  }

  .phone-more-item {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 16px;
    font-weight: bold;
    line-height: 20px;
    color: #e7f5b8;
    -webkit-tap-highlight-color: transparent;
  }

  .phone-more-entry:hover,
  .phone-more-entry:focus,
  .phone-more-item:hover,
  .phone-more-item:focus {
    color: #fff;
    text-decoration: none;
  }

  .phone-more-entry:focus-visible,
  .phone-more-item:focus-visible,
  .phone-more-summary:focus-visible {
    outline-offset: -3px;
  }

  /* The page you're on (DECISIONS 132): white, with a gold bar at its left edge. */
  .phone-more-entry[aria-current='page'],
  .phone-more-item[aria-current='page'] {
    color: #fff;
    box-shadow: inset 3px 0 0 #e9bd7f;
  }

  /* /menu: the panel is the page; the wide-screen pointer to the menu bar isn't needed. */
  .phone-more-page {
    margin-top: 6px;
  }

  .menu-page-wide {
    display: none;
  }
}
