/* The header bar on every page without React: the root site's pages and the corpus sites'
   generated passage and book-index pages. Behaviour is /site-bar.js; the app draws the same
   bar with its own components (web-corpus/src/siteHeader.tsx, styles.css), so a change here
   is made there too.

   Until 2026-11-14 this was site.css's alone, and the passage pages kept a smaller bar of
   their own — logo, Ask, Read — so the corpus site's header lost the corpora, Study and the
   account the moment a reader opened a chapter (Jack). One stylesheet now, linked after
   /tokens.css by both kinds of page. Type and spacing are the look's tokens (2026-11-19): each
   design system sizes its own header (Danish law's tighter, the Bible's airier).

   Two lines (Jack, 2026-11-18: EU-lovgivning's style, made everyone's). The first is for going
   between collections: the logo, the links to other collections (pipeline/corpus_links.py:
   all three on the root site, the other law site on each law site, none on the Bible), and the
   account pushed to the end. The second, on a corpus site,
   is for going about this one: its sections as tabs and a page's own action. The root site
   has no second line. A look colours the second line (EU-lovgivning's blue band,
   pipeline/looks/journal.css); the layout is this sheet's. Groups on a line are told apart by
   the gap between them. */
.site-bar {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  /* Groups on a line are told apart by this gap: the design systems' space-6. */
  gap: 0 var(--space-6);
  max-inline-size: var(--frame);
  min-block-size: var(--bar-height);
  margin-inline: auto;
  border-block-end: 1px solid var(--rule);
  font: var(--type-ui);
}

/* The lockup is an outlined image, one file per scheme, the monogram alone on a phone:
   the <picture> in each page picks it. */
.site-logo { display: inline-flex; flex: none; align-items: center; min-block-size: var(--bar-height); }
.site-logo img { display: block; block-size: 2.25rem; inline-size: auto; }

/* The nav steps out of the layout, so its parts can sit on either line: the collections and
   the account on the first, the sections on the second. On a phone it is the Menu's panel. */
.site-nav { display: contents; }

/* The collections, by name. Plain links: three names need no menu (Jack, 2026-11-18). */
.corpus-links { display: flex; align-items: center; gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
.corpus-links li { display: flex; margin: 0; }
.corpus-links a {
  display: inline-flex;
  align-items: center;
  min-block-size: 2.75rem;
  color: var(--ink-muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.corpus-links a:hover { color: var(--ink); }
.corpus-links a[aria-current] { color: var(--ink); font-weight: 600; }

/* The second line: this collection's own navigation, the whole width under the first. */
.site-sections {
  display: flex;
  order: 1;
  flex-basis: 100%;
  align-items: stretch;
  gap: var(--space-1);
  min-block-size: 3rem;
  border-block-start: 1px solid var(--rule);
}

/* A corpus site's sections as tabs — Ask, Read, Study — with the same underline as the
   app's. Study is `hidden` in the markup and shown by site-bar.js once someone is signed in.
   A tab is the look's `ui` style, the current one its `ui-strong` (each design system's
   "the current tab"), so a look's weights land here without a rule of its own. */
.site-tabs { display: flex; align-self: stretch; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.site-tabs li { display: flex; margin: 0; }
.site-tabs li[hidden] { display: none; }
.site-tabs a {
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-3);
  border-block-end: var(--tab-mark) solid transparent;
  margin-block-end: -1px;
  color: var(--ink-muted);
  font: var(--type-ui);
  text-decoration: none;
}
.site-tabs a:hover { color: var(--ink); }
.site-tabs a[aria-current="page"] { color: var(--ink); font: var(--type-ui-strong); border-block-end-color: var(--accent); }

/* A page's own way to ask about itself ("Ask about this chapter"), at the end beside the
   account: the next thing a reader of that page may want, never a section of the site. */
.site-bar .ask {
  display: inline-flex;
  align-items: center;
  align-self: center;
  min-block-size: var(--control-height);
  margin-inline-start: auto;
  padding-inline: var(--space-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  color: var(--ink);
  font-weight: var(--weight-button);
  text-decoration: none;
  white-space: nowrap;
}
.site-bar .ask:hover { background: var(--surface-sunken); }

/* The account, at the end: the reader's initial when signed in (never the address, which
   is personal data on a screen someone may be sharing), Sign in and Create an account when
   not. Rendered by `renderAccountEnd` (site-bar.js). */
#account-slot { display: flex; align-items: center; gap: var(--space-5); margin-inline-start: auto; }

/* The day's allowance on a corpus site: a quiet line in the look's `label` style, a segment
   per question where there are few. */
.allowance {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-muted);
  font: var(--type-label);
  white-space: nowrap;
}
.allowance__meter { display: inline-flex; gap: 2px; }
.allowance__meter i { inline-size: 0.375rem; block-size: 0.75rem; border-radius: 1px; background: var(--rule); }
.allowance__meter i[data-on="true"] { background: var(--ink-muted); }

/* The colour-scheme switch (theme.js): one press moves device → light → dark → device, and
   the icon shows the current choice. An icon alone, so its name is in aria-label and title.
   The design systems' switch size (32 px) and icon size (20 px); its border is a control's,
   so `--rule-strong`, which holds 3:1 where `--rule` only separates. */
.theme-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2rem;
  block-size: 2rem;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}
.theme-switch:hover { color: var(--ink); background: var(--surface-sunken); }
.theme-switch svg { inline-size: 1.25rem; block-size: 1.25rem; }
/* Sign in: a link, so in the link colour (the design systems' `signal`). */
.site-nav__link { color: var(--link); font-weight: 500; text-decoration: none; }
.site-nav__link:hover { text-decoration: underline; text-underline-offset: 0.25em; }
.site-nav__primary {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--control-height);
  padding-inline: var(--space-4);
  border-radius: var(--radius-control);
  background: var(--action);
  color: var(--on-action);
  font-weight: var(--weight-button);
  text-decoration: none;
}
/* The signed-in reader's initial in a circle: a link on the static pages, the button that
   opens the account menu in the app (accountUi.tsx). 32 px and 15 px, every design system's
   avatar; the face is the look's display face, which the root's site.css sets to its mono. */
.account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2rem;
  block-size: 2rem;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  color: var(--ink);
  font: 600 0.9375rem/1 var(--font-display);
  text-decoration: none;
}

/* The phone's Menu button, put there by site-bar.js. Hidden on a wide screen, where
   everything fits on the bar. Without JavaScript there is no button and the nav simply
   wraps, which reads worse but loses nothing. */
.menu-toggle { display: none; }

/* A phone: the monogram and a Menu button share the bar; the collections, the sections and the
   account open under it as one list. */
@media (max-width: 40rem) {
  .site-bar { flex-wrap: wrap; }
  .site-bar.has-menu { flex-wrap: nowrap; }
  .site-bar.has-menu .menu-toggle {
    display: inline-flex;
    align-items: center;
    min-block-size: 2.75rem;
    margin-inline-start: auto;
    padding-inline: 0.9rem;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font: inherit;
    cursor: pointer;
  }
  .site-bar.has-menu .site-nav {
    display: none;
    position: absolute;
    inset-inline: 0;
    inset-block-start: 100%;
    z-index: 10;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-block: 0.5rem;
    background: var(--surface-page);
    border-block-end: 1px solid var(--rule);
  }
  .site-bar.has-menu.is-open .site-nav { display: flex; }
  .site-bar.has-menu .corpus-links { flex-direction: column; align-items: stretch; gap: 0; padding-block: 0.25rem; }
  .site-bar.has-menu .corpus-links a { min-block-size: 0; padding: 0.6rem 0.75rem; }
  .site-bar.has-menu .site-sections { order: 0; flex-direction: column; min-block-size: 0; }
  .site-bar.has-menu .site-tabs { flex-direction: column; padding-block: 0.5rem; }
  .site-bar.has-menu .site-tabs a { padding: 0.6rem 0.75rem; border-block-end: 0; }
  .site-bar.has-menu .site-tabs a[aria-current="page"] { box-shadow: inset var(--tab-mark) 0 0 var(--accent); }
  .site-bar.has-menu .ask { margin: 0.5rem 0.75rem; text-align: center; }
  .site-bar.has-menu #account-slot {
    margin-inline-start: 0;
    padding: 0.75rem;
    border-block-start: 1px solid var(--rule);
  }
}
