/* ENG-1249 Slice 1 — global navigation (DESIGN.md → Components → Global navigation).
   Two tiers: a 62px primary row with the lockup and the four Places, a 46px utility row
   with the signed-in person. Tokens only — tests/eng-1249-stylesheet-tokens.test.mjs
   fails this file on the first hand-picked colour. Not added to redesign.css on purpose. */

.global-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--chrome-gradient);
  color: var(--chrome-text);
}

.gn-row {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  padding: 0 var(--space-page-x);
}

.gn-primary {
  min-height: 62px;
}

/* The utility tier is separated by tone and one hairline, not a heavy border. ENG-1506: links
   on the left; usage, the person and Sign out on the right. */
.gn-utility {
  min-height: 46px;
  justify-content: space-between;
  gap: var(--space-4);
  background: var(--chrome-bg);
  border-top: 1px solid var(--chrome-border);
  font-size: var(--fs-body-sm);
  color: var(--chrome-muted-text);
}

.gn-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--touch);
  color: inherit;
  text-decoration: none;
}

.gn-plate {
  display: block;
  box-sizing: border-box;
  height: 44px;
  padding: 0.3rem 0.5rem;
  background: var(--bg-card-opaque);
  border-radius: var(--radius-sm);
  line-height: 0;
}

.gn-mark {
  display: block;
  width: auto;
  height: 100%;
  object-fit: contain;
}

.gn-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.gn-kicker {
  font-family: var(--mono);
  font-size: var(--fs-label-mono);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--chrome-muted-text);
}

.gn-title {
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tr-snug);
  color: var(--chrome-text);
}

/* Place links fill the 62px row so the hit target is the whole row height. */
.gn-places {
  display: flex;
  align-self: stretch;
  gap: var(--space-2);
  margin: 0;
}

.gn-places a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 62px;
  padding: 0 var(--space-3);
  font-size: var(--fs-body-lg);
  font-weight: var(--fw-semibold);
  color: var(--on-navy-secondary);
  text-decoration: none;
}

/* The one accent in the bar: a 3px underline in the lightened chrome accent. Hover shows it
   at 42% (opacity, so no second colour is minted); the current place shows it in full. */
.gn-places a::after {
  content: "";
  position: absolute;
  right: var(--space-3);
  bottom: 0;
  left: var(--space-3);
  height: 3px;
  background: var(--chrome-accent-text);
  opacity: 0;
}

.gn-places a:hover {
  color: var(--chrome-text);
}

.gn-places a:hover::after {
  opacity: 0.42;
}

.gn-places a[aria-current="page"] {
  color: var(--chrome-text);
}

.gn-places a[aria-current="page"]::after {
  opacity: 1;
}

.gn-places a:focus-visible,
.gn-links a:focus-visible,
.gn-lockup:focus-visible,
.global-nav .gn-signout:focus-visible {
  outline: 2px solid var(--chrome-accent-text);
  outline-offset: 2px;
}

.gn-links {
  display: flex;
  gap: var(--space-6);
}

.gn-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--on-navy-secondary);
  text-decoration: none;
  white-space: nowrap;
}

.gn-links a:hover,
.gn-links a[aria-current="page"] {
  color: var(--chrome-text);
}

.gn-links a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-color: var(--chrome-accent-text);
  text-underline-offset: 6px;
}

/* The usage line and the person share one hairline divider, as in the pack. */
.gn-usage {
  margin: 0 0 0 auto;
  padding-right: var(--space-4);
  border-right: 1px solid var(--chrome-border);
  color: var(--on-navy-secondary);
}

.gn-usage:empty {
  display: none;
}

.gn-usage strong {
  font-weight: var(--fw-semibold);
  color: var(--chrome-text);
}

.gn-person {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  min-width: 0;
}

.gn-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-text);
  font-size: var(--fs-caption);
  font-weight: var(--fw-bold);
}

.gn-person-name {
  font-weight: var(--fw-semibold);
  color: var(--chrome-text);
  white-space: nowrap;
}

.gn-person-role,
.gn-person-email {
  overflow: hidden;
  font-size: var(--fs-caption);
  color: var(--chrome-muted-text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-nav .gn-signout {
  min-height: 36px;
  padding: 0.3rem 0.75rem;
  font-size: var(--fs-body-sm);
  color: var(--chrome-text);
  background: transparent;
  border-color: var(--chrome-border);
}

.global-nav .gn-signout:hover:not(:disabled) {
  color: var(--chrome-text);
  border-color: var(--chrome-accent-text);
}

/* The production shell has no sidebar: the canvas is the whole width, centred at its cap. */
.app-shell[data-shell-mode="production"] {
  grid-template-columns: minmax(0, 1fr);
  min-height: calc(100vh - 108px);
}

.app-shell[data-shell-mode="production"] > .main {
  margin-inline: auto;
}

/* Home — ENG-1249 Slice 1. Your attention reuses the Needs me list; the other regions are
   plain lists. No counts in the place routes: "without becoming a wall of counts". */
.home-region {
  margin-top: var(--space-8);
}

.home-place-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-place-list li {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
}

.home-place-list a {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  text-decoration: none;
}

.home-place-list a:hover {
  color: var(--accent);
}

.home-place-list span {
  font-size: var(--fs-body-sm);
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .gn-row {
    padding: 0 var(--space-3-5);
  }

  .gn-primary {
    min-height: 56px;
  }

  /* Below 900px the Places live in the fixed mobile bar at the foot of the page. */
  .gn-places {
    display: none;
  }

  /* The links, the name and Sign out share one line down to about 360px and wrap below it.
     The usage line collapses here; Usage & Spend is one tap away. ENG-1249 caps the phone bar
     at 100px. */
  .gn-utility {
    flex-wrap: wrap;
    gap: var(--space-3);
    min-height: 40px;
  }

  .gn-links {
    gap: var(--space-3);
  }

  /* app.css makes every .btn full width on a phone; Sign out keeps its own size. */
  .global-nav .gn-signout {
    width: auto;
  }

  .gn-person {
    margin-left: auto;
  }

  .gn-usage,
  .gn-avatar,
  .gn-person-role,
  .gn-person-email {
    display: none;
  }

  .gn-person-name {
    overflow: hidden;
    max-width: 8rem;
    text-overflow: ellipsis;
  }

  .app-shell[data-shell-mode="production"] {
    min-height: calc(100vh - 96px);
  }
}
