:root {
    --cream: #f0ecdb;
    --brown: #422600;
}
.slider-container {
    position: relative;
    width: 100%;
    height: 800px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transition: all 0.2s ease-in-out;
}

/* --- Slide Wrapper Configuration --- */
.slide-content-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.slide-content-wrapper.active {
    z-index: 10;
    pointer-events: auto;
}

.slide-content-wrapper.leaving {
    z-index: 5; /* Stays above resting slides until covered */
}

/* Slide Background */
.slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.slide-bg video, .slide-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Panels Configuration --- */
.content-panel, .product-panel, .jar-wrapper {
    opacity: 0; /* Hidden by default */
    transform: translateX(0) rotate(0deg);
}

/* Active state keeps elements visible when no animation is running */
.slide-content-wrapper.active:not(.next-in):not(.prev-in):not(.next-out):not(.prev-out) .content-panel,
.slide-content-wrapper.active:not(.next-in):not(.prev-in):not(.next-out):not(.prev-out) .product-panel,
.slide-content-wrapper.active:not(.next-in):not(.prev-in):not(.next-out):not(.prev-out) .jar-wrapper {
    opacity: 1;
}

/* Left Content Panel */
.content-panel {
    position: absolute;
    margin: 20px 0 20px 20px;
    width: 48%;
    height: calc(100% - 40px);
    background-color: #eddec9;
    border-radius: 8px;
    z-index: 10;
    padding: 40px 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transition: width 0.3s;
}

.slide-number {
    font-family: 'Homemade Apple', cursive;
    font-size: 24px;
    color: var(--brown);
    margin-bottom: 10px;
}

.slide-title {
    font-family: Playfair Display, serif;
    font-size: clamp(30px, 6vw, 70px);
    line-height: 0.9;
    margin-bottom: 20px;
    max-width: 70%;
    font-weight: 700;
}

.slide-desc {
    font-size: 1.125rem;
    color: #000;
    line-height: 1.5;
    margin-bottom: 30px;
    max-width: 70%;
}

/* Right Product Panel */
.product-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: width 0.3s;
}

.flavor-name {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Staatliches', cursive;
    font-size: clamp(120px, 22vw, 300px);
    color: transparent;
    opacity: 0.5;
    z-index: 2;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
    line-height: 0.8;
    letter-spacing: 5px;
    transition: color 0.5s ease;
    -webkit-text-stroke: 2.5px #a39683;
    font-family: fantasy;
    z-index: 1
}

.jar-wrapper {
    position: relative;
    width: 300px;
    height: 450px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2
}

.jar-img {
    position: relative;
    width: 100%;
    height: 100%;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    z-index: 3;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
}

.nav-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
    position: absolute;
    z-index: 20;
    top: 50%;
}

.nav-btn {
    background: rgba(255,255,255,0.70);
    color: #333333;
    font-size: 22px;
    font-weight: bold;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease-in-out;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 #0000, 0 0 #0000, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}


/* =========================================
   ANIMATION KEYFRAMES
   ========================================= */

/* --- NEXT (Forward) Actions --- */
@keyframes nextBgIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0%);
    }
}
@keyframes nextContentIn {
    from {
        transform: translateX(-150px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
@keyframes nextJarRollIn {
    0% {
        transform: translateX(-250px) rotate(-25deg);
        opacity: 0;
    }
    60% {
        transform: translateX(30px) rotate(10deg);
        opacity: 1;
    }
    100% {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
}
@keyframes nextContentOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(150px);
        opacity: 0;
    }
}
@keyframes nextJarRollOut {
    from {
        transform: rotate(0deg);
        opacity: 1;
    }
    to {
        transform: rotate(25deg) translateX(150px);
        opacity: 0;
    }
}

/* Apply NEXT Animations */
.next-in .slide-bg {
    animation: nextBgIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.next-in .content-panel {
    animation: nextContentIn 0.6s ease 0.2s forwards;
}
.next-in .product-panel {
    animation: nextContentIn 0.6s ease 0.2s forwards;
}
.next-in .jar-wrapper {
    animation: nextJarRollIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

.next-out .content-panel {
    animation: nextContentOut 0.4s ease forwards;
}
.next-out .product-panel {
    animation: nextContentOut 0.4s ease forwards;
}
.next-out .jar-wrapper {
    animation: nextJarRollOut 0.4s ease forwards;
}


/* --- PREV (Backward) Actions --- */
@keyframes prevBgIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0%);
    }
}
@keyframes prevContentIn {
    from {
        transform: translateX(150px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
@keyframes prevJarRollIn {
    0% {
        transform: translateX(250px) rotate(25deg);
        opacity: 0;
    }
    60% {
        transform: translateX(-30px) rotate(-10deg);
        opacity: 1;
    }
    100% {
        transform: translateX(0) rotate(0deg);
        opacity: 1;
    }
}
@keyframes prevContentOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-150px);
        opacity: 0;
    }
}
@keyframes prevJarRollOut {
    from {
        transform: rotate(0deg);
        opacity: 1;
    }
    to {
        transform: rotate(-25deg) translateX(-150px);
        opacity: 0;
    }
}

/* Apply PREV Animations */
.prev-in .slide-bg {
    animation: prevBgIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.prev-in .content-panel {
    animation: prevContentIn 0.6s ease 0.2s forwards;
}
.prev-in .product-panel {
    animation: prevContentIn 0.6s ease 0.2s forwards;
}
.prev-in .jar-wrapper {
    animation: prevJarRollIn 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
}

.prev-out .content-panel {
    animation: prevContentOut 0.4s ease forwards;
}
.prev-out .product-panel {
    animation: prevContentOut 0.4s ease forwards;
}
.prev-out .jar-wrapper {
    animation: prevJarRollOut 0.4s ease forwards;
}
@media (max-width: 1024px) {
    .content-panel{
        width: 61%;
    }
    .product-panel{
        width: 75%;
    }
}
@media (max-height: 800px) {
    .slider-container{
        height: 650px;
        transition: all 0.2s ease-in-out;
    }
}
@media (max-width: 768px) {
    .slide-number{
        display: none
    }
    .content-panel {
        width: auto;
        margin: 10px;
        padding: 10px;
        height: auto;
        bottom: 5px;
        top: 33%;
        align-items: center;
        justify-content: flex-start;
        padding-top: 140px;
    }
    .product-panel {
        width: 100%;
        top: 0;
        height: 70%;
    }
    .slide-title {
        font-size: 40px;
    }
    .slide-desc{
        max-width: 100%;
        margin-bottom: 17px;
        overflow: hidden;
    }
    .jar-wrapper {
        width: 210px;
    }
    .nav-controls{
        padding: 0 5px;
    }
}