.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--color-bg);
  border-bottom: var(--border-thin);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  max-width: var(--wide-max);
  margin: 0 auto;
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4);
}

.brand {
  font-size: var(--text-lg);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.brand-symbol {
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  justify-content: center;
}

.brand-mark {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  object-fit: contain;
}

.brand:hover {
  text-decoration: none;
}

.header-spacer {
  flex: 1;
}

.header-nav {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

/* Icon-only navigation: the current page is signalled purely by colour. */
.nav-icon-btn {
  min-width: 2.75rem;
  padding: 0 var(--space-3);
  color: var(--color-text-muted);
}

.nav-icon-btn .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.back-btn {
  border: var(--border-thin);
  border-radius: var(--radius-full);
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0;
  color: var(--color-text);
}

.back-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
}

.header-nav a[aria-current="page"] {
  color: var(--color-text);
  background: var(--color-surface-2);
  text-decoration: none;
}

.header-nav a[aria-current="page"] .icon {
  fill: currentColor;
}

/* The badge pins to the top-right corner of the icon it belongs to. */
.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.app-main {
  max-width: var(--wide-max);
  margin: 0 auto;
  width: 100%;
  padding: var(--space-5) var(--space-4);
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + var(--space-8));
}

.bottom-nav {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-nav);
  display: flex;
  justify-content: space-around;
  background: var(--color-bg);
  border-top: var(--border-thin);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav:empty {
  display: none;
}

.bottom-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: var(--space-2) var(--space-4);
  min-width: 4.5rem;
  min-height: var(--bottom-nav-height);
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--track-wide);
  color: var(--color-text-muted);
  position: relative;
  border-top: 2px solid transparent;
}

.bottom-nav-link:hover {
  text-decoration: none;
  color: var(--color-text);
}

.bottom-nav-link .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.bottom-nav-link[aria-current="page"] {
  color: var(--color-text);
  border-top-color: var(--color-text);
}

.bottom-nav-link[aria-current="page"] .icon {
  fill: currentColor;
}

.nav-badge {
  position: absolute;
  top: -0.3rem;
  right: -0.4rem;
  min-width: 0.875rem;
  height: 0.875rem;
  padding: 0 0.15rem;
  border-radius: var(--radius-full);
  background: var(--color-love);
  color: #ffffff;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge:empty {
  display: none;
}

.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: var(--content-max);
  margin: 0 auto;
}

.page-wide {
  max-width: var(--wide-max);
}

.page-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.page-header h1 {
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (min-width: 48rem) {
  .header-nav {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .app-main {
    padding: var(--space-8) var(--space-6);
  }
}
