/* Hemispheres Carousel */
.hemi-section {
  margin-top: 30px;
}

.hemi-section h2 {
  margin: 0 0 12px 0;
}

.hemi-carousel {
  position: relative;
  width: 100%;
  height: 360px; /* default carousel height */
  /* Subtle dark gradient to suit transparent images */
  background: radial-gradient(1200px circle at 50% 50%, #1f2937 0%, #0f172a 55%, #0b1220 100%);
  border-radius: 8px;
  overflow: hidden; /* ensure zoom never shows outside */
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* Slide layering */
.carousel-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1500ms ease-in-out;
  z-index: 1; /* above decorative background */
}
.carousel-item.active {
  opacity: 1;
  pointer-events: auto;
}

.hemi-img {
  position: absolute;
  top: 50%; /* vertically center baseline before transforms */
  max-width: 50%; /* limit each image to half the container width */
  max-height: 70%; /* initial displayed height; allows room to zoom up to 100% */
  height: auto; /* maintain aspect ratio */
  width: auto; /* maintain aspect ratio */
  transform-origin: center center;
  will-change: transform; /* hint for smoother animations */
  object-fit: contain; /* ensure image fits within bounds */
}

.hemi-img.left {
  left: 0; /* anchor to left edge */
}

.hemi-img.right {
  right: 0; /* anchor to right edge */
}

/* Adjust image size for smaller screens */
@media (max-width: 768px) {
  .hemi-img {
    max-height: 60%;
  }
}

@media (max-width: 480px) {
  .hemi-img {
    max-height: 50%;
  }
}

/* Text slides */
.item-text .carousel-text {
  position: absolute;
  inset: 0; /* fill slide */
  display: flex;
  flex-direction: column; /* stack lines vertically */
  align-items: center;    /* horizontal center */
  justify-content: center;/* vertical center */
  gap: 8px;               /* space between lines */
  text-align: center;
  padding: 20px;          /* add padding to prevent edge touch */
  box-sizing: border-box; /* include padding in width calculation */
}

/* Decorative pattern overlay for text slide only */
.item-text::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* layered subtle dot grid pattern */
  background-image:
    radial-gradient(rgba(255,255,255,0.10) 1px, transparent 1px),
    radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 20px 20px, 40px 40px;
  background-position: 0 0, 10px 10px;
  opacity: 0.35;
}

/* Animated wave canvas overlay (brain-signal-like) */
.hemi-carousel .wave-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;            /* blend subtly over background */
  mix-blend-mode: screen;  /* brighten on dark gradient */
  z-index: 0;              /* keep behind images/text */
}

.item-text .carousel-text-line {
  position: static;      /* let flexbox control layout */
  transform: none;
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: #f5f7fa;        /* light text on dark gradient */
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap; /* single line */
  z-index: 2;            /* above waves */
  max-width: 100%;       /* never exceed container width */
  overflow: hidden;      /* hide any overflow */
  text-overflow: ellipsis; /* show ... if text is cut */
  display: inline-block; /* needed for max-width to work */
}

.item-text .carousel-text-line.text-line-2 {
  font-size: 2.5rem; /* larger for "GPU-Empowered Mapping" */
}

/* Responsive font sizes for smaller screens */
@media (max-width: 900px) {
  .item-text .carousel-text-line {
    font-size: 1.5rem;
  }
  .item-text .carousel-text-line.text-line-2 {
    font-size: 1.8rem;
  }
}

@media (max-width: 600px) {
  .item-text .carousel-text-line {
    font-size: 1.2rem;
  }
  .item-text .carousel-text-line.text-line-2 {
    font-size: 1.4rem;
  }
}

@media (max-width: 400px) {
  .item-text .carousel-text-line {
    font-size: 1rem;
  }
  .item-text .carousel-text-line.text-line-2 {
    font-size: 1.2rem;
  }
}

.item-text .carousel-text-line.text-line-1 {
  color: #60a5fa; /* distinct color for "Highly Accurate Retinotopic Maps" */
}
