@charset "utf-8";
@use "util";
@use "base/colors";
@use "base/lengths";
@use "base/mixins";

/**
 * Media rules for different screen sizes.
 * This will override some basic rules.
 */

lengths.$standard-margin: 4px;

// (orientation: portrait),
@media all and (max-width: 42.5em) {
  body,
  #search > ol,
  #search div.snippet > span,
  header,
  header input,
  div#resultinfo,
  #pagination > a {
    font-size: 9pt;
  }

  header {
    padding-top: 3rem;

    &.shifted {
      padding-left: 0;
    }
  }
  
  header form {
    margin: 1.5rem 1rem;
    padding-left: 0;

    &#searchform {
      margin: 2.5rem 1rem 0 1rem;
    }
  }

  .navbar {
    *:not(:first-child) {
      display: none;
    }

    a.logo > h1 {
      margin-left: 0;
    }

    .burger-icon {
      position: relative;
      display: none;
      width: lengths.$standard-size-and-spacing;
      height: lengths.$standard-size-and-spacing;
      font-size: 1.8rem;
      color: colors.$nearly-white;

      &.show {
        display: block;
        cursor: pointer;
      }

      &::after {
        position: absolute;
        top: 2rem;
        left: 2rem;
        transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -webkit-transform: translate(-50%, -50%);
      }
    }

    &.show .burger-icon {
      position: absolute;
      top: 0;
      right: 0;
      background-color: colors.$middle-green;
    }

    &.show * {
      display: block;
    }

    &-group {
      margin-top: lengths.$standard-size-and-spacing;
      width: 100%;
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      background-color: colors.$middle-green;

      fieldset.fieldset-login {
        display: block !important;
        margin-right: 0 !important;
        padding: 1rem;

        form.login {
          align-items: normal !important;
          flex-direction: column;
          gap: 8px;
          
          input[type=text],
          input[type=password] {
            @include mixins.input-field;
            margin-right: 0 !important;
          }
    
          button.btn-login {
            width: 100% !important;
            align-self: center;
            background-color: colors.$dark-green !important;

            &:hover {
              background-color: colors.$middle-green !important;
              color: unset !important;
            }
          }
        }
      }

      h3.nav-link {
        height: 2rem;
  
        a {
          padding: .75rem !important;
        }
      }
      
      p {
        padding: 1rem 0 0;
  
        a {
          display: inline;
        }
      }
    }
    
    .dropdown {
      margin-right: 0 !important;

      &-btn {
        &.login {
          display: none;

          & + .dropdown-content {
            margin-top: 0;
          }
        }

        &.profile {
          & + .dropdown-content {
            margin-top: 3.9rem;
          }
        }

        h3.user-name {
          max-width: unset;
          overflow: unset;
        }
      }

      &-content {
        display: block !important;
        width: 100% !important;

        form.login {
          input[type=text],
          input[type=password] {
            width: 100%;
          }
        }

        p {
          a {
            display: inline;
          }
        }
      }
    }
  }

  .vc {
    font-size: 9pt;
    .builder {
      .doc {
        padding-left: 3em;
      }
      * .docGroup {
        margin-left: 3em;
      }
      > .doc {
        padding-left: .5em;
      }
      > .docGroup {
        margin-left: .5em;
      }
    }
  }

  h1 {
    margin-left: 0px;
    width: 130px;
    height: 40px;
    background: {
      size: 100%;
      position: 50% 0;
    }
    z-index: 110;
    position: absolute !important;
    top: 50%;
    transform: translateY(-50%);
    -o-transform: translateY(-50%);;
    -moz-transform: translateY(-50%);
    -webkit-transform: translateY(-50%);
  }

  #searchbar {
    padding-right: 30px;
    margin-top: 0;
    input#q-field {
      font-size: 9pt;
      border-radius: 6px 0 0 6px;
    }
    button[type=submit] {
      right: 0;
    }
  }

  .level-1 {
    padding-bottom: 2px;
  }

  .level-2 {
    padding-bottom: 4px;
  }

  main {
    padding: 1rem;
    margin-left: lengths.$standard-margin;
    margin-right: lengths.$standard-margin;

    &.shifted {
      padding-left: 0;
    }
  }

  header .button {
    margin-right: lengths.$standard-margin;
    &.top {
      height: auto;
    }
  }

  #search ol {
    > li:target, > li.active {
      > div > div.snippet {
	      margin: 2px 2em 2px 4px;
      }
    }
    > li div.meta {
      display: none;
    }
  }

  div.matchinfo {
    font-size: 9pt;
  }

  div.matchtable tr > * {
    padding: 1pt 3pt;
  }

  div.matchtree { //, div.metatable {
    h6 {
      display: block;
      float: none;
    }
    > div { // , > dl {
      margin-left: 2px;
    }
  }
  
  #logos {
    margin-left: 0;
    margin-right: 0;

    > div {
      border-top-width: 14px;
      padding-right: 0;
      .logo > * {
        background: {
          size: 60%;
          position: 0 0;
        }
      }
    }
  }

  .logo > * {
    > div.logoaddon {
      // right: -1.2rem;
      // top: 1.4rem;
      right: -2.4rem;
      top: 1.6rem;
    }
  }

  div.intro {
    width: 100%;
  }

  body.embedded aside > div {
    top: 0;
    transform: translateY(0);
  }
  
  aside {
    &:not(:focus):not(.active) {
      margin-left: -1 * lengths.$logo-left-distance;
      &::after {
	      font-size: 12pt;
	      height: 11pt;
        text-align: right;
        padding-right: 3pt;
        padding-top: 2pt;
      }
    }
    ul {
      font-size: 9pt;
      line-height: 1em;
    }
    // &.active ~ main div.intro,
    // &.active ~ main.page {
    //   margin-left: $standard-margin !important;
    // }

    &.active {
      position: relative;
      display: block;
      padding-top: 0;
      width: 100%;
      top: 0;
      border-width: 0;

      fieldset input {
        font-size: 9pt;
      }
      &::after {
        display: none;
      }
      p, hr {
        display: none;
      }
    }

    .nav.nav-doc:first-child {
      margin-top: lengths.$standard-size-and-spacing !important;
    }
  }

  #tutorial {
    border-radius: 0;
    border-width: 0;
    right: 0;
    left: 0;
    bottom: 0;
    top: 0;
    padding: 0;
    iframe {
      border-radius: 0;
    }
    > ul.action.right {
      height: 1.5em;
      right: 20px;
      border-bottom-left-radius: 5px;
      border-bottom-right-radius: 5px;
    }
  }

  // main.page {
  //   margin-right: 20px;
  // }

  footer {
    padding-left: 0 !important;
    padding-top: 2rem;
    flex-direction: column;
    height: unset;
    nav {
      margin-left: 1em;
      height: auto;
      flex-direction: column;
      div {
        margin-left: 0;
        &:after {
          content: "";
        }
      }
    }
  }
}

@media all and (max-width: 32em) {
  footer {
    padding-top: 1em;
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    div#logos {
      margin: auto;
    }
  }
}

@media print {
  body, html, select, g > text {
    color: black;
  }
  header, aside {
    display: none;
  }
  main.page {
    margin: 1em;
  }
  a.embedded-link {
    color: black;
    text-decoration: underline;
  }
  pre.query.tutorial {
    background-color: white;
    color: black;
    margin-left: 1em;
    margin-right: 1em;
  }
  blockquote.warning {
    background-color: grey;
    color: white;
    border-left-color: black;
    border-left-width: 1em;
  }
}
