/* The one Aces header: brand, the four sections (Maths, English, Reading,
   Games) and the reader. Every section page links this file and uses the same
   <header class="topbar"> markup, so the header looks the same everywhere.
   Rules are scoped under .topbar so pages with their own button/link resets
   (the maths/English map) cannot change it. */
.topbar {
  --th-paper: #fbf8f0;
  --th-ink: #243d38;
  --th-muted: #65746d;
  --th-green: #35634e;
  --th-mint: #e5eddf;
  --th-line: #dfe3d7;
  padding: 14px max(20px, calc((100vw - 1110px) / 2));
  /* three columns with equal sides keep the section tabs in the same place on
     every page, whatever width the reader's name is (or none, on Games) */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 30px;
  border-bottom: 1px solid var(--th-line);
  flex-shrink: 0;
  background: var(--th-paper);
  color: var(--th-ink);
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
  box-sizing: border-box;
}
.topbar * {
  box-sizing: border-box;
}
.topbar a,
.topbar button {
  touch-action: manipulation;
}
.topbar a:focus-visible,
.topbar button:focus-visible {
  outline: 3px solid #b37f22;
  outline-offset: 4px;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  color: inherit;
  text-decoration: none;
  min-height: 48px;
}
.topbar .brand-logo {
  display: block;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 24%;
}
.topbar .brand > span {
  font-size: 25px;
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -1px;
}
.topbar .brand-sub {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  margin-top: 6px;
}
.topbar .subjects {
  display: flex;
  gap: 3px;
  margin: 0;
  justify-self: center;
}
.topbar .subjects a {
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: grid;
  place-items: center;
  min-width: 65px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--th-muted);
}
.topbar .subjects [aria-current] {
  background: var(--th-mint);
  color: var(--th-green);
}
.topbar .profile {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--th-ink);
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  justify-self: end;
  max-width: 180px;
}
.topbar .profile > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .avatar {
  background: #eddfb8;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .topbar {
    padding: 9px 15px;
    grid-template-columns: auto 1fr auto;
    gap: 5px;
  }
  .topbar .brand > span {
    font-size: 22px;
  }
  .topbar .brand-logo {
    width: 44px;
    height: 44px;
  }
  .topbar .subjects {
    gap: 0;
  }
  .topbar .subjects a {
    min-width: 49px;
    padding: 0 8px;
    font-size: 11px;
  }
  .topbar .profile {
    min-width: 44px;
    max-width: 44px;
    justify-content: center;
  }
  .topbar .profile > span:last-child {
    display: none;
  }
  .topbar .avatar {
    width: 34px;
    height: 34px;
  }
}
/* Give the rocket and all four subject tabs room on narrow phones. The home
   link keeps its accessible name when the printed wordmark is hidden. */
@media (max-width: 480px) {
  .topbar .brand > span {
    display: none;
  }
}
/* Four section tabs plus the reader button must fit a 360px phone without
   sideways scrolling; keep 44px tap targets. */
@media (max-width: 380px) {
  .topbar .subjects a {
    min-width: 44px;
    padding: 0 5px;
  }
}
