/* ===== НОВОСТИ МОДУЛЬ v2 (nv-) — железная изоляция от старых .news-* ===== */
/* Все селекторы начинаются с .nv-section или .nv-wall-modal для максимальной специфичности */

/* === СЕКЦИЯ === */
.nv-section { padding: 60px 0; background: #f8fafc; }
.nv-header { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; flex-wrap:wrap; margin-bottom:30px; }
.nv-title-group { flex:1; min-width:0; }
.nv-label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:#64748b; display:block; margin-bottom:4px; }
.nv-all-btn-top { background:none; border:none; color:#0056b3; font-weight:700; font-size:14px; cursor:pointer; padding:10px 0; white-space:nowrap; transition:color .2s; }
.nv-all-btn-top:hover { text-decoration:underline; color:#003c78; }

/* === СЕТКА ПЛИТОК (фиксированный размер) === */
.nv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    align-items: stretch; /* ВСЕ ПЛИТКИ ОДНОЙ ВЫСОТЫ ПО РЯДУ */
}
.nv-loading, .nv-empty, .nv-error { text-align:center; color:#94a3b8; padding:40px 20px; font-size:14px; grid-column: 1/-1; }
.nv-error { color:#dc2626; }

/* === ПЛИТКА (фиксированная высота 440px на десктопе) === */
.nv-tile {
    background:#fff;
    border-radius:16px;
    overflow:hidden;
    box-shadow:0 2px 12px rgba(0,0,0,.06);
    transition:transform .2s, box-shadow .2s;
    display:flex;
    flex-direction:column;
    height: 440px; /* ФИКСИРОВАННАЯ ВЫСОТА — источник единообразия */
    cursor: pointer;
}
.nv-tile:hover { transform:translateY(-4px); box-shadow:0 8px 24px rgba(0,0,0,.1); }

.nv-tile-head { display:flex; justify-content:space-between; align-items:center; padding:16px 20px 0; gap:12px; flex-shrink:0; }
.nv-tag { font-size:11px; font-weight:700; text-transform:uppercase; padding:4px 10px; border-radius:12px; letter-spacing:.3px; white-space:nowrap; }
.nv-date { font-size:12px; color:#94a3b8; font-weight:500; white-space:nowrap; }

.nv-tile-title { 
    margin:12px 20px 0; 
    font-size:17px; 
    font-weight:700; 
    color:#0f172a; 
    line-height:1.35; 
    word-break:normal; 
    hyphens:auto;
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    min-height:calc(2 * 1.35em);
    flex-shrink:0;
}

/* === МЕДИА-СЛОТ: ПОЛНОЕ ФОТО БЕЗ ОБРЕЗКИ === */
.nv-media-slot {
    position: relative;
    width: 100%;
    height: 200px; /* Фиксированная высота слота */
    background: #f1f5f9;
    overflow: hidden;
    margin-top: 16px;
    border-radius: 8px;
    flex-shrink: 0;
}
/* Максимальная специфичность: .nv-section .nv-media-slot img.nv-thumb = (0,3,1) */
.nv-section .nv-media-slot img.nv-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;        /* < ПОЛНОЕ ФОТО БЕЗ ОБРЕЗКИ */
    object-position: center;    /* центрирование внутри слота */
    display: block;
    cursor: zoom-in;
    transition: opacity .2s, transform .3s;
    transform-origin: center;
    background: #fff; /* белый фон вокруг прозрачных PNG/SVG */
}
.nv-section .nv-media-slot img.nv-thumb:hover { opacity: .92; transform: scale(1.02); }

/* === ЗАГЛУШКА === */
.nv-section .nv-placeholder {
    width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; position: relative; overflow: hidden;
}
.nv-section .nv-placeholder::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(currentColor 1.2px, transparent 1.2px);
    background-size: 18px 18px; opacity: 0.18; pointer-events: none;
}
.nv-section .nv-ph-svg { width: 52px; height: 52px; opacity: 0.75; filter: drop-shadow(0 3px 6px rgba(0,0,0,.15)); z-index: 1; }
.nv-section .nv-ph-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.85; z-index: 1; }

.nv-excerpt { 
    margin: 16px 20px; 
    font-size: 14px; 
    color: #475569; 
    line-height: 1.6; 
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    flex-shrink: 0;
}

.nv-tile-foot { 
    padding: 0 20px 16px; 
    margin-top: auto; 
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.nv-react-preview { display:flex; gap:6px; flex-wrap:wrap; }
.nv-rp-item { font-size:12px; color:#64748b; display:inline-flex; align-items:center; gap:2px; }
.nv-rp-item b { font-weight:700; color:#0f172a; }
.nv-comment-count { font-size:12px; color:#94a3b8; white-space:nowrap; }

/* === РЯД КНОПКИ "ВСЕ НОВОСТИ" ПОСЛЕ СЕТКИ === */
.nv-all-row { margin-top: 24px; text-align: center; }
.nv-all-btn-inline { 
    background: linear-gradient(135deg, #0056b3 0%, #0ea5e9 100%);
    color: #fff; border: none; padding: 12px 28px; border-radius: 10px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,86,179,.25); transition: all .2s;
}
.nv-all-btn-inline:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,86,179,.35); }

/* === СТЕНА НОВОСТЕЙ (МОДАЛКА) === */
.nv-wall-modal { position:fixed; inset:0; z-index:9990; display:none; align-items:center; justify-content:center; padding:20px; }
.nv-wall-overlay { position:absolute; inset:0; background:rgba(15,23,42,.6); backdrop-filter:blur(3px); }
.nv-wall-content { position:relative; background:#f1f5f9; width:100%; max-width:680px; height:min(86vh,900px); border-radius:16px; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.nv-wall-header { display:flex; justify-content:space-between; align-items:center; padding:16px 22px; background:#fff; border-bottom:1px solid #e2e8f0; }
.nv-wall-header h2 { margin:0; font-size:18px; color:#0f172a; }
.nv-wall-close { background:#f1f5f9; border:none; width:38px; height:38px; border-radius:10px; font-size:18px; cursor:pointer; }
.nv-wall-body { overflow-y:auto; padding:20px; display:flex; flex-direction:column; gap:16px; }

.nv-wall-post { background:#fff; border-radius:14px; padding:18px 20px; box-shadow:0 1px 6px rgba(0,0,0,.05); }
.nv-wall-post.nv-highlight { outline:3px solid #0ea5e9; }
.nv-wall-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:10px; }
.nv-wdate { font-size:12px; color:#94a3b8; }
.nv-wtitle { margin:0 0 12px; font-size:18px; font-weight:700; color:#0f172a; line-height:1.35; }
.nv-wimg { width:100%; max-height:400px; object-fit:contain; background:#f1f5f9; border-radius:10px; margin:0 0 14px; cursor:zoom-in; display:block; }
.nv-wtext { font-size:15px; color:#334155; line-height:1.7; white-space:pre-wrap; margin-bottom:14px; }
.nv-wtext a { color:#0056b3; text-decoration:underline; font-weight:600; }

.nv-reactions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.nv-react-btn { background:#f1f5f9; border:1px solid #e2e8f0; border-radius:20px; padding:6px 12px; font-size:16px; cursor:pointer; transition:all .15s; display:inline-flex; align-items:center; gap:4px; }
.nv-react-btn:hover { background:#e2e8f0; transform:scale(1.05); }
.nv-react-btn.active { background:#dbeafe; border-color:#0284c7; }
.nv-cnt { font-size:12px; font-weight:700; color:#0f172a; }

.nv-comments-toggle { background:none; border:none; color:#0056b3; font-weight:600; font-size:13px; cursor:pointer; padding:8px 0; display:block; width:100%; text-align:left; }
.nv-comments-list { display:none; flex-direction:column; gap:10px; margin-top:10px; padding-top:10px; border-top:1px solid #e2e8f0; }
.nv-comment { font-size:14px; color:#334155; line-height:1.5; }
.nv-comment b { color:#0f172a; }
.nv-cdate { font-size:11px; color:#94a3b8; margin-left:8px; }
.nv-pending { opacity:.6; }
.nv-pending-badge { font-size:10px; background:#fef3c7; color:#b45309; padding:2px 6px; border-radius:8px; margin-left:6px; }
.nv-comment-form { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.nv-comment-form input, .nv-comment-form textarea { padding:10px 12px; border:1px solid #cbd5e1; border-radius:8px; font-size:14px; font-family:inherit; }
.nv-comment-form textarea { resize:vertical; min-height:60px; }
.nv-comment-form button { align-self:flex-start; background:#0056b3; color:#fff; border:none; padding:8px 16px; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer; transition:background .2s; }
.nv-comment-form button:hover { background:#003c78; }

/* === ЛАЙТБОКС === */
.nv-lightbox { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(15,23,42,.92); backdrop-filter:blur(8px); z-index:10000; display:none; align-items:center; justify-content:center; padding:20px; opacity:0; transition:opacity .3s ease; }
.nv-lightbox.show { display:flex; opacity:1; }
.nv-lightbox-content { position:relative; max-width:92vw; max-height:92vh; display:flex; flex-direction:column; align-items:center; }
.nv-lightbox-close { position:absolute; top:-50px; right:0; background:rgba(255,255,255,.15); border:none; color:#fff; width:44px; height:44px; border-radius:50%; font-size:22px; cursor:pointer; transition:all .2s; display:flex; align-items:center; justify-content:center; }
.nv-lightbox-close:hover { background:rgba(255,255,255,.3); transform:rotate(90deg); }
#nvLightboxImg { max-width:100%; max-height:80vh; object-fit:contain; border-radius:8px; background:#fff; }
.nv-lightbox-caption { color:#fff; margin-top:15px; font-size:14px; text-align:center; max-width:90%; opacity:.9; }

/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 768px) {
    .nv-section { padding: 40px 0; }
    .nv-header { flex-direction:column; align-items:stretch; gap:12px; }
    .nv-all-btn-top { align-self:flex-start; }
    .nv-grid { grid-template-columns: 1fr; gap: 20px; }
    .nv-tile { height: 380px; } /* Компактнее на телефоне */
    .nv-media-slot { height: 160px; }
    .nv-tile-title { font-size: 16px; }
    .nv-excerpt { -webkit-line-clamp: 2; font-size: 13.5px; }
    .nv-all-row { margin-top: 20px; }
    .nv-all-btn-inline { width: 100%; padding: 14px 20px; font-size: 16px; }
}

/* === VISION MODE (ГОСТ Р 52872-2019) === */
body.vision-mode .nv-tile,
body.vision-mode .nv-wall-post { border: 2px solid #000 !important; box-shadow: none !important; }
body.vision-mode .nv-media-slot,
body.vision-mode .nv-placeholder { background: #fff !important; border: 1px dashed #000 !important; }
body.vision-mode .nv-ph-svg,
body.vision-mode .nv-ph-label { color: #000 !important; opacity: 1 !important; }
body.vision-mode .nv-read-more,
body.vision-mode .nv-all-btn-top,
body.vision-mode .nv-all-btn-inline { color: #000 !important; text-decoration: underline !important; }
body.vision-mode .nv-react-btn { border: 1px solid #000 !important; background: #fff !important; }