/* ============================================================
   Design tokens
   ============================================================ */
:root {
    color-scheme: light;

    --bg:            #FAFAF9;
    --surface:       #FFFFFF;
    --surface-2:     #F5F5F4;
    --surface-3:     #EEEDEC;

    --ink:           #18181B;
    --ink-2:         #52525B;
    --ink-3:         #A1A1AA;

    --line:          #E7E5E4;
    --line-2:        #D6D3D1;

    --accent:        #4F46E5;
    --accent-ink:    #FFFFFF;
    --accent-soft:   #EEF2FF;

    --ok:            #059669;
    --ok-soft:       #ECFDF5;
    --bad:           #DC2626;
    --bad-soft:      #FEF2F2;

    --r-s: 6px; --r-m: 10px; --r-l: 14px; --r-xl: 20px;
    --r-pill: 999px;

    --shadow-1: 0 1px 2px rgba(24,24,27,.06);
    --shadow-2: 0 4px 16px -4px rgba(24,24,27,.10), 0 2px 6px -2px rgba(24,24,27,.06);

    --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;

    /* Горизонтальные отступы контейнера — адаптивные */
    --gutter: clamp(16px, 4vw, 24px);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg:            #09090B;
    --surface:       #131316;
    --surface-2:     #1C1C21;
    --surface-3:     #26262C;
    --ink:           #FAFAFA;
    --ink-2:         #A1A1AA;
    --ink-3:         #52525B;
    --line:          #27272A;
    --line-2:        #3F3F46;
    --accent:        #818CF8;
    --accent-ink:    #0B0B0E;
    --accent-soft:   #1E1B4B;
    --ok:            #34D399;
    --ok-soft:       #052E2B;
    --bad:           #F87171;
    --bad-soft:      #450A0A;
    --shadow-1: 0 1px 2px rgba(0,0,0,.5);
    --shadow-2: 0 4px 16px -4px rgba(0,0,0,.7), 0 2px 6px -2px rgba(0,0,0,.5);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden; /* страховка от горизонтального скролла */
}

body {
    margin: 0;
    background: var(--bg) !important;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color .2s, color .2s;
    overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: var(--accent-ink);
    padding: 10px 16px;
    border-radius: 0 0 var(--r-m) 0;
    z-index: 100; font-weight: 600;
}
.skip-link:focus { left: 0; }

.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;
}

/* Bootstrap container — переопределяем на адаптивный padding */
.container,
.container-fluid {
    padding-left: var(--gutter) !important;
    padding-right: var(--gutter) !important;
    max-width: 1200px;
}

/* ============================================================
   Progress bar
   ============================================================ */
.read-progress {
    position: fixed; top: 0; left: 0;
    height: 2px; width: 0;
    background: var(--accent);
    z-index: 100;
    transition: width .1s linear;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.site-header__inner {
    display: flex; align-items: center; gap: 10px;
    height: 60px;
    min-width: 0;
}
@media (min-width: 768px) { .site-header__inner { height: 64px; gap: 16px; } }

.brand {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--ink); min-width: 0;
}
.brand:hover { text-decoration: none; color: var(--ink); }

.brand__mark {
    width: 34px; height: 34px; flex: 0 0 34px;
    display: grid; place-items: center;
    background: var(--ink); color: var(--bg);
    border-radius: var(--r-m);
    font-family: var(--font-display);
    font-weight: 600; font-size: 18px; letter-spacing: -.5px;
}
.brand__mark svg { width: 18px; height: 18px; }

.brand__name {
    font-family: var(--font-display);
    font-weight: 600; font-size: 18px;
    letter-spacing: -.3px; white-space: nowrap;
}
@media (min-width: 768px) { .brand__name { font-size: 19px; } }

.site-header__nav {
    display: none; align-items: center;
    gap: 2px; margin-left: 12px;
}
@media (min-width: 900px) { .site-header__nav { display: flex; } }

.site-header__nav a {
    display: inline-flex; align-items: center;
    height: 36px; padding: 0 12px;
    border-radius: var(--r-s);
    color: var(--ink-2);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.site-header__nav a:hover {
    background: var(--surface-2);
    color: var(--ink);
    text-decoration: none;
}
.site-header__nav a.is-active {
    background: var(--ink);
    color: var(--bg);
}

.site-header__spacer { flex: 1 1 auto; min-width: 0; }

.icon-btn {
    width: 40px; height: 40px; flex: 0 0 40px;
    display: grid; place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    background: var(--surface);
    color: var(--ink-2);
    cursor: pointer; text-decoration: none;
    transition: background-color .15s, color .15s, border-color .15s;
}
@media (min-width: 768px) {
    .icon-btn { width: 38px; height: 38px; flex-basis: 38px; }
}
.icon-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--line-2);
    text-decoration: none;
}
.icon-btn svg { width: 18px; height: 18px; display: block; }

html[data-theme="light"] .icon-btn .i-moon,
html[data-theme="dark"]  .icon-btn .i-sun { display: none; }

/* ============================================================
   Page head
   ============================================================ */
.page-head {
    padding: 40px 0 24px;
    text-align: center;
}
@media (min-width: 768px) {
    .page-head { padding: 56px 0 32px; }
}

.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--ink-3); }
.eyebrow--center::after { content: ""; width: 20px; height: 1px; background: var(--ink-3); }

.page-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(28px, 7vw, 56px);
    line-height: 1.1;
    letter-spacing: -.022em;
    margin: 0 0 14px;
    color: var(--ink);
    text-wrap: balance;
}
.page-lead {
    font-size: 15.5px; line-height: 1.6;
    color: var(--ink-2);
    margin: 0 auto; max-width: 60ch;
}
@media (min-width: 768px) { .page-lead { font-size: 17px; } }

.totals {
    margin-top: 20px;
    display: inline-flex; flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
    padding: 10px 16px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    font-size: 13.5px;
    color: var(--ink-2);
    max-width: 100%;
}
.totals__item strong {
    color: var(--ink); font-weight: 700;
    margin-right: 4px;
}
.totals__sep { color: var(--ink-3); }
@media (max-width: 480px) { .totals__sep { display: none; } }

/* ============================================================
   Featured
   ============================================================ */
.featured {
    display: block;
    padding: 24px 0 32px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--line);
    margin-bottom: 28px;
}
@media (min-width: 768px) {
    .featured { padding: 40px 0 48px; margin-bottom: 40px; }
}
.featured:hover { text-decoration: none; color: inherit; }

.featured__inner {
    display: grid;
    grid-template-columns: 1fr; gap: 24px;
    align-items: center;
}
@media (min-width: 900px) {
    .featured__inner { grid-template-columns: 1.3fr 1fr; gap: 56px; }
}

.featured__label {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--accent); margin-bottom: 14px;
}
.featured__label::before {
    content: ""; width: 6px; height: 6px;
    background: var(--accent); border-radius: 50%;
}
.featured__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(24px, 6.5vw, 42px);
    line-height: 1.14; letter-spacing: -.02em;
    margin: 0 0 14px; color: var(--ink);
    transition: color .2s; text-wrap: balance;
}
.featured:hover .featured__title { color: var(--accent); }
.featured__desc {
    font-size: 15.5px; line-height: 1.6;
    color: var(--ink-2);
    margin: 0 0 18px; max-width: 55ch;
}
@media (min-width: 768px) { .featured__desc { font-size: 17px; } }

.featured__meta {
    display: flex; flex-wrap: wrap; gap: 8px 16px;
    font-size: 13px; color: var(--ink-3); align-items: center;
}
.featured__meta > span { display: inline-flex; align-items: center; gap: 6px; }
.featured__meta svg { width: 15px; height: 15px; }

.featured__viz {
    aspect-ratio: 16/10;
    border-radius: var(--r-l);
    background:
        radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 55%),
        radial-gradient(120% 100% at 100% 100%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%),
        linear-gradient(135deg, var(--surface-2), var(--surface-3));
    display: grid; place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    position: relative;
    max-height: 240px;
}
@media (min-width: 900px) {
    .featured__viz { aspect-ratio: 4/3; max-height: none; border-radius: var(--r-xl); }
}
.featured__viz::before {
    content: attr(data-letter);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(80px, 22vw, 200px);
    line-height: 1;
    color: color-mix(in srgb, var(--accent) 22%, transparent);
    letter-spacing: -.04em;
    user-select: none;
}

/* ============================================================
   Stats line
   ============================================================ */
.stats-line {
    display: flex; flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 12.5px;
    color: var(--ink-2);
    align-items: center;
    margin: 0 0 12px;
    line-height: 1.4;
}
.stats-line__item {
    display: inline-flex; align-items: center; gap: 4px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    white-space: nowrap;
}
.stats-line__item span:first-child { font-size: 14px; line-height: 1; }
.stats-line__item--score {
    padding: 2px 8px;
    background: var(--ok-soft);
    color: var(--ok);
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
}

/* ============================================================
   Toolbar
   ============================================================ */
.toolbar {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 10px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: 24px;
}
@media (min-width: 768px) { .toolbar { padding: 16px 0; margin-bottom: 32px; gap: 12px; } }

/* Горизонтальный скролл на мобилке — больше не «вылезает» */
.chip-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    flex: 1 1 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 8px;
    margin: -2px -2px 0;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}
.chip-row::-webkit-scrollbar { height: 4px; }
.chip-row::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 4px;
}
@media (min-width: 900px) {
    .chip-row {
        flex-wrap: wrap;
        overflow: visible;
        padding: 0;
        margin: 0;
    }
}

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 13.5px; font-weight: 500;
    line-height: 1; text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    flex: 0 0 auto;
    scroll-snap-align: start;
    transition: background-color .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.chip:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.chip.is-active { background: var(--ink); color: var(--bg); }
.chip.is-active:hover { background: var(--ink); color: var(--bg); }
.chip__count { font-size: 11.5px; opacity: .65; font-weight: 600; }

/* Select и view-toggle — отдельная строка на узких экранах */
.select { position: relative; display: inline-flex; align-items: center; }
.select select {
    appearance: none; -webkit-appearance: none;
    height: 38px; padding: 0 34px 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    background: var(--surface); color: var(--ink);
    font: inherit; font-size: 13.5px; font-weight: 500;
    cursor: pointer; outline: none;
    transition: border-color .15s;
    max-width: 100%;
}
.select select:hover { border-color: var(--line-2); }
.select select:focus { border-color: var(--accent); }
.select::after {
    content: ""; position: absolute; right: 14px; top: 50%;
    width: 6px; height: 6px;
    border-right: 1.5px solid var(--ink-2);
    border-bottom: 1.5px solid var(--ink-2);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}

.view-toggle {
    display: inline-flex; padding: 3px;
    background: var(--surface-2); border-radius: var(--r-m);
    gap: 2px;
    margin-left: auto;
}
.view-toggle a {
    display: grid; place-items: center;
    width: 34px; height: 32px;
    border-radius: 7px;
    color: var(--ink-3);
    text-decoration: none;
    transition: background-color .15s, color .15s;
}
.view-toggle a:hover { color: var(--ink); text-decoration: none; }
.view-toggle a.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-1);
}
.view-toggle svg { width: 16px; height: 16px; }

/* ============================================================
   Search
   ============================================================ */
.search { position: relative; margin: 16px 0 18px; }
@media (min-width: 768px) { .search { margin: 20px 0 24px; } }

.search__input {
    width: 100%; height: 50px;
    padding: 0 48px 0 44px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface); color: var(--ink);
    font: inherit; font-size: 15px; outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
@media (min-width: 768px) {
    .search__input { height: 52px; font-size: 15.5px; padding: 0 52px 0 48px; }
}
.search__input::placeholder { color: var(--ink-3); }
.search__input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search__input::-webkit-search-cancel-button { display: none; }
.search__icon {
    position: absolute; left: 14px; top: 50%;
    transform: translateY(-50%);
    width: 20px; height: 20px;
    color: var(--ink-3); pointer-events: none;
}
@media (min-width: 768px) { .search__icon { left: 16px; } }

.search__clear {
    position: absolute; right: 6px; top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    color: var(--ink-3); text-decoration: none;
    transition: background-color .15s, color .15s;
}
.search__clear:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.search__clear svg { width: 18px; height: 18px; }

/* ============================================================
   Catalog layout / cards
   ============================================================ */
.layout { padding-bottom: 48px; }
@media (min-width: 992px) { .layout { padding-bottom: 80px; } }

/* Bootstrap row g-5 даёт большие gap'ы — на мобилке уменьшаем */
.layout.row { margin-top: 0; }

.grid { display: grid; gap: 28px 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid--cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid--cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 480px) { .grid { gap: 24px 0; } }

.post-card {
    display: flex; flex-direction: column;
    gap: 10px;
    text-decoration: none; color: inherit;
    min-width: 0;
}
.post-card:hover { text-decoration: none; color: inherit; }

.post-card__cover {
    aspect-ratio: 16/9;
    border-radius: var(--r-l);
    background:
        radial-gradient(80% 80% at 10% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
        linear-gradient(135deg, var(--surface-2), var(--surface-3));
    display: grid; place-items: center;
    overflow: hidden;
    border: 1px solid var(--line);
    transition: transform .25s ease;
    position: relative;
}
.post-card:hover .post-card__cover { transform: translateY(-2px); }
.post-card__cover::before {
    content: attr(data-letter);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(56px, 14vw, 96px);
    line-height: 1;
    color: color-mix(in srgb, var(--accent) 30%, transparent);
    letter-spacing: -.04em;
    user-select: none;
}
.post-card__cat {
    position: absolute; top: 10px; left: 10px;
    display: inline-flex; align-items: center;
    height: 22px; padding: 0 9px;
    border-radius: var(--r-pill);
    background: var(--surface); color: var(--ink);
    font-size: 10.5px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
    box-shadow: var(--shadow-1);
    max-width: calc(100% - 20px);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (min-width: 768px) {
    .post-card__cat { top: 12px; left: 12px; height: 24px; padding: 0 10px; font-size: 11px; }
}
.post-card__title {
    font-family: var(--font-display);
    font-size: 19px; line-height: 1.25;
    font-weight: 600; letter-spacing: -.015em;
    margin: 0; color: var(--ink);
    transition: color .15s;
    display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    word-break: break-word;
}
@media (min-width: 768px) { .post-card__title { font-size: 21px; } }
.post-card:hover .post-card__title { color: var(--accent); }
.post-card__desc {
    margin: 0;
    font-size: 14px; line-height: 1.55;
    color: var(--ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    word-break: break-word;
}
@media (min-width: 768px) { .post-card__desc { font-size: 14.5px; } }

.post-card__meta {
    display: flex; flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 12.5px; color: var(--ink-3);
    align-items: center;
    margin-top: auto; padding-top: 6px;
}
.post-card__meta > span { display: inline-flex; align-items: center; gap: 4px; }
.post-card__meta svg { width: 14px; height: 14px; }

/* list view */
.grid--list { grid-template-columns: 1fr !important; gap: 0; }
.grid--list .post-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}
.grid--list .post-card:first-child { padding-top: 0; }
.grid--list .post-card:last-child  { border-bottom: 0; }
.grid--list .post-card__cover { aspect-ratio: 16/9; border-radius: var(--r-m); }
.grid--list .post-card__cover::before { font-size: 52px; }
.grid--list .post-card__cat { display: none; }

@media (min-width: 640px) {
    .grid--list .post-card {
        grid-template-columns: 180px 1fr;
        gap: 24px;
    }
    .grid--list .post-card__cover { aspect-ratio: 4/3; }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 88px; gap: 32px; }
}

.block__title {
    font-size: 11.5px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 12px; padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.block__stats {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 1px; background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    overflow: hidden;
}
.stat { padding: 14px 10px; background: var(--surface); text-align: center; }
.stat__n {
    display: block;
    font-family: var(--font-display);
    font-size: 20px; line-height: 1.1;
    font-weight: 600; letter-spacing: -.02em;
    color: var(--ink);
}
.stat__l {
    display: block; font-size: 10.5px;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-3); margin-top: 3px;
}

.block__recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.recent-item {
    display: flex; gap: 12px; text-decoration: none;
    color: inherit; align-items: flex-start;
    min-width: 0;
}
.recent-item:hover { text-decoration: none; color: inherit; }
.recent-item__num {
    flex: 0 0 22px; width: 22px; height: 22px;
    display: grid; place-items: center;
    background: var(--surface-2); color: var(--ink-3);
    border-radius: var(--r-s);
    font-size: 11.5px; font-weight: 700; margin-top: 1px;
}
.recent-item__title {
    font-size: 14px; line-height: 1.35; font-weight: 500;
    color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    transition: color .15s;
    word-break: break-word;
}
.recent-item:hover .recent-item__title { color: var(--accent); }
.recent-item__meta {
    display: block; margin-top: 3px;
    font-size: 12px; color: var(--ink-3);
}

.block__tags {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.tag {
    display: inline-flex; align-items: center; gap: 5px;
    height: 30px; padding: 0 11px;
    border-radius: var(--r-s);
    background: var(--surface-2); color: var(--ink-2);
    font-size: 13px; text-decoration: none;
    transition: background-color .15s, color .15s;
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tag:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.tag.is-active { background: var(--accent-soft); color: var(--accent); }
.tag__count { font-size: 11px; opacity: .7; font-weight: 600; flex: 0 0 auto; }

.score-big { margin-bottom: 12px; }
.score-big__value {
    display: block;
    font-family: var(--font-display);
    font-size: 38px; line-height: 1;
    font-weight: 600; letter-spacing: -.03em;
    color: var(--ok);
}
.score-big__label {
    display: block; margin-top: 6px;
    font-size: 13px; line-height: 1.4;
    color: var(--ink-2);
}
.score-caption {
    margin-top: 10px;
    font-size: 12.5px; color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}
.score-caption b { color: var(--ink); font-weight: 600; }

/* ============================================================
   Bar
   ============================================================ */
.bar__track {
    height: 8px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.bar__fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--r-pill);
    transition: width .6s ease;
}
.bar__fill--ok { background: var(--ok); }

/* ============================================================
   Chart
   ============================================================ */
.chart {
    display: flex; flex-direction: column;
    gap: 10px;
    margin: 0 0 24px;
}
.chart__row {
    display: grid;
    grid-template-columns: 28px 1fr 36px;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}
@media (min-width: 480px) {
    .chart__row { grid-template-columns: 32px 1fr 40px; gap: 12px; font-size: 14px; }
}
.chart__icon {
    font-size: 18px; line-height: 1;
    text-align: center;
}
@media (min-width: 480px) { .chart__icon { font-size: 20px; } }
.chart__track {
    height: 10px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    overflow: hidden;
    position: relative;
    min-width: 0;
}
.chart__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 65%, var(--bg)));
    border-radius: var(--r-pill);
    transition: width .8s cubic-bezier(.2,.7,.2,1);
}
.chart__value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--ink-2);
    text-align: right;
    font-size: 13px;
}

/* ============================================================
   Interest block
   ============================================================ */
.interest {
    scroll-margin-top: 80px;
    margin: 0 0 20px;
}
.interest__hint {
    margin: 0 0 20px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-radius: var(--r-m);
    color: var(--ink-2);
    font-size: 14px;
    line-height: 1.55;
}
@media (min-width: 768px) {
    .interest__hint { padding: 16px 20px; font-size: 14.5px; }
}

.score { margin: 0 0 24px; }
.score__head {
    display: flex; align-items: baseline;
    justify-content: space-between;
    gap: 12px; margin-bottom: 10px;
}
.score__label {
    font-size: 12px; font-weight: 600;
    letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-2);
}
.score__pct {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 600;
    letter-spacing: -.02em;
    color: var(--ok);
    font-variant-numeric: tabular-nums;
}
@media (min-width: 480px) { .score__pct { font-size: 24px; } }

/* ============================================================
   Votes / reactions
   ============================================================ */
.votes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 0 16px;
}
@media (min-width: 480px) {
    .votes { display: flex; flex-wrap: wrap; }
}

.vote {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
    border-radius: var(--r-pill);
    cursor: pointer; font: inherit;
    font-size: 13.5px; font-weight: 500;
    transition: background-color .15s, border-color .15s, color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    white-space: nowrap;
}
@media (min-width: 480px) {
    .vote { padding: 0 18px; font-size: 14px; }
}
.vote:hover { background: var(--surface-2); border-color: var(--line-2); }
.vote:active { transform: scale(.97); }
.vote svg { width: 17px; height: 17px; flex: 0 0 auto; }
.vote__count {
    display: inline-grid; place-items: center;
    min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 12px; font-weight: 700;
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}
.vote--up.is-active {
    background: var(--ok-soft);
    border-color: var(--ok); color: var(--ok);
}
.vote--up.is-active .vote__count {
    background: color-mix(in srgb, var(--ok) 20%, transparent);
    color: var(--ok);
}
.vote--down.is-active {
    background: var(--bad-soft);
    border-color: var(--bad); color: var(--bad);
}
.vote--down.is-active .vote__count {
    background: color-mix(in srgb, var(--bad) 20%, transparent);
    color: var(--bad);
}

/* Эмодзи-реакции: сетка с равными ячейками, красиво переносится */
.reactions__emojis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
@media (min-width: 480px) {
    .reactions__emojis {
        display: flex; flex-wrap: wrap; gap: 6px;
    }
}

.emoji-btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    height: 46px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface); color: var(--ink);
    border-radius: var(--r-pill);
    cursor: pointer; font: inherit;
    transition: background-color .15s, border-color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
    min-width: 0;
    overflow: hidden;
}
@media (min-width: 480px) {
    .emoji-btn { padding: 0 14px 0 12px; height: 42px; }
}
.emoji-btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.emoji-btn:active { transform: scale(.96); }
.emoji-btn.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}
.emoji-btn__icon { font-size: 19px; line-height: 1; }
@media (min-width: 480px) { .emoji-btn__icon { font-size: 19px; } }
.emoji-btn__count {
    font-size: 13px; font-weight: 600;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    min-width: 12px;
    text-align: center;
}
.emoji-btn.is-active .emoji-btn__count { color: var(--accent); }

/* ============================================================
   Article
   ============================================================ */
.crumbs {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px;
    font-size: 12.5px; color: var(--ink-3);
    padding: 20px 0 0;
    line-height: 1.5;
}
@media (min-width: 768px) {
    .crumbs { font-size: 13px; padding: 32px 0 0; gap: 8px; }
}
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: none; }
.crumbs svg { width: 11px; height: 11px; opacity: .55; flex: 0 0 auto; }

.article-head { padding: 20px 0 28px; text-align: center; }
@media (min-width: 768px) { .article-head { padding: 24px 0 40px; } }

.article-head__cats { margin-bottom: 16px; }
.article-head__title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(26px, 7.5vw, 54px);
    line-height: 1.12; letter-spacing: -.022em;
    margin: 0 0 16px; color: var(--ink);
    text-wrap: balance;
    word-break: break-word;
}
.article-head__lead {
    font-size: 16px; line-height: 1.55;
    color: var(--ink-2);
    margin: 0 auto 22px; max-width: 60ch;
    text-wrap: pretty;
}
@media (min-width: 768px) { .article-head__lead { font-size: 18px; margin-bottom: 28px; } }

.article-head__meta {
    display: flex; flex-wrap: wrap;
    justify-content: center; gap: 6px 14px;
    font-size: 12.5px; color: var(--ink-3);
}
@media (min-width: 768px) {
    .article-head__meta { gap: 8px 20px; font-size: 13.5px; }
}
.article-head__meta > span,
.article-head__meta > time {
    display: inline-flex; align-items: center; gap: 6px;
}
.article-head__meta svg { width: 14px; height: 14px; flex: 0 0 auto; }
@media (min-width: 768px) { .article-head__meta svg { width: 15px; height: 15px; } }

.article-body {
    font-size: 16.5px; line-height: 1.7;
    color: var(--ink);
    padding-bottom: 8px;
    word-break: break-word;
}
@media (min-width: 768px) { .article-body { font-size: 18px; line-height: 1.72; } }

.article-body > :first-child { margin-top: 0; }
.article-body > :last-child  { margin-bottom: 0; }
.article-body p { margin: 0 0 20px; }
@media (min-width: 768px) { .article-body p { margin-bottom: 24px; } }

.article-body p:first-of-type {
    font-size: 18px; line-height: 1.6;
    color: var(--ink-2); letter-spacing: -.005em;
}
@media (min-width: 768px) { .article-body p:first-of-type { font-size: 20px; } }

.article-body h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(21px, 5.5vw, 30px);
    line-height: 1.22; letter-spacing: -.02em;
    margin: 40px 0 14px;
    color: var(--ink);
    scroll-margin-top: 80px;
    word-break: break-word;
}
@media (min-width: 768px) { .article-body h2 { margin: 56px 0 18px; } }

.article-body h3 {
    font-weight: 600; font-size: 18px;
    line-height: 1.35; letter-spacing: -.01em;
    margin: 32px 0 10px;
}
@media (min-width: 768px) { .article-body h3 { font-size: 20px; margin: 40px 0 12px; } }

.article-body ul, .article-body ol {
    margin: 0 0 20px; padding: 0; list-style: none;
}
@media (min-width: 768px) { .article-body ul, .article-body ol { margin-bottom: 24px; } }

.article-body li {
    position: relative; padding-left: 24px;
    margin-bottom: 10px; line-height: 1.6;
}
@media (min-width: 768px) { .article-body li { padding-left: 28px; margin-bottom: 12px; line-height: 1.65; } }

.article-body ul > li::before {
    content: ""; position: absolute;
    left: 8px; top: 11px;
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent);
}
@media (min-width: 768px) {
    .article-body ul > li::before { top: 12px; width: 6px; height: 6px; }
}

.article-body ol { counter-reset: n; }
.article-body ol > li { padding-left: 30px; counter-increment: n; }
@media (min-width: 768px) { .article-body ol > li { padding-left: 34px; } }
.article-body ol > li::before {
    content: counter(n) "."; position: absolute; left: 4px; top: 0;
    color: var(--accent); font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.article-body strong { font-weight: 700; color: var(--ink); }
.article-body em { font-style: italic; color: var(--ink-2); }
.article-body a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    word-break: break-word;
}
.article-body a:hover { text-decoration-color: var(--accent); }

.article-body blockquote {
    margin: 24px 0;
    padding: 4px 0 4px 18px;
    border-left: 3px solid var(--accent);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 17px; line-height: 1.5;
    color: var(--ink-2);
}
@media (min-width: 768px) {
    .article-body blockquote { margin: 32px 0; padding-left: 24px; font-size: 20px; }
}
.article-body blockquote p { margin: 0; }

.article-body img {
    max-width: 100%; height: auto;
    border-radius: var(--r-m);
    display: block; margin: 24px auto;
}
@media (min-width: 768px) {
    .article-body img { border-radius: var(--r-l); margin: 32px auto; }
}

/* Таблица — горизонтальный скролл вместо обрезки */
.article-body table {
    width: 100%; border-collapse: collapse;
    margin: 24px 0; font-size: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-m);
    overflow: hidden;
}
@media (min-width: 768px) {
    .article-body table { margin: 32px 0; font-size: 15px; }
}
.article-body th, .article-body td {
    padding: 10px 12px; text-align: left;
    border-bottom: 1px solid var(--line);
}
@media (min-width: 768px) {
    .article-body th, .article-body td { padding: 12px 16px; }
}
.article-body tr:last-child td { border-bottom: 0; }
.article-body th {
    background: var(--surface-2);
    font-weight: 600; font-size: 12px;
    letter-spacing: .02em; text-transform: uppercase;
    color: var(--ink-2);
}
@media (min-width: 768px) { .article-body th { font-size: 13px; } }

/* Обернуть таблицу в скролл на мобилке */
.article-body .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 24px 0;
}

.article-divider {
    height: 1px; background: var(--line);
    margin: 40px auto; max-width: 100px;
    border: 0;
}
@media (min-width: 768px) {
    .article-divider { margin: 56px auto; max-width: 120px; }
}

/* ============================================================
   Section head
   ============================================================ */
.block-head {
    display: flex; align-items: baseline;
    gap: 10px; margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
@media (min-width: 768px) {
    .block-head { gap: 12px; margin-bottom: 20px; padding-bottom: 14px; }
}
.block-head__title {
    font-family: var(--font-display);
    font-weight: 600; font-size: 20px;
    letter-spacing: -.015em;
    margin: 0; color: var(--ink);
}
@media (min-width: 768px) { .block-head__title { font-size: 22px; } }
.block-head__count {
    font-size: 12.5px; color: var(--ink-3);
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

/* ============================================================
   Sources
   ============================================================ */
.sources { list-style: none; margin: 0; padding: 0; }
.sources li { padding: 12px 0; border-bottom: 1px solid var(--line); }
@media (min-width: 768px) { .sources li { padding: 14px 0; } }
.sources li:last-child { border-bottom: 0; }

.source {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: inherit; min-width: 0;
}
.source:hover { text-decoration: none; color: inherit; }
.source:hover .source__host { color: var(--accent); }

.source__favicon {
    flex: 0 0 32px; width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: var(--r-s);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 14px; font-weight: 600;
    text-transform: uppercase;
}
.source__text { min-width: 0; flex: 1 1 auto; }
.source__host {
    display: block; font-size: 14px;
    font-weight: 500; color: var(--ink);
    transition: color .15s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (min-width: 768px) { .source__host { font-size: 14.5px; } }
.source__url {
    display: block; font-size: 12px;
    color: var(--ink-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source__icon {
    flex: 0 0 16px; width: 16px; height: 16px;
    color: var(--ink-3);
}

/* ============================================================
   Pager
   ============================================================ */
.pager { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 32px 0; }
@media (min-width: 640px) {
    .pager { grid-template-columns: 1fr 1fr; gap: 12px; margin: 48px 0; }
}
.pager__btn {
    display: flex; flex-direction: column; gap: 6px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    text-decoration: none; color: inherit;
    transition: border-color .15s, background-color .15s;
    min-height: 80px;
}
@media (min-width: 768px) {
    .pager__btn { padding: 20px 22px; min-height: 96px; }
}
.pager__btn:hover {
    border-color: var(--line-2);
    background: var(--surface-2);
    text-decoration: none; color: inherit;
}
.pager__label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11.5px; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-3);
}
.pager__title {
    font-family: var(--font-display);
    font-size: 15px; line-height: 1.35;
    font-weight: 500; color: var(--ink);
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    word-break: break-word;
}
@media (min-width: 768px) { .pager__title { font-size: 16px; } }
.pager__btn--next { text-align: right; }
.pager__btn--next .pager__label { justify-content: flex-end; }

/* ============================================================
   Pagination
   ============================================================ */
.page-nav {
    display: flex; justify-content: center; align-items: center;
    gap: 4px; margin-top: 36px; flex-wrap: wrap;
}
@media (min-width: 768px) { .page-nav { margin-top: 56px; } }

.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 10px;
    border-radius: var(--r-m);
    color: var(--ink-2);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    transition: background-color .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.page-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.page-btn.is-active { background: var(--ink); color: var(--bg); }
.page-btn.is-active:hover { background: var(--ink); color: var(--bg); }
.page-btn.is-disabled { opacity: .35; pointer-events: none; }
.page-btn svg { width: 16px; height: 16px; }
.page-ellipsis { padding: 0 4px; color: var(--ink-3); user-select: none; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    margin-top: 64px;
    border-top: 1px solid var(--line);
    padding: 40px 0 28px;
    background: var(--surface);
}
@media (min-width: 768px) {
    .site-footer { margin-top: 96px; padding: 56px 0 32px; }
}
.site-footer__grid {
    display: grid; grid-template-columns: 1fr;
    gap: 32px; margin-bottom: 32px;
}
@media (min-width: 640px) {
    .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 36px; }
}
@media (min-width: 960px) {
    .site-footer__grid {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
        gap: 40px; margin-bottom: 48px;
    }
}
.site-footer__col-title {
    font-size: 11.5px; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); margin: 0 0 14px;
}
.site-footer__links {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
    font-size: 14px; color: var(--ink-2);
}
.site-footer__links a { color: var(--ink-2); text-decoration: none; }
.site-footer__links a:hover { color: var(--accent); }
.site-footer__brand {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px;
}
.site-footer__brand-name {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 600; letter-spacing: -.02em;
}
.site-footer__desc {
    margin: 0; font-size: 14px; line-height: 1.6;
    color: var(--ink-2); max-width: 40ch;
}
.site-footer__bottom {
    display: flex; flex-direction: column;
    gap: 8px;
    padding-top: 24px; border-top: 1px solid var(--line);
    font-size: 12.5px; color: var(--ink-3);
}
@media (min-width: 640px) {
    .site-footer__bottom {
        flex-direction: row; flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px 24px;
    }
}

/* ============================================================
   Empty / error
   ============================================================ */
.empty {
    padding: 48px 20px;
    text-align: center;
    border: 1px dashed var(--line-2);
    border-radius: var(--r-l);
    color: var(--ink-2);
}
@media (min-width: 768px) { .empty { padding: 80px 24px; } }
.empty svg { width: 36px; height: 36px; color: var(--ink-3); margin-bottom: 14px; }
@media (min-width: 768px) { .empty svg { width: 40px; height: 40px; margin-bottom: 16px; } }
.empty__title {
    font-family: var(--font-display);
    font-size: 20px; font-weight: 600;
    margin: 0 0 8px; color: var(--ink);
}
.empty p { margin: 0 0 8px; font-size: 14.5px; }
.empty a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.alert-error {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 16px 18px;
    border-radius: var(--r-m);
    background: var(--bad-soft); color: var(--bad);
    margin: 20px 0;
    border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
}
@media (min-width: 768px) {
    .alert-error { padding: 20px 24px; gap: 16px; margin: 24px 0; }
}
.alert-error svg { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 2px; }
.alert-error p { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; }

/* ============================================================
   Back to top
   ============================================================ */
.back-top {
    position: fixed;
    right: 16px; bottom: 16px;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    background: var(--ink); color: var(--bg);
    border-radius: var(--r-m);
    border: 0; cursor: pointer;
    box-shadow: var(--shadow-2);
    opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 40;
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) {
    .back-top { right: 24px; bottom: 24px; }
}
.back-top.is-visible { opacity: 1; pointer-events: auto; }
.back-top:hover { transform: translateY(-2px); }
.back-top svg { width: 18px; height: 18px; }

/* ============================================================
   Мелочи, чтобы ничего не вылезало
   ============================================================ */
h1, h2, h3, h4, p, li, a, span, time, code {
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* Bootstrap-специфичное: убираем большие gap'ы row g-5 на мобилке */
@media (max-width: 991px) {
    .layout.row > [class*="col-"] { margin-top: 0 !important; }
}

/* Сайдбар в каталоге — отступ сверху на мобилке */
@media (max-width: 991px) {
    .layout .sidebar {
        margin-top: 8px;
        padding-top: 24px;
        border-top: 1px solid var(--line);
    }
}

/* Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
    html { scroll-behavior: auto; }
}

/* ============================================================
   Узкие экраны (≤380px) — финальные корректировки
   ============================================================ */
@media (max-width: 380px) {
    :root { --gutter: 14px; }

    .site-header__inner { height: 56px; }
    .brand__name { font-size: 17px; }
    .brand__mark { width: 30px; height: 30px; flex-basis: 30px; font-size: 16px; }
    .icon-btn { width: 36px; height: 36px; flex-basis: 36px; }

    .page-title { font-size: 26px; }
    .article-head__title { font-size: 24px; }

    .votes { grid-template-columns: 1fr; }
    .vote { padding: 0 12px; font-size: 13px; }
    .reactions__emojis { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .emoji-btn { height: 44px; padding: 0 8px; gap: 4px; }
    .emoji-btn__icon { font-size: 17px; }

    .post-card__title { font-size: 17px; }
    .post-card__desc { font-size: 13.5px; }

    .article-body { font-size: 16px; }
    .article-body h2 { font-size: 20px; }

    .block__stats { grid-template-columns: repeat(2, 1fr); }

    .source__favicon { flex-basis: 28px; width: 28px; height: 28px; font-size: 13px; }
}