/* ============================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   Применяется только на экранах <= 768px
   ============================================ */

@media (max-width: 768px) {

    /* ===== 1. ЛОМАЕМ ВЛОЖЕННУЮ ПРОКРУТКУ ===== */
    html, body {
        height: auto !important;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    body {
        display: block;   /* было flex — из-за этого body растягивался */
    }

    .container {
        display: flex;
        flex-direction: column;
        flex: none !important;
        min-height: 0 !important;
        height: auto !important;
        margin: 5px;
        gap: 8px;
    }

    .centerBar {
        width: 100%;
        margin: 0;
        height: auto !important;
        flex: none !important;
        min-height: 0 !important;
    }

    .center {
        overflow-y: visible !important;  /* ключевая правка */
        overflow-x: visible !important;
        flex: none !important;
        min-height: 0 !important;
        height: auto !important;
        border-width: 20px;
    }

    /* ===== 2. МЕНЮ СВЕРХУ ===== */
    .sidebarLeft {
        width: 100%;
    }

    .menu {
        width: auto;
        border-width: 20px;
        padding: 10px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px 14px;
    }

    .menu p {
        margin: 0;
    }

    .menu .incenter {
        display: none;
    }

    /* ===== 3. ПОСТЫ РАСТЕНИЙ ===== */
    .main_text {
        padding: 10px;
        gap: 15px;
    }

    .post {
        flex-wrap: wrap !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin: 0 0 25px 0 !important;
        align-items: stretch !important;
    }

    .post img {
        width: 100% !important;
        max-width: 100%;
        height: auto;
    }

    /* Блок с двумя картинками — рядом */
    .post > div[style*="flex-direction: column"] {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    .post > div[style*="flex-direction: column"] img {
        width: calc(50% - 10px) !important;
    }

    .post p[style*="font-size: 24px"] {
        font-size: 20px !important;
    }

    /* ===== 4. ПРАВЫЙ САЙДБАР ПОД КОНТЕНТОМ ===== */
    .sidebarRight {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        align-items: flex-start;
    }

    .portrait {
        border-width: 20px;
        width: 130px;
    }

    .contacts,
    .links {
        width: calc(50% - 5px);
        min-width: 150px;
        border-width: 20px;
        padding: 12px;
        margin-top: 0;
        box-sizing: border-box;
    }

    /* ===== 5. ОБЩЕЕ ===== */
    img {
        max-width: 100%;
        height: auto;
    }

    .me img {
        width: 40px !important;
    }

    .incenter[style*="font-size: 30px"] {
        font-size: 22px !important;
    }

    .otherInfo {
        flex-direction: column;
        padding: 0 10px;
    }

    .gallery {
        column-count: 2;
        padding: 10px;
        column-gap: 8px;
    }
}

@media (max-width: 400px) {
    .post > div[style*="flex-direction: column"] img {
        width: 100% !important;
    }

    .contacts,
    .links {
        width: 100%;
    }

    .gallery {
        column-count: 1;
    }
}