/**
 * Challenge Showcase Widget CSS
 * Widget-specific styles only - common styles are in bugloos-design-system.css
 * 
 * Dependencies: bugloos-design-system.css must be loaded first
 */

/* ===== WIDGET-SPECIFIC STYLES ONLY ===== */

/* Main section container */
.challenge-showcase {
  position: relative;
  padding: var(--spacing-20) 0;
  background-color: var(--bugloos-white);
  overflow: hidden;
}

/* Background parallax element */
.challenge-showcase__bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(99, 195, 209, 0.03) 0%, rgba(124, 110, 176, 0.03) 100%);
  z-index: -1;
}

/* Container wrapper */
.challenge-showcase__container {
  max-width: var(--container-7xl);
  margin: 0 auto;
  padding: 0 var(--spacing-4);
}

/* Section header */
.challenge-showcase__header {
  text-align: center;
  margin-bottom: var(--spacing-16);
}

.challenge-showcase__title {
  font-family: var(--font-family-primary);
  font-size: var(--text-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--bugloos-dark);
  margin: 0;
  line-height: var(--leading-tight);
}

/* Main content grid */
.challenge-showcase__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 var(--spacing-12);
  align-items: center;
}

/* Mobile: Media always on top */
.challenge-showcase__media {
  order: -1; /* Force media to appear first on mobile */
}

/* Content column */
.challenge-showcase__content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
}

/* Description paragraphs */
.challenge-showcase__description p,
.challenge-showcase__context p {
  font-family: var(--font-family-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--bugloos-gray-700);
  margin: 0;
}

/* Code snippets in text */
.challenge-showcase__description code,
.challenge-showcase__context code {
  background-color: rgba(99, 195, 209, 0.1);
  color: var(--bugloos-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

/* Challenge points list */
.challenge-showcase__points {
  margin: 0;
}

.challenge-showcase__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

.challenge-showcase__point {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-4);
}

.challenge-showcase__bullet {
  display: block;
  width: 12px;
  height: 12px;
  background-color: var(--bugloos-primary);
  border-radius: 50%;
  margin-top: 8px;
  flex-shrink: 0;
}

.challenge-showcase__text {
  font-family: var(--font-family-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--bugloos-gray-700);
}

/* Generic unordered and ordered lists (no classes required) */
.challenge-showcase__description ul,
.challenge-showcase__context ul,
.challenge-showcase__overflow-content ul,
.challenge-showcase__description ol,
.challenge-showcase__context ol,
.challenge-showcase__overflow-content ol {
  margin: var(--spacing-4) 0;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
}

/* Unordered list styling */
.challenge-showcase__description ul,
.challenge-showcase__context ul,
.challenge-showcase__overflow-content ul {
  list-style: none;
}

/* Only direct children of ul get the unordered list styling */
.challenge-showcase__description ul > li,
.challenge-showcase__context ul > li,
.challenge-showcase__overflow-content ul > li {
  position: relative;
  padding-left: var(--spacing-6);
  font-family: var(--font-family-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--bugloos-gray-700);
}

/* Custom bullets for unordered lists - only direct children */
.challenge-showcase__description ul > li::before,
.challenge-showcase__context ul > li::before,
.challenge-showcase__overflow-content ul > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 12px;
  background-color: var(--bugloos-primary);
  border-radius: 50%;
  flex-shrink: 0;
}

/* Ordered list styling */
.challenge-showcase__description ol,
.challenge-showcase__context ol,
.challenge-showcase__overflow-content ol {
  list-style: none;
  counter-reset: challenge-counter;
}

/* Only direct children of ol get the ordered list styling */
.challenge-showcase__description ol > li,
.challenge-showcase__context ol > li,
.challenge-showcase__overflow-content ol > li {
  position: relative;
  padding-left: var(--spacing-8);
  font-family: var(--font-family-primary);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--bugloos-gray-700);
  counter-increment: challenge-counter;
}

/* Custom numbers for ordered lists - only direct children */
.challenge-showcase__description ol > li::before,
.challenge-showcase__context ol > li::before,
.challenge-showcase__overflow-content ol > li::before {
  content: counter(challenge-counter) ".";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-family-primary);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--bugloos-primary);
}

/* Nested lists */
.challenge-showcase__description ul ul,
.challenge-showcase__context ul ul,
.challenge-showcase__overflow-content ul ul,
.challenge-showcase__description ol ol,
.challenge-showcase__context ol ol,
.challenge-showcase__overflow-content ol ol,
.challenge-showcase__description ul ol,
.challenge-showcase__context ul ol,
.challenge-showcase__overflow-content ul ol,
.challenge-showcase__description ol ul,
.challenge-showcase__context ol ul,
.challenge-showcase__overflow-content ol ul {
  margin-top: var(--spacing-3);
  margin-bottom: 0;
}

/* Nested list items with slightly smaller font - direct children only */
.challenge-showcase__description ul ul > li,
.challenge-showcase__context ul ul > li,
.challenge-showcase__overflow-content ul ul > li,
.challenge-showcase__description ol ol > li,
.challenge-showcase__context ol ol > li,
.challenge-showcase__overflow-content ol ol > li,
.challenge-showcase__description ol ul > li,
.challenge-showcase__context ol ul > li,
.challenge-showcase__overflow-content ol ul > li,
.challenge-showcase__description ul ol > li,
.challenge-showcase__context ul ol > li,
.challenge-showcase__overflow-content ul ol > li {
  font-size: var(--text-base);
}

/* Nested unordered list bullets (in ul or ol) - direct children only */
.challenge-showcase__description ul ul > li::before,
.challenge-showcase__context ul ul > li::before,
.challenge-showcase__overflow-content ul ul > li::before,
.challenge-showcase__description ol ul > li::before,
.challenge-showcase__context ol ul > li::before,
.challenge-showcase__overflow-content ol ul > li::before {
  width: 8px;
  height: 8px;
  top: 8px;
  background-color: var(--bugloos-secondary);
}

/* Image container */
.challenge-showcase__media {
  justify-self: center;
  width: 100%;
  max-width: 600px;
  margin-bottom: var(--spacing-8);
}

.challenge-showcase__image-container {
  background-color: var(--bugloos-gray-700);
  border-radius: var(--radius-xl);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.challenge-showcase__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: var(--radius-xl);
  transition: transform var(--transition-normal);
}

.challenge-showcase__image:hover {
  transform: scale(1.02);
}

/* Responsive design */
@media (min-width: 768px) {
  .challenge-showcase__container {
    padding: 0 var(--spacing-6);
  }
  
  .challenge-showcase__grid {
    gap: 0 var(--spacing-16);
  }
}

@media (min-width: 1024px) {
  .challenge-showcase {
    padding: var(--spacing-24) 0;
  }
  
  .challenge-showcase__container {
    padding: 0 var(--spacing-8);
  }
  
  .challenge-showcase__grid {
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--spacing-20);
  }
  
  .challenge-showcase__title {
    font-size: var(--text-4xl);
  }
  
  /* Desktop: Reset order for proper two-column layout */
  .challenge-showcase__content {
    order: 0;
  }
  
  .challenge-showcase__media {
    order: 0;
  }
}

@media (min-width: 1280px) {
  .challenge-showcase__grid {
    gap: 0 var(--spacing-24);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .challenge-showcase__image {
    transition: none;
  }
  
  .challenge-showcase__image:hover {
    transform: none;
  }
}

/* ===== SHOW MORE FUNCTIONALITY ===== */

/* Overflow content section (appears below grid when expanded) */
.challenge-showcase__overflow {
  width: 100%;
  margin: 0;
  padding: 0;
}

.challenge-showcase__overflow-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-8);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.challenge-showcase__overflow--visible .challenge-showcase__overflow-content {
  max-height: 5000px; /* Large enough for most content */
  opacity: 1;
  padding: var(--spacing-5) 0 0;
}

/* Truncated state for main content */
.challenge-showcase__content-wrapper {
  position: relative;
}

.challenge-showcase__content-wrapper--truncated .challenge-showcase__content {
  position: relative;
}

.challenge-showcase__content-wrapper--truncated .challenge-showcase__content::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--bugloos-white));
  pointer-events: none;
  z-index: 1;
}

/* Remove fade when expanded */
.challenge-showcase__content-wrapper--expanded .challenge-showcase__content::after {
  display: none;
}

@media (min-width: 768px) {  
  .challenge-showcase__toggle-container {
    padding: 0 var(--spacing-6);
  }
}

@media (min-width: 1024px) {  
  .challenge-showcase__toggle-container {
    padding: 0 var(--spacing-8);
  }

  .challenge-showcase__media {
    margin-bottom: 0;
  }
}

/* Show More/Less Button Container */
.challenge-showcase__toggle-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: var(--spacing-6);
  padding: 0 var(--spacing-4);
}

/* When overflow is visible, button goes inside overflow section */
.challenge-showcase__overflow--visible .challenge-showcase__toggle-container {
  margin-top: var(--spacing-8);
  padding: var(--spacing-6) var(--spacing-4) 0;
}

/* Show More/Less Button */
.challenge-showcase__toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-1) var(--spacing-4);
  background-color: transparent;
  border: 2px solid var(--bugloos-primary);
  border-radius: var(--radius-md);
  color: var(--bugloos-primary);
  font-family: var(--font-family-primary);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.challenge-showcase__toggle-btn:hover {
  background-color: var(--bugloos-primary);
  color: var(--bugloos-white);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 195, 209, 0.3);
}

.challenge-showcase__toggle-btn:active {
  transform: translateY(0);
}

.challenge-showcase__toggle-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}

/* Rotate icon when expanded (button is inside overflow section) */
.challenge-showcase__overflow--visible .challenge-showcase__toggle-icon {
  transform: rotate(180deg);
}

/* ===== FULL-WIDTH VARIATION (NO MEDIA) ===== */

/* Full-width layout when no media is present */
.challenge-showcase--full-width .challenge-showcase__grid {
  grid-template-columns: 1fr;
  max-width: 900px;
  margin: 0 auto;
}

.challenge-showcase--full-width .challenge-showcase__content {
  max-width: 100%;
}

.challenge-showcase--full-width .challenge-showcase__media {
  display: none;
}

/* Adjust typography for full-width */
.challenge-showcase--full-width .challenge-showcase__description p,
.challenge-showcase--full-width .challenge-showcase__context p {
  font-size: var(--text-xl);
}

.challenge-showcase--full-width .challenge-showcase__text {
  font-size: var(--text-xl);
}

/* ===== CENTERED CONTENT VARIATION ===== */

/* Can be used independently or combined with other variations */
.challenge-showcase--centered .challenge-showcase__content {
  align-items: center;
  text-align: center;
}

.challenge-showcase--centered .challenge-showcase__description,
.challenge-showcase--centered .challenge-showcase__context {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.challenge-showcase--centered .challenge-showcase__points {
  text-align: left;
  max-width: 600px;
}

.challenge-showcase--centered .challenge-showcase__toggle-btn {
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 1024px) {
  .challenge-showcase--full-width .challenge-showcase__grid {
    max-width: 1000px;
  }
  
  .challenge-showcase--full-width .challenge-showcase__title {
    font-size: var(--text-5xl);
  }
}

/* Reduced motion for button and overflow */
@media (prefers-reduced-motion: reduce) {
  .challenge-showcase__toggle-btn,
  .challenge-showcase__toggle-icon,
  .challenge-showcase__overflow-content {
    transition: none;
  }
  
  .challenge-showcase__toggle-btn:hover {
    transform: none;
  }
  
  .challenge-showcase__overflow--visible .challenge-showcase__overflow-content {
    max-height: none;
  }
}
