/* Новости на сайте (ST-1706): страница /news, окно новости, оповещение и счётчик у «Еще». */

/* ---------- Страница ---------- */

.news-page {
    background: linear-gradient(180deg, #d9cdfb 0%, #ede7fd 320px, #f7f5fe 640px, #fff 100%);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

/* Полоса за закреплённой шапкой (layout lending): тот же тон, что верх фона страницы,
   иначе в зазорах по бокам шапки видна полоса темнее. */
.news-header-strip {
    background: #d9cdfb;
}

.news-hero {
    padding: 64px 24px 28px;
    text-align: center;
}

.news-hero__title {
    margin: 0 auto;
    max-width: 640px;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(105deg, #5b2ee6 0%, #8752fa 60%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Одна строка на десктопе; на телефоне переносится сама (см. медиазапрос ниже). */
.news-hero__subtitle {
    margin: 12px auto 0;
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.45;
    color: #55536a;
}

/* «Прочитать все (N)» — справа над лентой, по правому краю сетки. */
.news-toolbar {
    display: flex;
    justify-content: flex-end;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px 20px;
}

.news-read-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid #ddd3fd;
    border-radius: 12px;
    background: #fff;
    color: #6d3ff5;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(113, 55, 249, 0.08);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.news-read-all:hover {
    background: #f6f2ff;
    border-color: #c9b8fb;
}

.news-read-all:focus-visible {
    outline: 2px solid #8752fa;
    outline-offset: 2px;
}

/* display: inline-flex выше перебил бы атрибут hidden — без непрочитанных кнопки нет. */
.news-read-all[hidden] {
    display: none;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px 96px;
}

.news-empty {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 24px 120px;
    text-align: center;
    color: #55536a;
}

/* ---------- Карточка ---------- */

/* Деловой вид (ST-1880): без картинки с эмодзи — фиолетовая полоса сверху, заголовок, краткое
   описание и кнопка. Полоса — border-top у скруглённой карточки, поэтому загибается по углам. */
.news-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 20px;
    border: 1px solid #ece9f6;
    border-top: 3px solid #6c3ef4;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(92, 64, 190, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(92, 64, 190, 0.14);
}

.news-card__title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #17162a;
}

/* Плашка NEW стоит в правом верхнем углу — заголовок под неё не заезжает. Плашку снимает
   скрипт (прочитано), и тогда заголовок занимает всю ширину. */
.news-new-badge + .news-card__title {
    padding-right: 68px;
}

.news-card__summary {
    margin: 10px 0 22px;
    font-size: 14px;
    line-height: 1.5;
    color: #55536a;
}

/* Кнопка всегда внизу слева: карточки в ряду одной высоты, а текст у них разной длины. */
.news-card__more {
    align-self: flex-start;
    margin-top: auto;
    padding: 11px 22px;
    border-radius: 10px;
    background: #6c3ef4;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.news-card__more:hover {
    color: #fff;
    filter: brightness(1.08);
}

.news-new-badge {
    position: absolute;
    z-index: 2;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff;
    color: #6b3df0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(92, 64, 190, 0.14);
}

.news-new-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

/* ---------- Окно новости ---------- */

.news-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.news-modal[hidden] {
    display: none;
}

.news-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(58, 45, 120, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.news-modal__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 566px;
    max-height: calc(100vh - 48px);
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 60px rgba(30, 20, 80, 0.3);
}

.news-modal__close {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #17162a;
    box-shadow: 0 2px 8px rgba(30, 20, 80, 0.15);
    cursor: pointer;
}

.news-modal__content {
    overflow-y: auto;
    padding: 28px 30px 32px;
}

.news-modal__title {
    margin: 0;
    /* Крестик теперь над текстом, а не на цветной плашке — заголовок под него не заезжает. */
    padding-right: 36px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    color: #17162a;
}

.news-modal__body {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: #2e2c40;
    overflow-wrap: anywhere;
}

.news-modal__body p,
.news-modal__body div {
    margin: 0 0 12px;
}

.news-modal__body ul,
.news-modal__body ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.news-modal__body ul {
    list-style: disc;
}

.news-modal__body ol {
    list-style: decimal;
}

.news-modal__body a {
    color: #6b3df0;
    text-decoration: underline;
}

.news-modal__body b,
.news-modal__body strong {
    font-weight: 700;
}

body.news-modal-open {
    overflow: hidden;
}

/* ---------- Счётчик у «Еще» ---------- */

.news-unread[hidden] {
    display: none;
}

/* Число: в пункте «Новости» и рядом с «Еще». */
.news-unread--count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #8752fa;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Зелёный кружок у «Еще»: «там что-то новое». */
.news-unread--dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff;
}

.news-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ---------- Оповещение справа внизу ---------- */

/* Макет ST-1850: белая карточка с фиолетовой полосой слева (border-left у скруглённой карточки —
   поэтому полоса загибается по углам), шапка «колокольчик + НОВОСТИ СЕРВИСА», подпись, заголовок и
   кнопка «Подробнее» по ширине текста. */
.news-popup {
    position: fixed;
    z-index: 900;
    right: 24px;
    bottom: 24px;
    width: 460px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    padding: 16px 22px 18px 24px;
    border: 1px solid #ece9f6;
    border-left: 5px solid #6c3ef4;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(92, 64, 190, 0.16);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

.news-popup[hidden] {
    display: none;
}

/* Карточка выезжает снизу, потом каждые ~3 с колокольчик в шапке «звенит». */
.news-popup:not([hidden]) {
    animation: news-popup-enter 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.news-popup:not([hidden]) .news-popup__bell {
    animation: news-popup-ring 3s ease-in-out 0.6s infinite;
    transform-origin: 50% 20%;
}

@keyframes news-popup-enter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Звон — в первой трети цикла, дальше колокольчик спокоен. */
@keyframes news-popup-ring {
    0%, 30%, 100% {
        transform: rotate(0);
    }
    5% {
        transform: rotate(-14deg);
    }
    10% {
        transform: rotate(12deg);
    }
    15% {
        transform: rotate(-9deg);
    }
    20% {
        transform: rotate(6deg);
    }
    25% {
        transform: rotate(-3deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-popup:not([hidden]),
    .news-popup:not([hidden]) .news-popup__bell {
        animation: none;
    }
}

.news-popup__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 28px;
    color: #6f6d80;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.news-popup__bell {
    display: inline-flex;
    color: #6c3ef4;
}

.news-popup__caption {
    margin-top: 10px;
    font-size: 13px;
    color: #6f6d80;
}

.news-popup__title {
    margin-top: 2px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: #17162a;
}

.news-popup__more {
    display: inline-block;
    margin-top: 14px;
    padding: 9px 22px;
    border-radius: 10px;
    background: #6c3ef4;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.news-popup__more:hover {
    color: #fff;
    filter: brightness(1.08);
}

.news-popup__close {
    position: absolute;
    top: 13px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a8899;
    cursor: pointer;
}

.news-popup__close:hover {
    background: #f1edfe;
    color: #17162a;
}

/* ---------- Мобильная ширина ---------- */

@media (max-width: 1023px) {
    .news-hero {
        padding-top: 48px;
    }

    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .news-hero {
        padding: 40px 16px 28px;
    }

    .news-hero__title {
        font-size: 30px;
    }

    .news-hero__subtitle {
        font-size: 15px;
        white-space: normal;
    }

    .news-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 0 16px 64px;
    }

    .news-toolbar {
        padding: 0 16px 16px;
    }

    .news-modal {
        align-items: flex-end;
        padding: 0;
    }

    .news-modal__panel {
        max-width: none;
        max-height: 92vh;
        border-radius: 24px 24px 0 0;
    }

    .news-modal__content {
        padding: 22px 20px 28px;
    }

    .news-modal__title {
        font-size: 20px;
    }

    .news-popup {
        right: 16px;
        left: 16px;
        bottom: 16px;
        width: auto;
        max-width: none;
    }
}
