/* Asar Dynasty as an installed app (loaded on every page from usersc/includes/head_tags.php).
 * 1. The "Install App" button, centred between the logo and the menu (Daniel, 15 Nov 2026); install-button.js
 *    hides it inside the installed app. Its help note (#install-help) for browsers that cannot install by button.
 * 2. Desktop title-bar mode (window-controls-overlay): the Asar menu bar moves into the title-bar strip, beside the
 *    window's own buttons. Everything for it sits inside the display-mode query, so an ordinary browser tab keeps
 *    the Asar look exactly as it is. Same idea as JW Cruises' P11 block.
 */
#header #install[hidden] { display: none !important; }
#header #install {
  flex: 0 0 auto;
  margin: 0 auto;
  white-space: nowrap;
  font-size: 0.75rem;
  line-height: 1.4;
}
/* Asar colours, not Bootstrap blue. */
#header #install { background: var(--asar-purple, #8c44ad); border-color: var(--asar-purple, #8c44ad); color: #fff; }
#header #install:hover, #header #install:focus-visible { background: var(--asar-red, #fa3232); border-color: var(--asar-red, #fa3232); }
/* Phones and small tablets: the round logo sits at the left and the menu fills the bar, so the button is just its
   icon, in the gap right of the logo. */
@media (max-width: 767px) {
  #header.header-top #install { margin: 0 4px 0 44px; padding: 0 6px; }
  #header.header-top #install .install-label { display: none; }
}
/* While the button shows, the empty title stops pushing the menu right; the button's own auto margins centre it. */
#header .container:has(> #install:not([hidden])) > h1 { margin-right: 0; }
#install-help {
  position: fixed;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100002;
  width: min(92vw, 360px);
  padding: 12px 14px;
  background: #000;
  color: #fff;
  border: 1px solid var(--asar-purple, #8c44ad);
  border-radius: 10px;
  font-size: 0.95rem;
  text-align: center;
}
#install-help p { margin: 0 0 8px; }
#install-help button {
  background: var(--asar-purple, #8c44ad);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 2px 18px;
}

@media (display-mode: window-controls-overlay) {
  #header.header-top {
    left: env(titlebar-area-x, 0);
    top: env(titlebar-area-y, 0);
    right: auto;
    width: env(titlebar-area-width, 100%);
    height: env(titlebar-area-height, 33px);
    -webkit-app-region: drag;
    app-region: drag;
  }
  #header #install { display: none !important; }
  /* The empty strip moves the window; everything you can press does not. */
  #header a, #header button, #header nav, #header form, #header .dropdown,
  #top a, #top button, #top li {
    -webkit-app-region: no-drag;
    app-region: no-drag;
  }
  /* The small sign-in and admin icons sit inside the strip, clear of the window's buttons. */
  #top { top: calc(env(titlebar-area-y, 0px) + (env(titlebar-area-height, 33px) - 20px) / 2); }
  #top div:first-child { left: calc(env(titlebar-area-x, 0px) + 8px); }
  #top div:last-child { right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100vw) + 8px); }
}
