/* Shared navigation bar.
 *
 * Include this BEFORE the page stylesheet, which supplies the colors:
 *   :root { --bar-color: #177FD7; --bar-hover: darkblue; }
 *
 * Everything here is sized explicitly. The bar used to rely on the static
 * position of a fixed element and on `line-height: normal` (which derives
 * from the font's own ascent/descent metrics) -- both of which resolve
 * differently in Safari on macOS, which clipped the top of the bar and let
 * the buttons hang below it.
 */

@font-face {
  font-family: GothamBold;
  src: url('fonts/gotham/GothamBold.woff') format('woff');
}

:root {
  --bar-height: 48px;
  /* Fallbacks; page stylesheets override these. */
  --bar-color: #177FD7;
  --bar-hover: darkblue;
}

/* `html body` (specificity 0,0,2) so this survives the Meyer reset in
   projects.css, which sets `body { margin: 0; padding: 0 }` at 0,0,1 and is
   loaded after this file -- at equal specificity the reset would win on
   source order and drop the content behind the fixed bar. */
html body {
  margin: 0;
  padding-top: var(--bar-height);
}

.bar {
  /* Explicit placement: never resolved from the static position. */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  z-index: 100;

  display: flex;
  flex-direction: row;
  align-items: stretch;

  height: var(--bar-height);
  margin: 0;
  padding: 0;
  border: 0;
  float: none;

  list-style-type: none;
  background-color: var(--bar-color);
}

.bar li {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  float: none;
  list-style-type: none;
}

/* Page title sits left; everything after it is pushed to the right edge. */
.bar .bartitle {
  margin-right: auto;
  min-width: 0;
}

.bar .bartitle h1 {
  font-family: GothamBold, Helvetica, Arial, sans-serif;
  font-size: 26pt;
  line-height: 1;
  color: #FCFCFC;
  margin: 0 0 0 13px;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar li a {
  display: flex;
  align-items: center;
  height: 100%;
  box-sizing: border-box;

  font-family: GothamBold, Helvetica, Arial, sans-serif;
  font-size: 20px;
  line-height: 1;
  color: #FCFCFC;
  background-color: var(--bar-color);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;

  margin: 0;
  padding: 0 16px;
  border: 0;
  border-left: 3px solid var(--bar-color);

  -webkit-appearance: none;
  appearance: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bar li a:hover,
.bar li a:active {
  background-color: var(--bar-hover);
}

/* Narrow viewports: let the bar shed padding before it sheds items. */
@media (max-width: 640px) {
  .bar .bartitle h1 {
    font-size: 18pt;
  }

  .bar li a {
    font-size: 16px;
    padding: 0 9px;
  }
}
