/*
 * Новости: список (content/news_list.tpl.php) и страница новости (content/news_item.tpl.php).
 * Тёмная панель статьи — как в каталоге героев (heroes-list.css) и на странице героя;
 * карточки списка — как блок «Новости и обновления» в макете !-design/design-index-heroes.png.
 */

.ep_theme {
    --nw-text:  #d5def0;
    --nw-muted: #8fa1c2;
    --nw-line:  rgba(126, 162, 230, .2);
}

/* Тёмная статья ============================================================ */

#body section article:has(.ep_news_list, .ep_news_head, .ep_news_empty) {
    border: 1px solid var(--ep-line);
    background: linear-gradient(180deg, rgba(16, 33, 66, .88) 0%, rgba(10, 22, 46, .9) 100%);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: var(--nw-text);
}
#body section article:has(.ep_news_list, .ep_news_head, .ep_news_empty) h1 { color: #fff; }
#body section article:has(.ep_news_list, .ep_news_empty) .category_description { color: var(--nw-text); }

/* Метки категорий (slug категории → цвет) */
.ep_news_cat {
    --c: #64748b;
    display: inline-block;
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--c);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    text-decoration: none;
    white-space: nowrap;
}
a.ep_news_cat:hover { color: #fff; filter: brightness(1.15); text-decoration: none; }
.ep_news_cat--obnovlenija         { --c: #2563eb; }
.ep_news_cat--novosti-igry        { --c: #0d9488; }
.ep_news_cat--voiny               { --c: #dc2626; }
.ep_news_cat--beta                { --c: #d97706; }
.ep_news_cat--novye-geroi-mesjaca { --c: #ca8a04; }
.ep_news_cat--obzory              { --c: #9333ea; }
.ep_news_cat--saita               { --c: #475569; }

/* Дата · просмотры · комментарии */
.ep_news_meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 16px;
    color: var(--nw-muted);
    font-size: 13px;
    line-height: 18px;
}
.ep_news_meta a { color: var(--nw-muted); text-decoration: none; }
.ep_news_meta a:hover { color: #fff; }
.ep_news_meta_user,
.ep_news_meta_hits,
.ep_news_meta_comments { display: inline-flex; align-items: center; gap: 5px; }
.ep_news_meta_user::before,
.ep_news_meta_hits::before,
.ep_news_meta_comments::before {
    content: '';
    width: 15px;
    height: 15px;
    background: currentColor;
    -webkit-mask: var(--i) no-repeat center / contain;
    mask: var(--i) no-repeat center / contain;
}
.ep_news_meta_user     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='8' r='4.500'/%3E%3Cpath d='M3 21c0-4.400 4-7 9-7s9 2.600 9 7z'/%3E%3C/svg%3E"); }
.ep_news_meta_hits     { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5C6.500 5 2.700 9.300 1.500 12c1.200 2.700 5 7 10.500 7s9.300-4.300 10.500-7C21.300 9.300 17.500 5 12 5zm0 11a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm0-6a2 2 0 1 0 0 4 2 2 0 0 0 0-4z'/%3E%3C/svg%3E"); }
.ep_news_meta_comments { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 3h16a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H9l-5 4v-4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"); }

/* Список ==================================================================== */

.ep_news_list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }

.ep_news_card {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    padding: 12px;
    border: 1px solid var(--nw-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .03);
}
.ep_news_card:hover { border-color: rgba(96, 165, 250, .55); background: rgba(59, 130, 246, .06); }
.ep_news_card.is_vip { border-color: rgba(245, 192, 74, .55); }

.ep_news_thumb {
    position: relative;
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    align-self: start;
    border-radius: 8px;
    background: #0b1730;
}
.ep_news_thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    transition: transform .25s ease;
}
.ep_news_card:hover .ep_news_thumb img { transform: scale(1.04); }
/* Нет картинки — фон сайта с затемнением */
.ep_news_thumb--empty {
    background:
        linear-gradient(180deg, rgba(7, 16, 36, .25), rgba(7, 16, 36, .65)),
        url("/static/theme/empires/hero-1920.jpg") center 35% / cover;
}

.ep_news_body { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 2px 4px 2px 0; }

#body section .ep_news_title {
    margin: 0;
    font-family: var(--ep-font);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}
#body section .ep_news_title a { color: #fff; text-decoration: none; }
#body section .ep_news_title a:hover { color: var(--ep-sky); }

.ep_news_teaser {
    display: -webkit-box;
    overflow: hidden;
    margin: 0;
    color: #b9c6de;
    font-size: 14px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}
.ep_news_teaser--full { display: block; overflow: visible; } /* «Кратко» показываем целиком, без обрезки */
.ep_news_body .ep_news_meta { margin-top: auto; padding-top: 4px; }

.ep_news_empty { color: var(--nw-muted); }

/* Раздел /news: вертикальные карточки в две колонки, первая новость крупно ==== */
/* Базовые правила выше — горизонтальная карточка, она осталась у виджета на главной */

.ep_news_list--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ep_news_list--grid .ep_news_card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.ep_news_list--grid .ep_news_thumb { align-self: stretch; aspect-ratio: 16 / 9; border-radius: 0; }
/* Картинка не задаёт высоту карточки: пресет big бывает квадратным (690×690) */
.ep_news_list--grid .ep_news_thumb img { position: absolute; inset: 0; }
.ep_news_list--grid .ep_news_body { flex: 1; gap: 8px; padding: 14px 16px; }
.ep_news_list--grid .ep_news_teaser { line-height: 1.55; }
/* Нижняя строка: дата и счётчики слева, метка категории справа */
.ep_news_list--grid .ep_news_body .ep_news_meta { padding-top: 6px; }
.ep_news_list--grid .ep_news_meta .ep_news_cat { margin-left: auto; color: #fff; }

/* Самая свежая новость: на всю ширину, картинка слева, текст справа */
.ep_news_list--grid .ep_news_card.is_lead {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
}
.ep_news_list--grid .is_lead .ep_news_thumb { aspect-ratio: auto; min-height: 260px; }
.ep_news_list--grid .is_lead .ep_news_body { justify-content: center; padding: 22px 24px; }
#body section .ep_news_list--grid .is_lead .ep_news_title { font-size: 24px; }
.ep_news_list--grid .is_lead .ep_news_teaser { font-size: 15px; }
.ep_news_list--grid .is_lead .ep_news_meta { margin-top: 4px; }

/* Пагинация */
#body section article:has(.ep_news_list) .pagebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}
#body section article:has(.ep_news_list) .pagebar_nav,
#body section article:has(.ep_news_list) .pagebar_pages {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}
#body section article:has(.ep_news_list) .pagebar_nav { margin-right: 10px; }
#body section article:has(.ep_news_list) .pagebar_page,
#body section article:has(.ep_news_list) .pagebar_current {
    min-width: 34px;
    padding: 6px 10px;
    border: 1px solid var(--nw-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
    color: #cfd9ee;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}
#body section article:has(.ep_news_list) .pagebar a.pagebar_page:hover { border-color: var(--ep-sky); color: #fff; }
#body section article:has(.ep_news_list) .pagebar .pagebar_current { border-color: var(--ep-accent); background: var(--ep-accent); color: #fff; }
#body section article:has(.ep_news_list) .pagebar .disabled { opacity: .45; }
#body section article:has(.ep_news_list) .pagebar_notice { margin-left: auto; color: var(--nw-muted); font-size: 13px; }

/* Страница новости ========================================================== */

.ep_news_head {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--nw-line);
}
#body section .ep_news_head h1 { margin: 0; font-size: 28px; line-height: 1.25; }

/* Картинка новости: внутри текста после вступления, прижата к правому краю, текст обтекает её слева */
.ep_news_text .ep_news_photo_wrap { float: right; width: 280px; max-width: 45%; margin: 4px 0 12px 20px; }
.ep_news_text img.ep_news_photo {
    display: block;
    width: 100%;
    border: 1px solid var(--nw-line);
    border-radius: 10px;
}
.ep_news_text a.ep_news_zoom { display: block; cursor: zoom-in; }
.ep_news_text .ep_news_gallery { display: flex; flex-wrap: wrap; gap: 8px; clear: both; margin: 12px 0; }
.ep_news_text .ep_news_gallery a.ep_news_zoom { display: block; }
.ep_news_text .ep_news_gallery img { display: block; height: 140px; width: auto; border: 1px solid var(--nw-line); border-radius: 8px; }
.ep_news_text::after { content: ""; display: block; clear: both; }
.ep_news_lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .85);
    cursor: zoom-out;
}
.ep_news_lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 8px 40px rgba(0, 0, 0, .6); }
@media (max-width: 600px) {
    .ep_news_text .ep_news_photo_wrap { float: none; width: auto; max-width: 320px; margin: 14px auto; }
}

/* Поле «Кратко» над текстом новости */
.ep_news_brief {
    margin: 0 0 20px;
    padding: 12px 16px;
    border-left: 3px solid var(--ep-sky);
    border-radius: 0 8px 8px 0;
    background: rgba(255, 255, 255, .05);
    color: #fff;
    font-size: 16px;
    line-height: 1.55;
}

.ep_news_text,
.ep_news_text .field { color: var(--nw-text); font-size: 15px; line-height: 1.65; } /* .field — перебить «.content_item .field» из theme-content.css */
.ep_news_text .value > *:first-child { margin-top: 0; }
.ep_news_text a { color: var(--ep-sky); }
.ep_news_text a:hover { color: #fff; }
.ep_news_text h2, .ep_news_text h3, .ep_news_text h4,
#body section .ep_news_text h2, #body section .ep_news_text h3 { color: #fff; font-family: var(--ep-font); }
.ep_news_text strong, .ep_news_text b { color: #fff; }
.ep_news_text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}
.ep_news_text blockquote {
    margin: 16px 0;
    padding: 10px 16px;
    border-left: 3px solid var(--ep-sky);
    border-radius: 0 8px 8px 0;
    background: rgba(255, 255, 255, .04);
    color: #cfd9ee;
}
.ep_news_text table { border-collapse: collapse; max-width: 100%; }
.ep_news_text td, .ep_news_text th { padding: 6px 10px; border: 1px solid var(--nw-line); }
.ep_news_text hr { border: 0; border-top: 1px solid var(--nw-line); }
/* Старые новости со светлой разметкой из редактора: белый фон и тёмный текст на тёмной панели не читаются */
.ep_news_text [style*="background-color: rgb(255, 255, 255)"],
.ep_news_text [style*="background-color:#fff"],
.ep_news_text [style*="background-color: #fff"] { background-color: transparent !important; }
.ep_news_text [style*="color: rgb(0, 0, 0)"],
.ep_news_text [style*="color: rgb(36, 64, 97)"],
.ep_news_text [style*="color:#000"],
.ep_news_text [style*="color: #000"] { color: inherit !important; }

/* Нижняя строка: оценка */
.ep_news_text .info_bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 0;
    padding: 14px 0 0;
    border: 0;
    border-top: 1px solid var(--nw-line);
    background: none;
}
.ep_news_text .info_bar .bar_item { margin: 0; padding: 0; background: none; color: var(--nw-muted); }
.ep_news_text .rating_widget {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid var(--nw-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
}
.ep_news_text .rating_widget .arrow,
.ep_news_text .rating_widget .arrow a,
.ep_news_text .rating_widget .arrow span,
.ep_news_text .rating_widget .score { background: none; }
.ep_news_text .rating_widget .score,
.ep_news_text .rating_widget .score span { min-width: 18px; color: #fff !important; text-align: center; }
.ep_news_text .rating_widget svg,
.ep_news_text .rating_widget .style-svg { fill: #9fb0cf; }
.ep_news_text .rating_widget .arrow a:hover svg,
.ep_news_text .rating_widget .arrow a:hover .style-svg { fill: #fff; }

/* «Похожие новости» (виджет relevants под новостью) */
.ep_theme .widget_tabbed:has(.relevants) {
    border: 1px solid var(--ep-line);
    background: linear-gradient(180deg, rgba(16, 33, 66, .88) 0%, rgba(10, 22, 46, .9) 100%);
    box-shadow: none;
}
.ep_theme .widget_tabbed:has(.relevants) .tabs ul { background: none; border-bottom: 1px solid var(--nw-line); }
.ep_theme .widget_tabbed:has(.relevants) .tabs ul li a,
.ep_theme .widget_tabbed:has(.relevants) .tabs ul li a.active {
    padding: 0 20px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 50px;
}
.ep_theme .widget_tabbed:has(.relevants) .widgets .body { padding: 14px 18px 18px; background: none; }
/* .ep_theme — перебить styles.css плагина relevanter, он подключается позже */
.ep_theme .relevants.news_list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ep_theme .relevants .relevants_list_item {
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 2px 12px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--nw-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
}
.ep_theme .relevants .relevants_list_item:hover { border-color: rgba(96, 165, 250, .55); }
.ep_theme .relevants .relevants_list_item .photo { grid-row: 1 / 3; float: none; width: 72px; height: 54px; margin: 0; overflow: hidden; border-radius: 6px; }
.ep_theme .relevants .relevants_list_item .photo img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.ep_theme .relevants .relevants_list_item .desc { float: none; margin: 0; padding: 0; }
.ep_theme .relevants .relevants_list_item .title a { color: #fff; font-size: 14px; font-weight: 700; line-height: 1.3; text-decoration: none; }
.ep_theme .relevants .relevants_list_item .title a:hover { color: var(--ep-sky); }
.ep_theme .relevants .relevants_list_item .info_bar { margin: 0; padding: 0; border: 0; background: none; }
.ep_theme .relevants .relevants_list_item .info_bar .bar_item,
.ep_theme .relevants .relevants_list_item .info_bar a { color: var(--nw-muted); font-size: 12px; }
.ep_theme .relevants .relevants_list_item .info_bar a:hover { color: #fff; }

@media screen and (max-width: 640px) {
    .ep_theme .relevants.news_list { grid-template-columns: 1fr; }
}

/* Комментарии под новостью */
#body section article:has(.ep_news_head) #comments_widget { margin-top: 26px; }
#body section article:has(.ep_news_head) #comments_widget .tabbed,
#body section article:has(.ep_news_head) #comments_widget > ul {
    border-bottom: 1px solid var(--nw-line);
    background: none;
}
#body section article:has(.ep_news_head) #comments_widget > ul li,
#body section article:has(.ep_news_head) #comments_widget > ul li a {
    border: 0;
    background: none;
    color: #fff;
    font-weight: 700;
}
#body section article:has(.ep_news_head) #comments_widget > ul li.active a { box-shadow: inset 0 -2px 0 var(--ep-sky); }
#body section article:has(.ep_news_head) #comments_widget .tab { padding: 16px 0 0; border: 0; background: none; }
#body section article:has(.ep_news_head) #comments_list .no_comments,
#body section article:has(.ep_news_head) #comments_widget .login_to_comment { color: var(--nw-muted); }
#body section article:has(.ep_news_head) #comments_widget a { color: var(--ep-sky); }
#body section article:has(.ep_news_head) #comments_widget a:hover { color: #fff; }
#body section article:has(.ep_news_head) #comments_list .comment { border-color: var(--nw-line); }
#body section article:has(.ep_news_head) #comments_list .comment .info,
#body section article:has(.ep_news_head) #comments_list .comment .date { color: var(--nw-muted); }
#body section article:has(.ep_news_head) #comments_list .comment .text { color: var(--nw-text); }

/* Карточки в виджете (content/widgets/list/list_news_cards) — компактнее ==== */

.ep_news_list--widget { gap: 10px; margin: 0; }
.ep_news_list--widget .ep_news_card { grid-template-columns: 168px minmax(0, 1fr); gap: 14px; padding: 10px; }
.ep_news_list--widget .ep_news_body { gap: 4px; }
#body .ep_news_list--widget .ep_news_title { margin: 0; font-family: var(--ep-font); font-size: 16px; font-weight: 700; line-height: 1.3; }
#body .ep_news_list--widget .ep_news_title a { color: #fff; text-decoration: none; }
#body .ep_news_list--widget .ep_news_title a:hover { color: var(--ep-sky); }
.ep_news_list--widget .ep_news_teaser { font-size: 13px; -webkit-line-clamp: 2; }
.ep_theme .widget .ep_news_meta a { color: var(--nw-muted); }
.ep_theme .widget .ep_news_meta a:hover { color: #fff; }
.ep_theme .widget a.ep_news_cat { color: #fff; }

/* Слайдер (content/widgets/slider/slider) =================================== */

.ep_theme .widget > .body:has(> .ep_feat) { padding: 14px; }
.ep_feat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 14px;
}
.ep_feat_main {
    position: relative;
    overflow: hidden;
    min-height: 300px;
    border-radius: 10px;
    background: #0b1730;
}
.ep_feat_slide {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s ease, visibility .45s;
}
.ep_feat_slide.is-active { opacity: 1; visibility: visible; }
.ep_feat_slide img { width: 100%; height: 100%; object-fit: cover; border: 0; }
.ep_feat_slide--empty {
    background:
        linear-gradient(180deg, rgba(7, 16, 36, .2), rgba(7, 16, 36, .6)),
        url("/static/theme/empires/hero-1920.jpg") center 35% / cover;
}
.ep_feat_caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 40px 18px 16px;
    background: linear-gradient(180deg, rgba(7, 16, 36, 0) 0%, rgba(7, 16, 36, .85) 55%, rgba(7, 16, 36, .95) 100%);
}
.ep_feat_title { color: #fff; font-size: 20px; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.ep_feat_caption time { color: #b9c6de; font-size: 13px; }
.ep_feat_slide:hover .ep_feat_title { color: var(--ep-sky); }

.ep_feat_list { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ep_feat_list li { margin: 0; padding: 0; }
.ep_theme .widget a.ep_feat_item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    border: 1px solid var(--nw-line);
    border-left: 3px solid transparent;
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
    color: #cfd9ee;
    text-decoration: none;
}
.ep_feat_item_title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.ep_feat_item time { color: var(--nw-muted); font-size: 12px; }
.ep_theme .widget a.ep_feat_item:hover,
.ep_theme .widget a.ep_feat_item.is-active {
    border-color: rgba(96, 165, 250, .45);
    border-left-color: var(--ep-sky);
    background: rgba(59, 130, 246, .14);
    color: #fff;
}

@media screen and (max-width: 900px) {
    .ep_feat { grid-template-columns: 1fr; }
    .ep_feat_main { min-height: 0; aspect-ratio: 16 / 9; }
    .ep_feat_list { display: none; }
}

/* Узкие экраны ============================================================= */

@media screen and (max-width: 900px) {
    .ep_news_list--grid { grid-template-columns: 1fr; }
    .ep_news_list--grid .ep_news_card.is_lead { display: flex; }
    .ep_news_list--grid .is_lead .ep_news_thumb { aspect-ratio: 16 / 9; min-height: 0; }
    .ep_news_list--grid .is_lead .ep_news_body { padding: 14px 16px; }
    #body section .ep_news_list--grid .is_lead .ep_news_title { font-size: 20px; }
}

@media screen and (max-width: 640px) {
    .ep_news_card,
    .ep_news_list--widget .ep_news_card { grid-template-columns: 1fr; gap: 10px; }
    .ep_news_thumb { aspect-ratio: 16 / 8; }
    #body section .ep_news_title { font-size: 17px; }
    #body section .ep_news_head h1 { font-size: 23px; }
}
