/* Utility Classes */
/* Skip-link, screen-reader-only text, spacing helpers, and focus states */

/* ===================================
   SKIP-TO-CONTENT LINK (WCAG 2.2)
   =================================== */

.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-navy);
  color: var(--color-white);
  padding: var(--space-md) var(--space-lg);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  z-index: var(--z-index-skip-link);
  border-radius: 0 0 var(--border-radius-md) 0;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--color-turquoise);
  outline-offset: 2px;
}

/* ===================================
   SCREEN READER ONLY
   =================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Make element visible when focused (for skip links, etc.) */
.sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ===================================
   DISPLAY UTILITIES
   =================================== */

.hidden {
  display: none;
}

.block {
  display: block;
}

.inline-block {
  display: inline-block;
}

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.grid {
  display: grid;
}

/* ===================================
   VISIBILITY UTILITIES
   =================================== */

.invisible {
  visibility: hidden;
}

.visible {
  visibility: visible;
}

/* ===================================
   SPACING UTILITIES
   =================================== */

/* Margin Top */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

/* Margin Bottom */
.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

/* Margin Left */
.ml-xs { margin-left: var(--space-xs); }
.ml-sm { margin-left: var(--space-sm); }
.ml-md { margin-left: var(--space-md); }
.ml-lg { margin-left: var(--space-lg); }
.ml-xl { margin-left: var(--space-xl); }

/* Margin Right */
.mr-xs { margin-right: var(--space-xs); }
.mr-sm { margin-right: var(--space-sm); }
.mr-md { margin-right: var(--space-md); }
.mr-lg { margin-right: var(--space-lg); }
.mr-xl { margin-right: var(--space-xl); }

/* Margin Auto */
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Padding Top */
.pt-xs { padding-top: var(--space-xs); }
.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }

/* Padding Bottom */
.pb-xs { padding-bottom: var(--space-xs); }
.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }
.pb-xl { padding-bottom: var(--space-xl); }

/* ===================================
   FLEXBOX UTILITIES
   =================================== */

.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ===================================
   WIDTH UTILITIES
   =================================== */

.w-full { width: 100%; }
.w-auto { width: auto; }

/* ===================================
   ANIMATION UTILITIES
   =================================== */

/* Fade-in animation for scroll-triggered elements */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===================================
   FOCUS ENHANCEMENT UTILITIES
   =================================== */

/* Force focus visibility for testing */
.focus-visible-always:focus {
  outline: 3px solid var(--color-turquoise);
  outline-offset: 3px;
}

/* Remove focus outline (use with caution, ensure keyboard accessibility) */
.focus-none:focus {
  outline: none;
}
