
/* Import the comprehensive color system */
@import url('color-system.css');

/* Modern CSS Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  width: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-secondary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Typography Scale */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
  text-wrap: balance; /* Improved headline balance */
  line-height: 1.1;
}

/* Fluid Typography Scale with Better Readability */
h1 { 
  font-size: clamp(2rem, 5vw + 1rem, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

h2 { 
  font-size: clamp(1.625rem, 4vw + 0.5rem, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 650;
  margin-bottom: 1.25rem;
}

h3 { 
  font-size: clamp(1.375rem, 3vw + 0.25rem, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin-bottom: 1.125rem;
}

h4 { 
  font-size: clamp(1.25rem, 2.5vw + 0.125rem, 1.875rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin-bottom: 1rem;
}

h5 { 
  font-size: clamp(1.125rem, 2vw + 0.125rem, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 550;
  margin-bottom: 0.875rem;
}

h6 { 
  font-size: clamp(1rem, 1.5vw + 0.125rem, 1.25rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 550;
  margin-bottom: 0.75rem;
}

/* Enhanced Body Text */
p {
  margin-bottom: 1.25rem;
  max-width: 65ch; /* Optimal reading width */
  text-wrap: pretty; /* Better line breaks for readability */
  line-height: 1.65;
  font-size: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
  color: var(--text-primary);
}

/* Enhanced Reading Experience */
.lead {
  font-size: clamp(1.125rem, 1vw + 1rem, 1.375rem);
  line-height: 1.6;
  font-weight: 400;
  color: var(--text-primary);
  max-width: 60ch;
  text-wrap: pretty;
}

.small {
  font-size: clamp(0.875rem, 0.5vw + 0.75rem, 1rem);
  line-height: 1.5;
  color: var(--text-muted);
}

/* Enhanced Navigation */
nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--nav-purple);
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--nav-purple);
  background: var(--bg-secondary);
  transform: translateY(-1px);
}

/* Mobile Navigation Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
  font-size: 1.25rem;
}

/* Container and Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main-content {
  display: grid;
  gap: 2rem;
  margin: 2rem 0;
}

/* Enhanced Cards */
.card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

/* Button System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  line-height: 1;
}

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

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--hover-bg);
  border-color: var(--border-focus);
}

/* Form Improvements */
.form-group {
  margin-bottom: 1.5rem;
}

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

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: var(--bg-tertiary);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Search Enhancement */
.search-container {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  border: 2px solid var(--border-color);
  border-radius: 25px;
  font-size: 1rem;
  background: var(--bg-tertiary);
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Status Badges Enhanced */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
}

/* Grid Systems */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Responsive Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Enhanced Focus Styles */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  nav, .no-print { display: none !important; }
  body { background: white !important; color: black !important; }
  .card { border: 1px solid #ccc !important; box-shadow: none !important; }
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    transition: all 0.2s ease;
  }
  
  .nav-toggle:hover {
    background: var(--hover-bg);
    transform: scale(1.05);
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    flex-direction: column;
    padding: 1rem;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
    border-radius: 0 0 12px 12px;
    animation: slideDown 0.3s ease;
  }
  
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .nav-links.active {
    display: flex;
  }
  
  .nav-links a {
    padding: 0.875rem 1rem;
    width: 100%;
    text-align: center;
    border-radius: 8px;
    margin: 0.125rem 0;
    transition: all 0.2s ease;
  }
  
  .nav-links a:hover {
    background: var(--primary-brand);
    color: white;
    transform: translateX(4px);
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  .card {
    padding: 1.25rem;
    border-radius: 10px;
    margin-bottom: 1rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    border-radius: 10px;
    font-weight: 600;
  }
  
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  
  .main-content {
    gap: 1.75rem;
    margin: 1.25rem 0;
  }
  
  /* Enhanced touch targets for mobile */
  .status-badge {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  
  /* Better form controls on mobile */
  .form-input,
  .search-input {
    padding: 1rem;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 10px;
    min-height: 44px;
  }
  
  /* Improved card stacking */
  .impact-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .impact-item {
    padding: 1.25rem;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px; /* Slightly larger for better readability */
  }
  
  .nav-container {
    padding: 0 0.75rem;
  }
  
  .container {
    padding: 0 0.75rem;
  }
  
  .card {
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
  }
  
  .search-input {
    padding: 0.875rem 0.875rem 0.875rem 2.75rem;
    border-radius: 12px;
  }
  
  .search-icon {
    left: 0.875rem;
    font-size: 1.1rem;
  }
  
  /* Enhanced mobile typography for better readability */
  h1 { 
    font-size: clamp(1.75rem, 8vw, 2.5rem);
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin-bottom: 1.25rem;
  }
  
  h2 { 
    font-size: clamp(1.5rem, 6vw, 2rem);
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
  }
  
  h3 { 
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0.875rem;
  }
  
  h4 { 
    font-size: clamp(1.125rem, 4vw, 1.5rem);
    line-height: 1.2;
    margin-bottom: 0.75rem;
  }
  
  /* Enhanced mobile paragraph readability */
  p {
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 100%; /* Full width on mobile for better space usage */
  }
  
  .readable {
    max-width: 100%;
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    line-height: 1.7;
  }
  
  /* Improved spacing for small screens */
  .section {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
  }
  
  /* Better button sizing for touch */
  .btn {
    padding: 0.875rem 1.75rem;
    min-height: 48px;
    border-radius: 12px;
  }
}

/* Featured Visualizations Section */
.featured-visualizations {
  margin: 3rem 0;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
}

.featured-visualizations h3 {
  text-align: center;
  color: var(--primary-brand);
  margin-bottom: 2rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

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

.viz-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.viz-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-brand);
}

.viz-thumbnail {
  height: 180px;
  position: relative;
  overflow: hidden;
}

.timeline-thumb {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.map-thumb {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

.viz-preview {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Timeline thumbnail preview */
.timeline-dots {
  display: flex;
  gap: 1rem;
  position: relative;
  z-index: 2;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.dot.removal { background: var(--primary-brand); }
.dot.legal { background: #0284c7; }
.dot.restoration { background: var(--success-color); }
.dot.policy { background: #fd7e14; }

.timeline-line {
  position: absolute;
  top: 50%;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

/* Map thumbnail preview */
.map-outline {
  position: relative;
  width: 120px;
  height: 80px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.facility-marker {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: var(--shadow-sm);
}

.facility-marker.geo {
  background: #e74c3c;
  top: 20%;
  left: 25%;
}

.facility-marker.corecivic {
  background: #3498db;
  top: 45%;
  right: 30%;
}

.facility-marker.igsa {
  background: #f39c12;
  bottom: 25%;
  left: 40%;
}

.facility-marker.other {
  background: #9b59b6;
  top: 35%;
  left: 60%;
}

.viz-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.viz-card:hover .viz-overlay {
  opacity: 1;
}

.viz-content {
  padding: 1.5rem;
  color: var(--text-on-gray);
}

.viz-content h4 {
  color: var(--text-on-gray);
}

.viz-content p {
  color: var(--text-on-gray);
}

.viz-content h4 {
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
}

.viz-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.viz-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat {
  background: var(--bg-secondary);
  color: var(--primary-brand);
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.viz-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-brand);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
}

.viz-button:hover {
  background: var(--primary-brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: white;
}

/* Mobile responsiveness for visualizations */
@media (max-width: 768px) {
  .visualization-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }
  
  .viz-thumbnail {
    height: 150px;
  }
  
  .viz-content {
    padding: 1.25rem;
  }
  
  .viz-stats {
    gap: 0.5rem;
  }
  
  .stat {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .featured-visualizations {
    margin: 2rem 0;
    padding: 1.5rem 0;
  }
  
  .viz-thumbnail {
    height: 120px;
  }
  
  .timeline-dots {
    gap: 0.75rem;
  }
  
  .dot {
    width: 10px;
    height: 10px;
  }
  
  .map-outline {
    width: 100px;
    height: 70px;
  }
  
  .facility-marker {
    width: 6px;
    height: 6px;
  }
}

/* Enhanced Visual Polish */
.glass-effect {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Smooth micro-interactions */
.card,
.btn,
.form-input,
.status-badge {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* Enhanced focus states for accessibility */
.card:focus-within,
.btn:focus,
.form-input:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Improved loading states */
.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  color: white;
}

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

/* Enhanced status badges with better visual hierarchy */
.status-badge {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-badge:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Improved form styling */
.form-input:focus {
  transform: translateY(-1px);
  border-color: var(--border-focus);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Better visual hierarchy for content */
.section {
  position: relative;
  overflow: hidden;
}

.section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary-brand), var(--primary-brand-hover));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.section:hover::before {
  opacity: 1;
}

/* Enhanced grid animations */
.grid > * {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Lightbox Modal for Images */
.lightbox-modal {
  display: none;
  position: fixed;
  z-index: 1002;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

.lightbox-modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  margin: auto;
  animation: zoomIn 0.3s ease;
}

.lightbox-image {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-caption {
  position: absolute;
  bottom: -50px;
  left: 0;
  right: 0;
  color: white;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

/* Clickable Images Styling */
.clickable-image {
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.clickable-image:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  filter: brightness(1.05);
}

.image-expand-hint {
  position: relative;
  display: inline-block;
}

.image-expand-hint::after {
  content: '🔍';
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-expand-hint:hover::after {
  opacity: 1;
}

/* Lightbox Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Enhanced Accessibility */
@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;
  }
  
  .lightbox-modal,
  .lightbox-content,
  .clickable-image {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --border-color: #666 !important;
    --text-muted: #333 !important;
  }
}

/* Dark mode support (respects system preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --border-color: #475569;
    --hover-bg: #475569;
  }
  
  nav {
    background: rgba(15, 23, 42, 0.95);
  }
}

/* Enhanced Typography Utilities */
.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;
}

/* Text Alignment */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Typography Utilities */
.text-balance { text-wrap: balance; }
.text-pretty { text-wrap: pretty; }
.text-nowrap { white-space: nowrap; }

/* Reading Experience Classes */
.readable {
  max-width: 65ch;
  line-height: 1.65;
  text-wrap: pretty;
  font-size: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
}

.narrow-reading {
  max-width: 55ch;
  line-height: 1.7;
}

.wide-reading {
  max-width: 75ch;
  line-height: 1.6;
}

/* Font Weight Scale */
.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Text Color Utilities */
.text-black { color: #000000 !important; }
.text-white { color: #ffffff !important; }

/* Force black text on white backgrounds */
.white-bg-black-text {
  background: #ffffff !important;
  color: #000000 !important;
}

.white-bg-black-text h1,
.white-bg-black-text h2,
.white-bg-black-text h3,
.white-bg-black-text h4,
.white-bg-black-text h5,
.white-bg-black-text h6 {
  color: #000000 !important;
}

.white-bg-black-text p,
.white-bg-black-text span,
.white-bg-black-text div {
  color: #000000 !important;
}

/* Font Size Utilities */
.text-xs { font-size: clamp(0.75rem, 0.25vw + 0.6875rem, 0.875rem); }
.text-sm { font-size: clamp(0.875rem, 0.5vw + 0.75rem, 1rem); }
.text-base { font-size: clamp(1rem, 0.5vw + 0.875rem, 1.125rem); }
.text-lg { font-size: clamp(1.125rem, 1vw + 1rem, 1.375rem); }
.text-xl { font-size: clamp(1.25rem, 1.5vw + 1rem, 1.625rem); }
.text-2xl { font-size: clamp(1.5rem, 2vw + 1rem, 2rem); }
.text-3xl { font-size: clamp(1.875rem, 3vw + 1rem, 2.5rem); }

/* Line Height Utilities */
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

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