/* Navbar title when the navbar is collapsed behind the menu button.
   Quarto clips the title with an ellipsis once it runs out of room, so on
   phones the book's name was cut ("The Biosecurity H...") and the search
   button wrapped onto a second row. On wider collapsed screens Quarto places
   the title just after the menu button rather than in the middle.
   Below 768px the title may wrap to two balanced lines and every control
   stays on one row; from 768px until the navbar expands, the title sits in
   the middle of the bar. The title text itself is unchanged.
   The same file ships in all four handbooks (Life Sciences adds one block
   at the end); each book's own collapse point is matched through Quarto's
   navbar-expand-* class. */

@media (max-width: 767.98px) {
  #quarto-header .navbar .navbar-container {
    flex-wrap: nowrap;
  }

  #quarto-header .navbar .navbar-brand-container {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 0;
    max-width: none;
    margin: 0 0.125rem !important;
  }

  #quarto-header .navbar .navbar-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding: 2px 0;
    margin: 0;
    overflow: visible;
    white-space: normal;
  }

  #quarto-header .navbar .navbar-title {
    display: block;
    font-size: 1rem !important;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: normal;
  }

  #quarto-header .navbar .quarto-navbar-tools,
  #quarto-header .navbar #quarto-search {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  #quarto-header .navbar .quarto-navbar-tools {
    display: flex;
    align-items: center;
  }

  #quarto-header .navbar #quarto-search {
    margin-left: 0;
  }

  #quarto-header .navbar .navbar-toggler {
    margin-right: 0.25rem;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  #quarto-header .navbar.navbar-expand-lg .navbar-container,
  #quarto-header .navbar.navbar-expand-xl .navbar-container,
  #quarto-header .navbar.navbar-expand-xxl .navbar-container {
    position: relative;
  }

  #quarto-header .navbar.navbar-expand-lg .navbar-brand-container,
  #quarto-header .navbar.navbar-expand-xl .navbar-brand-container,
  #quarto-header .navbar.navbar-expand-xxl .navbar-brand-container {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: calc(100% - 22rem);
    transform: translate(-50%, -50%);
  }

  #quarto-header .navbar.navbar-expand-lg .navbar-brand,
  #quarto-header .navbar.navbar-expand-xl .navbar-brand,
  #quarto-header .navbar.navbar-expand-xxl .navbar-brand {
    margin-right: 0;
  }

  #quarto-header .navbar.navbar-expand-lg .quarto-navbar-tools,
  #quarto-header .navbar.navbar-expand-xl .quarto-navbar-tools,
  #quarto-header .navbar.navbar-expand-xxl .quarto-navbar-tools {
    margin-left: auto;
  }

  #quarto-header .navbar.navbar-expand-lg #quarto-search,
  #quarto-header .navbar.navbar-expand-xl #quarto-search,
  #quarto-header .navbar.navbar-expand-xxl #quarto-search {
    margin-left: 0.25rem;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  #quarto-header .navbar.navbar-expand-xl .navbar-container,
  #quarto-header .navbar.navbar-expand-xxl .navbar-container {
    position: relative;
  }

  #quarto-header .navbar.navbar-expand-xl .navbar-brand-container,
  #quarto-header .navbar.navbar-expand-xxl .navbar-brand-container {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: calc(100% - 22rem);
    transform: translate(-50%, -50%);
  }

  #quarto-header .navbar.navbar-expand-xl .navbar-brand,
  #quarto-header .navbar.navbar-expand-xxl .navbar-brand {
    margin-right: 0;
  }

  #quarto-header .navbar.navbar-expand-xl .quarto-navbar-tools,
  #quarto-header .navbar.navbar-expand-xxl .quarto-navbar-tools {
    margin-left: auto;
  }
}

@media (min-width: 1200px) and (max-width: 1399.98px) {
  #quarto-header .navbar.navbar-expand-xxl .navbar-container {
    position: relative;
  }

  #quarto-header .navbar.navbar-expand-xxl .navbar-brand-container {
    position: absolute;
    top: 50%;
    left: 50%;
    max-width: calc(100% - 22rem);
    transform: translate(-50%, -50%);
  }

  #quarto-header .navbar.navbar-expand-xxl .navbar-brand {
    margin-right: 0;
  }

  #quarto-header .navbar.navbar-expand-xxl .quarto-navbar-tools {
    margin-left: auto;
  }
}

/* Life Sciences only: styles/reader-experience.css gives each navbar tool a
   44px minimum width below 768px, which left the title a one-word column.
   32px keeps the targets above the 24px WCAG 2.2 minimum and lets the title
   fit on one line. */
@media (max-width: 767.98px) {
  #quarto-header .navbar .quarto-navbar-tools .quarto-navigation-tool {
    min-width: 32px;
  }
}
