* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: var(--text-base);
}

/* Focus management */
*:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #d1d5db;
}

.btn-secondary:hover {
  background: #f9fafb;
  border-color: var(--muted);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Main content */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm);
}

.hero {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  margin-bottom: var(--space-md);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: var(--text-lg);
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto var(--space-lg);
}

/* Demo section */
.demo-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-lg);
}

.demo-header {
  padding: var(--space-lg);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.demo-title {
  font-size: var(--text-xl);
  font-weight: 600;
}

.demo-content {
  padding: var(--space-lg);
}

/* Test examples */
.test-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.test-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color 0.2s ease;
}

.test-card.has-issues {
  border-color: var(--danger);
  background: #fef2f2;
}

.test-card-title {
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.test-card.has-issues .test-card-title {
  color: var(--danger);
}

/* Form styles */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: var(--space-sm);
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent);
}

/* Problematic elements for demo */
.bad-contrast {
  background: #f0f0f0;
  color: #d0d0d0;
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
}

.missing-alt img {
  width: 150px;
  height: 100px;
  background: #e5e7eb;
  border-radius: var(--radius-sm);
}

.empty-link {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.no-focus-indicator:focus {
  outline: none !important;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.stat-card {
  background: var(--surface);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--muted);
  font-size: var(--text-sm);
}

.stat-errors .stat-number {
  color: var(--danger);
}
.stat-warnings .stat-number {
  color: #f59e0b;
}
.stat-info .stat-number {
  color: var(--accent);
}

/* Responsive design */
@media (max-width: 768px) {
  .header-content {
    padding: var(--space-sm);
  }

  .main {
    padding: var(--space-md) var(--space-sm);
  }

  .demo-content {
    padding: var(--space-md);
  }

  .test-examples {
    grid-template-columns: 1fr;
  }
}

/* Loading state */
.loading {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Status indicator */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  font-weight: 500;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.status.active .status-dot {
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Accessibility improvements */
.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;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: var(--primary-contrast);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 6px;
}
