/**
 * IDEO Carousel Styling
 * 
 * Professional carousel with arrow navigation, dot indicators,
 * and responsive design. Maintains editorial feel (not full-screen).
 */

.carousel-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin: 2rem 0;
  width: 100%;
  max-width: 100%;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
}

.carousel-wrapper.visible {
  max-height: 1200px;
  opacity: 1;
}

/* Close button */
.carousel-close-btn {
  align-self: flex-end;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  color: #333;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.carousel-close-btn:hover {
  background: #e0e0e0;
}

.carousel-close-btn:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

/* Main carousel container */
.carousel-container {
  position: relative;
  width: 100%;
  background: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease;
}

.carousel-container:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Image container and image */
.carousel-image-container {
  position: relative;
  width: 100%;
  padding-bottom: 66.67%; /* 3:2 aspect ratio */
  background: linear-gradient(135deg, #f5f5f5 0%, #efefef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.carousel-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: white;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.carousel-image:hover {
  opacity: 0.95;
}

/* Loading state */
.carousel-loading {
  position: absolute;
  color: #999;
  font-size: 0.875rem;
  letter-spacing: 0.5px;
}

/* Error state */
.carousel-error {
  position: absolute;
  color: #d32f2f;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
  max-width: 80%;
  line-height: 1.4;
}

.carousel-error:not(.visible) {
  display: none;
}

/* Navigation arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  transition: all 0.3s ease;
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: translateY(-50%) scale(1.1);
}

.carousel-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

/* Keyboard focus styling */
.carousel-arrow:focus {
  outline: 2px solid #0066cc;
  outline-offset: 2px;
}

.carousel-arrow-prev {
  left: 1rem;
}

.carousel-arrow-next {
  right: 1rem;
}

/* Disabled state (for future use) */
.carousel-arrow:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(0, 0, 0, 0.2);
}

.carousel-arrow:disabled:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(-50%);
}

/* Dot indicators */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: #ddd;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.carousel-dot:hover {
  background: #bbb;
  transform: scale(1.15);
}

.carousel-dot.active {
  background: #333;
  transform: scale(1.3);
}

/* Keyboard focus on dots */
.carousel-dot:focus {
  outline: 2px solid #0066cc;
  outline-offset: 3px;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Project info section */
.carousel-info {
  text-align: center;
  padding: 0 1rem;
}

.carousel-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.carousel-counter {
  font-size: 0.875rem;
  color: #666;
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Responsive design */
@media (max-width: 768px) {
  .carousel-wrapper {
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .carousel-arrow {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }

  .carousel-arrow-prev {
    left: 0.75rem;
  }

  .carousel-arrow-next {
    right: 0.75rem;
  }

  .carousel-dots {
    gap: 0.5rem;
  }

  .carousel-dot {
    width: 10px;
    height: 10px;
  }

  .carousel-title {
    font-size: 1rem;
  }

  .carousel-counter {
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .carousel-wrapper {
    gap: 0.75rem;
    margin: 1rem 0;
  }

  .carousel-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
  }

  .carousel-arrow-prev {
    left: 0.5rem;
  }

  .carousel-arrow-next {
    right: 0.5rem;
  }

  .carousel-dots {
    gap: 0.4rem;
  }

  .carousel-dot {
    width: 9px;
    height: 9px;
  }

  .carousel-title {
    font-size: 0.9375rem;
  }

  .carousel-image-container {
    padding-bottom: 70%; /* Adjust aspect ratio for smaller screens */
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .carousel-container {
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  .carousel-container:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }

  .carousel-image-container {
    background: linear-gradient(135deg, #1f1f1f 0%, #2a2a2a 100%);
  }

  .carousel-image {
    background: #1a1a1a;
  }

  .carousel-loading {
    color: #999;
  }

  .carousel-title {
    color: #f0f0f0;
  }

  .carousel-counter {
    color: #999;
  }

  .carousel-dot {
    background: #555;
  }

  .carousel-dot:hover {
    background: #777;
  }

  .carousel-dot.active {
    background: #ddd;
  }
}

/* Print styles */
@media print {
  .carousel-wrapper {
    display: none;
  }
}
