/* ==========================================================================
   Материалы из админки (страницы /p/…, карточки, альбомы)
   Файл подключается на страницах-приёмниках и на самих материалах.
   ========================================================================== */

/* ---------- Языки ----------
   Каждый текст выводится сразу в трёх вариантах, показывается один.
   Язык берётся из <html lang>, который выставляет lang.js. */
.cms-l { display: none; }
html:not([lang="kz"]):not([lang="en"]) .cms-l.ru,
html[lang="kz"] .cms-l.kz,
html[lang="en"] .cms-l.en { display: contents; }

/* ---------- Страница материала ---------- */
.cms-article {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 20px 20px;
    color: var(--text-dark, #0b2340);
}

.cms-head { text-align: center; margin-bottom: 26px; }

.cms-kicker {
    display: inline-block;
    margin-bottom: 14px;
    padding: 7px 18px;
    border-radius: 999px;
    background: rgba(11, 99, 183, 0.09);
    border: 1px solid rgba(11, 99, 183, 0.22);
    color: var(--primary-color, #0b63b7);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.cms-title {
    color: var(--primary-color, #0b63b7);
    font-size: clamp(1.45rem, 3vw, 2.25rem);
    font-weight: 900;
    line-height: 1.2;
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}

.cms-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cms-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border-color, rgba(11, 99, 183, 0.12));
    color: var(--text-gray, #666666);
    font-size: 0.92rem;
    font-weight: 600;
}

.cms-status { font-weight: 800; letter-spacing: 0.02em; border-color: transparent; color: #ffffff; }
.cms-status.upcoming { background: linear-gradient(135deg, #0b63b7, #4facfe); }
.cms-status.live { background: linear-gradient(135deg, #e0412f, #ff8a5c); }
.cms-status.finished { background: linear-gradient(135deg, #5b6b7d, #8697a8); }

.cms-cover { margin: 0 0 28px; }
.cms-cover img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(11, 99, 183, 0.18);
}
/* вертикальная афиша: не растягиваем на всю ширину, а показываем по центру целиком */
.cms-cover.portrait img { width: auto; max-width: 100%; max-height: min(84vh, 880px); margin-inline: auto; }

.cms-body > * + * { margin-top: 24px; }

.cms-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 40px 0 20px;
}

/* ---------- Текст ---------- */
.cms-rt { font-size: 1.02rem; line-height: 1.8; color: var(--text-dark, #0b2340); overflow-wrap: anywhere; }
.cms-rt > :first-child { margin-top: 0; }
.cms-rt > :last-child { margin-bottom: 0; }
.cms-rt p { margin: 0 0 1em; }
.cms-rt h2 { color: var(--primary-color, #0b63b7); font-size: clamp(1.2rem, 2vw, 1.5rem); font-weight: 800; line-height: 1.3; margin: 1.4em 0 0.6em; }
.cms-rt h3 { color: var(--primary-color, #0b63b7); font-size: clamp(1.08rem, 1.7vw, 1.25rem); font-weight: 800; line-height: 1.3; margin: 1.2em 0 0.5em; }
.cms-rt ul, .cms-rt ol { margin: 0 0 1em; padding-left: 1.4em; }
.cms-rt li { margin: 0.3em 0; }
.cms-rt a { color: var(--primary-color, #0b63b7); text-decoration: underline; text-underline-offset: 2px; }
.cms-rt blockquote {
    margin: 1.2em 0;
    padding: 0.7em 1.1em;
    border-left: 4px solid var(--primary-color, #0b63b7);
    background: rgba(11, 99, 183, 0.05);
    border-radius: 0 12px 12px 0;
}
.cms-rt blockquote p:last-child { margin-bottom: 0; }
.cms-rt table { border-collapse: collapse; margin: 0 0 1em; max-width: 100%; display: block; overflow-x: auto; }
.cms-rt th, .cms-rt td { border: 1px solid rgba(11, 99, 183, 0.18); padding: 8px 12px; text-align: left; vertical-align: top; }
.cms-rt th { background: rgba(11, 99, 183, 0.07); font-weight: 700; }
.cms-rt hr { border: 0; border-top: 1px solid rgba(11, 99, 183, 0.18); margin: 1.4em 0; }
.cms-rt sub, .cms-rt sup { font-size: 0.75em; }

.cms-h { margin: 0; line-height: 1.25; font-weight: 800; color: var(--primary-color, #0b63b7); overflow-wrap: anywhere; }
h2.cms-h { font-size: clamp(1.3rem, 2.2vw, 1.7rem); margin-top: 18px; }
h3.cms-h { font-size: clamp(1.1rem, 1.8vw, 1.3rem); margin-top: 10px; }
/* заголовок открывает раздел: больше воздуха сверху, ближе к своему тексту снизу */
.cms-body > h2.cms-h { margin-top: 48px; }
.cms-body > h3.cms-h { margin-top: 36px; }
.cms-body > .cms-h + * { margin-top: 14px; }
.cms-body > .cms-h + .cms-h { margin-top: 12px; }
.cms-body > .cms-h:first-child { margin-top: 0; }
.cms-align-left { text-align: left; }
.cms-align-center { text-align: center; }
.cms-align-right { text-align: right; }

/* ---------- Изображение ---------- */
.cms-img { margin: 0; }
.cms-img img { display: block; width: 100%; height: auto; }
.cms-img a.cms-zoom { display: block; cursor: zoom-in; }
.cms-img.round img { border-radius: 14px; box-shadow: 0 12px 30px rgba(11, 99, 183, 0.15); }
.cms-img.s25 { width: 25%; } .cms-img.s33 { width: 33.333%; } .cms-img.s50 { width: 50%; }
.cms-img.s66 { width: 66.666%; } .cms-img.s75 { width: 75%; } .cms-img.s100 { width: 100%; }
.cms-img.a-left { margin-right: auto; } .cms-img.a-center { margin-inline: auto; } .cms-img.a-right { margin-left: auto; }
.cms-cap {
    margin-top: 9px;
    color: var(--text-gray, #666666);
    font-size: 0.86rem;
    line-height: 1.45;
    text-align: center;
}
@media (max-width: 640px) {
    .cms-img.s25 { width: 50%; }
    .cms-img.s33 { width: 62%; }
    .cms-img.s50, .cms-img.s66, .cms-img.s75 { width: 100%; }
}

/* ---------- Фотогалерея ---------- */
.cms-gallery a { display: block; position: relative; border-radius: 12px; overflow: hidden; cursor: zoom-in; background: #eaf1fa; }
.cms-gallery img { display: block; width: 100%; height: auto; transition: transform 0.35s ease; }
.cms-gallery a:hover img { transform: scale(1.04); }
.cms-gallery.masonry { column-count: var(--cols, 3); column-gap: 10px; }
.cms-gallery.masonry a { margin-bottom: 10px; break-inside: avoid; }
.cms-gallery.grid { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 10px; }
.cms-gallery.grid img { aspect-ratio: 4 / 3; object-fit: cover; height: 100%; }
.cms-gallery.slider {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.cms-gallery.slider::-webkit-scrollbar { display: none; }
.cms-gallery.slider a { flex: 0 0 min(88%, 560px); scroll-snap-align: center; }
.cms-slider-wrap { position: relative; }
.cms-slider-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, 0.92); color: var(--primary-color, #0b63b7);
    font-size: 26px; line-height: 1; cursor: pointer; z-index: 2;
    box-shadow: 0 6px 18px rgba(11, 35, 64, 0.25);
}
.cms-slider-btn.prev { left: 8px; } .cms-slider-btn.next { right: 8px; }
@media (max-width: 640px) {
    .cms-gallery.masonry, .cms-gallery.grid { --cols: 2 !important; }
}

/* ---------- Видео ---------- */
.cms-video { margin: 0; }
.cms-video-box { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 14px; overflow: hidden; box-shadow: 0 16px 40px rgba(11, 99, 183, 0.18); }
.cms-video-box iframe, .cms-video-box video, .cms-video-box .cms-yt { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cms-video-box video { object-fit: contain; background: #000; }
.cms-video-file video { display: block; width: 100%; height: auto; max-height: 82vh; background: #000; border-radius: 14px; box-shadow: 0 16px 40px rgba(11, 99, 183, 0.18); }
.cms-yt { padding: 0; border: 0; background: #000; cursor: pointer; display: block; }
.cms-yt img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.92; transition: opacity 0.25s; }
.cms-yt:hover img { opacity: 1; }
.cms-play {
    position: absolute; left: 50%; top: 50%; width: 74px; height: 52px; margin: -26px 0 0 -37px;
    border-radius: 14px; background: #e62117; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}
.cms-play::after { content: ""; position: absolute; left: 30px; top: 15px; border-style: solid; border-width: 11px 0 11px 19px; border-color: transparent transparent transparent #ffffff; }

/* ---------- Документы ---------- */
.cms-files { display: grid; gap: 14px; }
.cms-file-wrap > * + * { margin-top: 12px; }
.cms-file {
    display: flex; align-items: center; gap: 16px; padding: 16px 18px;
    background: #ffffff; border: 1px solid var(--border-color, rgba(11, 99, 183, 0.12));
    border-radius: 16px; box-shadow: var(--shadow, 0 8px 32px rgba(11, 99, 183, 0.12));
}
.cms-file-ic {
    flex: none; width: 54px; height: 62px; border-radius: 10px; display: grid; place-items: center;
    background: var(--gradient-1, linear-gradient(135deg, #0b63b7, #2b78b9)); color: #ffffff;
    font-weight: 800; font-size: 0.82rem; letter-spacing: 0.03em;
}
/* белая подпись на иконке должна читаться: оба конца градиента тёмные (контраст от 4.5:1) */
.cms-file-ic.pdf { background: linear-gradient(135deg, #b52a31, #d9363e); }
.cms-file-ic.doc, .cms-file-ic.docx { background: linear-gradient(135deg, #1d5a9e, #2b6cb0); }
.cms-file-ic.xls, .cms-file-ic.xlsx, .cms-file-ic.csv { background: linear-gradient(135deg, #146336, #187a42); }
.cms-file-ic.ppt, .cms-file-ic.pptx { background: linear-gradient(135deg, #8f3f12, #a84d1a); }
.cms-file-ic.zip, .cms-file-ic.rar { background: linear-gradient(135deg, #44546a, #5b6b7d); }
.cms-file-main { flex: 1; min-width: 0; }
.cms-file-title { font-weight: 700; font-size: 1.04rem; line-height: 1.35; overflow-wrap: anywhere; }
.cms-file-meta { margin-top: 3px; color: var(--text-gray, #666666); font-size: 0.82rem; }
.cms-file .btn { flex: none; margin: 0; white-space: nowrap; }
.cms-pdf { display: block; width: 100%; height: min(82vh, 900px); border: 1px solid var(--border-color, rgba(11, 99, 183, 0.18)); border-radius: 14px; background: #f3f6fa; }
@media (max-width: 560px) {
    .cms-file { flex-wrap: wrap; }
    .cms-file .btn { width: 100%; text-align: center; }
}

/* ---------- Цитата и выноска ---------- */
.cms-quote { margin: 0; padding: 22px 26px 22px 30px; position: relative; border-left: 5px solid var(--primary-color, #0b63b7); background: rgba(11, 99, 183, 0.05); border-radius: 0 16px 16px 0; }
.cms-quote p { margin: 0; font-size: clamp(1.1rem, 2vw, 1.3rem); line-height: 1.6; font-style: italic; color: var(--text-dark, #0b2340); }
.cms-quote cite { display: block; margin-top: 10px; font-style: normal; font-weight: 700; color: var(--primary-color, #0b63b7); font-size: 0.95rem; }

.cms-callout { padding: 22px 26px; border-radius: 16px; text-align: center; }
.cms-callout .cms-rt { color: inherit; }
.cms-callout .cms-rt a { color: inherit; }
.cms-callout .cms-rt h2, .cms-callout .cms-rt h3 { color: inherit; margin-top: 0; }
.cms-callout.blue { background: var(--gradient-1, linear-gradient(135deg, #0b63b7, #2b78b9)); color: #ffffff; }
.cms-callout.gold { background: linear-gradient(135deg, #d4af37 0%, #c19b2e 100%); color: #20180a; }
.cms-callout.light { background: rgba(11, 99, 183, 0.07); border: 1px solid rgba(11, 99, 183, 0.18); color: var(--text-dark, #0b2340); text-align: left; }
.cms-callout.dark { background: linear-gradient(135deg, #0b2340, #17406e); color: #ffffff; }
.cms-callout.left { text-align: left; }

/* ---------- Кнопки ---------- */
.cms-buttons { display: flex; gap: 14px; flex-wrap: wrap; }
.cms-buttons.center { justify-content: center; }
.cms-buttons.right { justify-content: flex-end; }
@media (max-width: 560px) { .cms-buttons .btn { width: 100%; text-align: center; } }

/* ---------- Таблица ---------- */
.cms-table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border-color, rgba(11, 99, 183, 0.15)); background: #ffffff; box-shadow: var(--shadow, 0 8px 32px rgba(11, 99, 183, 0.12)); }
.cms-table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.cms-table th, .cms-table td { padding: 11px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(11, 99, 183, 0.1); }
.cms-table thead th { background: var(--gradient-1, linear-gradient(135deg, #0b63b7, #2b78b9)); color: #ffffff; font-weight: 700; white-space: nowrap; border-bottom: 0; }
.cms-table tbody tr:nth-child(even) { background: rgba(11, 99, 183, 0.035); }
.cms-table tbody tr:last-child td { border-bottom: 0; }
.cms-table.medals tbody tr:nth-child(1) td { background: rgba(212, 175, 55, 0.18); font-weight: 700; }
.cms-table.medals tbody tr:nth-child(2) td { background: rgba(160, 170, 182, 0.22); font-weight: 700; }
.cms-table.medals tbody tr:nth-child(3) td { background: rgba(196, 128, 74, 0.18); font-weight: 700; }

/* ---------- Разделитель ---------- */
.cms-hr { border: 0; border-top: 1px solid rgba(11, 99, 183, 0.2); margin: 0; }
.cms-spacer.s { height: 12px; } .cms-spacer.m { height: 32px; } .cms-spacer.l { height: 64px; }

/* ---------- Картинка + текст ---------- */
.cms-split { display: flex; gap: 26px; align-items: flex-start; }
.cms-split.right { flex-direction: row-reverse; }
.cms-split-media { flex: 0 0 var(--w, 40%); margin: 0; }
.cms-split-media img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 12px 30px rgba(11, 99, 183, 0.15); }
.cms-split-text { flex: 1; min-width: 0; }
@media (max-width: 700px) {
    .cms-split, .cms-split.right { flex-direction: column; }
    .cms-split-media { flex-basis: auto; width: 100%; }
}

/* ---------- Свой HTML ---------- */
.cms-html { overflow: hidden; }
.cms-html iframe { max-width: 100%; border: 0; }
.cms-html img { max-width: 100%; height: auto; }

/* ---------- Карточки в лентах ---------- */
.cms-card .cms-badge {
    display: inline-block; margin-left: 8px; padding: 4px 11px; line-height: 1.2; border-radius: 999px;
    background: rgba(11, 99, 183, 0.1); color: var(--primary-color, #0b63b7);
    font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px;
}
.cms-card .cms-badge.live { background: #e0412f; color: #ffffff; }
.cms-card .cms-badge.finished { background: rgba(91, 107, 125, 0.14); color: #5b6b7d; }
.cms-card-ph {
    width: 100%; height: 220px; display: grid; place-items: center;
    background: linear-gradient(135deg, #0b63b7 0%, #4facfe 100%);
}
.cms-card-ph img { width: 96px !important; height: auto !important; object-fit: contain !important; opacity: 0.95; }
.cms-doc-ph {
    height: 200px; border-radius: 15px; margin-bottom: 20px; display: grid; place-items: center;
    background: var(--gradient-1, linear-gradient(135deg, #0b63b7, #2b78b9)); color: #ffffff;
    font-size: 2.4rem; font-weight: 900; letter-spacing: 0.05em;
}
.cms-doc-ph.pdf { background: linear-gradient(135deg, #d9363e, #f0707a); }
.cms-doc-ph.doc, .cms-doc-ph.docx { background: linear-gradient(135deg, #2b6cb0, #4f94dd); }
.cms-doc-ph.xls, .cms-doc-ph.xlsx { background: linear-gradient(135deg, #1f8a4c, #43b374); }
.cms-doc-ph.ppt, .cms-doc-ph.pptx { background: linear-gradient(135deg, #d9692f, #f19a62); }
.cms-card:target, .cms-album:target { outline: 3px solid rgba(11, 99, 183, 0.45); outline-offset: 4px; }

/* ---------- Альбом на странице «Медиа» ---------- */
.cms-album {
    scroll-margin-top: 110px; margin-bottom: 30px; background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color, rgba(11, 99, 183, 0.1)); border-radius: 22px; padding: 24px;
    box-shadow: var(--shadow, 0 8px 32px rgba(11, 99, 183, 0.12));
}
.cms-album h3 { margin: 0 0 6px; color: var(--primary-color, #0b63b7); font-size: clamp(1.4rem, 2vw, 1.9rem); font-weight: 800; }
.cms-album-note { margin: 0 0 18px; color: var(--text-gray, #666666); font-size: 0.95rem; }
.cms-album .cms-rt { margin: 0 0 18px; font-size: 0.98rem; line-height: 1.7; }
.cms-album-grid { column-width: 200px; column-gap: 12px; }
.cms-album-grid a { display: block; margin-bottom: 12px; break-inside: avoid; border-radius: 12px; overflow: hidden; cursor: zoom-in; background: #eaf1fa; }
.cms-album-grid img { display: block; width: 100%; height: auto; transition: transform 0.35s ease; }
.cms-album-grid a:hover img { transform: scale(1.04); }
.cms-album-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 520px)); gap: 14px; margin-top: 16px; }
.cms-album-videos .cms-video-box { box-shadow: none; }
.cms-album-links { margin-top: 18px; text-align: center; }

/* ---------- Просмотр фото на весь экран ---------- */
.cms-lightbox {
    position: fixed; inset: 0; z-index: 100000; display: none; align-items: center; justify-content: center;
    background: rgba(6, 18, 34, 0.94); -webkit-tap-highlight-color: transparent;
}
.cms-lightbox.open { display: flex; }
.cms-lb-img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
.cms-lb-btn {
    position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255, 255, 255, 0.14); color: #ffffff; font-size: 30px; line-height: 1;
}
.cms-lb-btn:hover { background: rgba(255, 255, 255, 0.28); }
.cms-lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.cms-lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.cms-lb-close { right: 14px; top: 14px; font-size: 28px; }
.cms-lb-info { position: absolute; left: 0; right: 0; bottom: 14px; padding: 0 70px; text-align: center; color: #ffffff; font-size: 0.95rem; line-height: 1.4; }
.cms-lb-count { display: block; margin-top: 4px; opacity: 0.7; font-size: 0.8rem; }
@media (max-width: 640px) {
    .cms-lb-btn { width: 40px; height: 40px; font-size: 24px; }
    .cms-lb-prev { left: 6px; } .cms-lb-next { right: 6px; }
    .cms-lb-info { padding: 0 54px; font-size: 0.85rem; }
}
