/*
  Раздел новостей hi.datool.ru/news/ (apps/news/views.py, шаблоны templates/news/).
  Вид — утверждённые макеты 24.10.2026: лента «Журнал», новость «Обложка-шапка»,
  поиск и тег «Карточки», автор «Карточка сбоку».

  Все классы — с приставкой nw-, чтобы общие стили сайта (.card, .btn, .tag…)
  их не задевали. Цвета — переменные темы сайта (source.css), свои — ниже в
  .nw и [data-bs-theme=dark] .nw: тёмная тема работает сама.
*/

/* 1. Цвета раздела поверх переменных темы */
.nw {
  --nw-bg: var(--bs-body-bg, #f7f7f8);
  --nw-surface: var(--bp-surface, #fff);
  --nw-surface-2: var(--bs-input-bg, #ecedee);
  --nw-ink: var(--bp-ink, #2c2d2f);
  --nw-muted: var(--bp-muted, #666a71);
  --nw-line: var(--line, #dcdcdc);
  --nw-brand: var(--brand, #6b45f6);
  --nw-brand-ink: var(--text-purple, #6b45f6);
  --nw-hover: var(--bp-hover, #edebfa);
  --nw-hover-2: var(--bp-hover-strong, #d2caf6);
  --nw-on-brand: #fff;
  --nw-green: #1d7f55; --nw-green-bg: #e6f6ee;
  --nw-blue: #2a62c9; --nw-blue-bg: #e8f0fd;
  --nw-orange: #a8540c; --nw-orange-bg: #fdf0e3;
  --nw-mark: #fff1a8; --nw-mark-ink: #2c2d2f;
  --nw-code-bg: #f1f1f4;
  color: var(--nw-ink);
}
[data-bs-theme=dark] .nw {
  --nw-green: #6cc79c; --nw-green-bg: rgba(96, 173, 137, .14);
  --nw-blue: #8db1f3; --nw-blue-bg: rgba(126, 166, 240, .14);
  --nw-orange: #f0a35e; --nw-orange-bg: rgba(240, 163, 94, .14);
  --nw-mark: rgba(255, 214, 0, .28); --nw-mark-ink: #f4f4f4;
  --nw-code-bg: #22262c;
}
.nw *, .nw *::before, .nw *::after { box-sizing: border-box; }
.nw a { color: inherit; text-decoration: none; }
.nw mark { background: var(--nw-mark); color: var(--nw-mark-ink); border-radius: 3px; padding: 0 1px; }
.nw svg.nw-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.nw :focus-visible { outline: 2px solid var(--nw-brand); outline-offset: 2px; }

/* 2. Каркас, крошки, заголовки */
.nw-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 16px 20px 56px; display: flex; flex-direction: column; gap: 24px; }
.nw-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--nw-muted); align-items: center; }
.nw-crumbs a { color: var(--nw-brand-ink); }
.nw-crumbs i { font-style: normal; opacity: .6; }
.nw-h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; text-wrap: balance; }
.nw-h2 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 700; }
.nw-h3 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; }
.nw-card { background: var(--nw-surface); border: 1px solid var(--nw-line); border-radius: 18px; }
.nw-pad { padding: 20px; }
.nw-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nw-between { justify-content: space-between; }
.nw-g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.nw-split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); gap: 24px; align-items: start; }
.nw-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.nw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--nw-brand); background: var(--nw-brand); color: var(--nw-on-brand) !important; font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.nw-btn--ghost { background: var(--nw-surface); color: var(--nw-brand-ink) !important; border-color: var(--nw-line); }
.nw-btn--ghost:hover { border-color: var(--nw-brand); }
.nw-link { color: var(--nw-brand-ink) !important; }
.nw-date { font-size: 13px; color: var(--nw-muted); white-space: nowrap; }
.nw-muted { color: var(--nw-muted); }

/* 3. Рубрики — серая таблетка (как ряд периодов), теги, плашка рубрики */
.nw-pills { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--nw-surface-2); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.nw-pills a { flex: 0 0 auto; height: 32px; padding: 0 14px; border-radius: 999px; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.nw-pills a small { color: var(--nw-muted); font-size: 12px; }
.nw-pills a[aria-current] { background: var(--nw-surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); color: var(--nw-brand-ink); font-weight: 700; }
.nw-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-tag { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--nw-surface-2); font-size: 13px; white-space: nowrap; }
.nw-tag:hover { background: var(--nw-hover); color: var(--nw-brand-ink); }
.nw-tag small { color: var(--nw-muted); }
.nw-tag--sm { height: 24px; font-size: 12px; }
.nw-rub { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.nw-rub--upd { background: var(--nw-hover); color: var(--nw-brand-ink); }
.nw-rub--news { background: var(--nw-blue-bg); color: var(--nw-blue); }
.nw-rub--art { background: var(--nw-green-bg); color: var(--nw-green); }
.nw-rub--how { background: var(--nw-orange-bg); color: var(--nw-orange); }

/* 4. Обложка 16:9: загруженная картинка или нарисованная заглушка цвета рубрики
   (цвет подписи — через .nw .nw-cov: иначе .nw a перекрасил бы её в цвет текста) */
.nw-cov { position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 14px; overflow: hidden; color: #fff; background-color: #5b3fe0; background-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 28px 28px; }
.nw .nw-cov { color: #fff; }
.nw-cov img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.nw-cov--upd { background-color: #5b3fe0; }
.nw-cov--news { background-color: #2a5fc4; }
.nw-cov--art { background-color: #1b7a52; }
.nw-cov--how { background-color: #a4520c; }
.nw-cov__k { position: absolute; left: 6%; top: 9%; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.nw-cov__art { position: absolute; right: 6%; bottom: 12%; width: 38%; height: 52%; display: flex; align-items: flex-end; gap: 5%; }
.nw-cov__art i { flex: 1; border-radius: 4px 4px 1px 1px; background: rgba(255, 255, 255, .85); }
.nw-cov__art i:nth-child(odd) { background: rgba(255, 255, 255, .45); }
.nw-cov--sm .nw-cov__k { font-size: 11px; }

/* 5. Автор: круглые аватары; у «Редакции» — логотип на белом */
.nw-by { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--nw-muted); min-width: 0; }
.nw-by b { color: var(--nw-ink); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nw-av { flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 700; letter-spacing: .02em; background: var(--nw-brand); }
.nw-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nw-av--logo { background: #fff; border: 1px solid var(--nw-line); }
.nw-av--logo img { width: 76%; height: auto; object-fit: contain; }
.nw-av--24 { width: 24px; height: 24px; font-size: 10px; }
.nw-av--32 { width: 32px; height: 32px; font-size: 12px; }
.nw-av--44 { width: 44px; height: 44px; font-size: 15px; }
.nw-av--120 { width: 120px; height: 120px; font-size: 38px; }

/* 6. Карточка новости: низ прижат, пустоты внутри нет */
.nw-nc { display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 16px; min-width: 0; }
.nw-nc:hover { border-color: var(--nw-hover-2); }
.nw-nc__body { display: flex; flex-direction: column; gap: 8px; padding: 0 6px; flex: 1; }
.nw-nc__t { margin: 0; font-size: 18px; line-height: 1.25; font-weight: 700; }
.nw-nc__t a:hover { color: var(--nw-brand-ink); }
.nw-nc__l { margin: 0; font-size: 14px; color: var(--nw-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nw-nc__f { margin-top: auto; padding-top: 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* 7. Лента «Журнал»: главная новость крупно */
.nw-feat { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; padding: 12px; align-items: center; }
.nw-feat__b { display: flex; flex-direction: column; gap: 12px; padding: 8px 12px 8px 0; }
.nw-feat__t { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 700; text-wrap: balance; }
.nw-feat__t a:hover { color: var(--nw-brand-ink); }
.nw-feat__l { margin: 0; font-size: 16px; color: var(--nw-muted); }
.nw-ic { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 8px; font-weight: 700; color: #fff; }
.nw-ic--max { background: #7b4dff; }
.nw-ic--tg { background: #2a9ed8; }
.nw-ic--vk { background: #0077ff; }
.nw-rss { color: #e36f0c; }

/* 8. «Пусто» (номера страниц — общая «Таблетка» .dt-pager, datool.css) */
.nw-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 20px; }
.nw-empty__ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--nw-hover); color: var(--nw-brand-ink); }
.nw-empty__ic svg.nw-i { width: 28px; height: 28px; }
.nw-empty p { margin: 0; color: var(--nw-muted); max-width: 460px; }

/* 9. Новость «Обложка-шапка»: цветная шапка, «поделиться» столбиком слева */
.nw-hero { background-color: #5b3fe0; background-image: linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px); background-size: 28px 28px; color: #fff; }
.nw-hero--news { background-color: #2a5fc4; }
.nw-hero--art { background-color: #1b7a52; }
.nw-hero--how { background-color: #a4520c; }
.nw-hero__in { max-width: 1240px; margin: 0 auto; padding: 20px 20px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: end; }
.nw-hero .nw-crumbs { color: rgba(255, 255, 255, .8); grid-column: 1 / -1; }
.nw-hero .nw-crumbs a { color: #fff; }
.nw-hero__t { display: grid; gap: 14px; }
.nw-hero__rub { justify-self: start; display: inline-flex; height: 24px; align-items: center; padding: 0 10px; border-radius: 7px; background: rgba(255, 255, 255, .18); font-size: 12px; font-weight: 700; }
.nw-hero h1 { margin: 0; font-size: 46px; line-height: 1.08; font-weight: 700; text-wrap: balance; }
.nw-hero p { margin: 0; font-size: 19px; line-height: 1.45; color: rgba(255, 255, 255, .88); max-width: 760px; }
.nw-hero .nw-by { color: rgba(255, 255, 255, .85); font-size: 14px; }
.nw-hero .nw-by b { color: #fff; font-weight: 700; }
.nw-hero .nw-av { border: 2px solid rgba(255, 255, 255, .6); }
.nw-hero__art { height: 200px; display: flex; align-items: flex-end; gap: 12px; }
.nw-hero__art i { flex: 1; border-radius: 6px 6px 2px 2px; background: rgba(255, 255, 255, .85); }
.nw-hero__art i:nth-child(odd) { background: rgba(255, 255, 255, .4); }
.nw-hero__cover { border-radius: 14px; box-shadow: 0 12px 40px -12px rgba(0, 0, 0, .45); }
.nw-preview { background: var(--nw-orange-bg); color: var(--nw-orange); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 700; }
.nw-body { display: grid; grid-template-columns: 56px minmax(0, 720px); gap: 32px; justify-content: center; align-items: start; }
.nw-rail { position: sticky; top: 16px; display: grid; gap: 8px; justify-items: center; }
.nw-rail small { font-size: 11px; color: var(--nw-muted); }
.nw-share { display: grid; gap: 8px; }
.nw-share a, .nw-share button { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--nw-line); background: var(--nw-surface); color: var(--nw-ink); cursor: pointer; padding: 0; }
.nw-share a:hover, .nw-share button:hover { border-color: var(--nw-brand); color: var(--nw-brand-ink); }
.nw-share .nw-ic { width: 26px; height: 26px; font-size: 9px; border-radius: 8px; }
.nw-share__done { font-size: 11px; color: var(--nw-green); text-align: center; }
.nw-pn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nw-pn a { display: grid; gap: 6px; padding: 16px 18px; }
.nw-pn a:hover { border-color: var(--nw-brand); }
.nw-pn small { color: var(--nw-muted); font-size: 13px; }
.nw-pn b { font-size: 16px; line-height: 1.3; }
.nw-about { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.nw-links { display: flex; flex-wrap: wrap; gap: 6px; }
.nw-links a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px; background: var(--nw-surface-2); font-size: 13px; }
.nw-links a:hover { background: var(--nw-hover); color: var(--nw-brand-ink); }

/* 10. Текст новости: Markdown (apps/docs/render.py) — заголовки, списки, код, рисунки, выноски */
.nw-prose { font-size: 17px; line-height: 1.65; max-width: 720px; overflow-wrap: anywhere; }
.nw-prose > * { margin: 0 0 16px; }
.nw-prose h2 { font-size: 24px; line-height: 1.25; margin: 32px 0 12px; }
.nw-prose h3 { font-size: 19px; margin: 24px 0 8px; }
.nw-prose ul, .nw-prose ol { padding-left: 22px; }
.nw-prose ul { list-style: disc; }
.nw-prose ol { list-style: decimal; }
.nw-prose li { margin-bottom: 6px; }
.nw-prose a { color: var(--nw-brand-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.nw-prose code { font-family: 'PT Mono', ui-monospace, Menlo, monospace; font-size: .86em; background: var(--nw-code-bg); padding: 1px 6px; border-radius: 6px; }
.nw-prose pre { background: var(--nw-code-bg); border: 1px solid var(--nw-line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font: 13.5px/1.6 'PT Mono', ui-monospace, Menlo, monospace; white-space: pre; }
.nw-prose pre code { background: none; padding: 0; font-size: inherit; }
.nw-prose blockquote { margin: 24px 0; padding: 20px 22px; border-radius: 16px; background: var(--nw-hover); font-size: 19px; line-height: 1.5; }
.nw-prose blockquote p { margin: 0 0 10px; }
.nw-prose blockquote p:last-child { margin: 0; }
.nw-prose table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 15px; }
.nw-prose th, .nw-prose td { border-bottom: 1px solid var(--nw-line); padding: 8px 10px; text-align: left; }
.nw-prose .docs-figure { margin: 24px 0; }
.nw-prose .docs-figure img { display: block; max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--nw-line); }
.nw-prose .docs-figure figcaption { margin-top: 8px; font-size: 13px; color: var(--nw-muted); }
.nw-prose .admonition { padding: 14px 16px; border-radius: 12px; background: var(--nw-blue-bg); }
.nw-prose .admonition.warning { background: var(--nw-orange-bg); }
.nw-prose .admonition.danger { background: var(--nw-orange-bg); border: 1px solid var(--nw-orange); }
.nw-prose .admonition-title { font-weight: 700; margin: 0 0 6px; }

/* 11. Поиск «Карточки»: крупное поле; тег — цветная шапка с похожими тегами */
.nw-band { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 36px 24px; border-radius: 22px; background: var(--nw-hover); border: 1px solid var(--nw-hover-2); }
.nw-band h1 { margin: 0; font-size: 34px; line-height: 1.15; }
.nw-field { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 640px; height: 52px; padding: 0 14px; border-radius: 12px; background: var(--nw-surface); border: 1px solid var(--nw-hover-2); }
.nw-field:focus-within { border-color: var(--nw-brand); box-shadow: 0 0 0 3px rgba(107, 69, 246, .12); }
.nw-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: 17px; height: 100%; color: inherit; }
.nw-field svg { color: var(--nw-muted); }
.nw-band .nw-tag { background: var(--nw-surface); }
.nw-band--tag { background-color: #5b3fe0; background-image: linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px); background-size: 28px 28px; border: 0; color: #fff; }
.nw-band--tag h1 { font-size: 48px; }
.nw-band--tag p { margin: 0; color: rgba(255, 255, 255, .88); }
.nw-band--tag .nw-tag { background: rgba(255, 255, 255, .18); color: #fff; }
.nw-band--tag .nw-tag:hover { background: rgba(255, 255, 255, .3); color: #fff; }
.nw-band--tag .nw-tag small { color: rgba(255, 255, 255, .75); }
.nw-band--tag .nw-crumbs, .nw-band--tag .nw-crumbs a { color: #fff; }
.nw-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 12. Автор «Карточка сбоку»: строки новостей слева, карточка и авторы справа */
.nw-nr { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; padding: 16px; border-bottom: 1px solid var(--nw-line); align-items: start; }
.nw-nr:last-child { border-bottom: 0; }
.nw-nr .nw-cov { border-radius: 12px; }
.nw-nr__b { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nw-nr .nw-nc__l { -webkit-line-clamp: 2; }
.nw-acard { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 24px 20px; }
.nw-acard p { margin: 0; font-size: 14px; color: var(--nw-muted); }
.nw-acard .nw-links { justify-content: center; }
.nw-anums { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.nw-anums div { padding: 10px; border-radius: 12px; background: var(--nw-bg); display: grid; }
.nw-anums b { font-size: 20px; font-variant-numeric: tabular-nums; }
.nw-anums span { font-size: 12px; color: var(--nw-muted); }
.nw-badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--nw-hover); color: var(--nw-brand-ink); font-size: 12px; font-weight: 700; }
.nw-mini { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; border-radius: 12px; border: 1px solid transparent; }
.nw-mini:hover { background: var(--nw-hover); }
.nw-mini[aria-current] { border-color: var(--nw-brand); background: var(--nw-hover); }
.nw-mini b { display: block; font-size: 14px; }
.nw-mini small { display: block; font-size: 12px; color: var(--nw-muted); }

/* 13. Узкие экраны */
@media (max-width: 900px) {
  .nw-g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nw-split { grid-template-columns: minmax(0, 1fr); }
  .nw-side { position: static; }
  .nw-feat { grid-template-columns: minmax(0, 1fr); }
  .nw-feat__b { padding: 4px 8px 12px; }
  .nw-feat__t { font-size: 24px; }
  .nw-hero__in { grid-template-columns: minmax(0, 1fr); }
  .nw-hero__art { display: none; }
  .nw-body { grid-template-columns: minmax(0, 1fr); }
  .nw-rail { position: static; grid-auto-flow: column; justify-content: start; }
  .nw-share { grid-auto-flow: column; }
}
@media (max-width: 640px) {
  .nw-main { padding: 12px 16px 40px; gap: 18px; }
  .nw-hero__in { padding: 16px 16px 28px; }
  .nw-h1 { font-size: 26px; }
  .nw-g3 { grid-template-columns: minmax(0, 1fr); }
  .nw-nr { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px 12px; }
  .nw-prose { font-size: 16px; }
  .nw-hero h1 { font-size: 30px; }
  .nw-hero p { font-size: 17px; }
  .nw-pn { grid-template-columns: minmax(0, 1fr); }
  .nw-band h1 { font-size: 26px; }
  .nw-band--tag h1 { font-size: 34px; }
  .nw-about { grid-template-columns: minmax(0, 1fr); justify-items: start; }
}
