/* Accessibility Styles */
/* WCAG 2.1 AA Compliance */

/* === SKIP LINK === */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background-color: var(--colour-primary);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 9999;
  transition: top var(--transition-base);
}

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

/* === FOCUS STYLES === */
/* Ensure all interactive elements have visible focus indicators */

*:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

/* Only show focus ring for keyboard navigation */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

/* Custom focus for buttons and links */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
  border-radius: var(--radius-sm);
}

/* === SCREEN READER ONLY === */
/* Hide content visually but keep it accessible to screen readers */
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Allow screen reader only content to be focusable */
.sr-only-focusable:focus,
.visually-hidden-focusable:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: inherit !important;
  margin: inherit !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* === HIGH CONTRAST MODE === */
/* Support for Windows High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --colour-text: #000000;
    --colour-background: #FFFFFF;
    --colour-border: #000000;
  }

  .btn {
    border-width: 2px;
  }

  .card {
    border-width: 2px;
  }

  a {
    text-decoration: underline;
    text-decoration-thickness: 2px;
  }
}

/* === REDUCED MOTION === */
/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Keep essential transitions but make them instant */
  .nav-menu,
  .mobile-menu-toggle,
  .accordion__icon {
    transition: none !important;
  }
}

/* === MINIMUM TOUCH TARGET SIZE === */
/* WCAG 2.2 Level AA - 24x24px minimum (we use 44x44px) */
button,
a,
input[type="submit"],
input[type="button"],
input[type="reset"],
input[type="checkbox"],
input[type="radio"] {
  min-width: 24px;
  min-height: 24px;
}

/* Most interactive elements use 44x44px for better mobile UX */
.btn,
.nav-link,
.form-input,
.form-select,
.accordion__button {
  min-height: 44px;
}

/* === TEXT SPACING === */
/* WCAG 2.1 Level AA - Support text spacing adjustments */
/* Users may override these with browser extensions */
html.user-text-spacing * {
  line-height: 1.5 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

html.user-text-spacing p {
  margin-bottom: 2em !important;
}

/* === FORCED COLOURS MODE === */
/* Support for Windows High Contrast Mode and forced colours */
@media (forced-colors: active) {
  .btn {
    border: 2px solid currentColor;
  }

  .card {
    border: 1px solid currentColor;
  }

  .nav-link[aria-current="page"] {
    border: 2px solid currentColor;
  }

  /* Ensure focus is visible in forced colours mode */
  *:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
  }
}

/* === KEYBOARD NAVIGATION INDICATORS === */
/* Show when user is navigating with keyboard */
body.using-keyboard *:focus {
  outline: var(--focus-outline);
  outline-offset: var(--focus-outline-offset);
}

/* === PRINT STYLES === */
@media print {
  /* Hide navigation and footer when printing */
  header[role="banner"],
  .site-footer,
  .skip-link,
  .mobile-menu-toggle,
  .btn-group,
  .cta-section {
    display: none;
  }

  /* Ensure text is black for printing */
  body {
    color: #000;
    background: #fff;
  }

  /* Remove shadows and background colours */
  .card,
  .testimonial,
  .service {
    box-shadow: none;
    border: 1px solid #000;
  }

  /* Ensure links show their URLs */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  /* Page breaks */
  h1, h2, h3 {
    page-break-after: avoid;
  }

  img {
    page-break-inside: avoid;
  }
}

/* === DARK MODE SUPPORT (Optional) === */
/* For future implementation if needed */
@media (prefers-color-scheme: dark) {
  /* Keep light mode for now as it's more suitable for disability services */
  /* Could add dark mode variables here in future */
}

/* === SELECTION HIGHLIGHTING === */
::selection {
  background-color: var(--colour-primary-light);
  color: white;
}

::-moz-selection {
  background-color: var(--colour-primary-light);
  color: white;
}

/* === FOCUS-WITHIN === */
/* Highlight container when child element is focused */
.form-group:focus-within .form-label {
  color: var(--colour-primary);
}

/* === ARIA LIVE REGIONS === */
/* Style for dynamically updated content */
[aria-live="polite"],
[aria-live="assertive"] {
  position: relative;
}

/* === ARIA HIDDEN === */
/* Ensure aria-hidden elements don't interfere */
[aria-hidden="true"] {
  display: none !important;
}

/* === DISABLED STATE === */
/* Clear indication of disabled elements */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* === REQUIRED FIELD INDICATOR === */
.required,
[aria-required="true"]::after {
  color: var(--colour-error);
}

/* === ERROR STATE === */
[aria-invalid="true"] {
  border-color: var(--colour-error);
  border-width: 2px;
}

[aria-invalid="true"]:focus {
  outline-color: var(--colour-error);
  box-shadow: 0 0 0 3px rgba(193, 59, 59, 0.2);
}

/* === TOOLTIP ACCESSIBILITY === */
[role="tooltip"] {
  position: absolute;
  z-index: var(--z-index-tooltip);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--colour-text);
  color: white;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

/* === LANDMARK REGIONS === */
/* Ensure landmarks are clearly defined */
[role="banner"],
[role="navigation"],
[role="main"],
[role="contentinfo"],
[role="complementary"] {
  /* Landmarks are structural, no visual styling needed */
  /* but ensures they're properly recognised by AT */
}
