/* AstronomyLive Mobile Menu
   On phones the header is one calm row: the logo and, right of LIVE, three red lines.
   A tap on the lines unfolds everything else of the header (menu, account, night mode,
   language, log out) in a panel underneath. On wider screens nothing changes. */

/* desktop and tablet: the button does not exist, the wrapper does not take part in the layout */
#al-area-header .al-mm-btn { display: none; }
#al-area-header .al-mm-panel,
#al-area-header .al-mm-inner { display: contents; }

@media (max-width: 760px) {
  /* ---------------------------------------------------------------- the header row */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) {
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    height: 68px !important;
    min-height: 68px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    gap: 10px !important;
    row-gap: 0 !important;
    overflow: visible !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-area-brand {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: calc(100% - 46px) !important;
    order: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-area-brand img {
    display: block;
    max-width: 100% !important;
    height: auto !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-area-tagline { display: none !important; }

  /* until the panel is built (a split second at most), menu and account stay out of the row */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) > nav,
  html:root body #al-area-header#al-area-header:not(#al-mm-x) > .al-area-account,
  html:root body #al-area-header#al-area-header:not(#al-mm-x) > .al-lang { display: none !important; }

  /* -------------------------------------------------------------- the three red lines */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-btn {
    display: inline-flex !important;
    order: 1 !important;
    flex: none !important;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 44px;
    height: 44px;
    margin: 0 -9px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px;
    background: transparent !important;
    box-shadow: none !important;
    color: #FD605B;            /* the red of LIVE in the logo */
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color .25s ease;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-btn:focus-visible {
    outline: 2px solid rgba(253, 96, 91, .55);
    outline-offset: 0;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-btn:active {
    background: rgba(253, 96, 91, .10) !important;
  }
  #al-area-header .al-mm-lines {
    position: relative;
    display: block;
    width: 26px;
    height: 20px;
  }
  #al-area-header .al-mm-lines .al-mm-l {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    transform-origin: 50% 50%;
    transition: transform .42s cubic-bezier(.45, 0, .2, 1), opacity .25s ease, top .42s cubic-bezier(.45, 0, .2, 1);
  }
  #al-area-header .al-mm-lines .al-mm-l:nth-child(1) { top: 0; }
  #al-area-header .al-mm-lines .al-mm-l:nth-child(2) { top: 8.5px; }
  #al-area-header .al-mm-lines .al-mm-l:nth-child(3) { top: 17px; }
  /* open: the lines fold into a cross */
  #al-area-header.al-mm-open .al-mm-lines .al-mm-l:nth-child(1) { top: 8.5px; transform: rotate(45deg); }
  #al-area-header.al-mm-open .al-mm-lines .al-mm-l:nth-child(2) { opacity: 0; transform: scaleX(.2); }
  #al-area-header.al-mm-open .al-mm-lines .al-mm-l:nth-child(3) { top: 8.5px; transform: rotate(-45deg); }

  /* ------------------------------------------------------------------- the panel */
  /* the header row gets a solid background while the panel is open */
  html:root body #al-area-header#al-area-header:not(#al-mm-x)::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: calc(50% - 50vw);
    width: 100vw;
    background: #06090c;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }
  html:root body #al-area-header#al-area-header.al-mm-open:not(#al-mm-x)::before { opacity: 1; }

  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-panel {
    display: grid !important;
    grid-template-rows: 0fr;
    position: absolute;
    z-index: 2;
    top: 100%;
    left: calc(50% - 50vw);
    width: 100vw;
    margin: 0 !important;
    background: #06090c;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .07), 0 28px 50px rgba(0, 0, 0, .6);
    visibility: hidden;
    transition: grid-template-rows .45s cubic-bezier(.45, 0, .2, 1), visibility 0s linear .45s;
  }
  html:root body #al-area-header#al-area-header.al-mm-open:not(#al-mm-x) .al-mm-panel {
    grid-template-rows: 1fr;
    visibility: visible;
    transition: grid-template-rows .45s cubic-bezier(.45, 0, .2, 1), visibility 0s linear 0s;
  }
  /* the page underneath dims a little, so the panel stands out */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-panel::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(2, 4, 6, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .4s ease;
  }
  html:root body #al-area-header#al-area-header.al-mm-open:not(#al-mm-x) .al-mm-panel::after { opacity: 1; }

  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner {
    display: block !important;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 27px;
    opacity: 0;
    transition: opacity .3s ease;
  }
  html:root body #al-area-header#al-area-header.al-mm-open:not(#al-mm-x) .al-mm-inner {
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 1;
    transition: opacity .35s ease .08s;
  }

  /* menu links: one under the other, large enough for a thumb */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    order: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 8px 0 14px !important;
    gap: 0 !important;
    overflow: visible !important;
    scrollbar-width: none;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav a {
    display: inline-flex !important;
    align-items: center !important;
    height: 50px !important;
    padding: 0 !important;
    font-size: 20px !important;
    font-weight: 500 !important;
    letter-spacing: -.01em;
    white-space: nowrap;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav a::after { bottom: 8px !important; }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav a + a { margin: 0 !important; }

  /* account, night mode, language and log out underneath */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    order: 0 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 18px 0 24px !important;
    gap: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 15px !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account > a.al-area-dashboard {
    flex: 1 1 30% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 44px;
    box-sizing: border-box;
    padding: 10px 8px !important;
    font-size: 15px !important;
    text-align: center;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account > .al-night-toggle { order: 5; }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account > .al-lang { order: 6; margin: 0 !important; }
  /* profile picture first in the row, next to Dashboard and Account */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account > .al-area-avatar {
    order: 0;
    flex: none !important;
    margin: 0 !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner .al-area-account > a:not(.al-area-dashboard):not(.al-area-avatar) {
    order: 7;
    margin-left: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    min-height: 44px;
    padding: 0 2px !important;
    font-size: 15px !important;
  }
}

@media (max-width: 760px) and (max-height: 560px) {
  /* phone held sideways: the links side by side in two columns */
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px !important;
  }
  html:root body #al-area-header#al-area-header:not(#al-mm-x) .al-mm-inner nav a {
    height: 42px !important;
    font-size: 17px !important;
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  #al-area-header .al-mm-lines .al-mm-l,
  #al-area-header .al-mm-panel,
  #al-area-header .al-mm-inner,
  #al-area-header .al-mm-panel::after,
  #al-area-header::before { transition: none !important; }
}
