* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #111;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.gallery-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery {
    position: relative;
    width: 100%;
    height: 80vh;
    max-height: 800px;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background-color: #000;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0.0, 0.2, 1),
        transform 1.5s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform: scale(1.08);
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    will-change: opacity, transform;
}

.slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.slide img {
    max-width: 100%;
    max-height: 85%;
    object-fit: contain;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 1.5s ease-out;
    will-change: transform;
}

.slide.active img {
    animation: subtle-zoom 15s linear infinite alternate;
}

@keyframes subtle-zoom {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.05);
    }
}

.caption {
    position: absolute;
    top: 50%;
    left: 50px;
    transform: translateY(-50%) translateX(-150%);
    width: 320px;
    max-width: 35%;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 20px 25px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    z-index: 10;
    opacity: 0;
    backdrop-filter: blur(8px);
    transition: opacity 0.6s ease, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    text-align: left;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.caption h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #3498db;
    position: relative;
    display: inline-block;
}

.caption h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background-color: #3498db;
    transition: width 0.8s ease;
}

.slide.active .caption h3::after {
    width: 100%;
    transition-delay: 1.5s;
}

.caption p {
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 300;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.slide.active .caption {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    transition-delay: 0.8s;
}

.slide.active .caption p {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 1.2s;
}

/* Typewriter cursor effect */
.caption::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background-color: #3498db;
    animation: cursor-blink 0.8s steps(1) infinite;
}

@keyframes cursor-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Text reveal animation */
.slide.active .caption::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.8) 0%,
            rgba(52, 152, 219, 0.3) 50%,
            rgba(0, 0, 0, 0.8) 100%);
    animation: typewriter-sweep 2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes typewriter-sweep {
    0% {
        left: 0;
    }

    100% {
        left: 100%;
    }
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
}

.dots-container {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #555;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.dot:hover {
    transform: scale(1.2);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.dot.active {
    background-color: #3498db;
    box-shadow: 0 0 8px #3498db;
}

@media (max-width: 768px) {
    .gallery {
        height: 60vh;
    }

    .caption {
        left: 25px;
        padding: 15px;
        max-width: 50%;
    }

    .caption h3 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .caption p {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    button {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}