/* Стили для модальных окон */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
    z-index: 1000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 375px;
    background: #CC0102;
    border-radius: 20px;
    padding: 30px;
    opacity: 0;
    visibility: hidden;
    transition: top 0.3s ease-out, opacity 0.3s ease-out, visibility 0.3s ease-out;
    z-index: 1001;
}

.modal.active {
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
    visibility: visible;
}

@keyframes slideIn {
    from {
        top: 200%;
        opacity: 1;
    }
    to {
        top: 50%;
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        top: 50%;
        opacity: 1;
    }
    to {
        top: 200%;
        opacity: 1;
    }
}

.modal.active {
    animation: slideIn 1.5s ease-out forwards;
}

.modal.closing {
    animation: slideOut 1.5s ease-out forwards;
}

.modal-content {
    position: relative;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.modal-close {
    position: absolute;
    top: -35px;
    right: -75px;
    width: 45px;
    height: 45px;
    cursor: pointer;
    z-index: 1002;
}

/* Стили для модального окна с изображениями */
.modal-images-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.modal-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
}

/* .modal-image-1 {
    position: absolute;
    top: 25%;
    left: 24%;
    width: 63%;
} */

.modal-image-1[data-cheese="petite"] {
    position: absolute;
    top: 13%;
    left: 17%;
    width: 73%;
}

.modal-image-2[data-cheese="petite"] {
    position: absolute;
    top: 46%;
    left: 13%;
    width: 11%;
}

.modal-image-3[data-cheese="petite"] {
    position: absolute;
    top: 16%;
    left: -1%;
    width: 26%;
}

.modal-image-4[data-cheese="petite"] {
    position: absolute;
    top: 17%;
    left: 73%;
    width: 25%;
}

.modal-image-1[data-cheese="camamber"] {
    position: absolute;
    top: 14%;
    left: 13%;
    width: 72%;
}

.modal-image-2[data-cheese="camamber"] {
    position: absolute;
    top: 46%;
    left: 13%;
    width: 11%;
}

.modal-image-3[data-cheese="camamber"] {
    position: absolute;
    top: 16%;
    left: -1%;
    width: 26%;
}

.modal-image-4[data-cheese="camamber"] {
    position: absolute;
    top: 17%;
    left: 73%;
    width: 25%;
}

.modal-image-1[data-cheese="blue"] {
    position: absolute;
    top: 20%;
    left: 25%;
    width: 70%;
}

.modal-image-2[data-cheese="blue"] {
    position: absolute;
    top: 47%;
    left: 13%;
    width: 11%;
}

.modal-image-3[data-cheese="blue"] {
    position: absolute;
    top: 15%;
    left: -5px;
    width: 27%;
}

.modal-image-4[data-cheese="blue"] {
    position: absolute;
    top: 15%;
    /* right: 1%; */
    width: 27%;
    left: 72%;
}

.modal-image-1[data-cheese="fondant"] {
    position: absolute;
    top: 29%;
    left: 6%;
    width: 78%;
}

.modal-image-2[data-cheese="fondant"] {
    display: none !important;
}

.modal-image-3[data-cheese="fondant"] {
    position: absolute;
    top: 22%;
    left: 0;
    width: 26%;
}

.modal-image-4[data-cheese="fondant"] {
    position: absolute;
    top: 21%;
    /* right: 2%; */
    width: 27%;
    left: 69%;
}

.modal-text-blocks {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    height: 300px;
}

.modal-text-blocks[data-cheese="blue"] {
    height: 300px;
}

.modal-text-blocks[data-cheese="fondant"] {
    height: 210px;
}

.modal-text-block {
    position: absolute;
    color: #fff;
    font-size: 1.2em;
    line-height: 1.3;
    text-align: center;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.modal-text-block:nth-of-type(1) {
    left: 30%;
    top: -2%;
    width: 40%;
}

.modal-text-block:nth-of-type(2) {
    left: 72%;
    top: 5%;
    width: 37%;
}

.modal-text-block:nth-of-type(3) {
    left: 60%;
    top: 87%;
    width: 64%;
}

.modal-text-blocks .modal-text-block.modal-text-block-1[data-cheese="petite"] {
    left: 24%;
    top: -9%;
    width: 40%;
}

.modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="petite"] {
    left: 76%;
    top: 1%;
    width: 27%;
}

.modal-text-blocks .modal-text-block.modal-text-block-3[data-cheese="petite"] {
    left: 50%;
    top: 80%;
    width: 64%;
}

.modal-text-blocks .modal-text-block.modal-text-block-1[data-cheese="camamber"] {
    left: 24%;
    top: -9%;
    width: 40%;
}

.modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="camamber"] {
    left: 74%;
    top: 1%;
    width: 37%;
}

.modal-text-blocks .modal-text-block.modal-text-block-3[data-cheese="camamber"] {
    left: 53%;
    top: 80%;
    width: 70%;
}

.modal-text-blocks .modal-text-block.modal-text-block-1[data-cheese="blue"] {
    left: 24%;
    top: -1%;
    width: 39%;
}

.modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="blue"] {
    left: 72%;
    top: -9%;
    width: 33%;
}

.modal-text-blocks .modal-text-block.modal-text-block-3[data-cheese="blue"] {
    left: 50%;
    top: 81%;
    width: 50%;
}

.modal-text-blocks .modal-text-block.modal-text-block-1[data-cheese="fondant"] {
    left: 22%;
    top: 3%;
    width: 40%;
}

.modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="fondant"] {
    left: 72%;
    top: 3%;
    width: 27%;
}

.modal-text-blocks .modal-text-block.modal-text-block-3[data-cheese="fondant"] {
    display: none !important;
}

/* Стили для модального окна с характеристиками */
.characteristics-container {
    display: flex;
    flex-direction: column;
    gap: 10px;            width: 100%;
}

.characteristic-block {
    text-align: center;
}

.characteristic-block h3 {
    color: #fff;
    margin-bottom: 10px;
}

.characteristic-block p {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.characteristic-images {
    display: flex;
    justify-content: center;
    width: 50%;
    margin-left: 25%;
}

.char-image {
    width: 18%;
    height: auto;
    position: relative;
}

.char-image-1 {
    top: 7px;
    left: 8px;
}

.char-image-2 {
    transform: rotate(180deg);
    left: 4px;
}

.char-image-3 {
    top: 7px;
}

.char-image-4 {
    transform: rotate(180deg);
    right: 4px;
}

.char-image-5 {
    top: 7px;
    right: 8px;
}


/* Стили для модального окна культуры плесени */
.modal-cheese-image {
    top: -160px;
    left: 20%;
    position: absolute;
    width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.modal-title {
    color: #fff;
    text-align: center;
}

.modal-subtitle {
    color: #FFE26B;
    text-align: center;
    font-size: 3.5vh;
    margin-top: 120px;
    margin-bottom: 0;
}

/* Стили для модального окна с описанием */
.modal-text {
    color: #fff;
    margin-top: 20px;
    text-align: center;
    width: 100%;
    font-size: 2.2vh;
    line-height: 1.3;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .modal {
        width: 440px;
        padding: 20px;
    }

    .modal-close {
        position: absolute;
        top: -15px;
        right: -15px;
        width: 30px;
        height: 30px;
        cursor: pointer;
        z-index: 1002;
    }

    .modal-text-blocks {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        height: 250px;
    }

    .modal-text-blocks[data-cheese="blue"] {
        height: 250px;
    }
    
    .modal-text-blocks[data-cheese="fondant"] {
        height: 210px;
    }

    .char-image {
        width: 15%;
    }
}

@keyframes arrowAnimation {
    0% {
        transform: translateX(0) scaleY(1);
    }
    50% {
        transform: translateX(-10px) scaleY(0.6);
    }
    100% {
        transform: translateX(0) scaleY(1);
    }
}

.desktop-back-arrow {
    position: fixed;
    left: 6%;
    top: 15%;
    width: 35px;
    height: 40px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
    z-index: 99;
    display: block;
    transform-origin: center;
}

.desktop-back-arrow.active {
    opacity: 1;
    pointer-events: auto;
    animation: arrowAnimation 1.8s ease-in-out infinite;
}

/* Стили для кнопки "Понятно" */
.modal-understand-button {
    position: relative;
    background: linear-gradient(to right, #FFE680, #FAB041, #FFE680);
    border: none;
    width: 90%;
    border-radius: 16px;
    padding: 18px 24px;
    cursor: pointer;
    color: #442F1E;
    font-weight: 400;
    font-size: 24px;
    text-align: center;
    font-family: 'Circe Rounded', Arial, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    line-height: 100%;
    overflow: hidden;
    margin-top: 30px;
}

.modal-understand-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.modal-understand-button::after {
    content: '';
    position: absolute;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: #fff;
    transition: all 0.3s ease;
    z-index: 1;
}

.modal-understand-button:hover::before {
    left: 0;
}

.modal-understand-button:hover::after {
    right: 0;
}

.modal-understand-button span {
    position: relative;
    z-index: 2;
    color: #442F1E;
    font-weight: 400;
    font-size: 24px;
}

.modal-understand-button:active {
    transform: scale(0.95);
}

@media (max-width: 768px) {
    .modal-understand-button {
        width: 90%;
        padding: 12px 24px;
        margin-top: 20px;
    }
    
    .modal-understand-button span {
        font-size: 20px;
    }
    
    .modal.active {
        width: 47%;
    }
    
    .modal-text-block {
        /* font-size: 2vh; */
    }
    
    .modal-cheese-image[data-cheese="fondant"] {
        content: url(../images/fondant-shadow.webp);
        top: -118px;
        left: 18%;
        width: 112%;
        z-index: 51;
    }

    .modal-subtitle {
        margin-top: 90px;
    }
}

@media (max-width: 600px) {
    .modal.active {
        width: 85%;
    }

    .modal-text-block {
        font-size: 1em;
    }

    .modal-text-blocks .modal-text-block.modal-text-block-1[data-cheese="petite"] {
        top: -11%;
    }

    .modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="petite"] {
        top: -1%;
    }

    .modal-text-blocks .modal-text-block.modal-text-block-2[data-cheese="camamber"] {
        top: -1%;
        width: 35%;
    }

    .modal-text-blocks .modal-text-block.modal-text-block-3[data-cheese="camamber"] {
        left: 50%;
        top: 81%;
    }
}
