/* Dropdown under a menu item in the Asar menu (first used by TTRPG; Daniel, 14 Nov 2026).
   Markup, in usersc/templates/asar/header.php:
     <li class="nav-drop"><a class="nav-drop-toggle">TTRPG</a><ul class="nav-drop-menu"><li><a>...</a></li></ul></li>
   It opens on mouse-over (devices with a mouse) and on click or tap (assets/js/nav-dropdown.js adds .open).
   Colours and type are the menu's own variables from style.css, so it follows the bar in every colour mode.
   Kept in its own file so that a saved copy of style.css in a browser can never meet the new menu markup. */
.nav-menu li.nav-drop { position: relative; }
.nav-menu .nav-drop-toggle { white-space: nowrap; }
.nav-menu .nav-drop-toggle .fa { font-size: 0.7em; margin-left: 4px; vertical-align: 0.1em; transition: none; }

/* A strip under the item, so the mouse can travel from "TTRPG" down to the list without it closing. */
.nav-menu li.nav-drop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; }

.nav-menu ul.nav-drop-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 998;
  min-width: 13em;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  margin: 0;
  padding: 6px 0 8px;
  list-style: none;
  text-align: left;
  background: var(--menu-background);
  border: var(--menu-bottom-border);
  border-radius: 12px;
  transition: none;
}
/* In the top bar the list hangs from the bar's own purple line. */
#header.header-top .nav-menu ul.nav-drop-menu { border-radius: 0 0 12px 12px; }
/* On the home page the menu sits low on the screen. When the list would run off the bottom, nav-dropdown.js adds
   .up and the list opens upward instead; it also limits the height to the room there is (the list then scrolls). */
.nav-menu li.nav-drop.up > ul.nav-drop-menu { top: auto; bottom: calc(100% + 6px); }
.nav-menu li.nav-drop.up::after { top: auto; bottom: 100%; }

.nav-menu li.nav-drop.open > ul.nav-drop-menu { display: block; }
@media (hover: hover) and (pointer: fine) {
  .nav-menu li.nav-drop:hover:not(.shut) > ul.nav-drop-menu { display: block; }
}

.nav-menu ul.nav-drop-menu li { margin: 0; transition: none; }
.nav-menu ul.nav-drop-menu a {
  padding: 5px 18px;
  font-size: 16px;
  text-transform: uppercase;
  white-space: nowrap;
}
/* The menu's purple underline, kept under the words instead of the whole row. */
.nav-menu ul.nav-drop-menu a:before { left: 18px; bottom: 3px; }
.nav-menu ul.nav-drop-menu a:hover:before,
.nav-menu ul.nav-drop-menu li:hover > a:before,
.nav-menu ul.nav-drop-menu a[aria-current="page"]:before { visibility: visible; width: calc(100% - 36px); }
.nav-menu ul.nav-drop-menu a[aria-current="page"] { color: #fff; }
.nav-menu ul.nav-drop-menu a:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* A purple rule between the generators and the signed-in person's own pages. */
.nav-menu ul.nav-drop-menu li.nav-drop-sep { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--asar-purple); }

/* Fingers need taller rows than a mouse does. */
@media (pointer: coarse) {
  .nav-menu ul.nav-drop-menu a { padding-top: 10px; padding-bottom: 10px; }
  .nav-menu ul.nav-drop-menu a:before { bottom: 8px; }
}

/* Phones: the bar is already full, so the arrow is left off (a tap still opens the list), and the list is pinned
   to the right edge of the screen under the bar, where it can never be cut off. */
@media (max-width: 576px) {
  .nav-menu .nav-drop-toggle .fa { display: none; }
  #header.header-top .nav-menu ul.nav-drop-menu { position: fixed; top: 39px; right: 0; border-right: 0; border-radius: 0 0 0 12px; }
}

/* Phones, since EVENTS joined the bar (14 Nov 2026): six words and the store icon no longer fit at 16px, so the
   words and the gaps between them are a little smaller on narrow screens. Wider screens are unchanged. */
@media (max-width: 480px) {
  .nav-menu a { font-size: 14px; }
  .nav-menu li + li { margin-left: 4px; margin-right: 4px; }
  .nav-menu .home-nav { margin-right: 4px; }
}
@media (max-width: 359px) {
  .nav-menu a { font-size: 12.5px; }
  .nav-menu li + li { margin-left: 3px; margin-right: 3px; }
  .nav-menu .home-nav { margin-right: 3px; }
}

/* Lists whose lines are typed by a person (the EVENTS list is Mage's event types): a very long name can never push
   the list off the screen; it is cut with three dots instead. */
.nav-menu ul.nav-drop-menu { max-width: calc(100vw - 12px); }
.nav-menu ul.nav-drop-menu a { overflow: hidden; text-overflow: ellipsis; }

/* Phones, home page (the menu sits in the middle of the screen, not in the top bar): the list is as wide as the
   whole menu and hangs from it, so it can never run off the left or right edge whichever word opened it. */
@media (max-width: 576px) {
  #header:not(.header-top) .nav-menu { position: relative; }
  #header:not(.header-top) .nav-menu li.nav-drop { position: static; }
  #header:not(.header-top) .nav-menu li.nav-drop::after { display: none; }
  #header:not(.header-top) .nav-menu ul.nav-drop-menu { left: 0; right: 0; min-width: 0; }
}

/* The gear (admin) dropdown at the top right (Daniel, 14 Nov 2026), in place of the store manager wrench.
   #top is see-through (60%) in style.css; here only its icons are, so the open list is solid and readable. */
#top { opacity: 1; }
#top > div > a, #top .nav-drop-toggle { opacity: 0.6; }
#top .nav-drop-toggle:hover, #top li.nav-drop.open > .nav-drop-toggle { opacity: 1; }
#top ul.top-drop { display: inline-block; margin: 0; padding: 0; list-style: none; }
#top li.nav-drop { position: relative; display: inline-block; }
#top li.nav-drop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; }
#top ul.nav-drop-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: -8px; z-index: 100002;
  min-width: 13em; max-width: calc(100vw - 12px); margin: 0; padding: 6px 0 8px; list-style: none; text-align: left;
  background: var(--menu-background); border: var(--menu-bottom-border); border-radius: 12px;
}
#top li.nav-drop.open > ul.nav-drop-menu { display: block; }
@media (hover: hover) and (pointer: fine) {
  #top li.nav-drop:hover:not(.shut) > ul.nav-drop-menu { display: block; }
}
#top li.nav-drop.up > ul.nav-drop-menu { top: auto; bottom: calc(100% + 6px); }
#top ul.nav-drop-menu a { display: block; padding: 5px 18px; font-size: 15px; text-transform: uppercase; white-space: nowrap; color: #fff; }
#top ul.nav-drop-menu a:hover { color: var(--asar-red); }
#top ul.nav-drop-menu a:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* The top bar on screens narrower than 768px, since TCG joined the bar (15 Nov 2026). The round logo shows there
   and covered HOME, and seven words no longer fit. So HOME is left out (the logo is now a link home), and the words
   are a little smaller on the narrowest phones and on small tablets. The home page's middle menu and screens 768px
   and wider are unchanged. Checked at 320, 360, 375, 414, 480, 576, 600, 700, 768 and 1024px. */
@media (max-width: 767.98px) {
  #header.header-top .nav-menu .home-nav { display: none !important; }
}
@media (min-width: 577px) and (max-width: 767.98px) {
  #header.header-top .nav-menu a { font-size: 16px; }
  #header.header-top .nav-menu li + li { margin-left: 6px; margin-right: 6px; }
}
@media (max-width: 480px) {
  #header.header-top .nav-menu li + li { margin-left: 3px; margin-right: 3px; }
}
@media (max-width: 400px) {
  #header.header-top .nav-menu a { font-size: 13px; }
}
@media (max-width: 359px) {
  #header.header-top .nav-menu a { font-size: 11.5px; }
  #header.header-top .nav-menu li + li { margin-left: 2px; margin-right: 2px; }
}
