/* ==========================================================================
   nota-ui.css — публичная часть сайта (layout.layout). В админку НЕ подключается.
   Грузится последним, поэтому только дополняет style.css / custom.css.
   Правила "защиты контента" (раздел 3) гарантируют, что HTML из админки
   (редактор, вставка из Word, огромные картинки/таблицы/iframe, длинные
   заголовки, битые фото) не ломает вёрстку.
   ========================================================================== */

:root {
    --nu-blue: #0b3f9e;
    --nu-blue-2: #1e88e5;
    --nu-gold: #e0a800;
    --nu-ink: #1b2233;
    --nu-muted: #6b7385;
    --nu-line: #e3e8f1;
    --nu-bg: #f4f6fb;
    --nu-radius: 12px;
    --nu-shadow: 0 1px 2px rgba(16, 32, 72, .06), 0 4px 14px rgba(16, 32, 72, .06);
    --nu-shadow-h: 0 2px 4px rgba(16, 32, 72, .08), 0 12px 28px rgba(16, 32, 72, .14);
}

/* ---------- 1. Логотип в шапке ------------------------------------------ */
.logotype_main {
    width: 150px !important;
    height: 150px;
    object-fit: contain;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 5px #fff, 0 6px 18px rgba(16, 32, 72, .22);
    margin-top: -6px !important;
    transition: transform .25s ease;
}
.logotype_main:hover { transform: scale(1.03); }

@media (min-width: 763px) {
    .top_header .logotype_main { margin-left: 10px; }
}
@media (max-width: 762px) {
    .logotype_main {
        width: 110px !important;
        height: 110px;
        margin: 0 auto !important;
        display: block;
    }
}

.site_name_muted { letter-spacing: .06em; font-weight: 500; }
.site_name { font-weight: 700; color: var(--nu-blue) !important; line-height: 1.25; }

/* ---------- 2. Карточки новостей ---------------------------------------- */

/* заголовок секции */
.nu-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 28px 0 16px;
    font-size: 22px;
    font-weight: 700;
    color: var(--nu-ink);
}
.nu-section-title::before {
    content: "";
    width: 5px;
    height: 26px;
    border-radius: 3px;
    background: linear-gradient(var(--nu-gold), var(--nu-blue));
}
.nu-section-title a { color: inherit; text-decoration: none; }
.nu-section-title a:hover { color: var(--nu-blue); }

/* сетка карточек на главной */
.nu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

/* вертикальная карточка */
.nu-card {
    display: flex;
    flex-direction: column;
    min-width: 0;                 /* не даёт длинному слову растянуть карточку */
    background: #fff;
    border: 1px solid var(--nu-line);
    border-radius: var(--nu-radius);
    overflow: hidden;
    box-shadow: var(--nu-shadow);
    transition: transform .2s ease, box-shadow .2s ease;
}
.nu-card:hover { transform: translateY(-3px); box-shadow: var(--nu-shadow-h); }

.nu-card__media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;         /* фиксированная рамка — любое фото из админки встаёт ровно */
    background: var(--nu-bg);
    overflow: hidden;
}
.nu-card__media img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    transition: transform .35s ease;
}
.nu-card:hover .nu-card__media img { transform: scale(1.05); }
/* заглушка, если фото нет/битое */
.nu-card__media img.is-fallback,
.nu-row__media img.is-fallback {
    object-fit: contain;
    padding: 14%;
    opacity: .55;
}

.nu-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    padding: 14px 16px 16px;
}
.nu-card__title {
    margin: 0;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 700;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;        /* максимум 3 строки, остальное обрезается */
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nu-card__title a { color: var(--nu-ink); text-decoration: none; }
.nu-card__title a:hover { color: var(--nu-blue); }

.nu-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    margin-top: auto;
    font-size: 12px;
    color: var(--nu-muted);
}
.nu-meta img { height: 13px; width: auto; vertical-align: -2px; margin-right: 4px; }

/* бейдж языка */
.nu-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(11, 63, 158, .9);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* горизонтальная карточка (список новостей / поиск) */
.nu-list { display: grid; gap: 14px; margin: 0 0 24px; padding: 0; list-style: none; }

.nu-row {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    background: #fff;
    border: 1px solid var(--nu-line);
    border-radius: var(--nu-radius);
    overflow: hidden;
    box-shadow: var(--nu-shadow);
    transition: box-shadow .2s ease, transform .2s ease;
}
.nu-row:hover { box-shadow: var(--nu-shadow-h); transform: translateY(-2px); }
.nu-row__media {
    position: relative;
    display: block;
    min-height: 135px;
    background: var(--nu-bg);
    overflow: hidden;
}
.nu-row__media img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
}
.nu-row__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
    padding: 14px 18px;
    min-width: 0;
}
.nu-row__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    font-weight: 700;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nu-row__title a { color: var(--nu-ink); text-decoration: none; }
.nu-row__title a:hover { color: var(--nu-blue); }

@media (max-width: 575px) {
    .nu-row { grid-template-columns: 1fr; }
    .nu-row__media { aspect-ratio: 16 / 9; min-height: 0; }
    .nu-grid { grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); }
    .nu-section-title { font-size: 19px; }
}

/* пагинация */
.page_number .pagination > li > a {
    border-radius: 8px !important;
    margin: 0 2px;
    border: 1px solid var(--nu-line);
    color: var(--nu-ink);
}
.page_number .pagination > .active-paginator > a,
.page_number .pagination > li > a:hover {
    background: var(--nu-blue);
    border-color: var(--nu-blue);
    color: #fff !important;
}

/* ---------- 3. Страница новости + защита контента из админки ------------ */

.contentCenterNews { padding-bottom: 30px; }

.contentCenterNews .MainTitleNew {
    font-size: 30px;
    line-height: 1.25;
    font-weight: 800;
    color: var(--nu-ink);
    overflow-wrap: anywhere;
    margin: 14px 0 10px;
}
@media (max-width: 767px) {
    .contentCenterNews .MainTitleNew { font-size: 22px; }
}

.contentCenterNews .list_link {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    color: var(--nu-muted);
    font-size: 13px;
    margin-bottom: 16px;
}
.contentCenterNews .list_link span { margin: 0; }

.nu-cover {
    margin: 0 0 16px;
    border-radius: var(--nu-radius);
    overflow: hidden;
    background: var(--nu-bg);
}
.nu-cover img { display: block; width: 100%; height: auto; max-height: 520px; object-fit: cover; }

/* тело статьи: всё, что приходит из редактора, держим в рамках */
.fullstoryMid {
    background: #fff !important;
    border: 1px solid var(--nu-line) !important;
    border-radius: var(--nu-radius);
    padding: 24px 26px 14px !important;
    font-size: 16px;
    line-height: 1.7;
    color: var(--nu-ink);
    text-align: left !important;       /* justify из шаблона давал «рваные» пробелы */
    overflow-wrap: anywhere;
    word-break: normal;
    overflow: hidden;                  /* ничто не вылезет за границы */
}
.fullstoryMid > *:first-child { margin-top: 0; }
.fullstoryMid p, .fullstoryMid li { font-size: inherit; line-height: inherit; }

.fullstoryMid img {
    max-width: 100% !important;        /* перебивает width="..." и style="width:..." */
    height: auto !important;
    border-radius: 8px;
}
.fullstoryMid [style*="width"]:not(img):not(td):not(th):not(table) { max-width: 100% !important; }
.fullstoryMid [style*="float"] { max-width: 50%; }
@media (max-width: 575px) {
    .fullstoryMid [style*="float"] { float: none !important; max-width: 100%; display: block; margin: 0 auto 12px !important; }
    .fullstoryMid { padding: 16px 14px 8px !important; font-size: 15px; }
}

.fullstoryMid table {
    display: block;                    /* широкие таблицы скроллятся внутри блока */
    max-width: 100% !important;
    width: auto;
    overflow-x: auto;
    border-collapse: collapse;
}
.fullstoryMid td, .fullstoryMid th { padding: 6px 10px; border: 1px solid var(--nu-line); }

.fullstoryMid iframe,
.fullstoryMid video,
.fullstoryMid embed,
.fullstoryMid object {
    max-width: 100% !important;
}
.fullstoryMid iframe[src*="youtube"],
.fullstoryMid iframe[src*="youtu.be"],
.fullstoryMid iframe[src*="vimeo"] {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
}
.fullstoryMid pre, .fullstoryMid code { white-space: pre-wrap; overflow-wrap: anywhere; }
.fullstoryMid a { color: var(--nu-blue); text-decoration: underline; text-underline-offset: 2px; }
.fullstoryMid h1, .fullstoryMid h2, .fullstoryMid h3, .fullstoryMid h4 { line-height: 1.3; margin: 1.4em 0 .5em; }
.fullstoryMid blockquote {
    margin: 1em 0; padding: 10px 18px;
    border-left: 4px solid var(--nu-gold);
    background: var(--nu-bg); font-size: inherit;
}
/* «пустые» абзацы из редактора (&nbsp;) не создают дыр */
.fullstoryMid p:empty { display: none; }

/* то же для статических страниц /info/... */
.cont_div { overflow-wrap: anywhere; overflow: hidden; }
.cont_div img { max-width: 100% !important; height: auto !important; }
.cont_div table { max-width: 100% !important; display: block; overflow-x: auto; }
.cont_div iframe { max-width: 100% !important; }

/* доп. фото под статьёй */
.nu-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 16px 0; }
.nu-gallery img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }

/* видео из поля video_url */
.nu-video { position: relative; aspect-ratio: 16 / 9; margin: 16px 0; border-radius: var(--nu-radius); overflow: hidden; background: #000; }
.nu-video iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; display: block !important; }

.ImgBottomText { color: var(--nu-muted); font-size: 12px; }

/* теги / рубрики */
.nu-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.nu-tags a {
    padding: 3px 10px; border-radius: 999px; background: var(--nu-bg);
    color: var(--nu-blue); font-size: 12px; text-decoration: none;
}
.nu-tags a:hover { background: var(--nu-blue); color: #fff; }

/* «Читайте также» — те же карточки */
.nu-related { margin-top: 26px; }
.nu-related .nu-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ---------- 4. Доступность ---------------------------------------------- */
.nu-card a:focus-visible, .nu-row a:focus-visible, .logotype_main:focus-visible {
    outline: 3px solid var(--nu-blue-2);
    outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    .nu-card, .nu-row, .nu-card__media img, .logotype_main { transition: none; }
    .nu-card:hover, .nu-row:hover { transform: none; }
}
.nu-visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* h1 на главной выглядит как прежний div.site_name */
h1.site_name { margin: 0; font-size: 19px; }

/* ---------- 5. Таблицы из Word (список нотариусов и т.п.) ---------------- */
.cont_div table.MsoNormalTable { border: 0 !important; }
.cont_div table.MsoNormalTable * { font-family: inherit !important; }
.cont_div table.MsoNormalTable span,
.cont_div table.MsoNormalTable p { font-size: 14px !important; line-height: 1.45 !important; margin: 0 !important; text-indent: 0 !important; text-align: left !important; }
.cont_div table.MsoNormalTable td,
.cont_div table.MsoNormalTable th {
    width: auto !important;
    padding: 10px 10px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--nu-line) !important;
    background: #fff !important;
    vertical-align: top;
    overflow-wrap: break-word;
}
.cont_div table.MsoNormalTable td:last-child:empty,
.cont_div table.MsoNormalTable td:last-child:not(.nu-status) p:only-child:empty { padding: 0 !important; }

.nu-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--nu-line);
    border-radius: var(--nu-radius);
    box-shadow: var(--nu-shadow);
    background: #fff;
    margin: 12px 0 24px;
}
.nu-table-wrap > table.nu-table { display: table; width: 100% !important; min-width: 1020px; border-collapse: separate; border-spacing: 0; }

.cont_div table.nu-table thead th {
    background: var(--nu-blue) !important;
    color: #fff;
    text-align: left;
    white-space: normal;
    border-bottom: 0 !important;
}
.cont_div table.nu-table thead th * { color: #fff !important; font-weight: 700; }
.nu-table thead th:last-child { padding: 0 !important; width: 0 !important; }

.nu-table tbody tr.nu-person:nth-child(even) td { background: #f7f9fd !important; }
.nu-table tbody tr.nu-person:hover td { background: #eaf1fd !important; }
.nu-table td:first-child { color: var(--nu-muted); width: 48px !important; }
.nu-table td:nth-child(2) { min-width: 190px; }
.nu-table td:nth-child(3) { min-width: 120px; }
.nu-table td:nth-child(4), .nu-table th:nth-child(4) { min-width: 118px; }
.nu-table td:nth-child(7), .nu-table th:nth-child(7) { min-width: 108px; }
.nu-table td:nth-child(5) { min-width: 200px; }
.nu-table td:nth-child(6) { min-width: 230px; }
.nu-table td:nth-child(6), .nu-table td:nth-child(6) * { overflow-wrap: normal; word-break: normal; }
.nu-table td:nth-child(2) * { font-weight: 700; color: var(--nu-ink); }

/* строки-районы */
.nu-table tr.nu-district td {
    background: #e8eefb !important;
    color: var(--nu-blue);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 12px 14px !important;
    border-left: 5px solid var(--nu-gold) !important;
}
.nu-table tr.nu-empty { display: none; }
.nu-table td:last-child:not(.nu-status) { width: 0 !important; padding: 0 !important; border: 0 !important; }

/* статус */
.nu-status span, .nu-status p { display: inline-block; padding: 2px 10px !important; border-radius: 999px; font-weight: 700; font-size: 12px !important; white-space: nowrap; }
.nu-status.is-on span, .nu-status.is-on p { background: #e3f6ea; color: #14773a; }
.nu-status.is-off span, .nu-status.is-off p { background: #fde8e8; color: #b3261e; }
.nu-table a { color: var(--nu-blue); }

/* панель поиска */
.nu-table-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 14px 0 0; }
.nu-table-search {
    flex: 1 1 320px; max-width: 520px; padding: 10px 14px; font-size: 15px;
    border: 1px solid var(--nu-line); border-radius: 10px; background: #fff;
}
.nu-table-search:focus { outline: 3px solid rgba(30, 136, 229, .3); border-color: var(--nu-blue-2); }
.nu-table-count { color: var(--nu-muted); font-size: 13px; }

/* телефон: каждая запись — карточка, подписи берутся из шапки таблицы */
@media (max-width: 767px) {
    .nu-table-wrap { border: 0; box-shadow: none; background: transparent; overflow: visible; }
    .nu-table-wrap > table.nu-table { display: block; min-width: 0; }
    .nu-table thead { display: none; }
    .nu-table tbody { display: block; }
    .nu-table tr.nu-person {
        display: block; margin: 0 0 12px; background: #fff;
        border: 1px solid var(--nu-line); border-radius: var(--nu-radius); box-shadow: var(--nu-shadow); overflow: hidden;
    }
    .nu-table tr.nu-person td { display: block; width: auto !important; padding: 6px 14px !important; border: 0 !important; background: transparent !important; }
    .nu-table tr.nu-person td::before { content: attr(data-label); display: block; font-size: 11px; color: var(--nu-muted); text-transform: uppercase; letter-spacing: .03em; }
    .nu-table tr.nu-person td:first-child { display: none; }
    .nu-table tr.nu-person td:nth-child(2) { background: var(--nu-bg) !important; padding-top: 10px !important; }
    .nu-table tr.nu-person td:nth-child(2)::before { display: none; }
    .nu-table tr.nu-person td:last-child:not(.nu-status) { display: none; }
    .nu-table tr.nu-district { display: block; margin: 18px 0 10px; }
    .nu-table tr.nu-district td { display: block; border-radius: 8px; }
}

.cont_div table.nu-table .nu-spacer { display: none !important; }
.cont_div table.nu-table tr.nu-district td { width: auto !important; min-width: 0 !important; }
