/* ==========================================================================
   Общие стили модального окна новости.
   Используется и на главной странице (home.html), и на странице
   списка новостей (news_list.html) — чтобы модалка выглядела одинаково.
   ========================================================================== */

    .news-modal-overlay {
      position: fixed; inset: 0; z-index: 9999;
      display: flex; align-items: center; justify-content: center;
      padding: 24px 16px;
      background: rgba(2, 8, 14, 0);
      backdrop-filter: blur(0px);
      -webkit-backdrop-filter: blur(0px);
      opacity: 0; visibility: hidden;
      transition: opacity .5s cubic-bezier(.16,1,.3,1),
                  background .5s cubic-bezier(.16,1,.3,1),
                  backdrop-filter .5s cubic-bezier(.16,1,.3,1),
                  visibility .5s;
    }
    .news-modal-overlay.show {
      opacity: 1; visibility: visible;
      background: rgba(2, 8, 14, .78);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .news-modal {
      position: relative;
      isolation: isolate;
      contain: layout paint;
      box-sizing: border-box;
      width: min(680px, 100%);
      max-height: 86vh;
      display: flex; flex-direction: column;
      overflow: hidden;
      background: #12151D;
      border: 1px solid var(--border-default);
      border-radius: 18px;
      padding: 30px 0 34px 30px;
      box-shadow: 0 30px 80px rgba(0,0,0,.6);
      transform: translateY(38px) scale(.94);
      opacity: 0;
      transition: transform .55s cubic-bezier(.16,1,.3,1),
                  opacity .45s cubic-bezier(.16,1,.3,1);
    }
    .news-modal-overlay.show .news-modal { transform: translateY(0) scale(1); opacity: 1; }
    .news-modal-scroll {
      position: relative; z-index: 1;
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      transform: translateZ(0);
      will-change: scroll-position;
      flex: 1 1 auto;
      min-height: 0;
      max-height: 100%;
      padding-right: 26px;
      padding-bottom: 6px;
      max-width: 100%;
      scrollbar-width: thin;
      scrollbar-color: rgba(117,255,240,.25) transparent;
    }
    .news-modal-scroll::-webkit-scrollbar {
      width: 5px;
    }
    .news-modal-scroll::-webkit-scrollbar-track {
      background: transparent;
    }
    .news-modal-scroll::-webkit-scrollbar-thumb {
      background: rgba(117,255,240,.22);
      border-radius: 99px;
    }
    .news-modal-scroll::-webkit-scrollbar-thumb:hover {
      background: rgba(117,255,240,.22);
    }
    .news-modal-header,
    .news-modal-title,
    .news-modal-subtitle,
    .news-modal-body {
      opacity: 0;
      transform: translateY(10px);
      transition: opacity .5s cubic-bezier(.16,1,.3,1),
                  transform .5s cubic-bezier(.16,1,.3,1);
      transition-delay: .08s;
    }
    .news-modal-title    { transition-delay: .14s; }
    .news-modal-subtitle { transition-delay: .18s; }
    .news-modal-body     { transition-delay: .22s; }
    .news-modal-overlay.show .news-modal-header,
    .news-modal-overlay.show .news-modal-title,
    .news-modal-overlay.show .news-modal-subtitle,
    .news-modal-overlay.show .news-modal-body {
      opacity: 1;
      transform: translateY(0);
    }
    .news-modal-top-fade {
      position: absolute; top: 0; left: 0; right: 0; height: 56px;
      z-index: 50; pointer-events: none; border-radius: 18px 18px 0 0;
      background: linear-gradient(#12151D 20%, rgba(18,21,29,0));
    }
    .news-modal-close {
      position: absolute; top: 12px; right: 12px; z-index: 60;
      width: 38px; height: 38px; border-radius: 999px;
      background: #1C202B;
      border: 1px solid var(--border-default);
      color: #E2E2E5; font-size: 26px; font-weight: 200; line-height: 1;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      padding: 0;
      appearance: none;
      flex-shrink: 0;
      pointer-events: auto;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
    .news-modal-close:hover,
    .news-modal-close:active {
      background: #1C202B;
    }
    .news-modal-header {
      display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
      margin-bottom: 18px; padding-right: 40px;
    }
    .news-modal-badge {
      display: inline-flex; align-items: center; gap: 7px;
      padding: 6px 14px; border-radius: 7px;
      background: rgba(80,255,150,.12); border: 1px solid rgba(80,255,150,.3);
      color: #6dffa8; font-size: 11px; font-weight: 400; letter-spacing: 1.5px;
    }
    .news-modal-date { font-size: 12px; color: #9BA1AE; font-weight: 600; }
    .news-modal-title {
      font-size: clamp(22px, 4vw, 30px); font-weight: 500; line-height: 1.3;
      letter-spacing: -.5px; margin-bottom: 14px;
      color: #E2E2E5;
overflow-wrap: break-word;
    }
    .news-modal-subtitle {
      font-size: 14px; color: var(--muted); font-style: italic;
      margin-bottom: 18px; padding-bottom: 18px;
      border-bottom: 1px solid var(--border-default);
    }
    .news-modal-body {
      font-size: 14.5px; font-weight: 500; line-height: 1.85; color: #E2E2E5;
      overflow-wrap: break-word;
      word-break: break-word;
    }
    .news-modal-body table {
      max-width: 100%;
      display: block;
      overflow-x: auto;
    }
    .news-modal-body p { margin-bottom: 14px; }
    .news-modal-body ul, .news-modal-body ol { margin: 4px 0 14px 20px; }
    .news-modal-body li { margin-bottom: 6px; }
    .news-modal-body strong, .news-modal-body b { color: #E2E2E5; }
    .news-modal-body h1, .news-modal-body h2, .news-modal-body h3, .news-modal-body h4 {
      color: #E2E2E5; font-weight: 800; line-height: 1.4;
      margin: 26px 0 10px; letter-spacing: -.2px;
    }
    .news-modal-body h1 { font-size: 19px; }
    .news-modal-body h2 { font-size: 18px; }
    .news-modal-body h3, .news-modal-body h4 { font-size: 16px; }
    .news-modal-body > :first-child { margin-top: 0; }
    .news-modal-body a { color: var(--accent); text-decoration: none; }
    .news-modal-body img {
      display: block; max-width: 100%; height: auto;
      border-radius: 12px; margin: 16px 0;
      border: 1px solid var(--border-default);
    }
    .news-modal-body .news-gallery {
      display: flex; flex-wrap: wrap; gap: 8px;
      margin: 14px 0 18px;
    }
    .news-modal-body .news-gallery a { display: block; line-height: 0; }
    .news-modal-body .news-gallery img {
      display: block; margin: 0;
      width: 130px; height: 86px; object-fit: cover;
      border-radius: 8px;
      transition: transform .15s, border-color .15s;
    }
    .news-modal-body .news-gallery a:hover img {
      transform: scale(1.04); border-color: var(--border-default);
    }
    .news-modal-original {
      display: inline-flex; align-items: center; gap: 8px;
      margin-top: 22px; padding: 10px 18px;
      background: #1C202B;
      border: 1px solid var(--border-default); border-radius: 8px;
      color: #E2E2E5; text-decoration: none;
      font-size: 12px; font-weight: 400; text-transform: uppercase; letter-spacing: 1px;
    }
    .news-modal-original img { width: 15px; height: 15px; display: block; }
