/* The editing bar, on the public site.
 *
 * Its own stylesheet, because it is drawn over whatever theme a site runs and
 * may inherit nothing from it: a bar that borrows the theme's type scale is a
 * bar that looks different on every site, and one that borrows its colours is
 * a bar that can be made to disappear.
 *
 * Every property is set rather than assumed for the same reason - a theme's
 * reset is not this bar's reset. Prefixed `ay-` so nothing a theme writes can
 * collide with it.
 */

.ay-bar {
  --ay-bar-ink: #f8fafc;
  --ay-bar-ground: #0b1220;

  position: relative;
  z-index: 2147483000;
  box-sizing: border-box;
  width: 100%;
  background: var(--ay-bar-ground);
  color: var(--ay-bar-ink);
  font: 500 0.8125rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}

.ay-bar *,
.ay-bar *::before,
.ay-bar *::after { box-sizing: border-box; }

.ay-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  max-width: 96rem;
  margin: 0 auto;
  padding: 0.4rem 1rem;
}

/* What this page is. The title is allowed to run out of room rather than to
 * wrap the bar onto a second line on a long one. */
.ay-bar-what {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  margin: 0;
}

.ay-bar-kind {
  flex: none;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgb(248 250 252 / 0.55);
}

.ay-bar-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

/* The state is said in words and carries its colour as well, never instead:
 * colour alone is not information (accessibility-conformance section 4). */
.ay-bar-state {
  flex: none;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  border: 1px solid currentColor;
}

.ay-bar-state-published { color: #6ee7b7; }
.ay-bar-state-draft_changes { color: #fcd34d; }
.ay-bar-state-draft { color: #cbd5e1; }
.ay-bar-state-archived { color: #fca5a5; }

.ay-bar-locale {
  flex: none;
  font-size: 0.6875rem;
  font-weight: 700;
  color: rgb(248 250 252 / 0.55);
}

.ay-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.ay-bar-form { margin: 0; }

/* Big enough to hit with a thumb, which is the one thing a bar squeezed into
 * 40 pixels usually gets wrong. */
.ay-bar-button,
.ay-bar-link {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0 0.7rem;
  border-radius: 0.4rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.ay-bar-button {
  border: 1px solid rgb(255 255 255 / 0.18);
  background: rgb(255 255 255 / 0.08);
  color: var(--ay-bar-ink);
}

.ay-bar-button:hover { background: rgb(255 255 255 / 0.16); }

.ay-bar-button-strong {
  border-color: transparent;
  background: #2563eb;
  color: #fff;
}

.ay-bar-button-strong:hover { background: #1d4ed8; }

.ay-bar-link {
  border: 1px solid transparent;
  background: none;
  color: rgb(248 250 252 / 0.7);
}

.ay-bar-link:hover { color: var(--ay-bar-ink); text-decoration: underline; }

.ay-bar-button:focus-visible,
.ay-bar-link:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

@media print { .ay-bar { display: none; } }
