/* General styling for the body and page */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
    box-sizing: border-box;
}

*, *:before, *:after {
  box-sizing: inherit;
}

header {
    background-color: #222;
    color: #f0f0f0;
    text-align: center;
    padding: 20px 0;
    box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 2px;
}

nav button {
    background-color: #444;
    color: #fff;
    border: none;
    padding: 10px 20px;
    margin: 5px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

nav button:hover {
    background-color: #666;
}

/* Carousel container and card styling */
#carousel-container {
    position: relative;
    width: 80%;
    height: 350px;  /* default height for desktops */
    margin: 50px auto;
    perspective: 1000px;
    overflow: visible; /* allow the zoomed card labels to show */
    touch-action: none;
}

#carousel {
    display: flex;
    justify-content: center;
    align-items: center;
    transform-style: preserve-3d;
    transition: transform 1s ease-in-out;
    width: 100%;
    height: 100%;
}

.card {
    position: absolute;
    width: 100px;
    height: 150px;
    transition: transform 0.8s ease;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-label {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 4px;
    color: #333;
}

.card img {
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
}

/* Floating card details (visible on desktop) */
#card-details {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    width: 90%;
    padding: 20px;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Back button styling */
.back-button {
    margin-right: auto;
    margin-left: 20px;
    background-color: #444;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.back-button:hover {
    background-color: #666;
}

/* Fullscreen modal for enlarged image */
#image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

#image-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
}

/* Bottom sheet text modal for mobile card description */
#text-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    max-height: 40%;  /* reduced max height for mobile */
    background-color: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    box-shadow: 0px -2px 10px rgba(0, 0, 0, 0.2);
    transform: translateY(120%);  /* start further offscreen */
    transition: transform 0.3s ease-out;
    overflow-y: auto;
    z-index: 1100;
    cursor: pointer;
    box-sizing: border-box;
    padding: 8px;
}

#text-modal.open {
    transform: translateY(0);
}

#text-modal-content {
    padding: 8px;
    font-size: 12px;  /* smaller font for mobile */
    color: #333;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Media queries for mobile devices */
@media only screen and (max-width: 768px) {
    #carousel-container {
        height: 250px; /* smaller carousel height for phones */
        width: 100%;
        margin: 20px auto;
    }
  
    /* Hide the floating card details on phones */
    #card-details {
        display: none;
    }
  
    /* Adjust card sizes for better visibility on phones */
    .card {
        width: 80px;
        height: 120px;
    }
}
