/* ----- Carousel Specific CSS ----- */

    /* The main container that holds the carousel and its navigation */
    .carousel-wrapper {
        max-width: 1000px; /* Overall width of the carousel section */
        margin: 1.5rem auto 2rem auto; /* Consistent margin as before the grid */
        padding: 0 2rem; /* Consistent padding */
        position: relative; /* Needed for absolute positioning of navigation buttons */
        display: flex; /* To align carousel and buttons */
        align-items: center; /* Vertically center items (buttons with carousel) */
        justify-content: center; /* Horizontally center items */
    }

    /* The actual carousel container */
    .carousel-container {
        display: flex; /* Use flexbox for horizontal arrangement and scrolling */
        overflow-x: hidden; /* Hide the scrollbar, we'll control scrolling with JS */
        -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
        scroll-behavior: smooth; /* Smooth scrolling for JS navigation */
        gap: 1.5rem; /* Space between memo items */
        padding: 1.5rem 0; /* Add vertical padding for the top/bottom of items if padding was removed from .mini-memo-item */
        flex-grow: 1; /* Allow container to grow within its wrapper */
        align-items: center; /* Vertically center items */
    }

    /* Individual memo items within the carousel */
   .mini-memo-item {
    flex: 0 0 300px; /* Fixed width for each item (adjust as needed), no shrinking/growing */
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 0; /* Keep this at 0 for edge-to-edge image */
    display: flex;
    flex-direction: column; /* Arranges children vertically */
    text-align: center;
    min-height: 420px; /* Ensure consistent height */
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    scroll-snap-align: center; /* Snap items to the center when scrolling */
    position: relative;
    transform: scale(0.9); /* Default scaled down */
    opacity: 0.6; /* Default faded */
    justify-content: space-between; /* Distributes space between items, pushing button to bottom */
}

    /* State for the active (middle) carousel item */
  .carousel-item-active {
    transform: scale(1); /* Full size */
    opacity: 1; /* Fully visible */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Stronger shadow */
}


    /* State for the faded (side) carousel items */
 .carousel-item-faded {
    transform: scale(0.85); /* Slightly smaller */
    opacity: 0.4; /* More faded */
}

    body.dark-mode .mini-memo-item {
        background: #1f1f1f;
        color: white;
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
    }

    body.dark-mode .carousel-item-active {
        box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
    }

    .mini-memo-item h4 {
    font-size: 1.2rem;
    margin-top: 0; /* Removed margin-top, using padding */
    margin-bottom: 0; /* Removed margin-bottom, using padding */
    padding: 1.5rem 1.5rem 0.5rem 1.5rem; /* Specific padding for title */
    color: var(--accent);
}
    body.dark-mode .mini-memo-item h4 {
        color: white;
    }

    .mini-memo-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    border-bottom: 1px solid var(--memo-border);
    border-radius: 0; /* Image now fills top of card, no radius needed here */
    margin-bottom: 0; /* No margin here, as it pushes into the button space */
}

    body.dark-mode .mini-memo-item img {
        border-color: #333;
    }

    /* --- New CSS for the Read Memo Button --- */
.read-memo-button {
    display: inline-block; /* Allows padding and margin, and horizontal centering with text-align: center on parent */
    background-color: #FFA02F; /* Warm orange, matches your memo link hover */
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    text-decoration: none; /* Remove underline */
    font-weight: 600;
    margin-top: 1rem; /* Space above button */
    margin-bottom: 1.5rem; /* Space from bottom of the card */
    transition: background-color 0.3s ease, transform 0.1s ease;
    align-self: center; /* Ensures the button is centered within the flex column */
}

.read-memo-button:hover {
    background-color: #e68a00; /* Darker orange on hover */
    transform: scale(1.02); /* Slight scale on hover */
}

.read-memo-button:active {
    transform: scale(0.98); /* Slight shrink on click */
}

/* Dark mode for the button */
body.dark-mode .read-memo-button {
    background-color: #FFA02F; /* Keep the same or adjust */
}
body.dark-mode .read-memo-button:hover {
    background-color: #e68a00;
}

/* Lightbox Styles */
.lightbox-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Dark semi-transparent background */
    z-index: 1000; /* Ensure it's on top of everything */
    justify-content: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    opacity: 0; /* Start with 0 opacity for fade-in effect */
    transition: opacity 0.3s ease-in-out;
}

.lightbox-overlay.active {
    display: flex; /* Show when active */
    opacity: 1; /* Fade in */
}

.lightbox-content {
    position: relative;
    max-width: 90%; /* Max width of the content container */
    max-height: 90%; /* Max height of the content container */
    background: #fff; /* White background for the content box */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    display: flex; /* Use flexbox for iframe centering */
    flex-direction: column; /* Stack iframe, then caption */
    align-items: center; /* Center iframe */
}

/* Dark Mode for Lightbox content */
body.dark-mode .lightbox-content {
    background: #1f1f1f;
}
body.dark-mode .lightbox-caption {
    color: white;
}
body.dark-mode .lightbox-close { /* Removed lightbox-nav, as it's not present */
    color: white;
    background: rgba(255, 255, 255, 0.1);
}
body.dark-mode .lightbox-close:hover { /* Removed lightbox-nav:hover */
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-iframe { /* Only iframe here, no image */
    max-width: 100%;
    max-height: 75vh; /* Max height relative to viewport height */
    display: block; /* Remove extra space below iframes */
    object-fit: contain; /* Ensure entire content is visible */
    margin-bottom: 15px;
    width: 80vw; /* Adjust as needed */
    height: 75vh; /* Adjust as needed */
}

/* Hide iframe by default, show based on content type */
.lightbox-iframe {
    display: none;
}
.lightbox-iframe.active {
    display: block;
}

.lightbox-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 30px;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    border-radius: 5px;
    transition: background-color 0.2s ease;
}
.lightbox-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.lightbox-caption {
    font-size: 1.1rem;
    color: #333;
    text-align: left;
    margin-top: 10px;
    padding-left: 80px; 
    padding-right: 80px;
    max-height: 100px; /* Adjust this value as needed. This sets the maximum height before scrolling. */
    overflow-y: auto; /* Adds a vertical scrollbar if content overflows */
    word-wrap: break-word; /* Ensures long words don't overflow */
    box-sizing: border-box; /* Ensures padding doesn't add to the total width/height */
}

/* Dark Mode adjustment for scrollbar if you want it to be more visible */
body.dark-mode .lightbox-caption {
    color: white;
    /* Optional: Style scrollbar for dark mode, though browser default is often fine */
    /* scrollbar-color: #555 #333; */ /* thumb and track */
}
