/* Общие стили контейнера */
.recipe-main-layout {
    display: grid;
    /* На десктопе картинка занимает 1 часть, инфо-колонка — 1.5 части */
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    margin-top: 20px;
    padding: 0 24px;
}

/* Колонки на десктопе */
.recipe-img-col { 
    position: relative; 
    min-width: 0; /* Защита от распирания сетки длинным контентом */
}

.recipe-info-col { 
    display: grid;
    /* Размечаем области для контроля порядка элементов */
    grid-template-areas: 
        "title"
        "desc"
        "quote";
    gap: 15px;
    min-width: 0;
}

/* Привязываем элементы к областям */
.recipe-info-col h1 { grid-area: title; }
.recipe-description-body { grid-area: desc; }
.quote-modern-box { grid-area: quote; }

.recipe-image-main {
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Стиль цитаты с полоской */
.quote-modern-box {
    border-left: 4px solid #d4a373;
    padding-left: 20px;
    margin-top: 30px;
    background: rgba(212, 163, 115, 0.04);
    padding: 20px;
    border-radius: 0 15px 15px 0;
}

/* Адаптивность для мобилок */
@media (max-width: 768px) {
    .recipe-info-col h1 {
        font-size: 1.4rem !important; 
        font-weight: bold;
        margin-bottom: 15px !important;
    }
    
    .recipe-main-layout {
        /* Переключаем главный макет в одну колонку */
        grid-template-columns: 1fr;
        padding: 0 20px;
    }
    
    .recipe-img-col {
        margin-bottom: 20px;
    }
    
    /* Цитату отправляем визуально в самый низ на мобильном */
    .recipe-info-col {
        grid-template-areas: 
            "title"
            "desc"
            "quote"; /* Шаблон гарантирует правильный порядок сверху вниз */
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    .quote-modern-box {
        margin-top: 40px;
    }
}

.recipe-wrapper {
    margin: 40px auto;
    padding: 0 20px;
    color: var(--text-color);
    font-family: var(--font-mine);
}

.recipe-wrapper h1 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    text-align: center;
    color: var(--text-dark);
    padding: 50px 0;
}

.favorite_recipe {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    gap: 0;
}

.favorite_recipe .favorite_btn {
    padding: 8px;
    display: inline-block;
    max-width: max-content;
}

.recipe-body {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: center;
    justify-items: center;
    gap: 40px;
    width: 100%;
}

.recipe-image {
    max-width: 350px;
    width: 100%;
    display: grid;
    justify-content: center;
}

.recipe-image img {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 8px;
    box-shadow: 0 10px 20px var(--text-color), 0 6px 6px var(--text-color);
    transition: all 0.3s ease;
}

.recipe-content {
    margin: 0 auto;
    width: 100%;
    max-width: 800px;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: center;
}

.recipe-content ol li > strong {
    background: var(--accent-color);
    padding: 3px 19px 3px 9px;
    border-radius: 8px;
    color: #fff;
}

.recipe-content ul {
    padding-left: 0;
    margin: 0 20px;
    list-style-position: inside;
}

.recipe-content ul li, .recipe-content ol li {
    color: #000;
    font-weight: bold;
    padding: 0 20px;
}

.recipe-content ol li {
    margin: 26px 0;
}

.recipe-content h3 {
    color: var(--nana-img);
}

/* Стили для блока цитаты бабушки */
.recipe-content blockquote, 
.recipe-content p:has(img) {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    margin: 30px auto;
    width: 100%;
}

/* Центрирование самой картинки бабушки */
.recipe-content img[src*="grandma"], 
.recipe-content p img {
    display: block;
    margin: 15px auto;
    justify-self: center;
}

.recipe-content p:last-of-type > strong {
    display: block;
    text-align: center;
    color: var(--teracot-color);
    margin-top: 15px;
}

.recipe-content p {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-dark);
}

/* Кнопки */
.btn-group {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
}

.btn {
    background-color: var(--accent);
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    text-decoration: none;
    font-size: 1rem;
    transition: 0.3s;
    text-align: center;
}

.btn:hover {
    background-color: #bf3d14;
}

.btn-back {
    background-color: #555;
}

.btn-back:hover {
    background-color: #333;
}

/* Медиа для мобильных */
@media (max-width: 900px) {
    .recipe-wrapper h1 {
        padding: 30px 0;
    }
}

@media (max-width: 768px) { 
    .recipe-wrapper {
        padding: 0 15px;
    }

    .recipe-body {
        gap: 24px;
        justify-items: center;
    }

    .recipe-image {
        max-width: 100%;
        padding: 0 auto;
    }

    .recipe-content {
        margin: 0 20px;
        text-align: center;
        justify-items: center;
    }

    .recipe-content h3 {
        text-align: center;
    }

    .recipe-content ul {
        list-style-type: none;
        padding-left: 0;
        text-align: center;
    }

    .recipe-content ol {
        padding-left: 20px;
        text-align: left;
        width: 100%;
        max-width: 600px;
    }

    .btn-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 630px) {
    .recipe-wrapper {
        margin: 14px auto;
        padding: 0;
    }

    .recipe-body {
        justify-items: center;
    }

    .recipe-content {
        padding: 0 20px;
    }

    .recipe-wrapper h1 {
        font-size: 1.4rem;
    }

    li, p {
        font-size: 1rem;
    }
}
