/* --- Main Carousel Container --- */
.carousel {
    position: relative;
    max-width: 100%;
    margin: 2rem auto;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    background-color: #000;
    aspect-ratio: 16/9; 
}

/* --- Image Stacking & Transitions --- */
.carousel img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.carousel img.active {
    opacity: 1;
    z-index: 1;
}

/* --- Caption Overlay (Scroll Fix) --- */
.caption-overlay {
    position: absolute;
    bottom: 0; 
    left: 0; 
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 1.5rem;
    font-size: 1rem;
    z-index: 20;
    text-align: center;
    backdrop-filter: blur(5px);
    max-height: 25%; 
    overflow-y: auto;
    opacity: 0;
    pointer-events: none; 
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.caption-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.caption-overlay.user-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(20px);
}

/* --- Custom Scrollbar --- */
.caption-overlay::-webkit-scrollbar { width: 6px; }
.caption-overlay::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.3); border-radius: 10px; }

/* --- Global Button Styles --- */
.carousel-btn {
    position: absolute;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 30; 
    transition: all 0.3s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.carousel-btn:hover { background-color: rgba(255, 255, 255, 0.9); color: #000; }

/* --- Side Navigation --- */
.carousel-btn.prev { top: 50%; left: 20px; transform: translateY(-50%); }
.carousel-btn.next { top: 50%; right: 20px; transform: translateY(-50%); }

/* --- Control Buttons (Lower Right) --- */
.carousel-btn.toggle-text, 
.carousel-btn.play-pause {
    bottom: 20px;
    top: auto;
    width: 40px;
    height: 40px;
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.5);
    transform: none;
}

.carousel-btn.toggle-text { right: 20px; font-weight: bold; }
.carousel-btn.play-pause { right: 70px; } /* Placed next to the T button */
