/* Soft-navigation feedback (page-nav.js). Indicator lives inside the swapped
   region only; view transitions stay short and honour reduced motion. */

main:focus,
.cz-nav-region:focus {
  outline: none;
}

.cz-nav-region {
  position: relative;
}

.cz-nav-loading {
  opacity: 0.7;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.cz-nav-spinner {
  position: absolute;
  top: 0.9rem;
  right: 1.1rem;
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--line, rgba(32, 40, 34, 0.2));
  border-top-color: var(--forest, #155b43);
  border-radius: 50%;
  animation: cz-nav-spin 0.7s linear infinite;
  z-index: 30;
  pointer-events: none;
}

@keyframes cz-nav-spin {
  to {
    transform: rotate(360deg);
  }
}

.cz-nav-error {
  margin: 1rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line, #d2d8cd);
  border-radius: 12px;
  background: var(--card, #fbfaf6);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  color: var(--ink, #202822);
}

.cz-nav-error[hidden] {
  display: none;
}

.cz-nav-error-text {
  margin: 0;
  font-size: 0.92rem;
}

@media (prefers-reduced-motion: reduce) {
  .cz-nav-loading {
    transition: none;
  }
  .cz-nav-spinner {
    animation-duration: 2s;
  }
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 140ms;
    animation-timing-function: ease;
  }
}

/* Theme toggle icon defaults and visibility: single source of truth for every
   page that participates in soft navigation. nav.css is linked last by every
   page and survives CSS accumulation, so per-page copies can never diverge
   again (doc/theme.md: light shows the moon, dark shows the sun). Icon sizes
   stay page-specific. */
.theme-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun {
  display: none;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-icon-moon {
  display: none;
}
