/* ============================================================
   Ульпан Политика — тема по Figma «Ulpan Politika»
   Палитра снята с макета:
     акцент       #3855cf
     футер        #4c5be7
     фон страницы #f5f6ff
     текст        #000
     даты/серое   #8a8a8a
   Шрифт: Arial/Helvetica, заголовки — 800 caps.
   ============================================================ */

:root {
    --up-accent: #3855cf;
    --up-accent-dark: #2b43ad;
    --up-indigo: #4c5be7;
    --up-bg: #f5f6ff;
    --up-surface: #eef0fe;
    --up-card: #ffffff;
    --up-ink: #000000;
    --up-gray: #8a8a8a;
    --up-line: rgba(23, 23, 60, 0.14);
    --up-radius: 24px;
    --up-radius-sm: 16px;
    --up-shadow-card: 0 10px 34px rgba(45, 55, 130, 0.08);
    --up-shadow-deck: 14px 18px 40px rgba(40, 45, 100, 0.18);
    --up-container: 1296px;
    --up-pad: 24px;
    --up-font: var(--gh-font-body, Arial, "Helvetica Neue", Helvetica, sans-serif);
}

/* ---------- Базовое ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--up-font);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.5;
    color: var(--up-ink);
    background: var(--up-bg);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--up-accent); text-decoration: none; }

button {
    font-family: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: inherit;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--gh-font-heading, var(--up-font));
}
p { margin: 0; }

.up-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.up-container {
    max-width: calc(var(--up-container) + var(--up-pad) * 2);
    margin: 0 auto;
    padding-inline: var(--up-pad);
}

/* Растянутая ссылка поверх карточки; интерактив выше неё — z-index: 2 */
.up-card-cover {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

/* ---------- Шапка ---------- */

.up-header {
    padding-top: 34px;
    position: relative;
    /* view-transition-name делает шапку stacking context'ом —
       без своего z-index открытое меню оказывается под контентом */
    z-index: 60;
}

.up-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.up-logo {
    font-size: 38px;
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--up-accent);
    max-width: 340px;
}

.up-logo img { height: 96px; width: auto; display: block; }

.up-header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-top: 10px;
}

.up-icon-btn {
    color: var(--up-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: background 0.15s ease;
}

.up-icon-btn:hover { background: rgba(56, 85, 207, 0.08); }

.up-icon-btn svg { width: 24px; height: 24px; }

.up-icon-btn.is-copied { color: var(--up-accent-dark); }

.up-copylink { position: relative; }

.up-copylink-status {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    padding: 2px 7px;
    border-radius: 6px;
    color: #fff;
    background: var(--up-accent-dark);
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.up-copylink.is-copied .up-copylink-status {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .up-copylink-status { transition: none; }
}

/* бургер: вторая иконка (крест) скрыта, пока меню закрыто */
.up-burger svg:last-child { display: none; }
body.up-menu-open .up-burger svg:first-child { display: none; }
body.up-menu-open .up-burger svg:last-child { display: block; }

.up-nav {
    margin-top: 26px;
    padding-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
.up-nav::-webkit-scrollbar { display: none; }

.up-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-width: max-content;
}

.up-nav a,
.up-menu a {
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--up-accent);
    white-space: nowrap;
}

.up-nav a:hover { color: var(--up-accent-dark); }

/* Active item uses color only; equal item widths prevent menu shifts during navigation. */
.up-nav .nav-current a {
    color: var(--up-accent-dark);
}

/* полноэкранное меню за бургером */
.up-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 40;
    background: var(--up-card);
    border-block: 1px solid var(--up-line);
    box-shadow: 0 24px 48px rgba(45, 55, 130, 0.12);
}

.up-menu ul {
    list-style: none;
    margin: 0;
    padding: 28px 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.up-menu a { font-size: 17px; }

.up-menu-secondary { border-top: 1px solid var(--up-line); }
.up-menu-secondary ul { padding-top: 20px; }
.up-menu-secondary a { color: var(--up-gray); }

/* ---------- Теги-буллеты ---------- */

.up-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    position: relative;
    z-index: 2;
}

.up-tag {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--up-accent);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.up-tag::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex: none;
}

.up-tag:hover { color: var(--up-accent-dark); }

/* ---------- Секции ---------- */

.up-main { padding-bottom: 72px; }

.up-section { margin-top: 40px; }

.up-section.is-first { margin-top: 48px; }

.up-split .up-container::before,
.up-news .up-container::before,
.up-cardsblock .up-container::before,
.up-gallerysec .up-container::before {
    content: "";
    display: block;
    height: 1px;
    background: var(--up-line);
    margin-bottom: 40px;
}

.up-section-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.up-section-head h2 {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-rule { flex: 1; height: 1px; background: var(--up-line); }

.up-taghead-desc {
    max-width: 640px;
    margin: -8px 0 24px;
    color: var(--up-ink);
    font-size: 16px;
}

/* ---------- Hero ---------- */

.up-hero { margin-top: 34px; }

.up-hero .up-container { position: relative; }

.up-hero-media img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    border-radius: var(--up-radius);
}

.up-hero-card {
    position: relative;
    background: var(--up-card);
    border-radius: var(--up-radius);
    box-shadow: var(--up-shadow-card);
    width: min(1120px, 96%);
    margin: 0 auto;
    padding: 44px 56px 48px;
    text-align: center;
}

.up-hero-media + .up-hero-card { margin-top: -170px; }

.up-hero-card .up-tags { justify-content: center; }

.up-hero-card .up-tag:first-child::before { display: none; }

.up-hero-title {
    margin-top: 18px;
    font-size: 38px;
    line-height: 1.14;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-hero-excerpt {
    margin: 18px auto 0;
    max-width: 620px;
    font-size: 18px;
    line-height: 1.5;
}

/* ---------- Лента: сплит ---------- */

.up-split-grid {
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 24px;
    align-items: stretch;
}

.up-split-grid.is-solo {
    grid-template-columns: 1fr;
    justify-items: center;
}

.up-split-grid.is-solo > .up-card {
    width: 100%;
    max-width: 640px;
}

/* правая фотокарточка тянется на высоту левой колонки */
.up-split-grid > .up-card { height: 100%; }

.up-split-grid .up-card-img {
    position: relative;
    flex: 1;
    min-height: 300px;
    overflow: hidden;
}

.up-split-grid .up-card-img img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.up-split-grid .up-card-body { flex: none; }

.up-split-list {
    background: var(--up-surface);
    border-radius: var(--up-radius);
    padding: 12px 44px;
}

.up-feeditem {
    position: relative;
    padding: 30px 0;
}

.up-feeditem + .up-feeditem { border-top: 1px solid var(--up-line); }

.up-feeditem-title {
    margin-top: 12px;
    font-size: 26px;
    line-height: 1.18;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-feeditem-excerpt {
    margin-top: 10px;
    font-size: 18px;
    line-height: 1.45;
    max-width: 560px;
}

/* ---------- Карточка ленты ---------- */

.up-card {
    position: relative;
    background: var(--up-card);
    border-radius: var(--up-radius);
    overflow: hidden;
    box-shadow: var(--up-shadow-card);
    display: flex;
    flex-direction: column;
}

.up-card-img img {
    width: 100%;
    height: 320px;
    object-fit: cover;
}

.up-card-body {
    padding: 26px 30px 30px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.up-card-title {
    margin-top: 12px;
    font-size: 25px;
    line-height: 1.18;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-card-excerpt {
    margin-top: 10px;
    font-size: 17px;
    line-height: 1.45;
}

.up-card-deck-badge {
    position: absolute;
    top: 28px;
    right: 30px;
    z-index: 2;
    display: inline-flex;
    color: var(--up-accent);
    pointer-events: none;
}

.up-card-deck-badge svg { width: 24px; height: 24px; }

.up-card.has-deck-badge .up-tags { padding-right: 38px; }

/* ---------- Новости ---------- */

.up-news-grid {
    background: var(--up-surface);
    border-radius: var(--up-radius);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.up-news-item {
    position: relative;
    padding: 34px 36px 30px;
    display: flex;
    flex-direction: column;
}

.up-news-item + .up-news-item { border-left: 1px solid var(--up-line); }

.up-news-title {
    margin-top: 14px;
    font-size: 19px;
    line-height: 1.25;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
    display: inline;
}

.up-news-excerpt {
    font-size: 18px;
    line-height: 1.35;
    margin-top: 2px;
}

.up-news-date {
    margin-top: 34px;
    font-size: 15px;
    color: var(--up-gray);
}

/* ---------- Блок «Карточки» ---------- */

.up-cardsblock-card {
    background: var(--up-card);
    border-radius: var(--up-radius);
    padding: 56px 64px;
    display: grid;
    grid-template-columns: minmax(320px, 460px) 1fr;
    gap: 48px;
    align-items: center;
}

.up-block-title {
    margin-top: 16px;
    font-size: 38px;
    line-height: 1.1;
    font-weight: 700;
    text-transform: uppercase;
}

.up-block-title a { color: var(--up-accent); }

.up-block-excerpt {
    margin-top: 18px;
    font-size: 15px;
    line-height: 1.55;
    max-width: 420px;
}

/* ---------- Колода карточек ---------- */

.up-deck {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 36px;
    outline: none;
}

.up-deck-arrow {
    color: var(--up-accent);
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s ease, opacity 0.15s ease;
    flex: none;
    position: relative;
    z-index: 2;
    transform: translateY(-18px);
}

.up-deck-arrow:hover { background: rgba(56, 85, 207, 0.08); }

.up-deck-arrow:disabled { opacity: 0.25; cursor: default; }

.up-deck-stage {
    position: relative;
    padding-bottom: 36px;
}

.up-deck-card {
    position: relative;
    width: 320px;
    height: 420px;
    background: var(--up-card);
    border-radius: 20px;
    box-shadow: var(--up-shadow-deck);
    border: 1px solid rgba(23, 23, 60, 0.06);
    padding: 30px 28px;
    overflow: hidden;
}

.up-deck.is-preview .up-deck-card { cursor: pointer; }

.up-deck-slide {
    height: 100%;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.5;
}

.up-deck-slide h2, .up-deck-slide h3 {
    font-size: 17px;
    line-height: 1.3;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
    margin: 0 0 12px;
}

.up-deck-slide p { margin: 0 0 12px; }
.up-deck-slide ul, .up-deck-slide ol { margin: 0 0 12px; padding-left: 20px; }
.up-deck-slide img { border-radius: 10px; margin: 0 0 12px; }

.up-deck-counter {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--up-accent);
    pointer-events: none;
}

.up-deck-noscript { margin-top: 24px; }

/* Колода из картинок: слайд — портретное изображение */
.up-deck.is-images .up-deck-card {
    width: 430px;
    height: auto;
    aspect-ratio: 4 / 5;
    padding: 0;
}

.up-deck.is-images .up-deck-slide {
    height: 100%;
    overflow: hidden;
}

.up-deck.is-images .up-deck-slide > div { height: 100%; }

.up-deck.is-images .up-deck-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

/* ---------- Фотогрид ---------- */

.up-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-flow: dense;
    gap: 24px;
}

/* Мозаика листингов: фотокарточки занимают две строки (grid-row: span 2, dense flow), квадрат задан на обёртке .up-card-img, потому что после lazy loading браузеры игнорируют aspect-ratio у img с height: auto; текстовые карточки — одну */

.up-grid-3 > .up-card:has(.up-card-img) { grid-row: span 2; }

.up-grid-3 .up-card-img {
    flex: none;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.up-grid-3 .up-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.up-grid-3 .up-card-excerpt {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}


.up-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

/* related-колоды: крупные заголовки как в макете Card_09 */
.up-grid-2 .up-card-title { font-size: 36px; line-height: 1.12; }

/* ---------- Галерея / фоторепортаж ---------- */

.up-gallery-card {
    background: var(--up-card);
    border-radius: var(--up-radius);
    padding: 48px 52px;
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 44px;
    align-items: center;
}

.up-gallery-card .up-block-title { font-size: 28px; }

.up-gallery-media {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

.up-gallery-media img {
    width: 100%;
    height: 420px;
    object-fit: cover;
}

.up-gal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.up-gal-arrow.is-prev { left: 12px; }
.up-gal-arrow.is-next { right: 12px; }

/* ---------- Футер ---------- */

.up-footer {
    background: var(--up-indigo);
    padding: 34px 0;
}

.up-footer-copy {
    text-align: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.up-footer-nav ul {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 28px;
}

.up-footer-nav a {
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ---------- Пост-колода ---------- */

.up-cards-post { padding-top: 8px; }

.up-cards-shell {
    background: var(--up-card);
    border-radius: var(--up-radius);
    padding: 30px 40px 64px;
    box-shadow: var(--up-shadow-card);
}

.up-cards-topbar {
    display: grid;
    grid-template-columns: 1fr minmax(0, auto) 1fr;
    align-items: center;
    margin-bottom: 36px;
}

.up-cards-actions { display: flex; gap: 10px; }

.up-cards-topbar-tags { grid-column: 2; }

.up-cards-topbar-tags .up-tags { justify-content: center; }

.up-cards-topbar > .up-copylink {
    grid-column: 3;
    justify-self: end;
}

.up-cards-hero {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 44px;
}

.up-cards-hero .up-tags { justify-content: center; }

.up-cards-title {
    margin-top: 16px;
    font-size: 38px;
    line-height: 1.12;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-cards-excerpt {
    margin: 16px auto 0;
    max-width: 640px;
    font-size: 16px;
    line-height: 1.55;
    color: var(--up-ink);
}

.up-cards-post .up-deck-card {
    width: 500px;
    height: 600px;
    padding: 40px 44px 64px;
}

.up-cards-post .up-deck-slide { font-size: 17px; line-height: 1.55; }

.up-cards-post .up-deck-slide h2,
.up-cards-post .up-deck-slide h3 { font-size: 22px; margin-bottom: 16px; }

/* ---------- Статья ---------- */

.up-article { padding-top: 8px; }

.up-article .up-container { max-width: 936px; }

.up-article-post .up-container { max-width: 1308px; }

.up-article-post .up-article-hero {
    width: 100vw;
    height: 550px;
    max-width: none;
    margin: 0 calc(50% - 50vw);
}

.up-article-post .up-article-hero img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
}

.up-article-paper {
    position: relative;
    background: var(--up-card);
    border-radius: 40px 40px var(--up-radius) var(--up-radius);
    box-shadow: var(--up-shadow-card);
}

.up-article-paper.has-hero { margin-top: -70px; }

.up-article-header {
    position: relative;
    background: var(--up-card);
    border-radius: var(--up-radius);
    box-shadow: var(--up-shadow-card);
    padding: 44px 56px;
    text-align: center;
}

.up-article-paper .up-article-header {
    background: none;
    border-radius: 0;
    box-shadow: none;
    padding: 48px 96px 34px;
}

.up-article-toolbar {
    display: grid;
    grid-template-columns: 1fr minmax(0, auto) 1fr;
    align-items: center;
}

.up-article-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 6px;
}

.up-article-paper .up-article-actions {
    position: static;
    display: flex;
    gap: 6px;
    justify-self: start;
}

.up-article-toolbar > .up-tags {
    grid-column: 2;
    justify-content: center;
}

.up-article-toolbar > .up-copylink {
    grid-column: 3;
    justify-self: end;
}

.up-article-header .up-tags { justify-content: center; }

.up-article-title {
    margin-top: 16px;
    font-size: 36px;
    line-height: 1.14;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-article-post .up-article-title {
    max-width: 1040px;
    margin-inline: auto;
    font-size: 38px;
}

.up-article-excerpt {
    margin: 16px auto 0;
    max-width: 620px;
    font-size: 16px;
    line-height: 1.55;
}

.up-article-post .up-article-excerpt {
    max-width: 820px;
    font-size: 18px;
    color: var(--up-gray);
}

.up-article-date {
    display: block;
    margin-top: 20px;
    font-size: 14px;
    color: var(--up-gray);
}

.up-article-image { margin: 24px 0 0; }

.up-article-image img {
    width: 100%;
    max-height: 560px;
    object-fit: cover;
    border-radius: var(--up-radius);
}

.up-article-image figcaption {
    margin-top: 10px;
    text-align: center;
    font-size: 13px;
    color: var(--up-gray);
}

.up-article-content {
    width: min(960px, calc(100% - 48px));
    margin-inline: auto;
}

.up-article-caption {
    padding-top: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--up-gray);
    text-align: left;
}

.up-article-paper .up-prose {
    background: none;
    border-radius: 0;
    padding: 18px 0 48px;
    margin-top: 0;
}

.up-article-actions-bottom {
    width: min(960px, calc(100% - 48px));
    margin: 0 auto;
    padding: 0 0 34px;
}

.up-article-actions-bottom .up-copylink { margin-left: auto; }

/* Контентная типографика */

.up-prose {
    background: var(--up-card);
    border-radius: var(--up-radius);
    padding: 48px 96px;
    margin-top: 24px;
    font-size: 17px;
    line-height: 1.65;
}

.up-prose > * + * { margin-top: 20px; }

.up-prose h2 {
    margin-top: 40px;
    font-size: 20px;
    line-height: 1.3;
    font-weight: 700;
    text-transform: none;
    color: var(--up-ink);
}

.up-prose h3 {
    margin-top: 32px;
    font-size: 18px;
    font-weight: 700;
    color: var(--up-ink);
}

.up-prose a { text-decoration: none; text-underline-offset: 2px; }

.up-prose a:hover { text-decoration: underline; }

.up-prose img { border-radius: var(--up-radius-sm); }

.up-prose figure { margin: 32px 0; }

.up-prose figcaption {
    margin-top: 10px;
    font-size: 13px;
    color: var(--up-gray);
    text-align: center;
}

.up-prose blockquote {
    margin: 28px 0;
    padding-left: 22px;
    border-left: 3px solid var(--up-accent);
    font-size: 19px;
    line-height: 1.5;
}

.up-prose hr {
    border: 0;
    height: 1px;
    background: var(--up-line);
    margin: 40px 0;
}

.up-prose ul, .up-prose ol { padding-left: 24px; }
.up-prose li + li { margin-top: 8px; }

.up-prose .kg-width-wide { margin-inline: -48px; }
.up-prose .kg-width-full { margin-inline: -96px; }

/* ---------- Страница тега ---------- */

.up-tag-page { padding-top: 34px; }

.up-taghero-media {
    overflow: hidden;
    border-radius: var(--up-radius);
    background: #e7eafb;
}

.up-taghero-media img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.up-taghead {
    position: relative;
    z-index: 1;
    background: var(--up-card);
    border-radius: 40px 40px 0 0;
    padding: 30px 36px 34px;
    margin-bottom: 24px;
}

.up-taghead.has-hero {
    width: calc(100% - 32px);
    margin: -76px auto 24px;
}

.up-taghead-title {
    font-size: 22px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--up-accent);
}

.up-taghead-count {
    margin-top: 4px;
    font-size: 15px;
    color: var(--up-gray);
}

.up-taghead .up-taghead-desc {
    margin: 16px 0 0;
}

/* .up-tag-grid: карточки в ряду выравниваются по самой высокой (стандартный stretch) */

/* ---------- Загрузка изображений: скелетон + плавное проявление ---------- */

/* Контейнеры фото имеют фиксированную высоту или aspect-ratio, поэтому
   текст не прыгает; пока картинка грузится — мягкий шиммер. */
.up-hero-media,
.up-card-img,
.up-gallery-media,
.up-article-image,
.up-deck.is-images .up-deck-card {
    background: linear-gradient(100deg, #e7eafb 40%, #f4f5ff 50%, #e7eafb 60%);
    background-size: 200% 100%;
    animation: up-shimmer 1.5s ease-in-out infinite;
}

@keyframes up-shimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}

.up-hero-media.is-done,
.up-card-img.is-done,
.up-gallery-media.is-done,
.up-article-image.is-done,
.up-deck.is-images .up-deck-card.is-done {
    animation: none;
    background: #e7eafb;
}

/* Фейд только у реально грузящихся картинок: класс ставит JS до первой
   отрисовки, закэшированные фото не трогаются — ничего не «моргает». */
.up-hero-media img,
.up-card-img img,
.up-gallery-media img,
.up-article-image img,
.up-deck.is-images .up-deck-slide img {
    transition: opacity 0.35s ease;
}

img.up-img-loading { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
    .up-hero-media, .up-card-img, .up-gallery-media, .up-article-image,
    .up-deck.is-images .up-deck-card { animation: none; }
    .up-hero-media img, .up-card-img img, .up-gallery-media img,
    .up-article-image img, .up-deck.is-images .up-deck-slide img { transition: none; }
}

/* ---------- Плавные переходы между страницами (View Transitions) ---------- */

@view-transition {
    navigation: auto;
}

/* шапка не участвует в кроссфейде — визуально остаётся на месте */
.up-header { view-transition-name: up-header; }

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.22s;
}

::view-transition-old(up-header),
::view-transition-new(up-header) {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
}

/* ---------- Пагинация ---------- */

.pagination {
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.pagination .newer-posts { grid-column: 1; justify-self: start; }
.pagination .page-number { grid-column: 2; }
.pagination .older-posts { grid-column: 3; justify-self: end; }

.pagination a,
.pagination .page-number {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--up-accent);
}

.pagination .page-number { color: var(--up-gray); }

/* ---------- Лайтбокс ---------- */

.up-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    z-index: 120;
    background: #0b0d26;
    touch-action: none;
}

/* мобильные адресные строки: динамическая высота вьюпорта — всегда до низа */
@supports (height: 100dvh) {
    .up-lightbox { height: 100dvh; }
}

.up-lightbox[hidden] { display: none; }

/* скролл-лок, работающий и на iOS */
body.up-lb-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

.up-lb-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.up-lb-img {
    max-width: 94vw;
    max-height: 90vh;
    border-radius: 8px;
    transform-origin: center;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
}

.up-lb-close,
.up-lb-arrow {
    position: fixed;
    z-index: 2;
    color: #fff;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(8, 10, 30, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(4px);
}

.up-lb-close {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
}

.up-lb-arrow { top: 50%; transform: translateY(-50%); }
.up-lb-arrow.is-prev { left: max(10px, env(safe-area-inset-left)); }
.up-lb-arrow.is-next { right: max(10px, env(safe-area-inset-right)); }
.up-lb-arrow:disabled { opacity: 0.25; cursor: default; }

.up-lb-counter {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    background: rgba(8, 10, 30, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    padding: 5px 14px;
}

@media (max-width: 760px) {
    .up-lb-img { max-height: 82vh; }
}

/* тап по карточке открывает просмотр */
.up-deck.is-images:not(.is-preview) .up-deck-slide { cursor: zoom-in; }

/* ---------- Печать ---------- */

@media print {
    body { background: #fff; }

    .up-header,
    .up-footer,
    .up-menu,
    .up-cards-actions,
    .up-article-actions,
    .up-related-cards,
    .up-news,
    .up-readmore,
    .pagination { display: none !important; }

    .up-cards-shell,
    .up-article-paper,
    .up-article-header,
    .up-prose {
        box-shadow: none;
        border-radius: 0;
    }

    /* Колода: печатаются ВСЕ карточки подряд, интерактив скрыт.
       Важно: скрываем карточку-вьюпорт, а не stage — источник лежит внутри stage. */
    .up-deck-card,
    .up-deck-arrow,
    .up-deck-counter { display: none !important; }

    .up-deck.is-images .up-deck-card { display: none !important; }
    .up-deck-stage { background: none; animation: none; }

    .up-deck .up-deck-source,
    .up-deck .up-deck-source[hidden] {
        display: block !important;
    }

    .up-deck-source figure,
    .up-deck-source .kg-card {
        margin: 0 0 16px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .up-deck-source img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 560px !important;
        max-height: 940px !important;
        margin: 0 auto 16px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .up-deck-source p { break-inside: avoid; }
}

/* ---------- Поиск ---------- */

.up-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(96px, 16vh, 180px) 24px 32px;
    background: rgba(19, 23, 55, 0.18);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.up-search-overlay[hidden] { display: none; }

.up-search-stack {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-height: 100%;
}

.up-search-panel {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    width: min(780px, 100%);
    min-height: 0;
    max-height: 100%;
    padding: 34px 48px 30px;
    border-radius: var(--up-radius);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 18px 42px rgba(25, 31, 82, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Широкий лист служит декоративной подложкой позади панели */
.up-search-drop {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.up-search-drop[hidden] { display: none; }

/* колонка контента листа выровнена по левому краю пилюли-инпута */
.up-search-tags,
.up-search-results {
    width: 100%;
}

.up-search-tags {
    flex: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 18px 0 2px;
}

.up-search-tags[hidden] { display: none; }

.up-search-tag {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border: 1px solid rgba(56, 85, 207, 0.4);
    border-radius: 999px;
    color: var(--up-accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.up-search-tag:hover,
.up-search-tag:focus-visible {
    background: rgba(56, 85, 207, 0.08);
    color: var(--up-accent-dark);
}

.up-search-close {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--up-accent);
}

.up-search-close:hover,
.up-search-close:focus-visible { background: rgba(56, 85, 207, 0.08); }

.up-search-close svg { width: 22px; height: 22px; }

.up-search-title {
    flex: none;
    margin-bottom: 24px;
    color: var(--up-accent);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
}

.up-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: none;
    min-height: 56px;
    padding: 0 22px;
    border: 1px solid #5b6ef0;
    border-radius: 999px;
    background: #fff;
    color: var(--up-accent);
}

.up-search-input-wrap:focus-within { box-shadow: 0 0 0 3px rgba(56, 85, 207, 0.14); }

.up-search-input-wrap svg { width: 24px; height: 24px; flex: none; }

.up-search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    padding: 0;
    background: transparent;
    color: var(--up-ink);
    font: inherit;
    font-size: 15px;
    font-weight: 700;
}

.up-search-input::placeholder {
    color: #676767;
    opacity: 1;
    font-weight: 400;
    letter-spacing: normal;
    text-transform: none;
}

.up-search-input::-webkit-search-cancel-button { cursor: pointer; }

.up-search-results {
    min-height: 0;
    margin-top: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.up-search-results:empty { display: none; }

.up-search-result {
    display: block;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--up-ink);
}

.up-search-result:hover,
.up-search-result:focus-visible,
.up-search-result.is-active {
    outline: none;
    background: rgba(56, 85, 207, 0.08);
    color: var(--up-ink);
}

.up-search-result-title,
.up-search-result-excerpt { display: block; }

.up-search-result-title {
    font-size: 17px;
    line-height: 1.35;
}

.up-search-result-excerpt {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    color: var(--up-gray);
    font-size: 15px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.up-search-result b { font-weight: 700; }

.up-search-status {
    padding: 18px 12px 8px;
    color: var(--up-gray);
    font-size: 15px;
    text-align: center;
}

.up-search-all {
    flex: none;
    align-self: center;
    margin-top: 12px;
    color: var(--up-accent);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-align: center;
    text-transform: uppercase;
}

.up-search-all:hover,
.up-search-all:focus-visible { color: var(--up-accent-dark); }

.up-search-page-status {
    padding: 48px 24px;
    color: #626262;
    font-size: 17px;
    text-align: center;
}

.up-search-page-status[hidden] { display: none; }

[data-search-grid]:empty { display: none; }

[data-search-grid] b { font-weight: 700; }

body.up-search-open {
    position: fixed;
    width: 100%;
    overflow: hidden;
}

@media (max-width: 899px) {
    /* Мобайл: одна сплошная карточка (панель и лист сливаются) */
    .up-search-stack {
        border-radius: 20px;
        background: #fff;
        box-shadow: 0 18px 42px rgba(25, 31, 82, 0.2);
        overflow: hidden;
        max-height: 100%;
    }

    .up-search-panel {
        width: 100%;
        padding: 22px 20px 18px;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .up-search-drop { padding-top: 12px; }

    .up-search-tags { padding-top: 6px; }

    .up-search-tags,
    .up-search-results { width: 100%; }
}

@media (max-width: 760px) {
    .up-search-overlay { padding: 96px 16px 16px; }

    .up-search-title { margin-bottom: 18px; }

    .up-search-input-wrap {
        min-height: 48px;
        padding-inline: 18px;
    }

    .up-search-input { font-size: 16px; }
    .up-search-result { padding: 10px 2px; border-radius: 8px; }
    .up-search-result-title { font-size: 17px; }
    .up-search-result-excerpt { font-size: 15px; }
}

/* ---------- Адаптив ---------- */

@media (max-width: 1120px) {
    .up-split-grid { grid-template-columns: 1fr; }
    .up-cardsblock-card { grid-template-columns: 1fr; gap: 36px; padding: 40px; }
    .up-gallery-card { grid-template-columns: 1fr; gap: 28px; }
    .up-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    :root { --up-pad: 16px; --up-radius: 20px; }

    .up-header { padding-top: 22px; }
    .up-logo { font-size: 34px; max-width: 260px; }
    .up-logo img { height: 96px; }
    .up-header-actions { gap: 8px; padding-top: 6px; }
    .up-nav { display: none; }
    .up-nav ul { gap: 22px; justify-content: flex-start; }

    .up-hero { margin-top: 18px; }
    .up-hero-media { margin-inline: calc(-1 * var(--up-pad)); }
    .up-hero-media img { height: 300px; border-radius: 0; }
    .up-hero-card {
        width: 100%;
        margin-top: 0;
        padding: 28px 22px 32px;
        text-align: left;
    }
    .up-hero-media + .up-hero-card { margin-top: -84px; }
    .up-hero-card .up-tags { justify-content: flex-start; }
    .up-hero-title { font-size: 28px; }
    .up-hero-excerpt { margin-inline: 0; }

    .up-section { margin-top: 28px; }
    .up-split .up-container::before,
    .up-news .up-container::before,
    .up-cardsblock .up-container::before,
    .up-gallerysec .up-container::before { display: none; }

    .up-split-list { padding: 0; background: none; border-radius: 0; }
    .up-feeditem {
        padding: 24px 22px;
        border-radius: var(--up-radius-sm);
        background: var(--up-card);
    }
    .up-feeditem + .up-feeditem { margin-top: 16px; border-top: 0; }
    .up-feeditem-title { font-size: 22px; }
    .up-feeditem-excerpt { font-size: 16px; }

    .up-card-img img { height: 230px; }
    .up-grid-3 > .up-card { grid-row: auto; }
    .up-grid-3 .up-card-img { flex: none; min-height: 0; aspect-ratio: auto; height: 230px; }
    .up-grid-3 .up-card-excerpt,
    .up-grid-3 .up-card:has(.up-card-img) .up-card-excerpt { display: block; -webkit-line-clamp: unset; overflow: visible; }
    .up-card-body { padding: 22px 22px 26px; }
    .up-card-deck-badge { top: 24px; right: 22px; }

    .up-grid-3, .up-grid-2 { grid-template-columns: 1fr; gap: 16px; }
    .up-grid-2 .up-card-title { font-size: 25px; }

    .up-news-grid {
        background: none;
        border-radius: 0;
        gap: 16px;
        grid-template-columns: 1fr;
    }
    .up-news-item {
        background: var(--up-card);
        border-radius: var(--up-radius);
        padding: 26px 22px;
    }
    .up-news-item + .up-news-item { border-left: 0; }

    .up-cardsblock-card { padding: 28px 22px; }
    .up-block-title { font-size: 30px; }

    .up-deck { gap: 0; position: relative; }
    .up-deck-stage { width: 100%; }
    .up-deck-card {
        width: 100%;
        height: 480px;
        padding: 26px 22px;
    }
    .up-deck.is-images .up-deck-card { width: 100%; height: auto; }
    .up-deck-arrow {
        position: absolute;
        bottom: 8px;
        z-index: 3;
        transform: none;
    }
    .up-deck-arrow.is-prev { left: 14px; }
    .up-deck-arrow.is-next { right: 14px; }
    .up-deck.is-images .up-deck-arrow {
        top: calc(50% - 18px);
        bottom: auto;
        transform: translateY(-50%);
    }

    .up-gallery-card { padding: 26px 22px; }
    .up-gallery-media img { height: 300px; }

    .up-cards-shell { padding: 22px 18px 44px; }
    .up-cards-topbar {
        grid-template-columns: 1fr 1fr;
        row-gap: 18px;
        margin-bottom: 24px;
    }
    .up-cards-topbar-tags { grid-column: 1 / -1; grid-row: 2; }
    .up-cards-topbar-tags .up-tags { justify-content: flex-start; }
    .up-cards-topbar > .up-copylink { grid-column: 2; grid-row: 1; }
    .up-cards-hero { max-width: none; margin-bottom: 32px; text-align: left; }
    .up-cards-title { font-size: 30px; }
    .up-cards-excerpt { margin-inline: 0; }
    .up-cards-post .up-deck-card { width: 100%; height: 540px; padding: 28px 22px; }
    .up-cards-post .up-deck.is-images .up-deck-card {
        height: auto;
        aspect-ratio: 4 / 5;
        padding: 0;
    }

    .up-article-post { padding-top: 18px; }
    .up-article-post .up-container { max-width: none; }
    .up-article-post .up-article-hero {
        height: 280px;
        margin-inline: calc(50% - 50vw);
    }
    .up-article-post .up-article-hero img { border-radius: 0; }
    .up-article-paper.has-hero { margin-top: -48px; }
    .up-article-paper .up-article-header {
        padding: 28px 22px 20px;
        text-align: left;
    }
    .up-article-toolbar {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .up-article-toolbar > .up-tags {
        grid-column: 1;
        grid-row: 2;
        justify-content: flex-start;
    }
    .up-article-toolbar > .up-copylink {
        grid-column: 1;
        grid-row: 1;
    }
    .up-article-post .up-article-title {
        margin-inline: 0;
        font-size: 28px;
    }
    .up-article-post .up-article-excerpt {
        margin-inline: 0;
        font-size: 16px;
        color: var(--up-ink);
    }
    .up-article-content,
    .up-article-actions-bottom { width: calc(100% - 44px); }
    .up-article-caption { padding-top: 4px; }
    .up-article-paper .up-prose { padding: 18px 0 32px; }
    .up-article-actions-bottom { padding-bottom: 24px; }

    .up-article-header { padding: 28px 22px 58px; text-align: left; }
    .up-article-actions { top: auto; bottom: 10px; right: 12px; }
    .up-article-header .up-tags { justify-content: flex-start; }
    .up-article-title { font-size: 28px; }
    .up-article-excerpt { margin-inline: 0; }
    .up-prose { padding: 28px 22px; font-size: 16px; }
    .up-prose .kg-width-wide { margin-inline: -22px; }
    .up-prose .kg-width-full { margin-inline: -22px; }

    .up-tag-page { padding-top: 18px; }
    .up-taghero-media {
        margin-inline: calc(-1 * var(--up-pad));
        border-radius: 0;
    }
    .up-taghero-media img { height: 300px; }
    .up-taghead { padding: 24px 28px 26px; margin-bottom: 16px; }
    .up-taghead.has-hero {
        width: 100%;
        margin: -58px 0 16px;
        border-radius: 32px;
    }
    .up-taghead-title { font-size: 20px; }

    .pagination {
        grid-template-columns: 1fr 1fr;
        row-gap: 16px;
    }
    .pagination .page-number {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: center;
    }
    .pagination .newer-posts { grid-column: 1; grid-row: 2; }
    .pagination .older-posts { grid-column: 2; grid-row: 2; }

    .up-footer { padding: 26px 0; }
    .up-footer-copy { font-size: 12px; }
}

@media (max-width: 640px) {
    .up-logo img { height: 64px; }
}
