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

:root {
  --primary-color: #1e40af;
  --primary-dark: #1e3a8a;
  --secondary-color: #f8fafc;
  --accent-color: #3b82f6;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Animation variables */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: #ffffff;
  scroll-behavior: smooth;
}

/* Focus styles for accessibility */
*:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 1000;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 300;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

/* Navigation */
.category-nav {
  background: white;
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 0;
}

.nav-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.nav-section {
  text-align: center;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  overflow-x: auto;
}

.nav-tab {
  background: none;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-tab:hover {
  color: var(--primary-color);
  background-color: var(--secondary-color);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

.nav-tab.active {
  color: white;
  background-color: var(--primary-color);
  font-weight: 600;
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}

.nav-tab:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Tech Companies Section */
.tech-companies {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--secondary-color);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
}

.tech-companies h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.company-card {
  background: white;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  text-align: center;
  transition: all var(--transition-fast);
}

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

.company-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.company-valuation {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Main Content */
.main-content {
  padding: 3rem 0;
  min-height: 60vh;
}

.category-header {
  text-align: center;
  margin-bottom: 3rem;
}

.category-header h2 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.category-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

/* Firms Grid */
.firms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.firm-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  will-change: transform;
}

.firm-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

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

.firm-rank {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--primary-color);
  color: white;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.firm-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  padding-right: 3rem;
}

.firm-location {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.firm-location::before {
  content: '📍';
  font-size: 0.9rem;
}

.firm-specialties {
  margin-bottom: 1.5rem;
}

.firm-specialties h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.specialties-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.specialty-tag {
  background: var(--secondary-color);
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.specialty-tag:hover {
  background: var(--primary-color);
  color: white;
  transform: scale(1.05);
}

.firm-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Loading State */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 1rem;
}

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

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Print styles */
@media print {
  .category-nav,
  .loading-overlay {
    display: none;
  }
  
  .hero {
    background: white;
    color: black;
  }
  
  .firm-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --primary-color: #000080;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #000000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  body {
    scroll-behavior: auto;
  }
}

/* Footer */
.footer {
  background: var(--secondary-color);
  padding: 2rem 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-sections {
    gap: 1.5rem;
  }
  
  .nav-tabs {
    justify-content: flex-start;
    padding-bottom: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .companies-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .category-header h2 {
    font-size: 2rem;
  }
  
  .firms-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .firm-card {
    padding: 1.5rem;
  }
  
  .nav-tabs {
    justify-content: flex-start;
    gap: 0.25rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .hero {
    padding: 2.5rem 0;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .firm-name {
    font-size: 1.25rem;
    padding-right: 2.5rem;
  }
  
  .firm-rank {
    width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
    top: 1rem;
    right: 1rem;
  }
  
  .nav-tab {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
}

/* Large screens optimization */
@media (min-width: 1400px) {
  .container {
    max-width: 1400px;
  }
  
  .firms-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}