:root {
  --a11y-focus-ring-width: 3px;
  --a11y-focus-ring-color: hsl(var(--primary));
  --a11y-focus-ring-offset: 2px;
  --a11y-min-touch-target: 44px;
  --a11y-large-touch-target: 48px;
}

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

.sr-only-focusable:focus,
.sr-only-focusable:focus-within {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px 16px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  text-decoration: none;
  z-index: 9999;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0;
}

*:focus-visible {
  outline: var(--a11y-focus-ring-width) solid var(--a11y-focus-ring-color);
  outline-offset: var(--a11y-focus-ring-offset);
}

.focus-visible-only:focus:not(:focus-visible) {
  outline: none;
}

button,
[role="button"],
a,
input,
select,
textarea,
[tabindex]:not([tabindex="-1"]) {
  min-height: var(--a11y-min-touch-target);
  min-width: var(--a11y-min-touch-target);
}

.touch-target-large {
  min-height: var(--a11y-large-touch-target);
  min-width: var(--a11y-large-touch-target);
}

[aria-live="polite"],
[aria-live="assertive"] {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.high-contrast {
  --background: 0 0% 0%;
  --foreground: 0 0% 100%;
  --card: 0 0% 5%;
  --card-foreground: 0 0% 100%;
  --popover: 0 0% 5%;
  --popover-foreground: 0 0% 100%;
  --primary: 210 100% 50%;
  --primary-foreground: 0 0% 100%;
  --secondary: 0 0% 20%;
  --secondary-foreground: 0 0% 100%;
  --muted: 0 0% 15%;
  --muted-foreground: 0 0% 80%;
  --accent: 210 100% 50%;
  --accent-foreground: 0 0% 100%;
  --destructive: 0 100% 50%;
  --destructive-foreground: 0 0% 100%;
  --border: 0 0% 40%;
  --input: 0 0% 20%;
  --ring: 210 100% 50%;
}

.high-contrast * {
  border-color: hsl(var(--border)) !important;
}

.high-contrast img {
  filter: contrast(1.2);
}

.high-contrast a,
.high-contrast button {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.large-text {
  font-size: 125%;
  line-height: 1.6;
}

.large-text-150 {
  font-size: 150%;
  line-height: 1.8;
}

.large-text h1,
.large-text-150 h1 {
  font-size: 2.5em;
}

.large-text h2,
.large-text-150 h2 {
  font-size: 2em;
}

.large-text h3,
.large-text-150 h3 {
  font-size: 1.75em;
}

.large-text p,
.large-text-150 p,
.large-text span,
.large-text-150 span {
  letter-spacing: 0.02em;
  word-spacing: 0.1em;
}

@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;
  }
}

.reduced-motion *,
.reduced-motion *::before,
.reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

.simplified-mode {
  --spacing-base: 1.5rem;
}

.simplified-mode .nav-item {
  padding: 1rem;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.simplified-mode .nav-icon {
  width: 32px;
  height: 32px;
}

.simplified-mode .status-indicator {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.simplified-mode .status-good {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.simplified-mode .status-warning {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.simplified-mode .status-bad {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.simplified-mode .action-button {
  min-height: 64px;
  padding: 1rem 2rem;
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border-radius: 12px;
}

.simplified-mode .task-card {
  padding: 1.5rem;
  border-radius: 12px;
  border-width: 2px;
}

.simplified-mode .step-indicator {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
}

.screen-reader-optimized [aria-hidden="true"] {
  display: none !important;
}

.screen-reader-optimized .decorative-icon {
  display: none;
}

.screen-reader-optimized table {
  border-collapse: collapse;
}

.screen-reader-optimized th,
.screen-reader-optimized td {
  border: 1px solid hsl(var(--border));
  padding: 0.75rem;
}

.screen-reader-optimized img:not([alt]) {
  outline: 3px solid red;
}

.screen-reader-optimized img[alt=""] {
  display: none;
}

@media (max-width: 768px) {
  button,
  [role="button"],
  a,
  input,
  select,
  textarea {
    min-height: var(--a11y-large-touch-target);
    min-width: var(--a11y-large-touch-target);
  }

  .simplified-mode .action-button {
    width: 100%;
    min-height: 56px;
  }

  .simplified-mode .nav-item {
    padding: 1.25rem;
  }
}

@media print {
  .skip-link,
  .a11y-toolbar,
  nav,
  aside {
    display: none !important;
  }

  * {
    color: black !important;
    background: white !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }
}
