/* Chapter Two Alternating Layout Styles */

/* Enhanced section layouts with 25% alternating margins */
.ch2-section {
  position: relative;
  overflow: visible;
}

/* Section content positioning */
.ch2-section-left .ch2-container {
  margin-right: 25%;
  margin-left: 0;
}

.ch2-section-right .ch2-container {
  margin-left: 25%;
  margin-right: 0;
}

.ch2-section-full .ch2-container {
  margin-left: auto;
  margin-right: auto;
}

/* Content wrapper for better typography */
.content-wrapper {
  max-width: 800px;
  width: 100%;
}

.ch2-section-left .content-wrapper {
  margin-left: 0;
  margin-right: auto;
}

.ch2-section-right .content-wrapper {
  margin-left: auto;
  margin-right: 0;
}

/* Primary vertical bars */
.ch2-section-left::before {
  content: '';
  position: absolute;
  right: 25%;
  top: 10%;
  bottom: 10%;
  width: 4px;
  background: var(--ch2-gradient-primary);
  border-radius: 2px;
  transform: translateX(50%);
  z-index: 10;
  opacity: 0;
  animation: slideInLeft 1s ease-out 0.3s forwards;
}

.ch2-section-right::before {
  content: '';
  position: absolute;
  left: 25%;
  top: 10%;
  bottom: 10%;
  width: 4px;
  background: var(--ch2-gradient-accent);
  border-radius: 2px;
  transform: translateX(-50%);
  z-index: 10;
  opacity: 0;
  animation: slideInRight 1s ease-out 0.3s forwards;
}

/* Secondary accent lines */
.ch2-section-left::after {
  content: '';
  position: absolute;
  right: 25%;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--ch2-primary);
  opacity: 0;
  border-radius: 1px;
  transform: translateX(200%);
  z-index: 5;
  animation: slideInLeft 1.2s ease-out 0.6s forwards;
}

.ch2-section-right::after {
  content: '';
  position: absolute;
  left: 25%;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--ch2-accent);
  opacity: 0;
  border-radius: 1px;
  transform: translateX(-200%);
  z-index: 5;
  animation: slideInRight 1.2s ease-out 0.6s forwards;
}

/* Animation keyframes */
@keyframes slideInLeft {
  to {
    opacity: 0.7;
    transform: translateX(50%);
  }
}

@keyframes slideInRight {
  to {
    opacity: 0.7;
    transform: translateX(-50%);
  }
}

/* Enhanced typography for sections */
.ch2-section h2 {
  position: relative;
  margin-bottom: 2rem;
}

.ch2-section h2::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--ch2-gradient-primary);
  border-radius: 2px;
  opacity: 0;
  animation: expandLine 1s ease-out 0.5s forwards;
}

.ch2-section-right h2::after {
  left: auto;
  right: 0;
  background: var(--ch2-gradient-accent);
}

@keyframes expandLine {
  from {
    width: 0;
    opacity: 0;
  }
  to {
    width: 60px;
    opacity: 1;
  }
}

/* Enhanced lead text styling */
.lead {
  font-size: 1.375rem;
  line-height: 1.6;
  color: var(--ch2-text-primary);
  font-weight: 400;
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease-out 0.7s forwards;
}

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

/* Section backgrounds for enhanced visual hierarchy */
.ch2-section:nth-child(even) {
  background: var(--ch2-bg-secondary);
  position: relative;
}

.ch2-section:nth-child(even)::before {
  background: var(--ch2-gradient-accent);
}

.ch2-section:nth-child(odd):not(.hero-section)::before {
  background: var(--ch2-gradient-primary);
}

/* Enhanced whitespace and spacing */
.ch2-section {
  padding: 6rem 0;
}

.ch2-section-sm {
  padding: 4rem 0;
}

.ch2-section-lg {
  padding: 8rem 0;
}

/* Responsive design for alternating layout */
@media (max-width: 1200px) {
  .ch2-section-left .ch2-container {
    margin-right: 20%;
  }
  
  .ch2-section-right .ch2-container {
    margin-left: 20%;
  }
  
  .ch2-section-left::before {
    right: 20%;
  }
  
  .ch2-section-right::before {
    left: 20%;
  }
  
  .ch2-section-left::after {
    right: 20%;
  }
  
  .ch2-section-right::after {
    left: 20%;
  }
}

@media (max-width: 1024px) {
  .ch2-section-left .ch2-container {
    margin-right: 15%;
  }
  
  .ch2-section-right .ch2-container {
    margin-left: 15%;
  }
  
  .ch2-section-left::before {
    right: 15%;
  }
  
  .ch2-section-right::before {
    left: 15%;
  }
  
  .ch2-section-left::after {
    right: 15%;
  }
  
  .ch2-section-right::after {
    left: 15%;
  }
}

@media (max-width: 768px) {
  /* Mobile: remove alternating margins and vertical bars */
  .ch2-section-left .ch2-container,
  .ch2-section-right .ch2-container {
    margin-left: 0;
    margin-right: 0;
  }
  
  .ch2-section-left::before,
  .ch2-section-right::before,
  .ch2-section-left::after,
  .ch2-section-right::after {
    display: none;
  }
  
  .content-wrapper {
    max-width: 100%;
  }
  
  .ch2-section-left .content-wrapper,
  .ch2-section-right .content-wrapper {
    margin-left: 0;
    margin-right: 0;
  }
  
  .ch2-section {
    padding: 4rem 0;
  }
  
  .lead {
    font-size: 1.25rem;
  }
}

/* Print styles for alternating layout */
@media print {
  .ch2-section-left::before,
  .ch2-section-right::before,
  .ch2-section-left::after,
  .ch2-section-right::after {
    display: none;
  }
  
  .ch2-section-left .ch2-container,
  .ch2-section-right .ch2-container {
    margin-left: 0;
    margin-right: 0;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  .ch2-section-left::before,
  .ch2-section-right::before,
  .ch2-section-left::after,
  .ch2-section-right::after,
  .ch2-section h2::after,
  .lead {
    animation: none;
    opacity: 0.7;
    transform: none;
  }
}

/* Enhanced focus styles for accessibility */
.ch2-section:focus-within {
  outline: 2px solid var(--ch2-primary);
  outline-offset: 4px;
}

/* Intersection observer enhancements */
.ch2-section {
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

.ch2-section.fade-in {
  opacity: 0;
}

.ch2-section.fade-in.visible {
  opacity: 1;
}
