/* ==========================================================================
   1. ШРИФТЫ И БАЗОВЫЕ ТЕГИ
   ========================================================================== */

header, nav, main, aside, footer, article, section {
    display: block;
}

body,
#mainDiv {
    min-width: 1060px;
}

body {
    margin: 0 0 20px 0;
    padding: 0;

    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 16px;
    line-height: 24px;
    text-align: left;
    vertical-align: top;
    color: #323232;

    background-color: #006ca5;
    background-image: url(images/bg.gif);
    background-repeat: repeat-x;
    background-position: center top;
}

a {
    font-weight: bold;
    text-decoration: underline;
    color: #005c9e;

    border: none;
}

a:hover {
    text-decoration: none;
}

img {
    border: none;
}

.clear {
    clear: both;
}

/* ==========================================================================
   2. ГЛАВНЫЙ КАРКАС И ШАПКА (МЕНЮ)
   ========================================================================== */

#mainDiv {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 139px 0 0 0;

    text-align: center;
    vertical-align: top;

    background-image: url(images/bg_main.jpg);
    background-repeat: no-repeat;
    background-position: center top;
}

#generalMenu {
    box-sizing: border-box;
    width: 1034px;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    padding: 5px 5px 0 5px;

    text-align: center;
    background-color: #fff;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
}

#mainMenu {
    width: 100%;
    min-height: 54px;
    margin: 0;
    padding: 0;

    background: linear-gradient(to bottom, #84b838 0%, #5e9416 100%);
    border-radius: 3px 3px 0 0;
}

#padd {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    padding: 0 18px;
    box-sizing: border-box;
}

.menuPunktActive,
.menuPunktNonActive {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    height: 54px;
    padding: 0 12px;

    font-size: 18px;
    white-space: nowrap;
    transition: background-color 0.2s ease;
}

.menuPunktNonActive {
    text-shadow: 1px 1px #466d10;
    background: transparent;
}

.menuPunktNonActive:hover {
    background-color: rgba(255, 255, 255, 0.12); /* Мягкая подсветка ячейки при наведении */
}

.menuPunktActive {
    text-shadow: 1px 1px #b27000;
    background: linear-gradient(to bottom, #ff9900 0%, #fe6001 100%);
}

.menuPunktActive::after,
.menu_sel::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 7px solid #ffffff;
}

a.PunktNonActive,
a.PunktActive {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;

    font-weight: normal;
    text-decoration: none;
    color: #ffffff;
}

a.PunktNonActive:hover {
    color: #e8ffba;
}

a.PunktActive:hover {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   3. ЦЕНТРАЛЬНЫЙ БЛОК И КОНТЕНТ
   ========================================================================== */

#mainPart {
    background: none;
}

#content {
    width: 1000px;
    margin: auto;
    padding: 28px 17px;

    text-align: left;

    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#content::after {
    content: "";
    display: table;
    clear: both;
}

#content img {
    max-width: 100%;
    height: auto;
}

#content_left {
    float: none; /* Убираем float: left, чтобы текст свободно обтекал правое меню #menu_right */
    width: 100%;
}

/* Карточка раздела: выстраиваем ровную колонку справа от фото без правки HTML */
.block {
    position: relative;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #d5d5d5;
}

/* Если в карточке картинка 150px (.sites_block) */
.block:has(.sites_block) {
    min-height: 102px;
    padding-left: 177px; /* 152px фото с рамкой + 25px отступ до текста */
}

/* Если в карточке картинка 180px (.main_block) */
.block:has(.main_block) {
    min-height: 122px;
    padding-left: 207px; /* 182px фото с рамкой + 25px отступ до текста */
}

/* Убираем лишний перенос строки сразу после заголовка, чтобы не было огромного отступа */
.block .hl_green + br,
.block .hl_blue + br {
    display: none;
}

.block_last {
    padding-bottom: 15px;
}

/* Превью 180px (.main_block) с любой высотой */
.main_block {
    float: left;
    width: 180px;
    margin-left: -207px;
    line-height: 0;
    border: 1px solid #d5d5d5;
}

.main_block img {
    display: block;
    width: 180px;
    height: auto;
}

/* Обычный .sites_block в списке материалов (без обёртки .block) */
.sites_block {
    float: left;
    width: 150px;
    margin-right: 25px;
    margin-bottom: 10px;
    line-height: 0;
    border: 1px solid #d5d5d5;
}

/* .sites_block внутри карточки .block (например, в разделах Фото/Сайты) */
.block .sites_block {
    margin-right: 0;
    margin-bottom: 0;
    margin-left: -177px;
}

.sites_block img {
    display: block;
    width: 150px;
    height: auto;
}

/* Заголовок ровно по верхнему краю картинки */
.block .hl_green,
.block .hl_blue {
    margin-top: -3px;
    margin-bottom: 8px;
    line-height: 22px;
}

.desc {
    overflow: hidden;

    font-size: 16px;
    line-height: 24px;
}

.hor_grey {
    clear: left; /* Не даёт полосе наезжать на превьюшку слева, если текст короткий */
    overflow: hidden; /* Заставляет полосу автоматически останавливаться перед правым меню */
    width: auto !important; /* Перебивает старые инлайн-стили */
    height: 1px;
    margin: 25px 0;

    background-color: #ccc;
}

#russia {
    margin-left: 30px;

    line-height: 23px;
}

#russia img {
    margin-right: 10px;
}

#content p {
    margin-top: 0;
    margin-bottom: 16px;
}

#content ul,
#content ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 24px;
}

#content li {
    margin-bottom: 6px;
}

/* Сетка портфолио: 5 фото в ряд на ПК */
.portfolio_grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px; /* Аккуратный отступ между фотографиями */
    max-width: 940px;
    margin: 15px auto 25px auto;
}

/* Модификатор сетки: 3 крупных фото в ряд на ПК */
.portfolio_grid_3 {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px; /* Чуть больший отступ между крупными карточками */
}

.portfolio_grid a {
    display: block;
    line-height: 0; /* Убирает лишний зазор снизу под картинкой */
}

.portfolio_grid img {
    width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   4. ПРАВОЕ МЕНЮ И ТИПОГРАФИКА (ЗАГОЛОВКИ И АКЦЕНТЫ)
   ========================================================================== */

h1 {
    margin-top: 0;
    margin-bottom: 18px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    font-weight: bold;
    line-height: 32px;
    color: #006ca5;
}

/* Для подзаголовков внутри статей или разделов */
h2 {
    margin-top: 24px;
    margin-bottom: 12px;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: bold;
    line-height: 26px;
    color: #006ca5;
}

#menu_right {
    float: right;
    width: 200px;
    padding-bottom: 15px;
    padding-left: 15px; /* Небольшой отступ слева, чтобы текст не прилипал к меню */
}

#menu_right .mainPunktSel {
    width: 200px;
    height: 31px;
    margin-bottom: 5px;
    padding-left: 10px;

    font-size: 18px;
    line-height: 31px;
    color: #fff;

    background-color: #006ca5;
    background-image: url(images/sub_menu_punkt.gif);
    background-repeat: no-repeat;
    background-position: left center;
}

#menu_right .mainPunktNonSel {
    width: 200px;
    height: 25px;
    margin-bottom: 5px;
    padding-left: 10px;

    font-size: 16px;
    line-height: 25px;
    color: #006ca5;

    background-image: url(images/sub_menu_punkt_nonsel.gif);
    background-repeat: no-repeat;
    background-position: left center;
}

#menu_right a.mainPunktActive {
    font-size: 16px;
    line-height: 31px;
    text-decoration: none;
    color: #fff;
}

#menu_right a.mainPunktActive:hover {
    text-decoration: underline;
}

#menu_right a.mainPunkt {
    text-decoration: none;
    color: #006ca5;
}

#menu_right a.mainPunkt:hover {
    text-decoration: underline;
}

.hl_blue {
    margin-top: 0;
    margin-bottom: 7px;

    font-size: 22px;
    font-weight: bold;
    text-transform: uppercase;
    color: #006699;
}

.hl_green {
    margin-top: 0;
    margin-bottom: 7px;

    font-size: 22px;
    font-weight: bold;
    text-transform: uppercase;
    color: #669900;
}

.orange {
    margin: 3px 0;

    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #fe6001;
}

.orange16 {
    font-size: 16px;
    font-weight: bold;
    font-style: italic;
    line-height: 18px;
    color: #fe6001;
}

.comp_orange {
    margin-left: 10px;

    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    line-height: 18px;
    color: #fe6001;
}

.blue {
    margin-bottom: 10px;

    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #006ca5;
}

.blue_right {
    margin-left: 10px;

    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #006ca5;
}

.green_right {
    margin-left: 10px;

    font-size: 18px;
    font-weight: bold;
    font-style: italic;
    color: #669900;
}

a.green {
    margin-left: 20px;

    color: #5e9416;
}

/* ==========================================================================
   5. ПОДВАЛ САЙТА (FOOTER)
   ========================================================================== */

#footer {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 1034px;
    min-height: 180px;
    margin: 0 auto;
    padding: 25px 45px;

    text-align: left;
    background: linear-gradient(to bottom, #92bd54 0%, #68942a 100%);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

#contact {
    display: flex;
    align-items: center;
    gap: 25px;
}

#photo {
    flex-shrink: 0;
    line-height: 0;
    border-top: 1px solid #5f773b;
    border-right: 1px solid #fff;
    border-bottom: 1px solid #fff;
    border-left: 1px solid #5f773b;
}

#photo img {
    display: block;
    max-width: 130px;
    height: auto;
}

#adress {
    font-size: 18px;
    line-height: 28px;
    font-weight: normal;
    color: #243f00;
    text-shadow: 1px 1px #b8d294;
}

#adress a {
    font-weight: normal;
    text-decoration: underline;
    color: #243f00;
}

#adress a:hover {
    text-decoration: none;
}

#vert_grey {
    width: 1px;
    height: 130px;
    margin: 0 30px;
    background: linear-gradient(
        to bottom,
        rgba(95, 119, 59, 0) 0%,
        rgba(95, 119, 59, 0.7) 50%,
        rgba(95, 119, 59, 0) 100%
    );
}

#social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-grow: 1;
}

#social a {
    display: block;
    line-height: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#social a:hover {
    transform: translateY(-3px);
    opacity: 0.9;
}

#social img {
    display: block;
    width: 68px;
    height: 68px;
    margin: 0;
    border: none;
}

/* ==========================================================================
   6. АДАПТИВНОСТЬ ДЛЯ ПЛАНШЕТОВ И СМАРТФОНОВ (ЭКРАНЫ ДО 1050PX)
   ========================================================================== */

@media (max-width: 1050px) {
    body,
    #mainDiv {
        min-width: 100%;
    }

    body {
        margin-bottom: 0;
    }

    /* Уменьшаем верхний отступ шапки на мобильных */
    #mainDiv {
        padding-top: 20px;
        background-size: 100% auto;
    }

    #generalMenu {
        width: 100%;
        padding: 4px 4px 0 4px;
        border-radius: 0;
    }

    #mainMenu {
        height: auto;
        padding: 6px 4px;
        border-radius: 0;
    }

    #padd {
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
        padding: 0;
    }

    .menuPunktActive,
    .menuPunktNonActive {
        flex: 0 1 auto;
        height: 36px;
        padding: 0 12px;
        font-size: 16px;
        border-radius: 4px;
    }

    .menuPunktActive::after,
    .menu_sel::after {
        display: none;
    }

    /* 3. Делаем центральный белый блок резиновым */
    #mainPart {
        background-image: none;
    }

    #content {
        display: block;
        box-sizing: border-box;
        width: 100%;
        padding: 20px 15px;
    }

    #content:has(#menu_right) {
    display: flex;
    flex-direction: column;
    }

    #content:has(#menu_right)::after {
        display: none;
    }

    /* 4. Переносим правую колонку вниз под основной текст */
    #menu_right {
        order: 2; /* Правое меню уходит строго под статью */
        float: none;
        box-sizing: border-box;
        width: 100%;
        margin-top: 25px;
        margin-bottom: 0;
        padding-top: 20px;
        padding-left: 0;
        border-top: 1px solid #d5d5d5;
        border-bottom: none;
    }

    #menu_right .mainPunktSel,
    #menu_right .mainPunktNonSel {
        box-sizing: border-box;
        width: 100%;
    }

    #content_left {
        order: 1; /* Статья всегда идёт первой */
        width: 100%;
    }

    /* Адаптируем карточки материалов и списков */
    .main_block {
        float: none;
        display: block;
        margin: 0 auto 12px auto;
    }

    /* Мобильные карточки: оба типа превью уменьшаются до 110px слева */
    .block:has(.sites_block),
    .block:has(.main_block) {
        min-height: 76px;
        margin-bottom: 18px;
        padding-bottom: 18px;
        padding-left: 126px; /* 112px фото с рамкой + 14px отступ до текста */
    }

    .main_block {
        float: left;
        display: block;
        width: 110px;
        margin: 0 0 0 -126px;
    }

    .sites_block img,
    .main_block img {
        width: 110px;
        height: auto;
    }

    /* Мобильный .sites_block в списке материалов (без обёртки .block) */
    .sites_block {
        float: left;
        display: block;
        width: 110px;
        margin: 0 14px 10px 0;
    }

    /* Мобильный .sites_block внутри карточки .block */
    .block .sites_block {
        margin: 0 0 0 -126px;
    }

    .block .hl_green,
    .block .hl_blue {
        margin-bottom: 6px;
        font-size: 18px;
        line-height: 20px;
    }

    #footer {
        flex-direction: column;
        width: 100%;
        height: auto;
        padding: 25px 15px;
        text-align: center;
        border-radius: 0;
    }

    #contact {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }

    #photo {
        margin: 0 auto;
    }

    #vert_grey {
        width: 80%;
        height: 1px;
        margin: 20px auto;
        background: linear-gradient(
            to right,
            rgba(95, 119, 59, 0) 0%,
            rgba(95, 119, 59, 0.7) 50%,
            rgba(95, 119, 59, 0) 100%
        );
    }

    #social {
        gap: 24px;
        width: 100%;
    }

    #social img {
        width: 56px;
        height: 56px;
    }

    h1 {
        font-size: 22px;
        line-height: 28px;
    }

    h2 {
        font-size: 19px;
        line-height: 24px;
    }

    /* Портфолио на планшетах (3 фото в ряд) */
    .portfolio_grid,
    .portfolio_grid_3 {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 15px 0 !important;
        padding: 0 !important;
    }

    .portfolio_grid a,
    .portfolio_grid_3 a {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .portfolio_grid img,
    .portfolio_grid_3 img {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 !important;
    }
}

@media (max-width: 600px) {
    /* Портфолио на смартфонах (2 фото в ряд) */
    .portfolio_grid,
    .portfolio_grid_3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
}