/* UX-07 Navigation V3: visible, thumb-sized exits. Page-specific headers keep their own skin. */
.navigation-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-block-size: 44px;
  min-inline-size: 44px;
  max-inline-size: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line, #b8aa98);
  border-radius: 999px;
  color: inherit;
  background: var(--paper, #fffdf8);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.navigation-exit .icon {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  flex: 0 0 auto;
}

.app-header:has(.navigation-exit) {
  /* The mark keeps a floor; the two controls keep their 44 px targets and shrink first. */
  grid-template-columns: minmax(44px, auto) minmax(64px, 1fr) minmax(44px, auto);
  gap: 0.5rem;
  container-type: inline-size;
}

/* At a large user text size on a narrow phone (rem grows, the header does not) the exit pill
 * drops its word and keeps its icon and accessible name, the way the bottom nav folds. */
@container (max-width: 12rem) {
  .navigation-exit {
    gap: 0;
    padding-inline: 0.55rem;
    font-size: 0;
  }

  .navigation-exit .icon {
    inline-size: 1.25rem;
    block-size: 1.25rem;
  }
}

.app-header:has(.navigation-exit) .wordmark {
  min-inline-size: 0;
  max-inline-size: 100%;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  /* Between the two words only; styles.css shrinks the mark so a break is rare. */
  overflow-wrap: normal;
}

.app-header:has(.navigation-exit) .wordmark > span {
  display: inline-block;
  max-inline-size: 100%;
}

html[data-easy="on"] .navigation-exit {
  min-block-size: 56px;
  min-inline-size: 56px;
  padding-inline: 0.9rem;
}

@media (max-width: 22rem) {
  .navigation-exit {
    padding-inline: 0.6rem;
  }

  .app-header:has(.navigation-exit) {
    gap: 0.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .navigation-exit {
    transition: none !important;
  }
}
