/* ==========================================================================
   СНТ «Окунь» — стили сайта
   Мобильная версия переработана: бургер-меню, таблица участков карточками,
   тап-зоны >= 44px, компактная шапка, крупнее вспомогательный текст.
   Палитра и общий характер сохранены. Ссылки/маршруты не менялись.
   ========================================================================== */

/* ---------- токены ---------- */
:root {
    --brand: #2f855a;
    --brand-dark: #276749;
    --brand-light: #e6f4ec;
    --ink: #1a2e2a;
    --muted: #5b6e68;
    --surface: #ffffff;
    --bg: #f7faf8;
    --border: #e3ece6;
    --radius-sm: 10px;
    --radius: 16px;
    --shadow-sm: 0 1px 2px rgba(26, 46, 42, 0.06);
    --shadow: 0 6px 24px -10px rgba(26, 46, 42, 0.18);
    --header-h: 58px;
    --tap: 44px;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 8px);
}

body {
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* страховка: ничего не должно выезжать за вьюпорт */
}

a { color: var(--brand-dark); text-underline-offset: 2px; }

:focus-visible {
    outline: 3px solid rgba(47, 133, 90, 0.45);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.container { padding-inline: 16px; }
@media (min-width: 576px) { .container { padding-inline: 12px; } }

/* ==========================================================================
   Шапка и навигация
   Мобильно: бренд + бургер, меню — раскрывающаяся панель.
   От 992px: прежнее горизонтальное меню «пилюлями».
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px) saturate(140%);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    min-height: var(--header-h);
    padding-block: 0.45rem;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    text-decoration: none;
    border-radius: 12px;
    padding: 4px 6px 4px 4px;
}
.brand-mark {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 3px 10px rgba(47, 133, 90, 0.32);
}
.brand-text {
    font-weight: 800;
    font-size: 1.02rem;
    line-height: 1.15;
    color: var(--ink);
    white-space: nowrap;
}
.brand-text small { display: none; }

/* бургер */
.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 13px;
    color: var(--ink);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.15s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* меню на телефоне: панель на всю ширину, пункты 48px */
.main-nav {
    flex-basis: 100%;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem 0 0.6rem;
}
.main-nav.collapse.show { display: flex; }
.main-nav .nav-link {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    color: var(--ink);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.main-nav .nav-link.active {
    background: var(--brand-light);
    color: var(--brand-dark);
    box-shadow: inset 3px 0 0 var(--brand);
}

@media (min-width: 992px) {
    .header-inner { flex-wrap: nowrap; min-height: 66px; }
    .nav-toggle { display: none; }
    .brand-mark { width: 42px; height: 42px; font-size: 1.25rem; }
    .brand-text { font-size: 1.15rem; }
    .brand-text small {
        display: block;
        font-size: 0.72rem;
        font-weight: 500;
        color: var(--muted);
    }
    .main-nav.collapse { display: flex !important; flex-basis: auto; }
    .main-nav { flex-direction: row; gap: 0.3rem; padding: 0; }
    .main-nav .nav-link {
        min-height: 0;
        padding: 0.5rem 0.95rem;
        border-radius: 999px;
        font-size: 0.95rem;
        transition: background 0.15s, color 0.15s;
    }
    .main-nav .nav-link:hover { background: var(--brand-light); color: var(--brand-dark); }
    .main-nav .nav-link.active { background: var(--brand); color: #fff; box-shadow: none; }
}

/* ==========================================================================
   Типографика секций
   ========================================================================== */
.page-intro { padding: 1.35rem 0 0.5rem; }
.list-section { padding: 0.5rem 0 2rem; }
.map-section, .map-page { padding: 1rem 0 1rem; }
.map-section-hero { padding: 0.75rem 0 0; }
.section-head { margin-bottom: 1rem; }

h1, .h1, .hero-title {
    font-size: clamp(1.5rem, 5.6vw, 2rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin-bottom: 0.4rem;
    text-wrap: balance;
}
h2, .h2 { font-size: clamp(1.2rem, 4.4vw, 1.45rem); font-weight: 800; letter-spacing: -0.01em; }
h3, .h3 { font-size: clamp(1.05rem, 3.8vw, 1.2rem); font-weight: 700; }
.h4 { font-size: 1.1rem; font-weight: 800; }
.section-head h1, .section-head h2 { margin-bottom: 0.25rem; }

.page-intro p, .section-head p { color: var(--muted); margin-bottom: 0; font-size: 0.95rem; }
.text-muted { color: var(--muted) !important; }
small, .small { font-size: 0.82rem; }

@media (min-width: 992px) {
    .page-intro { padding: 2.8rem 0 1rem; }
    .list-section { padding: 1rem 0 2.5rem; }
    .map-section, .map-page { padding: 2.8rem 0 1rem; }
    .map-section-hero { padding: 2rem 0 0; }
    .section-head { margin-bottom: 1.3rem; }
    h1, .h1, .hero-title { font-size: 2.35rem; }
    .page-intro p, .section-head p { font-size: 1.05rem; }
}

/* Hero */
.hero {
    padding: 2.25rem 0 2rem;
    background:
        radial-gradient(1000px 400px at 90% -10%, rgba(47, 133, 90, 0.10), transparent 60%),
        linear-gradient(180deg, #f2f9f5 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}
.hero-badge {
    display: inline-block;
    background: var(--brand-light);
    border: 1px solid #cfe9dc;
    color: var(--brand-dark);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    margin-bottom: 0.9rem;
}
.hero-title { max-width: 46rem; }
.hero-sub { font-size: 1rem; color: var(--muted); margin-bottom: 1.2rem; max-width: 40rem; }
.hero-actions { margin-bottom: 1.6rem; }
.hero-stats { display: flex; gap: 1.5rem 2rem; flex-wrap: wrap; }
.hero-stats .stat strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.hero-stats .stat span { color: var(--muted); font-size: 0.85rem; }

@media (min-width: 992px) {
    .hero { padding: 4.5rem 0 3.5rem; }
    .hero-title { font-size: 2.7rem; }
    .hero-sub { font-size: 1.12rem; margin-bottom: 1.6rem; }
    .hero-actions { margin-bottom: 2.4rem; }
    .hero-stats { gap: 3rem; }
    .hero-stats .stat strong { font-size: 2rem; }
    .hero-stats .stat span { font-size: 0.92rem; }
}

/* ==========================================================================
   Карточки-контейнеры
   ========================================================================== */
.table-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.table-card.p-4 { padding: 1rem !important; }
@media (min-width: 768px) {
    .table-card { box-shadow: var(--shadow); }
    .table-card.p-4 { padding: 1.5rem !important; }
}

/* «подпись → значение» (реквизиты, контакты) */
.table-card dl.row { margin-bottom: 0; }
.table-card dl.row dt {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.1rem;
}
.table-card dl.row dd {
    font-weight: 600;
    margin-bottom: 0.85rem;
    overflow-wrap: anywhere;
}
.table-card dl.row dd:last-of-type { margin-bottom: 0; }
@media (min-width: 576px) {
    .table-card dl.row dt { font-size: 0.78rem; margin-top: 0.15rem; }
    .table-card dl.row dd { margin-bottom: 0.75rem; }
}

.table-card ul, .table-card ol { padding-left: 1.15rem; }
.table-card li { margin-bottom: 0.4rem; }
.table-card li:last-child { margin-bottom: 0; }

/* ==========================================================================
   Таблицы: на десктопе обычные, на телефоне — карточки
   (thead визуально скрыт, но остаётся доступным скринридерам)
   ========================================================================== */
.table-card thead th {
    background: #f2f9f5;
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}
.table-card tbody td {
    padding: 0.75rem 1rem;
    border-color: var(--border);
    vertical-align: middle;
}
.table-card .badge { font-weight: 700; font-size: 0.8rem; padding: 0.35rem 0.6rem; }

/* сумма взноса: на десктопе одной строкой «начислено X / оплачено Y» */
.table--deb .cell-sum .sum-acc::after { content: " / "; }
.unit-m2 { display: none; }

@media (max-width: 767.98px) {
    .table-card thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }
    .table-card .table-responsive { overflow: visible; }
    .table-card table,
    .table-card tbody,
    .table-card tr,
    .table-card td { display: block; width: auto; }
    .table-card tbody tr { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
    .table-card tbody tr:last-child { border-bottom: 0; }
    .table-card tbody td { padding: 0; border: 0; overflow-wrap: anywhere; }
    .table-card tbody td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        color: var(--muted);
        margin-bottom: 0.1rem;
    }
}

/* ---- таблица участков и взносов: карточка участка ---- */
@media (max-width: 767.98px) {
    .table--deb tbody tr.deb-row {
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.1rem 0.5rem;
        padding: 0.7rem 1rem;
        border-left: 3px solid transparent;
        content-visibility: auto; /* список из 137 строк рисуется лениво */
        contain-intrinsic-size: 0 84px;
    }
    .table--deb tbody tr.deb-row:active { background: #f4faf6; }
    /* должник — красная полоса слева, оплачено — зелёная: список читается скан-путём */
    .table--deb tbody tr.deb-row.is-debt { border-left-color: #dc3545; }
    .table--deb tbody tr.deb-row.is-paid { border-left-color: #2f855a; }
    .table--deb .cell-num { font-size: 1.05rem; font-weight: 800; }
    .table--deb .cell-num::before { content: "№ "; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
    .table--deb .cell-status { margin-left: auto; }
    .table--deb .cell-cad { flex: 1 1 100%; font-size: 0.76rem; color: var(--muted); }
    .table--deb .cell-area { font-size: 0.82rem; color: var(--muted); }
    .table--deb .unit-m2 { display: inline; }
    .table--deb .cell-sum {
        margin-left: auto;
        display: flex;
        gap: 0.3rem;
        font-size: 0.82rem;
        line-height: 1.3;
        white-space: nowrap;
        color: var(--muted);
    }
    .table--deb .cell-sum .sum-acc::after { content: " ·"; }
    .table--deb .cell-sum .sum-paid { font-weight: 700; color: var(--ink); }
}

/* ---- документы в «Контактах» ---- */
@media (max-width: 767.98px) {
    .table--docs tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.5rem 0.75rem;
    }
    .table--docs .doc-title { font-weight: 700; }
    .table--docs .doc-action { text-align: right !important; }
}

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn { border-radius: 999px; font-weight: 700; }
.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}
@media (max-width: 767.98px) {
    .btn { min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; }
    .btn-sm { min-height: 40px; padding-inline: 1rem; }
}

/* ==========================================================================
   Карта
   ========================================================================== */
#map {
    height: calc(100dvh - var(--header-h) - 90px);
    min-height: 340px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    z-index: 0;
}
@media (min-width: 992px) {
    #map { height: 68vh; min-height: 420px; box-shadow: var(--shadow); }
    .map-section-hero #map { height: calc(100vh - 130px); min-height: 500px; }
}

/* кнопки зума/слоёв OpenLayers — крупнее под палец
   (!important нужен: CSS OpenLayers грузится после нашего и задаёт 1.375em) */
.ol-control button {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    line-height: 1 !important;
    border-radius: 10px;
}
.ol-control { padding: 3px; border-radius: 12px; }
.ol-zoom, .ol-attribution { border-radius: 12px; }
.ol-attribution { max-width: calc(100vw - 120px); }
.ol-attribution, .ol-attribution ul { font-size: 11px; }

.ol-popup {
    position: absolute;
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    min-width: 180px;
    max-width: min(320px, calc(100vw - 28px));
    bottom: 12px;
    left: -50px;
    line-height: 1.4;
    font-size: 0.92rem;
}
.ol-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 48px;
    border-width: 6px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}
.ol-popup-closer {
    text-decoration: none;
    position: absolute;
    top: 2px;
    right: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a9a95;
    font-weight: 700;
    line-height: 1;
    border-radius: 8px;
}
.ol-popup-closer::after { content: "✕"; }
.ol-popup-closer:hover { color: #4a5a55; background: #f2f5f3; }

/* ==========================================================================
   Фотоархив
   ========================================================================== */
.photo-group-title {
    margin: 1.5rem 0 0.75rem;
    font-size: 1.15rem;
    color: var(--ink);
    font-weight: 800;
}
.photo-group-title:first-child { margin-top: 0; }
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}
.photo-item {
    position: relative;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
    aspect-ratio: 4 / 3;
    content-visibility: auto;
    contain-intrinsic-size: 0 160px;
    transition: transform 0.15s, box-shadow 0.15s;
}
.photo-item:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 1.2rem 0.5rem 0.4rem;
    background: linear-gradient(transparent, rgba(26, 46, 42, 0.75));
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
}
@media (min-width: 768px) {
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
    .photo-group-title { margin: 2rem 0 1rem; font-size: 1.35rem; }
    .photo-caption { font-size: 0.85rem; padding: 1.5rem 0.6rem 0.5rem; }
}

/* ==========================================================================
   Подвал
   ========================================================================== */
.site-footer {
    margin-top: 2rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}
.site-footer .container { gap: 0.25rem; }
.site-footer strong { color: var(--ink); }
@media (min-width: 768px) {
    .site-footer { margin-top: 3.5rem; padding: 1.8rem 0; font-size: 0.92rem; }
}

/* ==========================================================================
   Блок «обязанность платить» + QR на странице участков и взносов
   ========================================================================== */
.deb-pay { padding: 0 0 0.75rem; }

.pay-banner {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid #cfe9dc;
    background: linear-gradient(180deg, #f2f9f5 0%, #ffffff 100%);
    box-shadow: var(--shadow-sm);
}
.pay-banner-title {
    font-size: 1.02rem;
    font-weight: 800;
    margin-bottom: 0.45rem;
    letter-spacing: -0.01em;
}
.pay-banner-text p { font-size: 0.9rem; line-height: 1.5; margin-bottom: 0.6rem; }
.pay-banner-text p:last-child { margin-bottom: 0; }
.pay-banner-qr {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.25rem;
    border-top: 1px dashed #cfe9dc;
}
.pay-banner-qr img {
    flex: 0 0 auto;
    width: 104px;
    height: 104px;
    object-fit: contain;
    padding: 5px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.pay-banner-link { flex: 1 1 auto; }

@media (min-width: 768px) {
    .pay-banner { grid-template-columns: 1fr auto; align-items: center; gap: 1.5rem; padding: 1.25rem 1.5rem; }
    .pay-banner-title { font-size: 1.1rem; }
    .pay-banner-text p { font-size: 0.95rem; }
    .pay-banner-qr {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding-top: 0;
        border-top: 0;
        width: 176px;
    }
    .pay-banner-qr img { width: 176px; height: 176px; margin-inline: auto; }
    .pay-banner-link { width: 100%; }
}

/* ==========================================================================
   Мелочи
   ========================================================================== */
.table-card a:not(.btn) { font-weight: 600; }
@media (max-width: 767.98px) {
    .table-card dd a { display: inline-flex; align-items: center; min-height: 32px; }
    .img-thumbnail { padding: 0.35rem; border-radius: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Новости
   ========================================================================== */
.news-list { display: grid; gap: 16px; }

.news-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    background: #fff;
    border: 1px solid var(--line, #e3e8ee);
    border-radius: 16px;
    overflow: hidden;
}

.news-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4 / 3;
}

.news-card-body { padding: 16px 18px 18px 0; }
.news-card:not(:has(.news-card-media)) .news-card-body { padding-left: 18px; }

.news-date {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand, #2f855a);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 6px;
}

.news-card-title { font-size: 20px; line-height: 1.3; margin: 0 0 8px; }
.news-card-title a { color: var(--ink, #1c2430); text-decoration: none; }
.news-card-title a:hover { color: var(--brand, #2f855a); }

.news-excerpt { color: var(--muted, #5b6674); margin: 0 0 10px; }
.news-more { font-weight: 700; text-decoration: none; }
.news-back { margin: 0 0 8px; }
.news-back a { text-decoration: none; font-weight: 600; }

.news-hero {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 18px;
}

.news-body { font-size: 16.5px; line-height: 1.65; }
.news-body > :first-child { margin-top: 0; }
.news-body p { margin: 0 0 12px; }
.news-body h2, .news-body h3 { font-size: 19px; margin: 22px 0 10px; }
.news-body ul, .news-body ol { margin: 0 0 12px; padding-left: 22px; }
.news-body li { margin-bottom: 6px; }
.news-body img { max-width: 100%; height: auto; border-radius: 12px; margin: 10px 0; }
.news-body figure { margin: 14px 0; }
.news-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; }
.news-body th, .news-body td { border: 1px solid var(--line, #e3e8ee); padding: 8px 10px; text-align: left; vertical-align: top; }
.news-body th { background: #f4f6f8; }
.news-body a { color: #2b6cb0; }

.news-other li { padding: 8px 0; border-bottom: 1px solid var(--line, #e3e8ee); }
.news-other time { display: inline-block; min-width: 92px; }

@media (max-width: 767.98px) {
    .news-card { grid-template-columns: 1fr; }
    .news-card-body, .news-card:not(:has(.news-card-media)) .news-card-body { padding: 0 16px 16px; }
    .news-card-media img { aspect-ratio: 16 / 9; }
    .news-card-title { font-size: 18px; }
    .news-other time { min-width: 0; display: block; }
}
