/* The work layout's top bar, set like a running head on one rule: the site name in small capitals, an italic search field, and on
   narrow screens the Files and Contents buttons (set as small-capital words) that open c-sidebar and c-toc as panels.
   <header class="c-topbar"><button class="c-topbar__button c-topbar__button--menu" aria-controls="sidebar" aria-expanded="false">
   Files</button><a class="c-topbar__home">Iron and Salt</a><form class="c-topbar__search-form" role="search"><input
   class="c-topbar__search" type="search" name="q"></form><button class="c-topbar__button c-topbar__button--toc">Contents</button>
   </header> */

.c-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  border-bottom: var(--stroke-hair) solid var(--color-rule);
  background-color: var(--color-paper);
  background-image: var(--paper-grain);
}

.c-topbar__home { flex: 0 1 auto; overflow: hidden; color: inherit; font-size: 1.2rem; font-variant-caps: all-small-caps; letter-spacing: var(--tracking-caps-wide); text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }

.c-topbar__search-form { display: flex; flex: 1 1 12rem; min-width: 0; max-width: 24rem; margin-left: auto; }

.c-topbar__search {
  width: 100%;
  padding: var(--space-1) 0;
  border: 0;
  border-bottom: var(--stroke-hair) solid var(--color-rule);
  border-radius: 0;
  background: transparent;
  font-style: italic;
}
/* The rule under the field darkens to the ink on focus: the field's focus indicator, in place of the outline. */
.c-topbar__search:focus-visible { outline: none; border-bottom-color: var(--color-ink); }

.c-topbar__button {
  display: none;
  padding: var(--space-1) var(--space-2);
  border: 0;
  background: transparent;
  font-size: 1.1rem;
  font-variant-caps: all-small-caps;
  letter-spacing: var(--tracking-caps);
}

/* Below --bp-toc there is no room for "On this page" beside the text: Contents opens it as a panel. */
@media (max-width: 88rem) {
  .c-topbar__button--toc { display: block; }
}

/* Below --bp-sidebar the file tree is a panel too, opened with Files. */
@media (max-width: 56rem) {
  .c-topbar { gap: var(--space-2); padding: 0 var(--space-3); }
  .c-topbar__button--menu { display: block; }
}

/* On a phone the site name gives its room to the search field. */
@media (max-width: 36rem) {
  .c-topbar__home { display: none; }
  .c-topbar__search-form { margin-left: 0; }
}

@media print {
  .c-topbar { display: none; }
}
