/* =================================================================
   OPTIMIZATION LAYER - Fixes spacing, contrast, and responsive issues
   This file overrides spacing, ensures visibility, and adds mobile support
================================================================= */

:root {
  /* Optimized spacing scale */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;
}

/* FIX #1: Reduce excessive section padding */
.section {
  padding: 3rem 0 !important;
}

@media (max-width: 768px) {
  .section {
    padding: 2rem 0 !important;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 1.5rem 0 !important;
  }
}

/* FIX #2: Fix hero section spacing */
.section-hero {
  padding-top: 1.5rem !important;
  padding-bottom: 3rem !important;
}

@media (max-width: 768px) {
  .section-hero {
    padding-top: 1rem !important;
    padding-bottom: 2rem !important;
  }
}

/* FIX #3: Fix section title margins */
.section-title {
  margin-bottom: 2.5rem !important;
}

.section-title h2 {
  margin-bottom: 0.75rem !important;
}

.section-title p {
  margin: 0.75rem auto 0 !important;
}

/* FIX #4: Fix workflow section */
.workflow-section {
  padding: 3rem 0 !important;
}

.workflow-pipeline {
  gap: 1.5rem !important;
  margin-top: 2rem !important;
}

.step-card {
  padding: 2rem !important;
}

@media (max-width: 768px) {
  .step-card {
    padding: 1.5rem !important;
  }
}

/* FIX #5: Fix text visibility - ensure proper contrast */
body {
  background-color: #fafafa;
  color: #1a1a1a;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #0f172a;
}

p {
  color: #404040;
}

.section-inverted p,
.section-inverted h1,
.section-inverted h2,
.section-inverted h3 {
  color: #ffffff !important;
}

/* FIX #6: Fix card padding and visibility */
.card {
  padding: 2rem !important;
  background: #fff;
  border-bottom: 4px solid #123e73;
}

.card h3 {
  margin: 0.5rem 0 1rem !important;
  font-size: 1.25rem;
  color: #123e73;
}

.card p {
  margin: 0;
  color: #404040;
}

/* FIX #7: Fix details section */
.details-section {
  padding: 3rem 0;
}

.details-grid {
  gap: 2rem;
}

@media (max-width: 768px) {
  .details-grid {
    gap: 1.5rem;
  }
}

/* FIX #8: Fix container padding */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }
}

/* FIX #9: Responsive font sizes */
h1 {
  font-size: clamp(2rem, 5vw, 3.5rem) !important;
  line-height: 1.1;
  margin-bottom: 1rem !important;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem) !important;
  line-height: 1.2;
  margin-bottom: 1rem !important;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem) !important;
  line-height: 1.2;
}

p {
  font-size: clamp(0.95rem, 1vw, 1.05rem) !important;
  line-height: 1.6;
}

/* FIX #10: Button improvements */
.btn {
  font-size: clamp(0.875rem, 1vw, 1rem) !important;
  padding: 0.75rem 1.5rem !important;
  border-radius: 0.5rem !important;
  transition: all 0.2s ease !important;
}

.btn:hover {
  transform: translateY(-2px) !important;
}

.btn-lg {
  padding: 1rem 2rem !important;
  font-size: 1rem !important;
}

/* FIX #11: Fix grid layouts for mobile */
.grid-features {
  grid-template-columns: 1fr !important;
  gap: 1.5rem !important;
}

@media (min-width: 768px) {
  .grid-features {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  .grid-features {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

.grid-asymmetric {
  grid-template-columns: 1fr !important;
  gap: 2rem !important;
}

@media (min-width: 1024px) {
  .grid-asymmetric {
    grid-template-columns: 1.2fr 0.8fr !important;
    align-items: center;
  }
}

/* FIX #12: Fix workflow pipeline grid */
.workflow-pipeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .workflow-pipeline {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .workflow-pipeline {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* FIX #13: Hero improvements */
.hero-content {
  max-width: 900px;
  padding: 1rem;
}

.hero h1 {
  margin-bottom: 1.5rem !important;
}

.hero p {
  margin: 1.5rem auto;
  max-width: 700px;
  font-size: clamp(1rem, 2vw, 1.125rem);
}

/* FIX #14: Section header spacing */
.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  margin-bottom: 0.5rem;
}

.section-header p {
  margin-top: 0.5rem;
}

/* FIX #15: Image responsiveness */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

.details-image,
.workflow-img-box img {
  border-radius: 0.75rem;
}

/* FIX #16: Link and button accessibility */
a {
  color: #123e73;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:not(.header-link):not(.btn-header-primary):not(.btn-header-secondary):hover {
  color: #3fa66b;
  text-decoration: underline;
}

a:focus {
  outline: 2px solid #123e73;
  outline-offset: 2px;
}

/* FIX #17: Mobile navigation improvements */
@media (max-width: 768px) {
  .header-nav {
    display: none !important;
  }

  .header-buttons {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  nav {
    height: auto;
    padding: 0.75rem 1rem;
  }

  .header-container {
    grid-template-columns: 1fr auto !important;
    gap: 1rem !important;
  }
}

/* FIX #18: Fix section label spacing */
.section-label {
  margin-bottom: 1rem !important;
  padding: 0.5rem 1rem !important;
}

.section-label-text {
  font-size: 0.75rem;
}

/* FIX #19: Animation performance */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* FIX #20: Print styles */
@media print {
  body {
    background: white;
  }

  .hero,
  .cta-section,
  nav,
  footer {
    display: none;
  }
}

/* Ensure hero badge is visible */
.hero-badge {
  background: #e6f5ec !important;
  color: #123e73 !important;
  padding: 0.75rem 1.5rem !important;
  margin-bottom: 1.5rem !important;
}

/* Ensure all text has proper line-height */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Remove excessive margins from lists */
ul,
ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

li {
  margin: 0.5rem 0;
}

/* Improve input focus states */
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #123e73;
  outline-offset: 2px;
}

/* Fix blockquotes and highlights */
.highlight-box {
  background: #f0f3ff;
  border-left: 4px solid #123e73;
  padding: 1.5rem !important;
  margin: 1.5rem 0 !important;
}

.highlight-box p {
  font-style: italic;
  color: #123e73;
}
