/* The frame of every page (templates/base.html): the header with the lab's name, the navigation and
   the time in UTC; the page; the footer. On a phone the navigation folds behind a menu button
   (js/header.js); without the script it stays open, a row of its own under the name. */
.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  min-height: var(--header-height);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--title-size);
  line-height: var(--title-leading);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand span {
  font-weight: 400;
  color: var(--text-muted);
}

/* On a wide screen the menu is no box of its own: the navigation and the account sit in the header's
   row, in this order. */
.site-menu {
  display: contents;
}

.site-nav {
  order: 1;
  flex-grow: 1;
  display: flex;
  gap: var(--space-7);
}

.site-nav a {
  padding-bottom: var(--space-1);
  border-bottom: 1px solid transparent;
  color: var(--text-secondary);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--text);
}

/* To the right, also when there is no navigation, as before a sign-in. */
.clock {
  order: 2;
  margin-left: auto;
  font-size: var(--meta-size);
  color: var(--text-muted);
  white-space: nowrap;
}

.site-account {
  order: 3;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--meta-size);
  color: var(--text-secondary);
}

.site-account .button {
  padding: 0 var(--space-3);
  font-size: var(--meta-size);
}

/* The public site's way in, where the app's header has the account. */
.sign-in {
  order: 3;
  padding: 0 var(--space-3);
  font-size: var(--meta-size);
}

.menu-button {
  order: 4;
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.menu-button svg {
  width: 20px;
  height: 20px;
  stroke: currentcolor;
  stroke-width: 1.5;
  fill: none;
}

main {
  flex-grow: 1;
}

/* What a page with any illustrative panel says first, edge to edge under the header. */
.notice {
  padding: var(--space-3) var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-secondary);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-8);
  padding: var(--space-7) var(--gutter);
  border-top: 1px solid var(--line);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer .spacer {
  flex-grow: 1;
}

/* A narrow page, such as signing in. */
.narrow {
  width: min(100% - 2 * var(--gutter), 360px);
  margin: var(--space-22) auto;
  display: grid;
  gap: var(--space-6);
}

@media (max-width: 640px) {
  .site-header {
    flex-wrap: wrap;
    gap: 0 var(--space-3);
    padding: 0 var(--space-4) 0 var(--gutter);
  }

  /* The menu is a panel under the header's row, edge to edge: as wide as the row and its padding. */
  .site-menu {
    order: 5;
    flex: 0 0 calc(100% + var(--gutter) + var(--space-4));
    display: grid;
    margin: 0 calc(-1 * var(--space-4)) 0 calc(-1 * var(--gutter));
    border-top: 1px solid var(--line);
  }

  .site-nav {
    flex-direction: column;
    gap: 0;
  }

  .site-nav a,
  .site-account {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 var(--gutter);
    border-bottom: 1px solid var(--line);
    font-size: var(--label-size);
  }

  .site-nav a[aria-current="page"] {
    border-bottom-color: var(--line);
    box-shadow: inset 2px 0 var(--text);
  }

  .site-account {
    justify-content: space-between;
    padding-block: var(--space-2);
  }

  /* With the script, the menu opens and closes behind its button. */
  .site-header.has-menu .menu-button {
    display: inline-flex;
  }

  .site-header.has-menu:not([data-menu="open"]) .site-menu {
    display: none;
  }
}
