.slideshow-cover-block {
  position: relative;
  overflow: hidden;
  display: flex;
  color: white;
  width: 100%;
  /* Remove static min-height - will be set via inline styles */
}

/* Ensure minimum height is respected even without inline styles */
.slideshow-cover-block:not([style*="min-height"]) {
  min-height: 400px;
}

/* Ensure all child elements respect the parent height */
.slideshow-cover-block .slideshow-container,
.slideshow-cover-block .slide,
.slideshow-cover-block .slideshow-overlay {
  min-height: inherit;
}

.slideshow-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden; /* Ensure container clips content */
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  background-attachment: scroll !important; /* Default to scroll */
  opacity: 0;
  transition: opacity 1s ease-in-out;
  transform: translateZ(0); /* Force hardware acceleration */
  backface-visibility: hidden; /* Prevent flickering */
}

.slide.active {
  opacity: 1;
}

/* Parallax effect - only when enabled and supported */
.slideshow-cover-block.has-parallax .slide {
  background-attachment: fixed !important;
  background-size: cover !important;
  background-position: center center !important;
  /* Ensure parallax works with proper height */
  min-height: 100vh !important;
  height: 100vh !important;
}

/* Disable parallax on mobile devices for performance and compatibility */
@media (max-width: 1024px) {
  .slideshow-cover-block.has-parallax .slide {
    background-attachment: scroll !important;
    min-height: 100% !important;
    height: 100% !important;
  }
}

/* Disable parallax on touch devices */
@media (hover: none) and (pointer: coarse) {
  .slideshow-cover-block.has-parallax .slide {
    background-attachment: scroll !important;
    min-height: 100% !important;
    height: 100% !important;
  }
}

/* iOS Safari parallax fix */
@supports (-webkit-overflow-scrolling: touch) {
  .slideshow-cover-block.has-parallax .slide {
    background-attachment: scroll !important;
  }
}

/* Firefox parallax optimization */ \
@-moz-document url-prefix() {
  .slideshow-cover-block.has-parallax .slide {
    background-attachment: scroll !important;
  }
}

.slideshow-overlay {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 2 !important;
  pointer-events: none !important; /* Allow clicks to pass through to content */
}

.slideshow-content {
  position: relative;
  z-index: 3;
  width: 100% !important; /* Force full width */
  height: 100% !important; /* Force full height */
  max-width: 100% !important; /* Ensure no width restrictions */
  display: flex;
  flex-direction: column;
  padding: 2rem;
  text-align: center;
  overflow: visible; /* Allow content to be visible */
  flex: 1; /* Take full available space */
  box-sizing: border-box;
}

/* Content positioning classes - more specific targeting */
.slideshow-cover-block[data-content-position*="top"] .slideshow-content {
  justify-content: flex-start !important;
}

.slideshow-cover-block[data-content-position*="center"]:not([data-content-position*="top"]):not(
    [data-content-position*="bottom"]
  )
  .slideshow-content {
  justify-content: center !important;
}

.slideshow-cover-block[data-content-position*="bottom"] .slideshow-content {
  justify-content: flex-end !important;
}

.slideshow-cover-block[data-content-position*="left"] .slideshow-content {
  align-items: flex-start !important;
  text-align: left !important;
}

.slideshow-cover-block[data-content-position*="right"] .slideshow-content {
  align-items: flex-end !important;
  text-align: right !important;
}

.slideshow-cover-block[data-content-position*="center"]:not([data-content-position*="left"]):not(
    [data-content-position*="right"]
  )
  .slideshow-content {
  align-items: center !important;
  text-align: center !important;
}

/* Fix for content positioning */
.slideshow-content > * {
  width: 100%;
  max-width: none !important;
  flex-shrink: 0; /* Prevent content from shrinking */
}

.slideshow-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background-color: #f0f0f0;
  color: #666;
  border: 2px dashed #ccc;
  text-align: center;
  padding: 2rem;
  min-height: 200px;
}

.slideshow-placeholder p {
  margin: 0;
  font-size: 1.1rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .slideshow-content {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .slideshow-content {
    padding: 0.5rem;
  }
}

/* Smooth loading */
.slideshow-cover-block {
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Accessibility improvements */
.slideshow-cover-block:focus-within {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .slideshow-cover-block .slide:not(.active) {
    display: none;
  }

  .slideshow-cover-block .slide.active {
    opacity: 1 !important;
    position: static !important;
  }
}

/* Prevent layout shifts */
.slideshow-cover-block * {
  box-sizing: border-box;
}

/* Ensure images maintain aspect ratio */
.slide {
  background-clip: padding-box;
}

/* Prevent nested slideshow blocks from displaying */
.slideshow-content .slideshow-cover-block,
.slideshow-content .slide,
.slideshow-content .slideshow-overlay {
  display: none !important;
}

/* If content contains actual inner blocks, show them normally */
.slideshow-content .wp-block-heading,
.slideshow-content .wp-block-paragraph,
.slideshow-content .wp-block-button,
.slideshow-content .wp-block-spacer,
.slideshow-content .wp-block-image,
.slideshow-content .wp-block-group {
  display: block !important;
}

.slideshow-content .wp-block-buttons {
  display: flex !important;
}

/* Ensure proper stacking and overflow handling */
.slideshow-cover-block,
.slideshow-container,
.slide {
  contain: layout style paint;
}

/* Fix for themes that might override overflow */
.slideshow-cover-block {
  overflow: hidden !important;
}

.slideshow-container {
  overflow: hidden !important;
}

/* Force full width for all content */
.slideshow-cover-block .slideshow-content,
.slideshow-cover-block .slideshow-content > *,
.slideshow-cover-block .slideshow-content .wp-block-heading,
.slideshow-cover-block .slideshow-content .wp-block-paragraph {
  width: 100% !important;
  max-width: 100% !important;
}
