* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-image: url('background.jpg');
    background-color: #000; /* Fallback color if the image fails to load */
    background-size: cover; /* Scales the image to cover the entire window */
    background-position: center center; /* Centers the image */
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keep the background fixed to the window */
    overflow: hidden;
    font-family: Arial, sans-serif;
    cursor: pointer;
    perspective: 1000px;
}

#carousel-container {
    position: fixed;
    top: 5vh;
    left: 5vw;
    width: 90vw;
    height: 90vh;
    perspective: 2500px;
    perspective-origin: center center;
    display: flex;
    align-items: center;
    justify-content: center;
}

#carousel {
    position: relative;
    width: 46vw; /* MODIFIED */
    height: 46vw; /* MODIFIED */
    max-width: none;
    max-height: none;
    transform-style: preserve-3d;
    transform-origin: center center;
}

.carousel-item {
    position: absolute;
    width: 46vw;
    height: 34.5vw;
    background: rgba(0, 0, 0, 0.0);
    border: none;
    border-radius: 10px;
    overflow: visible;
    opacity: 0.3;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease-out;
    backface-visibility: hidden;
    will-change: transform, opacity; /* Add this line */
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: center center;
    top: 50%;
    left: 50%;
    z-index: 1;
}

/* Portrait mode - narrower than 4:3 */
@media (orientation: portrait) {
    .carousel-item {
        width: 82.8vw !important; /* MODIFIED */
        height: calc(82.8vw * 0.75) !important; /* MODIFIED */
    }
}

/* Near square - between 4:3 and 1:1 */
@media (orientation: landscape) and (max-aspect-ratio: 4/3) {
    .carousel-item {
        width: 73.6vw !important; /* MODIFIED */
        height: calc(73.6vw * 0.75) !important; /* MODIFIED */
    }
}

/* Wide landscape - between 4:3 and 16:9 */
@media (orientation: landscape) and (min-aspect-ratio: 4/3) and (max-aspect-ratio: 16/9) {
    .carousel-item {
        width: 64.4vw !important; /* MODIFIED */
        height: calc(64.4vw * 0.75) !important; /* MODIFIED */
    }
}

/* Ultra-wide landscape - wider than 16:9 */
@media (orientation: landscape) and (min-aspect-ratio: 16/9) {
    .carousel-item {
        width: 46vw !important; /* MODIFIED */
        height: calc(55.2vw * 0.75) !important; /* MODIFIED */
    }
}

/* Super ultra-wide landscape - wider than 3:1 */
@media (orientation: landscape) and (min-aspect-ratio: 3/1) {
    .carousel-item {
        width: 27.6vw !important; /* MODIFIED */
        height: calc(36.8vw * 0.75) !important; /* MODIFIED */
    }
}

/* Super ultra-wide landscape - wider than 6:1 */
@media (orientation: landscape) and (min-aspect-ratio: 6/1) {
    .carousel-item {
        width: 18.4vw !important; /* MODIFIED */
        height: calc(36.8vw * 0.75) !important; /* MODIFIED */
    }
}

.carousel-item.active {
    opacity: 1;
    z-index: 100;
    transform-origin: center center;
}

/* Find the .carousel-item img rule and replace it with this */
.carousel-item img {
    width: 100%;
    height: auto;
    object-fit: contain; /* This prevents cropping */
    border-radius: 8px;
    max-height: 100%;
    display: block;
}

.carousel-item .image-name {
    color: rgba(253, 251, 252, 0.9);
      background: rgba(0, 0, 0, 0.0);
    display: none; /* MODIFIED: Hide text by default */
    padding:  5vh 1vw;
    border-radius: 5px;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 10;
    max-width: 100%;
    word-wrap: break-word;
    text-align: right;
    pointer-events: none;
}

/* MODIFIED: New rule to show text only on the active item */
.carousel-item.active .image-name {
    display: block;
}


.carousel-item .loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1px;
}

#controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    z-index: 100;
}

button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#info {
    display: none;
}

#fullscreenBtn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0);
    border: 0px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 14px;
}

#fullscreenBtn:hover {
    background: rgba(255, 255, 255, 0.3);
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    z-index: 50;
    display: none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#status {
    display: none;
}
/* STYLES FOR VIDEO OVERLAY */
#video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none; /* Initially hidden */
    cursor: default;
}

#video-player {
    /* This new positioning ensures the video is centered and fills the screen */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* This is key for aspect ratio and no cropping */
    cursor: pointer; 
}

#close-video-btn {
   display: none; /* Hide the close button */
}
@media (max-width: 768px) {
    .carousel-item .image-name {
        font-size: 10px;
        padding: 4px 8px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .carousel-item .image-name {
        font-size: 5px;
        padding: 3px 3px;
        max-width: 100%;
    }
}