/* ─────────────────────────────────────────────────────────────
   Global nav (shared across / , /explorer/ , /design/)
   Single fixed bar: [crest + wordmark]  ...  [contextual link] [EN|ES pill]
   Design tokens come from src/style.css (--surface, --border, --accent, etc.)
   ───────────────────────────────────────────────────────────── */

:root {
  --gnav-h: 48px;
  --gnav-h-mobile: 44px;
}

.gnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--gnav-h-mobile);
  padding-top: env(safe-area-inset-top);
  /* Opaque surface prevents charts/tables from reading through the fixed bar,
     especially in Explorer where content scrolls underneath it. */
  background: var(--surface, #111111);
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.12));
  color: var(--text, #f5f5f5);
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  contain: layout style;
}

@media (min-width: 640px) {
  .gnav { height: var(--gnav-h); }
}

.gnav-inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

@media (min-width: 640px) {
  .gnav-inner { padding: 0 24px; }
}

/* Left: crest + wordmark */
.gnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.gnav-crest {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 200ms ease;
}
.gnav-brand:hover .gnav-crest { transform: rotate(-6deg) scale(1.05); }

.gnav-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.gnav-mark {
  font: 800 11px/1 var(--font-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text, #f5f5f5);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .gnav-mark { font-size: 12px; }
}

.gnav-sep {
  display: none;
  font-size: 10px;
  color: var(--dim, #8a8a8a);
  opacity: 0.5;
}
@media (min-width: 640px) {
  .gnav-sep { display: inline; }
}

.gnav-tag {
  display: none;
  font: 500 10px/1 var(--font-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim, #8a8a8a);
  white-space: nowrap;
}
@media (min-width: 640px) {
  .gnav-tag { display: inline; }
}

/* Right: contextual link + EN|ES pill */
.gnav-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.gnav-link {
  font: 700 10px/1 var(--font-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim, #8a8a8a);
  text-decoration: none;
  padding: 8px 4px;
  transition: color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}
.gnav-link:hover { color: var(--text, #f5f5f5); }

/* EN|ES pill — SINGLE TOGGLE BUTTON.
   Tap anywhere on the pill and it flips to the other language. The two
   labels inside just paint state; the whole pill is the tap target,
   sized to hit a comfortable 40px+ mobile hit area via padding. */
.gnav-lang,
.gnav-lang-toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  /* Slimmer vertical padding — the previous 8px + 11px line-height +
     border pushed the pill to 36px, colliding with the brand chip
     (22px) in the nav row. Keep enough horizontal padding for a
     comfortable tap target; height is now ~26px matching the chip. */
  padding: 6px 12px;
  border: 1px solid var(--border-strong, rgba(255,255,255,0.16));
  border-radius: 999px;
  background: transparent;
  font: 700 11px/1 var(--font-mono, 'IBM Plex Mono', monospace);
  letter-spacing: 0.14em;
  color: var(--dim, #8a8a8a);
  cursor: pointer;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
  /* No min-height — let padding define the size so it aligns with the
     brand chip. Full-width tap comfort comes from horizontal padding. */
}
.gnav-lang:hover,
.gnav-lang-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.24);
  color: var(--text, #f5f5f5);
}
.gnav-lang:active,
.gnav-lang.is-pressed,
.gnav-lang-toggle:active,
.gnav-lang-toggle.is-pressed {
  transform: scale(0.96);
}
.gnav-lang:focus-visible,
.gnav-lang-toggle:focus-visible {
  outline: 2px solid var(--accent, #e8007d);
  outline-offset: 2px;
}
.gnav-lang-side {
  padding: 0 4px;
  color: var(--dim, #8a8a8a);
  transition: color 160ms ease;
  pointer-events: none;
}
.gnav-lang-side + .gnav-lang-side::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 10px;
  background: currentColor;
  opacity: 0.28;
  margin-right: 6px;
  vertical-align: middle;
}
.gnav-lang-side.is-active {
  color: var(--accent, #e8007d);
}

/* Pushes page content below the fixed nav.
   Pages that already have their own top padding may skip this. */
body.has-gnav {
  padding-top: calc(var(--gnav-h-mobile) + env(safe-area-inset-top));
}
@media (min-width: 640px) {
  body.has-gnav {
    padding-top: calc(var(--gnav-h) + env(safe-area-inset-top));
  }
}

/* Utility: hide nav entirely (used on narrative 3D hero slides) */
.gnav[hidden],
.gnav.gnav--hidden {
  display: none !important;
}
