/*
  Accessibility top bar + the accessibility tools (font size / contrast / read
  aloud). The bar is a NON-STICKY white band at the very top of the page
  (templates/partials/accessibility-bar.php); the SAME tools are also rendered
  inside the mobile menu drawer (.nav-tools in header.php). On ≤60rem the bar is
  hidden and the drawer copy shows instead.

  The floating header is pushed below this bar and rises as it scrolls away —
  see header.css (--header-current-offset) + assets/js/header-offset.js.
*/

/* ---- White top band (desktop) ---- */
.a11y-bar {
  padding-block: 0.5rem;
  background-color: var(--color-white);
  border-block-end: 1px solid var(--color-border);
}

.a11y-bar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;     /* tools, then search, aligned right */
  gap: var(--space-m);
  /* Match the header pill's inner inset (.site-header-inner, header.css) so the
     bar's right edge lines up with the last main-menu item. */
  padding-inline: 2.875rem;
}

/* ---- Tools (shared by bar + drawer) ---- */
.a11y-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2xs);
}

.a11y-tools__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3xs);
  min-block-size: 2.25rem;
  min-inline-size: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--color-green-strong);
  font-size: var(--text-small);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Font-size buttons share one segmented pill: drop individual borders/radius
   and divide them with hairlines instead. */
.a11y-tools__group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: clip;
}

.a11y-tools__group .a11y-tools__btn {
  border: 0;
  border-inline-end: 1px solid var(--color-border);
  border-radius: 0;
}

.a11y-tools__group .a11y-tools__btn:last-child {
  border-inline-end: 0;
}

/* Font-size buttons: bump the "A" and its +/− so the superscript stays legible. */
.a11y-tools__btn--font {
  font-size: 1rem;
}

.a11y-tools__btn--font sup {
  font-size: 0.85em;
  line-height: 0;
}

.a11y-tools__icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
}

.a11y-tools__btn:hover,
.a11y-tools__btn:focus-visible {
  background-color: var(--color-green-pale);
  color: var(--color-green-dark);
}

.a11y-tools__btn[aria-pressed="true"] {
  background-color: var(--color-green-strong);
  border-color: var(--color-green-strong);
  color: var(--color-white);
}

/* ---- Drawer copy (mobile only) ---- */
/* .nav-tools wraps the tools + search inside #primary-menu; hidden on desktop.
   The drawer surface is pale green, so give the controls darker borders. */
.nav-tools {
  display: none;
}

.a11y-tools--drawer .a11y-tools__btn,
.a11y-tools--drawer .a11y-tools__group {
  border-color: var(--color-green-dark);
}

/* The drawer shows the decorative butterfly behind the tools; the buttons are
   otherwise transparent, so fill them with the drawer's own background colour to
   stop it bleeding through. The pressed state keeps its solid green fill. */
.a11y-tools--drawer .a11y-tools__btn:not([aria-pressed="true"]) {
  background-color: var(--color-green-pale);
}

.a11y-tools--drawer .a11y-tools__btn:not([aria-pressed="true"]):hover,
.a11y-tools--drawer .a11y-tools__btn:not([aria-pressed="true"]):focus-visible {
  background-color: var(--color-white);
}

/* ---- Responsive swap at the nav breakpoint ---- */
@media (max-width: 60rem) {
  .a11y-bar {
    display: none;                 /* tools move into the drawer */
  }

  .nav-tools {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-m);
    margin-block-start: 2.5rem;    /* matches the drawer menu's item rhythm */
    padding-block-start: var(--space-m);
    border-block-start: 1px solid rgba(0, 0, 0, 0.15);
  }
}
