/* R */

/*
TODO
- remove highlights
- fallback for non popover
    if popover
      header / split
      show open/close buttons
- better position for open/close button
*/

/* CSS enhancements for native popovers */
/*
@supports selector([popover]:popover-open) { 
  [popover]:popover-open {
    opacity: 1;
  }
}
*/

#mobile-menu-btn-show,
#mobile-menu-btn-close {
  display: none;
}
#mobile-menu {
  border: none;
}
/* Fallback styles */
@supports not selector([popover]:popover-open) {
  header {
    display: block !important;
  }
  #mobile-menu {
    display: block;
    position: relative;
    width: 100%;
  }
}
@supports selector([popover]:popover-open) { 
  #mobile-menu-btn-show,
  #mobile-menu-btn-close {
    display: block;
  }
  #mobile-menu-btn-show {
    cursor: pointer;
  }
  #mobile-menu-btn-close {
    width: fit-content;
    cursor: pointer;
    /*position: absolute;*/
    top: 1rem;
    right: 1em;
    order: -1; /* move to top */
    align-self: flex-end;
  }
  #mobile-menu {
    --color-link: var(--color-light);
    display: none;
    /*
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.5rem;  
    inset: unset;
    top: 0;
    right: 0;
    */
    /*
    background-color: #fff;
    padding: 1rem 0.25rem 0 1.5rem;
    height: 100%;
    */
    background: var(--color-primary);
  }
  #mobile-menu:popover-open {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1.5rem;  
    inset: unset;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 2em;
    overflow-y: auto;
    /*max-inline-size: 1920px;*/
  }
  #mobile-menu::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
  }

  /*
  #mobile-menu a {
    width: fit-content;
  }
  */
  @media screen and (orientation: landscape) and (min-width: 1024px) {
    #mobile-menu-btn-close {
      position: static;
      justify-self: flex-end;
    }
    /*
    #mobile-menu:popover-open {
      display: grid;
      grid-template-columns: auto 1fr;
      grid-template-columns: 1px 1fr;
      grid-template-rows: auto;
      grid-template-areas:
        "empty button"
        "highlights navigation"
        "bottomleft text";
    }
    */
    #mobile-menu:popover-open {
      display: grid;
      grid-template-columns:
        minmax(0, 1fr)
        minmax(0, 100%)
        minmax(0, 1fr);
      grid-template-rows: auto;
      grid-template-areas:
        "highlights button empty"
        "highlights navigation empty"
        "highlights text empty";
    }
    /* Middle column cap */
    @supports (width: clamp(0px, 100%, 1823px)) {
      #mobile-menu:popover-open {
        grid-template-columns:
          minmax(0, 1fr)
          clamp(0px, calc(100% - 2em), 1823px)
          minmax(0, 1fr);
        gap: 1em;
      }
    }
    #mobile-menu:popover-open > *:first-child {
      grid-area: highlights;
    }
    #mobile-menu:popover-open > *:nth-child(2) {
      grid-area: navigation;
    }
    #mobile-menu:popover-open > *:nth-child(3) {
      grid-area: text;
    }
    #mobile-menu:popover-open > *:last-child {
      grid-area: button;
    }
  }
}






/********************************************************
 CHECK
 ********************************************************/

 /*
@media screen and (orientation: landscape) and (min-width: 1024px) {
  #mobile-menu:popover-open {
    flex-flow: row wrap;
    gap: 0;
  }
}
*/
/*
header {
  display: flex;
  justify-content: space-between;
}
#desktop-menu {
  display: flex;
  gap: 1.5rem;
}
*/
/*
@media (max-width: 7680px) {
  #desktop-menu {
    display: none;
  }
  #mobile-menu-btn-show {
    display: flex;
		display: block;
  }
}
*/