/*
 * Community Features with Immersive Storytelling Scroll
 * 
 * This file converts the community features into a horizontal scrolling narrative
 * where each feature becomes a "chapter" in the community story, with parallax
 * backgrounds, character illustrations, and progressive disclosure of information.
 * 
 * To revert: Simply remove the link to this file from index.html
 */

/* Hidden radio buttons for CSS-only state management */
.story-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}

/* Story Container - Full viewport experience */
.story-scroll-container {
  width: 100%;
  min-height: 60vh;
  position: relative;
  background: linear-gradient(135deg, 
    rgba(253, 249, 240, 0.4) 0%, 
    rgba(168, 181, 160, 0.1) 50%,
    rgba(253, 249, 240, 0.4) 100%);
  border-radius: var(--radius-lg, 1.5rem);
  overflow: hidden;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  margin-bottom: var(--space-xl, 3rem);
}

/* Story Navigation - Top horizontal tabs */
.story-navigation {
  display: flex;
  justify-content: center;
  gap: var(--space-sm, 1rem);
  padding: var(--space-lg, 2rem) var(--space-md, 1.5rem) var(--space-md, 1.5rem);
  background: rgba(253, 249, 240, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(168, 181, 160, 0.2);
  position: relative;
  z-index: 10;
}

.story-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs, 0.5rem);
  padding: var(--space-sm, 1rem) var(--space-md, 1.5rem);
  background: rgba(253, 249, 240, 0.6);
  border: 2px solid transparent;
  border-radius: var(--radius-md, 1rem);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  font-family: inherit;
  color: var(--dark-taupe, #3A352C);
  min-width: 80px;
  outline: none;
  position: relative;
  overflow: hidden;
  transform-origin: center center;
}

.story-nav-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(168, 181, 160, 0.2) 50%, 
    transparent 100%);
  transition: left 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.story-nav-btn:hover::before {
  left: 100%;
}

/* Active state using :checked selector */
#chapter-0:checked ~ .story-navigation label[for="chapter-0"],
#chapter-1:checked ~ .story-navigation label[for="chapter-1"],
#chapter-2:checked ~ .story-navigation label[for="chapter-2"],
#chapter-3:checked ~ .story-navigation label[for="chapter-3"] {
  background: linear-gradient(135deg, var(--sage-green, #A8B5A0) 0%, #95a387 100%);
  color: white;
  border-color: var(--sage-green, #A8B5A0);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(168, 181, 160, 0.3),
    0 2px 8px rgba(168, 181, 160, 0.2);
}

.story-nav-btn:hover:not(.active) {
  background: rgba(168, 181, 160, 0.15);
  border-color: rgba(168, 181, 160, 0.3);
  transform: translateY(-1px);
}

.story-nav-btn:focus {
  outline: 3px solid var(--sage-green);
  outline-offset: 2px;
}

.nav-icon {
  font-size: 1.4rem;
  line-height: 1;
  transition: transform 0.3s ease;
}

/* Active icon scaling */
#chapter-0:checked ~ .story-navigation label[for="chapter-0"] .nav-icon,
#chapter-1:checked ~ .story-navigation label[for="chapter-1"] .nav-icon,
#chapter-2:checked ~ .story-navigation label[for="chapter-2"] .nav-icon,
#chapter-3:checked ~ .story-navigation label[for="chapter-3"] .nav-icon {
  transform: scale(1.2);
}

.nav-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

/* Story Chapters Container */
.story-chapters {
  position: relative;
  min-height: 500px;
  height: auto;
  overflow: hidden;
  touch-action: pan-y; /* Allow vertical scrolling but enable horizontal swipe detection */
}

/* Individual Story Chapter - Directional slide transitions */
.story-chapter {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateX(100%);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: 
    opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1),
    transform 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Chapter content should also fade */
.story-chapter .chapter-content {
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Active chapter - slides in and becomes visible */
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="0"],
#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="1"],
#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="2"],
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="3"] {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* Active chapter content should also fade in */
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="0"] .chapter-content,
#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="1"] .chapter-content,
#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="2"] .chapter-content,
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="3"] .chapter-content {
  opacity: 1;
}

/* Chapter 0 active - others slide to appropriate directions */
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="1"],
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="2"],
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="3"] {
  opacity: 0;
  transform: translateX(100%); /* Slide right (off-screen to right) */
  pointer-events: none;
}

#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="1"] .chapter-content,
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="2"] .chapter-content,
#chapter-0:checked ~ .story-chapters .story-chapter[data-chapter="3"] .chapter-content {
  opacity: 0;
}

/* Chapter 1 active - chapter 0 slides left, others slide right */
#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="0"] {
  opacity: 0;
  transform: translateX(-100%); /* Slide left (off-screen to left) */
  pointer-events: none;
}

#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="0"] .chapter-content {
  opacity: 0;
}

#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="2"],
#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="3"] {
  opacity: 0;
  transform: translateX(100%); /* Slide right (off-screen to right) */
  pointer-events: none;
}

#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="2"] .chapter-content,
#chapter-1:checked ~ .story-chapters .story-chapter[data-chapter="3"] .chapter-content {
  opacity: 0;
}

/* Chapter 2 active - chapters 0,1 slide left, chapter 3 slides right */
#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="0"],
#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="1"] {
  opacity: 0;
  transform: translateX(-100%); /* Slide left (off-screen to left) */
  pointer-events: none;
}

#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="0"] .chapter-content,
#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="1"] .chapter-content {
  opacity: 0;
}

#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="3"] {
  opacity: 0;
  transform: translateX(100%); /* Slide right (off-screen to right) */
  pointer-events: none;
}

#chapter-2:checked ~ .story-chapters .story-chapter[data-chapter="3"] .chapter-content {
  opacity: 0;
}

/* Chapter 3 active - all others slide left */
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="0"],
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="1"],
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="2"] {
  opacity: 0;
  transform: translateX(-100%); /* Slide left (off-screen to left) */
  pointer-events: none;
}

#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="0"] .chapter-content,
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="1"] .chapter-content,
#chapter-3:checked ~ .story-chapters .story-chapter[data-chapter="2"] .chapter-content {
  opacity: 0;
}



/* Parallax Background Layers */
.chapter-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.parallax-layer {
  position: absolute;
  width: 120%;
  height: 120%;
  top: -10%;
  left: -10%;
}

/* Layer 1 - Base patterns */
.parallax-layer.layer-1 {
  background: 
    radial-gradient(circle at 20% 30%, rgba(168, 181, 160, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255, 107, 53, 0.08) 1px, transparent 1px);
  background-size: 80px 80px, 120px 120px;
  z-index: 1;
}

/* Layer 2 - Medium elements */
.parallax-layer.layer-2 {
  background: 
    radial-gradient(circle at 60% 20%, rgba(200, 137, 107, 0.06) 2px, transparent 2px),
    radial-gradient(circle at 30% 80%, rgba(168, 181, 160, 0.08) 1px, transparent 1px);
  background-size: 150px 150px, 100px 100px;
  z-index: 2;
}

/* Layer 3 - Foreground accents */
.parallax-layer.layer-3 {
  background: 
    radial-gradient(circle at 40% 60%, rgba(255, 107, 53, 0.04) 3px, transparent 3px);
  background-size: 200px 200px;
  z-index: 3;
}


/* Chapter Content Layout */
.chapter-content {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--space-xl);
  max-width: 1200px;
  margin: 0 auto;
  min-height: 400px;
}






/* Chapter Text Content - No animations */
.chapter-text {
  width: 100%;
  color: var(--dark-taupe);
  text-align: left;
}







.chapter-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--charcoal);
  margin: 0 0 var(--space-md) 0;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--charcoal) 0%, var(--dark-taupe) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.chapter-description {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0 0 var(--space-lg) 0;
  color: var(--dark-taupe);
  opacity: 0.9;
}

/* Chapter Details List */
.chapter-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.detail-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  transition: all 0.3s ease;
}

.detail-item:hover {
  transform: translateX(8px);
}

.detail-icon {
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(168, 181, 160, 0.15);
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.detail-item:hover .detail-icon {
  background: var(--sage-green);
  transform: scale(1.1);
}

.detail-item span:last-child {
  font-weight: 500;
  color: var(--dark-taupe);
}


/* Responsive Design */
@media (max-width: 768px) {
  .story-scroll-container {
    min-height: 50vh;
  }
  
  .story-navigation {
    padding: var(--space-md) var(--space-sm) var(--space-sm);
    gap: var(--space-xs);
  }
  
  .story-nav-btn {
    min-width: 70px;
    padding: var(--space-xs) var(--space-sm);
  }
  
  .nav-icon {
    font-size: 1.2rem;
  }
  
  .nav-label {
    font-size: 0.75rem;
  }
  
  .story-chapters {
    min-height: 450px;
    height: auto;
  }
  
  .chapter-content {
    flex-direction: column;
    text-align: center;
    gap: var(--space-lg);
    padding: var(--space-lg) var(--space-md);
  }
  
  
  .chapter-title {
    font-size: 1.8rem;
  }
  
  .chapter-description {
    font-size: 1rem;
  }
  
}

@media (max-width: 480px) {
  .story-navigation {
    padding: var(--space-sm);
    gap: 4px;
  }
  
  .story-nav-btn {
    min-width: 60px;
    padding: var(--space-xs);
  }
  
  .nav-icon {
    font-size: 1rem;
  }
  
  .nav-label {
    font-size: 0.7rem;
  }
  
  .story-chapters {
    min-height: 400px;
    height: auto;
  }
  
  .chapter-content {
    padding: var(--space-md) var(--space-sm);
  }
  
  
  .chapter-title {
    font-size: 1.5rem;
  }
  
  .chapter-description {
    font-size: 0.9rem;
  }
  
  .chapter-details {
    gap: var(--space-xs);
  }
  
  .detail-item {
    flex-direction: column;
    text-align: center;
    gap: var(--space-xs);
  }
  
  
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .story-chapter,
  .character,
  .detail-item,
  .story-nav-btn {
    transition: none;
    animation: none;
  }
  
  
  
  .parallax-layer {
    transform: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .story-scroll-container {
    background: white;
    border: 2px solid var(--dark-taupe);
  }
  
  .story-nav-btn {
    background: white;
    border: 2px solid var(--dark-taupe);
    color: var(--dark-taupe);
  }
  
  .story-nav-btn.active {
    background: var(--dark-taupe);
    color: white;
  }
  
  
  .detail-icon {
    background: var(--dark-taupe);
    color: white;
  }
  
  
}

/* Print Styles */
@media print {
  .story-scroll-container {
    background: white !important;
    box-shadow: none !important;
    border: 1px solid #ccc;
    break-inside: avoid;
  }
  
  .story-navigation {
    display: none;
  }
  
  .story-chapters {
    height: auto;
    display: block;
  }
  
  .story-chapter {
    position: static;
    opacity: 1 !important;
    transform: none !important;
    display: block !important;
    page-break-inside: avoid;
    margin-bottom: 2rem;
    border-bottom: 1px solid #ccc;
    padding-bottom: 1rem;
  }
  
  .chapter-background,
  
  .chapter-content {
    padding: 1rem 0;
  }
  
}