/**
 * Main Slideshow Styles
 *
 * This stylesheet ensures the main slideshow displays full-width
 * with no spacing between the header and slideshow.
 */

/* Remove all spacing when slideshow is present on the page */
body:has(.main-slideshow-block),
body.has-main-slideshow {
  margin: 0 !important;
}

body:has(.main-slideshow-block) main,
body:has(.main-slideshow-block) #main-content,
body.has-main-slideshow main,
body.has-main-slideshow #main-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

body:has(.main-slideshow-block) .site-header,
body.has-main-slideshow .site-header {
  margin-bottom: 0 !important;
}

body:has(.main-slideshow-block) .page-content,
body.has-main-slideshow .page-content {
  padding-top: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-top: 0 !important;
}

body:has(.main-slideshow-block) .container.page-content,
body.has-main-slideshow .container.page-content {
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Direct targeting for browsers that don't support :has() */
.page-content .main-slideshow-block {
  margin-top: 0 !important;
}

/* Remove top spacing from first layout section when it contains slideshow */
.layout-builder__layout .blb-section:first-child:has(.main-slideshow-block),
.layout-builder__layout > div:first-child:has(.main-slideshow-block) {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Remove the container width restriction for slideshow section */
.layout-builder__layout .blb-container-wrapper:has(.main-slideshow-block) {
  padding: 0 !important;
  margin: 0 !important;
}

.layout-builder__layout
  .blb-container-wrapper:has(.main-slideshow-block)
  .blb-container {
  max-width: none !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

.layout-builder__layout .blb-section:has(.main-slideshow-block) {
  margin: 0 !important;
  padding: 0 !important;
}

.layout-builder__layout .blb-section:has(.main-slideshow-block) .row {
  margin: 0 !important;
}

.layout-builder__layout .blb-section:has(.main-slideshow-block) .col-12 {
  padding: 0 !important;
}

/* Make the slideshow block full width with no margins */
.main-slideshow-block {
  margin: 0 !important;
  padding: 0 !important;
  width: 100vw !important;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw !important;
  margin-right: -50vw !important;
}

.main-slideshow-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
  /* Set responsive height for the slideshow */
  height: 60vh; /* 60% of viewport height */
  min-height: 400px;
  max-height: 800px;
}

.main-slideshow {
  width: 100%;
  height: 100%;
}

.slideshow-slide {
  position: relative;
  width: 100%;
  height: 100%;
  outline: none; /* Remove focus outline from slides */
  background: #000; /* Dark background for any gaps */
}

.slideshow-slide .slide-image {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.slideshow-slide .slide-image-link {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
}

.slideshow-slide .slide-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure images cover the area without distortion */
  object-position: center; /* Center the image */
  display: block;
}

.slideshow-slide .slide-caption-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.3) 30%,
    transparent 50%,
    rgba(0, 0, 0, 0.3) 70%,
    rgba(0, 0, 0, 0.7) 100%
  );
  color: white;
  z-index: 2;
  pointer-events: none;
}

/* Allow interactions with links inside overlay */
.slideshow-slide .slide-caption-overlay a {
  pointer-events: auto;
}

.slideshow-slide .slide-title {
  font-size: 4rem;
  font-weight: bold;
  margin: 0;
  padding: 2rem 4rem;
  color: white !important;
  text-shadow:
    2px 2px 8px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(0, 0, 0, 0.6);
  line-height: 1.2;
  text-align: center;
  width: 100%;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 10;
}

.slideshow-slide .slide-caption {
  font-size: 1.25rem;
  margin: 1rem 0;
  padding: 0 4rem;
  color: white;
  text-shadow:
    1px 1px 4px rgba(0, 0, 0, 0.8),
    0 0 10px rgba(0, 0, 0, 0.6);
  max-width: 800px;
  text-align: center;
  display: block;
  visibility: visible !important;
  opacity: 1 !important;
}

.slideshow-slide .slide-cta {
  display: inline-block;
  padding: 0.75rem 2rem;
  margin-top: 1rem;
  background: var(--umd-color-red, #e21833);
  color: white;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slideshow-slide .slide-cta:hover {
  background: var(--umd-color-redDark, #a90007);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

/* Slick dots customization */
.main-slideshow .slick-dots {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex !important;
  gap: 8px;
  list-style: none;
  padding: 10px 20px; /* Add padding to increase hover area */
  margin: 0;
  z-index: 10;
  opacity: 0;
  visibility: visible; /* Changed from hidden - allows hover detection */
  transition: all 0.3s ease;
  pointer-events: auto; /* Ensure dots can receive hover events */
}

.main-slideshow:hover .slick-dots,
.main-slideshow .slick-dots:hover {
  opacity: 1;
}

.main-slideshow .slick-dots li {
  margin: 0;
  padding: 0;
  width: auto;
  height: auto;
}

.main-slideshow .slick-dots li button {
  width: 12px;
  height: 12px;
  padding: 0;
  border: 2px solid white;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  font-size: 0;
  line-height: 0;
  transition: all 0.3s ease;
}

.main-slideshow .slick-dots li button:hover {
  background: rgba(255, 255, 255, 0.6);
  transform: scale(1.2);
}

.main-slideshow .slick-dots li.slick-active button {
  background: white;
  transform: scale(1.3);
}

.main-slideshow .slick-dots li button:before {
  display: none;
}

/* Slick arrows customization */
.main-slideshow .slick-prev,
.main-slideshow .slick-next {
  position: absolute;
  top: 0;
  bottom: 0;
  height: 100%;
  width: 80px;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: visible; /* Changed from hidden - allows hover detection */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0.5rem;
  font-size: 0;
  line-height: 0;
  text-indent: 0;
  pointer-events: auto; /* Ensure arrows can receive hover events */
}

.main-slideshow:hover .slick-prev,
.main-slideshow:hover .slick-next,
.main-slideshow .slick-prev:hover,
.main-slideshow .slick-next:hover {
  opacity: 1;
}

.main-slideshow .slick-prev:hover,
.main-slideshow .slick-next:hover {
  background: rgba(0, 0, 0, 0.8);
}

.main-slideshow .slick-prev {
  left: 0;
}

.main-slideshow .slick-next {
  right: 0;
}

.main-slideshow .slick-prev:before,
.main-slideshow .slick-next:before {
  font-family: Arial, sans-serif;
  font-size: 36px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.95);
  opacity: 1;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  display: block;
  text-indent: 0;
}

.main-slideshow .slick-prev:before {
  content: "‹";
}

.main-slideshow .slick-next:before {
  content: "›";
}

/* Arrow tooltip for slide preview - displayed inside the arrow bar */
.main-slideshow .slick-prev::after,
.main-slideshow .slick-next::after {
  content: attr(data-slide-title);
  position: relative;
  display: block;
  margin-top: 1rem;
  padding: 0;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: normal;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
  pointer-events: none;
  text-align: center;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Progress bar for autoplay */
.slideshow-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 11;
  overflow: hidden;
}

.slideshow-progress-bar-fill {
  height: 100%;
  background: var(--umd-color-white, #ffffff);
  width: 0;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

/* Disable outline on focus */
.main-slideshow .slick-prev:focus,
.main-slideshow .slick-next:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.5);
}

/* Loading state */
.main-slideshow:not(.slick-initialized) .slideshow-slide:not(:first-child) {
  display: none;
}

/* Fade animation improvements */
.main-slideshow.slick-slider {
  margin-bottom: 0;
  height: 100%;
}

.main-slideshow .slick-list {
  overflow: hidden;
  height: 100%;
}

.main-slideshow .slick-track {
  display: flex;
  align-items: center;
  height: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Adjust slideshow height for tablets */
  .main-slideshow-wrapper {
    height: 50vh;
    min-height: 300px;
    max-height: 600px;
  }

  .slideshow-slide .slide-title {
    font-size: 2.5rem;
    padding: 1.5rem 2rem;
  }

  .slideshow-slide .slide-caption {
    font-size: 1rem;
    padding: 0 2rem;
  }

  .slideshow-slide .slide-cta {
    padding: 0.5rem 1.5rem;
    font-size: 0.875rem;
  }

  .main-slideshow .slick-prev,
  .main-slideshow .slick-next {
    width: 60px;
  }

  .main-slideshow .slick-prev:before,
  .main-slideshow .slick-next:before {
    font-size: 28px;
  }

  /* Hide tooltips on smaller screens */
  .main-slideshow .slick-prev::after,
  .main-slideshow .slick-next::after {
    display: none;
  }

  .main-slideshow .slick-dots {
    bottom: 25px;
  }

  .main-slideshow .slick-dots li button {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  /* Adjust slideshow height for mobile phones */
  .main-slideshow-wrapper {
    height: 40vh;
    min-height: 250px;
    max-height: 400px;
  }

  .slideshow-slide .slide-title {
    font-size: 1.75rem;
    padding: 1rem 1rem;
  }

  .slideshow-slide .slide-caption {
    font-size: 0.875rem;
    margin: 0.5rem 0;
    padding: 0 1rem;
  }

  .slideshow-slide .slide-cta {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
  }

  .main-slideshow .slick-prev,
  .main-slideshow .slick-next {
    width: 50px;
  }

  .main-slideshow .slick-prev:before,
  .main-slideshow .slick-next:before {
    font-size: 24px;
  }

  .main-slideshow .slick-dots {
    bottom: 20px;
  }

  .slideshow-progress-bar {
    height: 3px;
  }
}
