:root {
  --bg: #ffffff;
  --text: #1a1a1a; /* 21:1 contrast ratio */
  --text-secondary: #4a4a4a; /* 7:1 contrast ratio */
  --card: #f7f9fc;
  --accent: #bdfc7a; /* lime punch */
  --link-color: #0066cc; /* 4.5:1 minimum */
  --focus: #005fcc; /* WCAG AA compliant focus outline */
  --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --success: #137333; /* Darker green for better contrast */
  --warning: #b7790f; /* Darker orange for better contrast */
  --error: #d93025; /* Darker red for better contrast */
  --border: #e5e7eb;
}

[data-theme="dark"] {
  --bg: #0a0f1a;
  --text: #ffffff;
  --text-secondary: #d1d5db;
  --card: #111827;
  --accent: #bdfc7a;
  --link-color: #60a5fa;
  --focus: #3b82f6;
  --border: #374151;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
}

[data-contrast="high"] {
  --bg: #000000;
  --text: #ffffff;
  --card: #0b1022;
  --accent: #bdfc7a;
  --focus: #ffcc00;
  --border: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header */
header {
  background: var(--gradient);
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  color: white;
  font-size: 1.8rem;
  font-weight: bold;
  margin: 0;
}

.accent {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* High contrast navigation links */
.nav-link {
  color: #000000 !important;
  background-color: #ffffff !important;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 600;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-link:hover {
  background-color: var(--accent) !important;
  color: #000000 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

nav a:not(.nav-link) {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: background-color 0.2s;
  font-weight: 500;
}

nav a:not(.nav-link):hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Quick Navigation at bottom */
.quick-navigation {
  background: var(--card);
  border-radius: 12px;
  padding: 2rem;
  margin: 3rem 0 2rem 0;
  border-left: 4px solid var(--accent);
  border-top: 1px solid var(--border);
}

.quick-navigation h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.3rem;
  color: var(--text);
  text-align: center;
}

.quick-navigation ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.quick-navigation li {
  margin: 0;
}

.quick-navigation a {
  color: var(--link-color);
  text-decoration: none;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: white;
  border: 2px solid var(--border);
  transition: all 0.3s;
  display: block;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-navigation a:hover {
  background: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-color: var(--accent);
}

/* Main content */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.hero {
  text-align: center;
  margin-bottom: 4rem;
}

.hero h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: #666;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Form styling with WCAG compliance */
.analyzer-form {
  margin: 2rem 0;
}

.form-group {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.required {
  color: var(--error);
  font-weight: bold;
  margin-left: 0.25rem;
}

.input-group {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.form-input, #urlInput {
  flex: 1;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px; /* Prevent iOS zoom */
  background: var(--bg);
  color: var(--text);
  min-height: 44px; /* iOS touch target */
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, #urlInput:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(0, 106, 173, 0.2);
}

.form-input:invalid {
  border-color: var(--error);
}

.form-input:invalid:focus {
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.2);
}

.analyze-button, #analyzeBtn {
  background: var(--gradient);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  min-height: 44px; /* iOS touch target */
  min-width: 44px;
  touch-action: manipulation;
}

.analyze-button:hover, #analyzeBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.analyze-button:focus, #analyzeBtn:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.analyze-button:disabled, #analyzeBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.help-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0.5rem 0;
  line-height: 1.4;
}

.input-help {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.demo-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.demo-btn {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

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

/* Progress indicator */
.progress-container {
  max-width: 400px;
  margin: 2rem auto;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

.progress-text {
  color: #666;
  font-size: 0.9rem;
}

/* Results section */
.results-section {
  margin: 3rem 0;
  padding: 2rem;
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.results-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.results-header h2 {
  color: var(--text);
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
}

.analysis-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.analysis-time {
  font-weight: 600;
}

.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  text-align: center;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.score-circle span:first-child {
  font-size: 2.5rem;
  line-height: 1;
}

.score-label {
  font-size: 0.8rem;
  opacity: 0.9;
}

.score-description h3 {
  margin: 0 0 0.5rem;
  color: var(--text);
}

.score-description p {
  color: var(--text-secondary);
  margin: 0 0 0.5rem;
}

.score-breakdown {
  margin-top: 0.5rem;
}

.score-breakdown small {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Categories grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.category-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 15px;
  padding: 1.5rem;
  transition: transform 0.2s;
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.category-icon {
  font-size: 1.5rem;
}

.category-header h4 {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
}

.category-score {
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  background: var(--success);
  color: white;
}

.category-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-card li {
  padding: 0.3rem 0;
  color: #666;
  font-size: 0.9rem;
}

.category-card li:before {
  content: '✓';
  color: var(--success);
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Progress bars in category cards */
.category-card .progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 1rem 0;
  overflow: hidden;
}

.category-card .progress {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.8s ease-in-out;
}

/* Recommendations section */
.recommendations {
  margin: 3rem 0 2rem;
  padding: 2rem;
  background: var(--bg);
  border-radius: 15px;
  border: 1px solid var(--border);
}

.recommendations h3 {
  color: var(--text);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.recommendation {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--card);
  border-radius: 10px;
  border-left: 4px solid;
}

.recommendation.high-priority {
  border-left-color: var(--error);
}

.recommendation.medium-priority {
  border-left-color: var(--warning);
}

.recommendation.low-priority {
  border-left-color: var(--success);
}

.priority-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: fit-content;
}

.priority-badge.high {
  background: var(--error);
  color: white;
}

.priority-badge.medium {
  background: var(--warning);
  color: white;
}

.priority-badge.low {
  background: var(--success);
  color: white;
}

.recommendation-content {
  flex: 1;
}

.recommendation-content h4 {
  color: var(--text);
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.recommendation-content p {
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.export-btn, .analyze-btn, .share-btn {
  padding: 0.8rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 44px;
  touch-action: manipulation;
}

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

.analyze-btn {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--accent);
}

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

.export-btn:hover, .analyze-btn:hover, .share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.export-btn:focus, .analyze-btn:focus, .share-btn:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.action-help {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.action-help small {
  text-align: center;
  max-width: 120px;
}

/* Skip to content link for accessibility */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--text);
  color: var(--bg);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 1000;
  border-radius: 4px;
  font-weight: 600;
}

.skip-to-content:focus {
  top: 6px;
}

/* Trust signals */
.trust-signals {
  margin: 4rem 0;
  padding: 2rem;
  background: var(--card);
  border-radius: 15px;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.trust-item {
  text-align: center;
}

.trust-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.trust-item p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
}

.trust-item strong {
  color: var(--text);
}

/* Statistics section */
.stats-section {
  margin: 4rem 0;
  padding: 3rem 2rem;
  background: var(--gradient);
  border-radius: 20px;
  color: white;
  text-align: center;
}

.stats-container h3 {
  font-size: 2rem;
  margin-bottom: 2rem;
  color: white;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.stat-label {
  font-size: 1rem;
  opacity: 0.9;
  color: white;
  display: block;
  margin-bottom: 0.5rem;
}

.stat-description {
  font-size: 0.8rem;
  opacity: 0.8;
  color: white;
  display: block;
}

.stats-subtitle {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  color: white;
}

/* Testimonials section */
.testimonials {
  margin: 4rem 0;
  padding: 2rem;
}

.testimonials-container h3 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 3rem;
  color: var(--text);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  max-width: 1000px;
  margin: 0 auto;
}

.testimonial {
  background: var(--card);
  border-radius: 15px;
  padding: 2rem;
  margin: 0;
  border-left: 4px solid var(--accent);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.testimonial:hover {
  transform: translateY(-2px);
}

.testimonial p {
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-style: italic;
}

.testimonial cite {
  display: block;
  font-style: normal;
  color: #666;
  font-size: 0.9rem;
}

.testimonial cite strong {
  color: var(--text);
  font-weight: 600;
}

/* Features section */
.features {
  margin: 4rem 0;
}

.features h3 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 2rem;
  color: var(--text);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--card);
  border-radius: 15px;
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.feature-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
}

.feature-card h4 {
  margin: 0 0 1rem;
  color: var(--text);
}

.feature-card p {
  color: #666;
  line-height: 1.5;
  margin: 0;
}

/* Blog styles */
.blog-post-preview {
  background: var(--card);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--accent);
}

.blog-post-preview h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1.3rem;
}

.post-meta {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
  font-style: italic;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.topic-card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.topic-card h4 {
  margin: 0 0 1rem 0;
  color: var(--text);
}

.topic-card p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}

/* Article styles */
article {
  margin-bottom: 3rem;
}

.hero-text {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  text-align: center;
}

.last-updated {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 2rem;
  font-style: italic;
}

/* Footer */
footer {
  background: var(--card);
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: start;
}

.footer-nav h4 {
  margin: 0 0 1rem 0;
  color: var(--text);
  font-size: 1.1rem;
}

.footer-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 0.5rem;
}

.footer-nav a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-info {
  color: #666;
  font-size: 0.9rem;
}

.footer-info p {
  margin: 0 0 0.5rem 0;
}

/* Animations */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .header-content {
    padding: 0 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .quick-navigation {
    padding: 1.5rem;
    margin: 2rem 0 1rem 0;
  }
  
  .quick-navigation ul {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .quick-navigation a {
    padding: 0.75rem 1rem;
  }
  
  .hero h2 {
    font-size: 2rem;
  }
  
  .input-group {
    flex-direction: column;
  }
  
  .score-display {
    flex-direction: column;
    gap: 1rem;
  }
  
  .categories-grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

/* Accessibility improvements */
button:focus, input:focus, a:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill {
    animation: none;
  }
  
  .spinner {
    animation: none;
  }
}