.carousel-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 3rem auto;
}

.carousel-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
    align-items: center;
    /* Height will be set dynamically by JavaScript */
    transition: height 0.4s ease-in-out;
}

/* This selector is now part of the .carousel-wrapper rule above */

.carousel-item {
    flex: 0 0 100%;
    scroll-snap-align: center;
    text-align: center;
    margin: 0;
    padding: 0 2vw;
    box-sizing: border-box;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column; /* Stack image and caption vertically */
    align-items: center; /* Horizontally center */
    justify-content: center; /* Vertically center */
    height: 100%;
}

.carousel-item.active {
    opacity: 1;
    transform: scale(1);
}

.carousel-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* Fit image within the bounds, maintaining aspect ratio */
    border-radius: 16px; /* Increased border-radius */
    /* A softer, more diffused shadow for a natural look */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), 0 5px 15px rgba(0,0,0,0.07);
    /* A more subtle reflection */
    -webkit-box-reflect: below 15px linear-gradient(transparent 50%, rgba(0,0,0,0.08));
}

.carousel-item .caption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ccc;
    flex-shrink: 0; /* Prevent caption from shrinking */
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 20; /* Ensure they are above items */
    font-size: 28px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.carousel-nav:hover {
    background-color: #e87722; /* Theme color orange */
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

/* Styles for portfolio controls and filter buttons */
.portfolio-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.category-filters .filter-btn {
    background-color: transparent;
    border: 1px solid #555;
    color: #ccc;
    padding: 0.5rem 1.5rem;
    margin: 0.25rem;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-filters .filter-btn:hover {
    background-color: #333;
    border-color: #888;
    color: #fff;
}

.category-filters .filter-btn.active {
    background-color: #eee;
    border-color: #eee;
    color: #121212;
    font-weight: bold;
}

@media (prefers-reduced-motion: reduce) {
  .carousel-container {
    scroll-behavior: auto;
  }
}

@media (max-width: 768px) {
    .carousel-item {
        flex: 0 0 100%;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    /* Height is now dynamic, so fixed height is removed */

    .carousel-item {
        flex: 0 0 100%; /* Ensure it takes full width */
        padding: 0 5vw; /* Adjust padding */
    }

    .carousel-nav {
        width: 35px;
        height: 35px;
        font-size: 18px;
        top: auto;
        bottom: 10px;
        transform: none;
    }

    .carousel-prev {
        left: 10px;
    }

    .carousel-next {
        right: 10px;
    }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
