/* ==========================================
   СТРАНИЦА НОВОСТЕЙ
========================================== */

.news-page-header {
    max-width: 900px;
    margin: 30px auto 25px;
    padding: 0 20px;
    text-align: center;
    position: relative;
}

.news-page-header h1 {
    font-size: 54px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 18px;
}

.news-page-header h1::after {
    content: "";
    display: block;
    width: 90px;
    height: 3px;
    margin: 22px auto 0;
    background: var(--accent);
    border-radius: 20px;
}

.news-page-header p {
    max-width: 700px;
    margin: 35px auto 0;
    color: var(--text-muted);
    font-size: 19px;
    line-height: 1.9;
}

.news-page-header::after {
    content: "";
    display: block;
    width: 50%;
    height: 2px;
    margin: 30px auto 0;
    background: var(--accent);
    border-radius: 20px;
    opacity: 0.6;
}

/* ==========================================
   СЕТКА НОВОСТЕЙ — широкая, 4–5 колонок
========================================== */

.news-grid-section {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px 30px 60px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* ==========================================
   КАРТОЧКА НОВОСТИ — фиксированная высота
========================================== */

.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    overflow: hidden;
    transition: 0.4s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 420px;
    min-height: 380px;
}

.news-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 20px 50px var(--shadow-hover);
}

.news-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.news-card:hover .news-image img {
    transform: scale(1.05);
}

.news-body {
    padding: 18px 22px 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-category {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-text);
    padding: 3px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    align-self: flex-start;
}

.news-body h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 6px 0;
    line-height: 1.3;
    flex-shrink: 0;
}

.news-date {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
    opacity: 0.7;
    flex-shrink: 0;
}

.news-body p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ==========================================
   МОДАЛЬНОЕ ОКНО — ДЕСКТОП
========================================== */

.news-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
}

.news-modal-content {
    background: var(--bg-modal);
    border-radius: 30px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    padding: 35px 40px 40px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
    box-sizing: border-box;
}

.news-modal-content::-webkit-scrollbar {
    width: 6px;
}

.news-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.news-modal-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

.news-modal-close {
    position: sticky;
    top: 0;
    float: right;
    font-size: 36px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
    z-index: 10;
    padding: 0 0 0 15px;
    margin-top: -5px;
}

.news-modal-close:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

.news-modal-body {
    display: flex;
    gap: 35px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.news-modal-image {
    flex: 0 0 40%;
    max-height: 400px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--bg-surface);
}

.news-modal-image img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
}

.news-modal-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.news-modal-category {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-text);
    padding: 4px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    align-self: flex-start;
    flex-shrink: 0;
}

.news-modal-text h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    line-height: 1.2;
    word-wrap: break-word;
}

.news-modal-date {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 18px;
    opacity: 0.7;
    flex-shrink: 0;
}

.news-modal-text p {
    color: var(--text-muted);
    font-size: 17px;
    line-height: 1.8;
    margin: 0 0 25px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.news-modal-video-wrapper {
    margin-top: 10px;
    flex-shrink: 0;
}

.news-modal-video-btn {
    background: var(--accent-gradient);
    color: var(--accent-text);
    border: none;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    display: inline-block;
}

.news-modal-video-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px var(--accent-glow);
}

.news-modal-video-container {
    margin-top: 20px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    max-height: 400px;
    width: 100%;
}

.news-modal-video-container video {
    width: 100%;
    max-height: 400px;
    display: block;
    background: #000;
}

/* ==========================================
   ПЛАНШЕТЫ
========================================== */

@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 25px;
    }
    .news-card {
        height: 380px;
    }
    .news-image {
        height: 170px;
    }
    .news-body h3 {
        font-size: 18px;
    }
    .news-modal-content {
        max-width: 96vw;
        padding: 30px 30px 35px;
    }
}

@media (max-width: 992px) {
    .news-modal-content {
        max-width: 98vw;
        padding: 25px 25px 30px;
        max-height: 92vh;
    }
    .news-modal-body {
        flex-direction: column;
        gap: 20px;
    }
    .news-modal-image {
        flex: 0 0 auto;
        width: 100%;
        max-height: 300px;
    }
    .news-modal-image img {
        max-height: 300px;
    }
    .news-modal-text h2 {
        font-size: 26px;
    }
}

/* ==========================================
   МОБИЛЬНЫЕ ТЕЛЕФОНЫ (до 768px)
========================================== */

@media (max-width: 768px) {
    .news-page-header {
        margin: 20px auto 15px;
        padding: 0 15px;
    }
    .news-page-header h1 {
        font-size: 34px;
    }
    .news-page-header h1::after {
        width: 60px;
        margin: 16px auto 0;
    }
    .news-page-header p {
        font-size: 16px;
        margin: 20px auto 0;
    }
    .news-page-header::after {
        width: 70%;
        margin: 20px auto 0;
    }

    .news-grid-section {
        padding: 15px 15px 40px;
    }
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 18px;
    }
    .news-card {
        height: 340px;
    }
    .news-image {
        height: 150px;
    }
    .news-body {
        padding: 14px 16px 18px;
    }
    .news-body h3 {
        font-size: 16px;
    }
    .news-body p {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    /* ==========================================
       МОДАЛКА НА ТЕЛЕФОНЕ — ПОЛНЫЙ ЭКРАН
    ========================================== */
    .news-modal {
        padding: 0;
        align-items: stretch;
        background: rgba(0, 0, 0, 0.9);
    }

    .news-modal-content {
        max-width: 100vw;
        max-height: 100vh;
        width: 100%;
        height: 100%;
        border-radius: 0;
        padding: 12px 16px 20px;
        overflow-y: auto;
        overflow-x: hidden;
        background: var(--bg-primary);
        border: none;
        box-shadow: none;
        display: flex;
        flex-direction: column;
    }

    .news-modal-content::-webkit-scrollbar {
        width: 0;
        height: 0;
    }

    .news-modal-close {
        position: sticky;
        top: 0;
        float: none;
        align-self: flex-end;
        font-size: 28px;
        width: 44px;
        height: 44px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(8px);
        color: #fff;
        padding: 0;
        margin: 0 0 10px 0;
        flex-shrink: 0;
        border: 1px solid rgba(255,255,255,0.15);
        z-index: 20;
    }

    .news-modal-close:hover {
        transform: rotate(90deg);
        background: rgba(212, 175, 55, 0.3);
    }

    .news-modal-body {
        flex-direction: column;
        gap: 14px;
        flex: 1;
        padding: 0;
        overflow-y: visible;
        width: 100%;
        box-sizing: border-box;
    }

    /* Изображение — нормальный размер, не ужимается */
    .news-modal-image {
        flex: 0 0 auto;
        width: 100%;
        max-height: 280px;
        border-radius: 14px;
        overflow: hidden;
        background: var(--bg-surface);
    }

    .news-modal-image img {
        width: 100%;
        height: auto;
        max-height: 280px;
        object-fit: cover;
        display: block;
    }

    .news-modal-text {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }

    .news-modal-category {
        font-size: 11px;
        padding: 3px 12px;
        margin-bottom: 6px;
        flex-shrink: 0;
        align-self: flex-start;
    }

    .news-modal-text h2 {
        font-size: 22px;
        margin: 0 0 4px 0;
        line-height: 1.25;
        word-wrap: break-word;
        overflow-wrap: break-word;
        width: 100%;
        box-sizing: border-box;
    }

    .news-modal-date {
        font-size: 13px;
        margin-bottom: 10px;
        flex-shrink: 0;
    }

    .news-modal-text p {
        font-size: 15px;
        line-height: 1.7;
        margin: 0 0 12px 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: pre-wrap;
        width: 100%;
        box-sizing: border-box;
        max-height: 35vh;
        overflow-y: auto;
        padding-right: 4px;
        flex: 1;
    }

    .news-modal-video-wrapper {
        flex-shrink: 0;
        margin-top: 4px;
        width: 100%;
        box-sizing: border-box;
    }

    .news-modal-video-btn {
        padding: 12px 20px;
        font-size: 15px;
        width: 100%;
        text-align: center;
        border-radius: 14px;
        box-sizing: border-box;
    }

    .news-modal-video-container {
        margin-top: 12px;
        border-radius: 14px;
        max-height: 280px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .news-modal-video-container video {
        width: 100%;
        max-height: 280px;
        display: block;
        background: #000;
    }
}

/* ==========================================
   МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 480px)
========================================== */

@media (max-width: 480px) {
    .news-page-header h1 {
        font-size: 28px;
    }
    .news-page-header p {
        font-size: 15px;
    }

    .news-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .news-card {
        height: 290px;
        border-radius: 18px;
        min-height: auto;
    }
    .news-image {
        height: 120px;
    }
    .news-body {
        padding: 10px 12px 14px;
    }
    .news-body h3 {
        font-size: 14px;
    }
    .news-body p {
        font-size: 12px;
        -webkit-line-clamp: 2;
        line-height: 1.5;
    }
    .news-date {
        font-size: 11px;
        margin-bottom: 6px;
    }
    .news-category {
        font-size: 9px;
        padding: 2px 10px;
        margin-bottom: 4px;
    }

    /* Модалка для маленьких телефонов */
    .news-modal-content {
        padding: 10px 12px 16px;
    }

    .news-modal-close {
        width: 38px;
        height: 38px;
        font-size: 24px;
        margin-bottom: 6px;
    }

    .news-modal-image {
        max-height: 200px;
    }

    .news-modal-image img {
        max-height: 200px;
    }

    .news-modal-text h2 {
        font-size: 19px;
    }

    .news-modal-text p {
        font-size: 14px;
        line-height: 1.6;
        max-height: 30vh;
    }

    .news-modal-video-btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .news-modal-video-container {
        max-height: 200px;
    }

    .news-modal-video-container video {
        max-height: 200px;
    }
}

/* ==========================================
   ОЧЕНЬ МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 380px)
========================================== */

@media (max-width: 380px) {
    .news-grid {
        gap: 10px;
    }
    .news-card {
        height: 260px;
    }
    .news-image {
        height: 100px;
    }
    .news-body h3 {
        font-size: 13px;
    }
    .news-body p {
        font-size: 11px;
    }

    .news-modal-content {
        padding: 8px 10px 14px;
    }

    .news-modal-image {
        max-height: 160px;
    }

    .news-modal-image img {
        max-height: 160px;
    }

    .news-modal-text h2 {
        font-size: 17px;
    }

    .news-modal-text p {
        font-size: 13px;
        max-height: 25vh;
        line-height: 1.5;
    }

    .news-modal-close {
        width: 34px;
        height: 34px;
        font-size: 20px;
    }

    .news-modal-video-btn {
        font-size: 13px;
        padding: 8px 14px;
    }

    .news-modal-video-container {
        max-height: 160px;
    }

    .news-modal-video-container video {
        max-height: 160px;
    }
}

/* ==========================================
   ПОЛНОЭКРАННЫЙ ПРОСМОТР ФОТО
========================================== */

.image-fullscreen {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    padding: 40px;
    box-sizing: border-box;
    cursor: zoom-out;
}

.image-fullscreen img {
    max-width: 95vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.8);
    display: block;
    user-select: none;
    -webkit-user-select: none;
}

.image-fullscreen-close {
    position: fixed;
    top: 24px;
    right: 32px;
    font-size: 48px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
    z-index: 100000;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
    opacity: 0.7;
    padding: 10px;
}

.image-fullscreen-close:hover {
    opacity: 1;
    transform: rotate(90deg);
    color: var(--accent);
}

/* Кнопка увеличения фото в модалке */
.news-modal-image {
    position: relative;
    flex: 0 0 40%;
    max-height: 400px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--bg-surface);
    cursor: pointer;
}

.news-modal-image img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: cover;
    display: block;
    transition: 0.3s;
}

.news-modal-image:hover img {
    filter: brightness(0.85);
}

.news-modal-image-expand {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    z-index: 5;
}

.news-modal-image:hover .news-modal-image-expand {
    opacity: 1;
    transform: scale(1);
}

.news-modal-image-expand:hover {
    background: var(--accent);
    color: var(--accent-text);
    transform: scale(1.1);
}

/* ==========================================
   АДАПТИВ ДЛЯ ПОЛНОЭКРАННОГО ПРОСМОТРА
========================================== */

@media (max-width: 768px) {
    .image-fullscreen {
        padding: 20px;
    }
    
    .image-fullscreen img {
        max-width: 100vw;
        max-height: 90vh;
    }
    
    .image-fullscreen-close {
        top: 16px;
        right: 20px;
        font-size: 40px;
        padding: 8px;
        background: rgba(0, 0, 0, 0.4);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(8px);
    }

    .news-modal-image-expand {
        opacity: 1 !important;
        transform: scale(1) !important;
        bottom: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 18px;
        background: rgba(0, 0, 0, 0.7);
    }
}

@media (max-width: 480px) {
    .image-fullscreen {
        padding: 12px;
    }
    
    .image-fullscreen img {
        max-width: 100vw;
        max-height: 85vh;
        border-radius: 4px;
    }
    
    .image-fullscreen-close {
        top: 12px;
        right: 14px;
        font-size: 32px;
        width: 44px;
        height: 44px;
    }

    .news-modal-image-expand {
        width: 36px;
        height: 36px;
        font-size: 16px;
        bottom: 10px;
        right: 10px;
    }
}