/*
 * Independent fallback stylesheet (served from /public).
 * Loads before bundled CSS so base typography and shell layout survive if the
 * main chunk fails (SW staleness, network glitch, or dev HMR issues).
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: #ffffff;
  color: #111827;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#main-content {
  display: block;
  min-height: 100vh;
}

/* Skip link — mirrors globals.css so it works even if Tailwind layer fails */
.skip-link:not(:focus):not(:focus-visible) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus,
.skip-link:focus-visible {
  position: fixed;
  left: 0.75rem;
  top: 0.75rem;
  z-index: 9999;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.5rem 0.75rem;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  border-radius: 0.5rem;
  background: #1e1b4b;
  color: #ffffff !important;
  text-decoration: none;
}

/* Primary nav shell when utility classes are missing */
nav[aria-label='Primary navigation'] {
  display: block;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

nav[aria-label='Primary navigation'] > div {
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem;
}

nav[aria-label='Primary navigation'] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/*
 * Do NOT set link color here — a single rule like nav a { color: #111827 } beats Tailwind's
 * .text-white on the active tab (higher specificity) and leaves dark text on purple buttons.
 * Colours come from Tailwind / tailwind-fallback.css utilities only.
 */
nav[aria-label='Primary navigation'] a {
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

/* Prevent duplicate Sign Out when Tailwind responsive utilities fail to load */
@media (min-width: 768px) {
  nav[aria-label='Primary navigation'] .nav-actions-mobile {
    display: none !important;
  }
}

@media (max-width: 767px) {
  nav[aria-label='Primary navigation'] .nav-actions-desktop {
    display: none !important;
  }
}
