/* Блок «Новости» на главной (blocks/block-news_2011.php + include/functions_news_block.php), префикс .nwb-*.
   Цвета — токены темы --tp-*: белая тема — белая карточка с чёрно-синей шапкой, чёрно-синяя — тёмные поверхности.
   Раскладка по ширине самого блока (container query nwb): узкий — список новостей лентой сверху,
   от 640 px — текст слева, список справа. Префикс .nb-* занят шапкой сайта, поэтому .nwb-*. */

.nwb {
    --nwb-bg: var(--tp-surface, #fff);
    --nwb-bg-2: var(--tp-surface-2, #f6f8fb);
    --nwb-bg-3: var(--tp-surface-3, #edf1f7);
    --nwb-line: var(--tp-border, #e3e8ef);
    --nwb-line-2: var(--tp-border-strong, #cfd7e3);
    --nwb-text: var(--tp-text, #0f172a);
    --nwb-text-2: var(--tp-text-2, #334155);
    --nwb-muted: var(--tp-muted, #64748b);
    --nwb-link: var(--tp-link, #1d4ed8);
    --nwb-acc: var(--tp-accent, #2563eb);
    --nwb-acc-h: var(--tp-accent-hover, #1d4ed8);
    --nwb-acc-soft: var(--tp-accent-soft, #e8f0ff);
    --nwb-head: radial-gradient(520px 150px at 100% -50%, rgba(79, 142, 247, .45), transparent 65%),
                linear-gradient(120deg, #050a18 0%, #0a1636 55%, #112e78 100%);
    --nwb-ink: linear-gradient(160deg, #0a1636 0%, #112e78 100%);   /* активная дата */
    --nwb-new: linear-gradient(135deg, #2563eb, #0b1f5c);
    --nwb-warn: #b45309;
    --nwb-warn-soft: rgba(245, 158, 11, .14);
    --nwb-del: #dc2626;
    --nwb-del-soft: rgba(239, 68, 68, .12);
    --nwb-r: var(--tp-radius, 16px);
    --nwb-clamp: 220px;                                             /* высота текста до «Развернуть» */
    container: nwb / inline-size;
    position: relative;
    min-width: 0;
    background: var(--nwb-bg);
    border: 1px solid var(--nwb-line);
    border-radius: var(--nwb-r);
    box-shadow: var(--tp-shadow, 0 1px 2px rgba(15, 23, 42, .04), 0 4px 14px rgba(15, 23, 42, .06));
    color: var(--nwb-text);
    font-family: var(--tp-font, Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
    font-size: 13.5px;
    line-height: 1.5;
    text-align: left;
}
.nwb *, .nwb *::before, .nwb *::after { box-sizing: border-box; }
.nwb [hidden] { display: none !important; }
.nwb :focus-visible { outline: 2px solid var(--nwb-acc); outline-offset: 2px; }

/* шапка — чёрно-синяя в обеих темах, как шапка сайта и страниц новостей */
.nwb-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 8px 10px 8px 12px;
    border-radius: calc(var(--nwb-r) - 1px) calc(var(--nwb-r) - 1px) 0 0;
    background: var(--nwb-head);
    color: #eef4ff;
}
.nwb-head__ttl {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 auto 0 0;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: .01em;
    color: #fff;
}
.nwb-head__ico {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(127, 176, 255, .28);
    color: #9cc2ff;
    font-size: 13px;
}
.nwb-head__nav { display: flex; align-items: center; gap: 6px; }
.nwb-hbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 1px rgba(127, 176, 255, .22);
    color: #dbe6ff !important;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}
.nwb-hbtn i { font-size: 11px; }
.nwb-hbtn:hover { background: rgba(255, 255, 255, .17); color: #fff !important; }
.nwb-hbtn--acc { width: 28px; padding: 0; background: var(--nwb-acc); box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .7); color: #fff !important; }
.nwb-hbtn--acc:hover { background: var(--nwb-acc-h); }
.nwb-head :focus-visible { outline-color: #9cc2ff; }

/* сетка: узкий блок — список лентой над текстом */
.nwb-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.nwb-panels { min-width: 0; }

.nwb-list {
    position: relative;
    display: flex;
    gap: 6px;
    min-width: 0;
    padding: 10px 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    border-bottom: 1px solid var(--nwb-line);
    background: var(--nwb-bg-2);
}
.nwb-grid.is-single .nwb-list { display: none; }

.nwb-item {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 210px;
    margin: 0;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--nwb-line);
    border-radius: 11px;
    background: var(--nwb-bg);
    color: var(--nwb-text-2);
    font: inherit;
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.nwb-item:hover { border-color: var(--nwb-line-2); color: var(--nwb-text); }
.nwb-item.is-on { border-color: transparent; background: var(--nwb-acc-soft); color: var(--nwb-text); box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .28); }

.nwb-day {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--nwb-bg-2);
    box-shadow: inset 0 0 0 1px var(--nwb-line);
    line-height: 1;
    transition: background .15s;
}
.nwb-day b { font-size: 14px; font-weight: 800; color: var(--nwb-text); font-variant-numeric: tabular-nums; }
.nwb-day small { margin-top: 2px; font-size: 9px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; color: var(--nwb-muted); }
.nwb-item.is-on .nwb-day { background: var(--nwb-ink); box-shadow: 0 4px 10px -4px rgba(10, 22, 54, .6); }
.nwb-item.is-on .nwb-day b { color: #fff; }
.nwb-item.is-on .nwb-day small { color: #a9c8ff; }

.nwb-item__txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nwb-item__ttl { overflow: hidden; font-size: 12.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.nwb-item__sub { display: none; align-items: center; gap: 8px; overflow: hidden; font-size: 11px; line-height: 1.3; white-space: nowrap; color: var(--nwb-muted); }
.nwb-item__com { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.nwb-item__com i { font-size: 10px; }

/* свежая новость (до 3 дней) — точка в углу даты */
.nwb-dot {
    position: absolute;
    top: 2px;
    left: 34px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px var(--nwb-bg);
}

/* новость */
.nwb-art { min-width: 0; padding: 14px 16px 14px; scroll-margin-top: calc(var(--tp-nav-h, 60px) + 12px); }
.nwb-art:focus-visible { outline-offset: -2px; border-radius: 0 0 var(--nwb-r) var(--nwb-r); }

.nwb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 4px; font-size: 11.5px; color: var(--nwb-muted); }
.nwb-meta time { font-weight: 600; color: var(--nwb-text-2); }
.nwb-meta__ago::before { content: "·"; margin-right: 10px; opacity: .6; }
.nwb-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .05em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}
.nwb-tag--new { color: #fff; background: var(--nwb-new); }
.nwb-tag--lock { color: var(--nwb-warn); background: var(--nwb-warn-soft); letter-spacing: 0; text-transform: none; font-weight: 700; }
.nwb-tag--lock i { font-size: 9px; }

.nwb-ttl {
    margin: 0 0 10px;
    padding: 0;
    font-size: 17px;
    font-weight: 750;
    line-height: 1.3;
    letter-spacing: -.01em;
    color: var(--nwb-text);
    overflow-wrap: anywhere;
}
.nwb-ttl a { color: inherit !important; font-weight: inherit; text-decoration: none !important; transition: color .15s; } /* style.css: a { font-weight: 400 } */
.nwb-ttl a:hover { color: var(--nwb-acc) !important; }

/* текст: до --nwb-clamp, дальше «Развернуть» (кнопку и затухание включает js/block-news.js, только если текст не влез) */
.nwb-body {
    position: relative;
    max-height: var(--nwb-clamp);
    overflow: hidden;
    color: var(--nwb-text-2);
    font-size: 13.5px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}
.nwb-body.is-open { max-height: none; }
.nwb-body.is-clamped::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    background: linear-gradient(180deg, transparent, var(--nwb-bg));
    pointer-events: none;
}
.nwb-body img { max-width: 100% !important; height: auto !important; border-radius: 10px; }
.nwb-body iframe, .nwb-body video { max-width: 100%; border-radius: 10px; }
.nwb-body a { color: var(--nwb-link); font-weight: inherit; }
.nwb-body blockquote, .nwb-body pre, .nwb-body table { max-width: 100%; overflow: auto; }
.nwb-body p { margin: 0 0 .6em; }

.nwb-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0;
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--nwb-link);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.nwb-more i { font-size: 10px; transition: transform .15s; }
.nwb-more[aria-expanded="true"] i { transform: rotate(180deg); }
.nwb-more:hover { color: var(--nwb-acc-h); }

/* вложения */
.nwb-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.nwb-files > li { min-width: 0; max-width: 100%; margin: 0; }
.nwb-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--nwb-line);
    border-radius: 9px;
    background: var(--nwb-bg-2);
    color: var(--nwb-text-2) !important;
    font-size: 12px;
    text-decoration: none !important;
    transition: border-color .15s, color .15s;
}
.nwb-file i { font-size: 11px; color: var(--nwb-acc); }
.nwb-file__n { min-width: 0; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.nwb-file small { flex: 0 0 auto; font-size: 11px; color: var(--nwb-muted); white-space: nowrap; }
a.nwb-file:hover { border-color: var(--nwb-acc); color: var(--nwb-text) !important; }
.nwb-file.is-locked { cursor: default; }
.nwb-file.is-locked i { color: var(--nwb-muted); }

/* действия */
.nwb-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--nwb-line);
}
.nwb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--nwb-line-2);
    border-radius: 9px;
    background: var(--nwb-bg);
    color: var(--nwb-text) !important;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none !important;
    transition: background .15s, border-color .15s, color .15s;
}
.nwb-btn i { font-size: 11px; }
.nwb-btn:hover { border-color: var(--nwb-acc); color: var(--nwb-acc) !important; }
.nwb-btn--pri { border-color: var(--nwb-acc); background: var(--nwb-acc); color: #fff !important; box-shadow: 0 4px 12px -6px rgba(37, 99, 235, .8); }
.nwb-btn--pri:hover { border-color: var(--nwb-acc-h); background: var(--nwb-acc-h); color: #fff !important; }
.nwb-cnt {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--nwb-bg-3);
    color: var(--nwb-text-2);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.nwb-foot__adm { display: flex; gap: 2px; margin-left: auto; }
.nwb-ibtn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    color: var(--nwb-muted) !important;
    font-size: 12px;
    text-decoration: none !important;
    transition: background .15s, color .15s;
}
.nwb-ibtn:hover { background: var(--nwb-bg-3); color: var(--nwb-text) !important; }
.nwb-ibtn--del:hover { background: var(--nwb-del-soft); color: var(--nwb-del) !important; }

/* пусто */
.nwb-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px 22px; text-align: center; color: var(--nwb-muted); }
.nwb-empty > i { font-size: 26px; opacity: .5; }

/* широкий блок: текст слева, список справа колонкой */
@container nwb (min-width: 640px) {
    .nwb-grid { grid-template-columns: minmax(0, 1fr) 248px; }
    .nwb-grid.is-single { grid-template-columns: minmax(0, 1fr); }
    .nwb-list {
        grid-column: 2;
        grid-row: 1;
        flex-direction: column;
        gap: 2px;
        padding: 8px;
        overflow: visible;
        border-bottom: 0;
        border-left: 1px solid var(--nwb-line);
        border-radius: 0 0 calc(var(--nwb-r) - 1px) 0;
    }
    .nwb-panels { grid-column: 1; grid-row: 1; }
    .nwb-item { max-width: none; width: 100%; padding: 6px 8px 6px 6px; border-color: transparent; background: transparent; }
    .nwb-item:hover { border-color: transparent; background: var(--nwb-bg-3); }
    .nwb-item.is-on { background: var(--nwb-bg); box-shadow: 0 1px 2px rgba(15, 23, 42, .06), inset 0 0 0 1px var(--nwb-line); }
    .nwb-item__sub { display: flex; }
    .nwb-dot { top: 4px; left: 36px; box-shadow: 0 0 0 2px var(--nwb-bg-2); }
    .nwb-art { padding: 16px 20px 16px; }
    .nwb-ttl { font-size: 18px; }
    .nwb-grid { --nwb-clamp: 260px; }   /* сам .nwb — контейнер, своим запросом его не задеть */
}
@container nwb (min-width: 900px) {
    .nwb-grid { grid-template-columns: minmax(0, 1fr) 280px; }
}
/* телефон */
@container nwb (max-width: 400px) {
    .nwb-head { padding-left: 10px; }
    .nwb-hbtn span { display: none; }
    .nwb-hbtn:not(.nwb-hbtn--acc) { width: 28px; padding: 0; }
    .nwb-list { padding: 8px 10px; }
    .nwb-item { max-width: 170px; }
    .nwb-art { padding: 12px 12px 12px; }
    .nwb-ttl { font-size: 15.5px; }
    .nwb-file small { display: none; }
}

/* чёрно-синяя тема */
:root[data-tp-theme="dark"] .nwb {
    --nwb-head: radial-gradient(520px 150px at 100% -50%, rgba(79, 142, 247, .3), transparent 65%),
                linear-gradient(120deg, #02050c 0%, #071029 55%, #0c2160 100%);
    --nwb-ink: linear-gradient(160deg, #3b82f6 0%, #1d4ed8 100%);
    --nwb-new: linear-gradient(135deg, #4f8ef7, #1d4ed8);
    --nwb-warn: #fbbf24;
    --nwb-warn-soft: rgba(251, 191, 36, .13);
    --nwb-del: #ff7b72;
    --nwb-del-soft: rgba(255, 123, 114, .12);
}
:root[data-tp-theme="dark"] .nwb-head { box-shadow: inset 0 -1px 0 rgba(127, 176, 255, .14); }
:root[data-tp-theme="dark"] .nwb-list { background: rgba(0, 0, 0, .14); }
:root[data-tp-theme="dark"] .nwb-item.is-on { box-shadow: inset 0 0 0 1px rgba(79, 142, 247, .4); }
:root[data-tp-theme="dark"] .nwb-item.is-on .nwb-day { box-shadow: 0 4px 12px -4px rgba(59, 130, 246, .7); }
:root[data-tp-theme="dark"] .nwb-item.is-on .nwb-day small { color: #dbe8ff; }
:root[data-tp-theme="dark"] .nwb-btn--pri { box-shadow: 0 4px 14px -6px rgba(79, 142, 247, .9); }
@container nwb (min-width: 640px) {
    :root[data-tp-theme="dark"] .nwb-item.is-on { background: var(--nwb-bg-3); box-shadow: inset 0 0 0 1px rgba(79, 142, 247, .35); }
    :root[data-tp-theme="dark"] .nwb-dot { box-shadow: 0 0 0 2px var(--nwb-bg); }
}

@media (prefers-reduced-motion: reduce) {
    .nwb-item, .nwb-day, .nwb-btn, .nwb-hbtn, .nwb-ibtn, .nwb-file, .nwb-more i, .nwb-ttl a { transition: none; }
}
