/* ===== SHARED TOPBAR ===== */

/* Above the full-screen views (600), not under them: Meanwhile and Explore
   are siblings in this chip row, so one press on either must switch to it
   while the other is open. */
/* The bar is a quiet grey frame around the page: the pictures, the map and
   the cards keep the white for themselves. */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 700;
  background: var(--surf);
}

.site-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 56px;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "brand links actions";
  align-items: center;
  gap: 1.5rem;
}

/* Chips in topbar — centred in links area */
.nav-chips {
  grid-area: links;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  overflow: hidden;
}

.nav-chips .chips-bar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-chips .chips-bar::-webkit-scrollbar { display: none; }

.site-nav-brand {
  grid-area: brand;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Nunito', var(--font);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.18s;
}

/* The mark is the desk globe from the tab sprite, drawn at the tabs' size
   so it keeps the same light and detail; it leans in like they do. */
.site-nav-brand:hover .brand-mark {
  transform: scale(1.08) rotate(-6deg);
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark { transition: none; }
  .site-nav-brand:hover .brand-mark { transform: none; }
}

.site-nav-links {
  grid-area: links;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-nav-link {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 0.4rem;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s;
}

.site-nav-link svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--accent);
  flex-shrink: 0;
  transition: opacity 0.18s;
}

.site-nav-link:hover { color: var(--text); }
.site-nav-link:hover svg { opacity: 0.75; }
.site-nav-link.is-active { color: var(--text); font-weight: 600; }

.site-nav-right {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ═══ The four tabs: Map, Meanwhile, Explore, In depth ═══ */
/* Each tab is a small object in its own colours (site-nav.js), so the tabs
   themselves carry none. They sit on the grey bar, and the open one is
   lifted out of it, white like the page below and softly shadowed, as a
   browser's open tab is part of its page. An object leans in when pointed
   at and gives a little hop when its tab is chosen. */
.nav-chips:has(.nav-tab) {
  gap: 2px;
  padding: 4px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 40px;
  padding: 0 0.9rem 0 0.5rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.25s ease, box-shadow 0.25s ease, color 0.2s ease;
}

.nav-ico {
  flex: none;
  width: 1.875rem;
  height: 1.875rem;
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.nav-tab:hover { color: var(--text); }
.nav-tab:hover .nav-ico { transform: scale(1.08) rotate(-3deg); }

.nav-tab[aria-current="page"] {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 10%), 0 4px 12px rgb(0 0 0 / 7%);
}
:root[data-theme="dark"] .nav-tab[aria-current="page"] { background: #3a3a3f; box-shadow: 0 1px 2px rgb(0 0 0 / 40%); }
.nav-tab[aria-current="page"] .nav-ico { animation: nav-hop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes nav-hop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.14) rotate(-4deg); }
  100% { transform: none; }
}
.nav-tab:focus-visible { outline: 2px solid var(--ui-action, var(--text)); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .nav-tab, .nav-ico { transition: none; }
  .nav-tab:hover .nav-ico { transform: none; }
  .nav-tab[aria-current="page"] .nav-ico { animation: none; }
}

@media (max-width: 600px) {
  .site-nav-links { display: none; }
  .site-nav-inner { grid-template-columns: 1fr auto; grid-template-areas: "brand actions"; }
}

/* Every full-screen view leaves by the same round cross, in the same place
   at the top right of the view. It scrolls away with the view rather than
   floating: fixed, it slid over whatever passed beneath it, such as the
   quiz's section counts. */
.view-close {
  position: absolute;
  top: clamp(0.9rem, 2vw, 1.5rem);
  right: clamp(0.9rem, 2vw, 1.5rem);
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.view-close:hover { background: color-mix(in srgb, var(--text) 24%, transparent); }
.view-close:focus-visible { outline: 2px solid var(--ui-action, var(--accent)); outline-offset: 3px; }
