/* memorial.css — левое меню раздела «Мемориальные объекты» (по макету maket-memorialnye-obekty.html).
   Классы с префиксом mem- , чтобы не конфликтовать с Bootstrap 3 темы.

   Поведение панели:
   - заголовки кладбищ всегда видны (не прокручиваются и не сжимаются);
   - прокрутка только внутри списка объектов открытого кладбища;
   - на мобильных панель сворачивается кнопкой-бургером. */

/* ===== Панель ===== */
.mem-side {
    border: 1px solid #d7d7d7;
    background: #f4f4f4;
    display: flex;
    flex-direction: column;
}

/* Без JS (класс mem-js не добавлен) меню идёт в потоке страницы, все кладбища раскрыты. */
.mem-side.mem-js {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: hidden;
}

.mem-head {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(#e9e9e9, #dcdcdc);
    padding: 11px 14px;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    border: 0;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    flex: 0 0 auto;
}
.mem-burger { display: inline-block; width: 18px; height: 14px; position: relative; flex: 0 0 auto; }
.mem-burger i { position: absolute; left: 0; right: 0; height: 2px; background: #555; }
.mem-burger i:nth-child(1) { top: 0; }
.mem-burger i:nth-child(2) { top: 6px; }
.mem-burger i:nth-child(3) { top: 12px; }

/* Список кладбищ: колонка, которая умеет сжиматься, чтобы внутренний блок прокручивался */
.mem-side.mem-js .mem-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;      /* аварийный случай — очень низкий экран */
    overflow-x: hidden;
}

.mem-group { margin: 0; }

.mem-side.mem-js .mem-group {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 0 0 auto;          /* закрытые кладбища — фиксированной высоты (только заголовок) */
}
.mem-side.mem-js .mem-group.open {
    flex: 0 1 auto;          /* открытое — может сжиматься, отдавая место списку */
}

.mem-cem-head {
    background: #e3e3e3;
    font-weight: bold;
    font-size: 14px;
    padding: 9px 12px;
    border-top: 1px solid #d5d5d5;
    border-bottom: 1px solid #cfcfcf;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    text-decoration: none;
    color: #333;
    flex: 0 0 auto;          /* заголовок кладбища не сжимается и не уезжает */
}
.mem-cem-head:hover { background: #dadada; color: #333; text-decoration: none; }
.mem-cem-head::after { content: '\25B8'; margin-left: auto; color: #777; font-size: 12px; }
.mem-group.open > .mem-cem-head::after { content: '\25BE'; }

.mem-cem-body { display: block; }
.mem-group.closed > .mem-cem-body { display: none; }

/* прокрутка — только здесь */
.mem-side.mem-js .mem-cem-body {
    min-height: 160px;      /* список не схлопывается в ноль на низких экранах */
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.mem-sub {
    background: #dde8f1;
    color: #23587f;
    font-size: 11.5px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 6px 12px;
    border-bottom: 1px solid #cfdce8;
}
.mem-item {
    display: block;
    padding: 8px 12px;
    font-size: 13.5px;
    color: #333;
    text-decoration: none;
    background: #fafafa;
    border-bottom: 1px solid #e6e6e6;
    cursor: pointer;
    line-height: 1.35;
}
.mem-item:hover { background: #eef3f8; color: #333; text-decoration: none; }
.mem-item.active {
    background: #fff;
    font-weight: bold;
    color: #1e567f;
    box-shadow: inset 3px 0 0 #2b6ca3;
}

/* ===== Лендинг раздела ===== */
.mem-land-intro {
    border: 1px solid #cfe0ee;
    background: #f6f9fc;
    padding: 12px 16px;
    font-size: 14px;
    color: #41576b;
    margin-bottom: 22px;
}
.mem-land-cem { margin: 0 0 26px; }
.mem-land-cem h3 {
    font-size: 18px;
    color: #1e567f;
    border-bottom: 2px solid #dde8f1;
    padding-bottom: 6px;
    margin: 0 0 10px;
}
.mem-land-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mem-land-groups h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #23587f;
    background: #dde8f1;
    padding: 6px 10px;
    margin: 0 0 6px;
}
.mem-land-groups ul { list-style: none; margin: 0; padding: 0; }
.mem-land-groups li { border-bottom: 1px solid #eee; }
.mem-land-groups a { display: block; padding: 6px 8px; font-size: 13.5px; color: #2b6ca3; text-decoration: none; }
.mem-land-groups a:hover { background: #eef3f8; text-decoration: underline; }

.mem-land-title { font-size: 26px; color: #54748e; margin: 4px 0 6px; }
.mem-land-sep { height: 3px; background: #2b6ca3; border-radius: 2px; margin: 6px 0 20px; }

/* ===== Списки погребённых ===== */
.mem-list-block { margin: 18px 0 0; }
.mem-list-title { font-size: 18px; color: #3d3d3d; margin: 0 0 8px; }
.mem-list-count { font-size: 13px; color: #6b7c8c; margin: 0 0 10px; }
.mem-list-wrap { overflow: auto; max-height: 640px; border: 1px solid #dde4ea; }
.mem-list { width: 100%; border-collapse: collapse; font-size: 13px; }
.mem-list thead th {
    position: sticky; top: 0; z-index: 1;
    background: #dde8f1; color: #23587f; text-align: left;
    padding: 7px 8px; border-bottom: 1px solid #c9d6e2; white-space: nowrap;
}
.mem-list td { padding: 6px 8px; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.mem-list tbody tr:nth-child(even) td { background: #fafcfe; }

/* ===== Мобильные: панель сворачивается ===== */
@media (max-width: 991px) {
    .mem-side,
    .mem-side.mem-js {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .mem-side .mem-body,
    .mem-side.mem-js .mem-body { display: none; }
    .mem-side.mem-open .mem-body,
    .mem-side.mem-js.mem-open .mem-body { display: flex; overflow: visible; }
    .mem-side .mem-cem-body,
    .mem-side.mem-js .mem-cem-body { overflow: visible; max-height: none; }
}

@media (min-width: 992px) {
    .mem-side .mem-body,
    .mem-side.mem-js .mem-body { display: flex !important; }
}

/* ===== Выравнивание в списках: № п/п, Год рождения, Дата гибели ===== */
.mem-list th:nth-child(1),
.mem-list td:nth-child(1),
.mem-list th:nth-child(4),
.mem-list td:nth-child(4),
.mem-list th:nth-child(5),
.mem-list td:nth-child(5) {
    text-align: center;
}