/* Base styles - your existing styles */
.image-and-card-wrapper {
  display: flex;
  flex-direction: column; /* Still column for the overall wrapper */
  align-items: center;
  gap: 50px;
  margin-bottom: 40px;
  padding: 0 15px; /* Prevent content from touching edges on small screens */
}

.containerd {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.page-header h1 {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 20px;
  font-family: 'Montserrat', sans-serif;
  color: #dd0000;
  font-weight: 800;
}

/* Wrapper to control overflow and position */
.image-border-animate {
  position: relative;
  display: inline-block; /* Allows width/height to be set more directly */
  overflow: hidden;
  border-radius: 12px;
  /* Default desktop values */
  width: 70%; /* Example: Start with a percentage of its container */
  max-width: 800px; /* Limit max size on larger screens */
  aspect-ratio: 16 / 9; /* Ensure landscape aspect ratio for desktop */
}

/* Actual Image */
.image-border-animate img {
  width: 100%;
  height: 100%; /* Fill the container's height */
  display: block;
  border-radius: 12px;
  transition: transform 0.4s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  object-fit: cover; /* Ensures the image covers the container */
  object-position: center;
}

/* Animated border using pseudo-element */
.image-border-animate::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #ffbb00;
  border-radius: 12px;
  transform: scale(1.1);
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

/* Hover effect */
.image-border-animate:hover::after {
  transform: scale(1);
  opacity: 1;
}

.image-border-animate:hover img {
  transform: scale(1.02);
}

.recent-events {
  display: flex;
  justify-content: center;
  align-items: flex-start; /* Align items to the start, not center for cards */
  flex-wrap: wrap; /* Make cards wrap on smaller screens */
  gap: 20px;
  padding: 0 15px;
}

.event-card {
  max-width: 400px; /* Default max-width for larger screens */
  flex: 1 1 auto; /* Allow cards to grow and shrink, but maintain some base */
  min-width: 280px; /* Crucial: set a minimum width so they don't get too small and can wrap */
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  background-color: #fff;
  text-align: center;
  transition: transform 0.3s ease;
  box-sizing: border-box; /* Ensure padding/border is included in element's total width/height */
}

.event-card:hover {
  transform: translateY(-5px);
}

.event-image.portrait {
  width: 100%;
  height: auto;
  object-fit: cover;
}

/* Mobile-first adjustments */
@media (max-width: 767px) {
  .image-border-animate {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9; /* Keeps landscape rectangle */
    margin: 0 auto;
  }

  .recent-events {
    flex-direction: column;
    align-items: center;
    padding: 0 10px;
    gap: 30px;
  }

  .event-card {
    max-width: 90%;
    min-width: unset; /* Let it shrink on smaller screens */
  }

  .page-header h1 {
    font-size: 1.8rem;
  }
}

/* Medium Devices (tablets) */
@media (min-width: 768px) and (max-width: 1024px) {
  .image-border-animate {
    width: 90%;
    max-width: 700px;
  }

  .event-card {
    max-width: 45%;
    min-width: 300px;
  }
}

/* Large screens (default styles already handle this well) */
