/* Каталог PNG. Оформление держится на переменных: тёмная тема — это только
   переопределение цветов, а не второй набор правил. */

:root {
    --ground: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #eef1f5;
    --line: #dde1e8;
    --ink: #121821;
    --ink-2: #4d5766;
    /* 4,85 к фону страницы: прежний #7b8593 давал 3,52 и не проходил
       проверку ни в Lighthouse, ни по формуле. */
    --ink-3: #656e7c;
    --accent: #0d6e78;
    --accent-ink: #ffffff;
    --accent-soft: #ddeef0;
    --shadow: 0 1px 2px rgba(18, 24, 33, .06), 0 8px 24px rgba(18, 24, 33, .06);
    --radius: 10px;
    --checker-a: #e7eaf0;
    --checker-b: #f7f8fa;
    --muted: #656e7c;
    --border: #dde1e8;
    --card: #ffffff;
    --checker: #eef1f5;
    --text: #121821;
    --badge: rgba(18, 24, 33, .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0e1218;
        --surface: #161c25;
        --surface-2: #1d2530;
        --line: #2a3441;
        --ink: #e9edf3;
        --ink-2: #a9b4c2;
        --ink-3: #8b95a5;
        --accent: #3fb6c0;
        --accent-ink: #06181b;
        --accent-soft: #10333a;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
        --checker-a: #1b232e;
        --checker-b: #131a22;
        --muted: #8b95a5;
        --border: #2a3441;
        --card: #161c25;
        --checker: #1d2530;
        --text: #e9edf3;
        --badge: rgba(255, 255, 255, .08);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100svh;
    display: flex; flex-direction: column;
    background: var(--ground);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }
/* Длинные слова в названиях и слагах переносим, а не растягиваем строку. */
body { overflow-x: clip; }
.card-title, .breadcrumbs, h1 { overflow-wrap: anywhere; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

/* ---------- Шапка ---------- */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 20;
}
.header-inner {
    display: flex; align-items: center; gap: 20px;
    padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap;
}
.logo { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.logo span { color: var(--ink-3); font-weight: 500; }

.search-form { position: relative; display: flex; gap: 8px; flex: 1 1 380px; }
.search-form input[type="search"] {
    flex: 1; min-width: 0; padding: 10px 14px; font-size: 15px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--ground); color: var(--ink);
}
.search-form button {
    padding: 10px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
    border: 0; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink);
}

.suggestions {
    position: absolute; top: calc(100% + 6px); left: 0; right: 78px; z-index: 30;
    margin: 0; padding: 6px; list-style: none;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
}
.suggestions a {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 8px 10px; border-radius: 6px; font-size: 14.5px;
}
.suggestions a:hover { background: var(--surface-2); }
.suggestions span { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Все пункты меню — с одинаковыми полями и по одной средней линии.
   У «Категорий» это раскрывающийся <summary> со своими отступами, и рядом
   с обычными ссылками он стоял с двойным зазором и чуть выше остальных. */
.site-nav { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-2); }
.site-nav > a, .megamenu > summary {
    display: inline-flex; align-items: center; min-height: 44px;
    padding: 6px 10px; border-radius: 8px; line-height: 1.4;
}
.site-nav > a:hover { background: var(--surface-2); }
/* Переключатель языков. Шесть ссылок по 27 px в высоту — палец по ним
   не попадает: замер 29.09 нашёл на главной 31 цель меньше 32 px. Нижняя
   граница по руководствам — 44 px, её и держим. Цвет тоже поднят: серый
   по светлому давал контраст 3,5 при норме 4,5. */
/* Свёрнутый переключатель. На широком экране раскрывать нечего — все
   шесть языков помещаются в строку, поэтому там список показан всегда,
   а стрелка и сама кнопка спрятаны. */
.lang-switch { position: relative; }
.lang-switch > summary {
    display: none; cursor: pointer; list-style: none;
    align-items: center; justify-content: center; gap: 5px;
    min-width: 52px; min-height: 44px; padding: 4px 10px;
    font-size: 13px; font-weight: 700; color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 8px;
}
.lang-switch > summary:hover { border-color: var(--accent); color: var(--accent); }
.lang-globe { flex: 0 0 auto; opacity: .75; }
.lang-switch > summary::-webkit-details-marker { display: none; }
.lang-switch > summary::after { content: "▾"; margin-left: 5px; opacity: .6; }
.lang-switch-body { display: flex; gap: 4px; }
.lang-switch a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
    padding: 4px 8px; font-size: 12.5px; font-weight: 600; border-radius: 6px;
    color: var(--ink-2);
}
.lang-switch a:hover { background: var(--surface-2); }
.lang-switch a.current { background: var(--accent-soft); color: var(--accent); }

/* ---------- Витрина ---------- */

main { flex: 1 0 auto; padding: 28px 0 64px; }
.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.02em; text-wrap: balance; }
.count { margin: 6px 0 0; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.toolbar {
    display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center;
    padding: 14px 16px; margin-bottom: 22px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.toolbar-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.toolbar-label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-right: 4px; }

.chip {
    padding: 5px 12px; font-size: 13.5px; cursor: pointer;
    background: var(--surface-2); color: var(--ink-2);
    border: 1px solid transparent; border-radius: 999px;
}
.chip:hover { border-color: var(--line); }
.chip--on, .chip.is-on { background: var(--accent); color: var(--accent-ink); }

/* Сетка: колонки подстраиваются сами, карточки не растягиваются в полосы. */
.image-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.card {
    display: flex; flex-direction: column; gap: 8px;
    padding: 12px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-frame {
    display: grid; place-items: center; aspect-ratio: 1;
    background:
        repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 16px 16px;
    border-radius: 6px; overflow: hidden;
}
.card-frame img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.card-title {
    font-size: 13.5px; line-height: 1.35; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin-top: auto; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* Подпись всегда занимает две строки: иначе соседние карточки в ряду
   расходятся по высоте, когда у одной название короткое. */
.card-title { min-height: calc(1.35em * 2); }
.image-grid > * { min-width: 0; }

.pager { display: flex; gap: 12px; justify-content: center; margin: 32px 0; }
.pager a {
    padding: 10px 20px; font-size: 15px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }

.empty { padding: 48px 0; text-align: center; color: var(--ink-2); }
.empty h2 { margin: 0 0 8px; }

.topics { margin-top: 48px; }
.topics h2 { font-size: 20px; margin: 0 0 14px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
    display: inline-flex; align-items: baseline; gap: 7px;
    padding: 6px 13px; font-size: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.tag-cloud a:hover { border-color: var(--accent); color: var(--accent); }
.tag-cloud span { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

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

.detail-page { padding-top: 4px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--ink-3); margin-bottom: 18px; }
.breadcrumbs a:hover { color: var(--accent); }

.detail-grid { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.stage {
    display: grid; place-items: center; min-height: 380px; padding: 28px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.checker {
    background-image: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%);
    background-size: 22px 22px;
}
.stage img { max-width: 100%; max-height: 68vh; width: auto; height: auto; object-fit: contain; }

.detail-info h1 { font-size: clamp(20px, 2.4vw, 27px); margin: 0 0 10px; letter-spacing: -.02em; text-wrap: balance; }
.description { color: var(--ink-2); margin: 0 0 16px; }

.specs { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 20px; }
.specs > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 14px; background: var(--surface); }
.specs dt { color: var(--ink-3); font-size: 13.5px; margin: 0; }
.specs dd { margin: 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---------- Панель обработки ---------- */

.editor {
    display: grid; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.editor-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.editor-label { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); min-width: 74px; }
.button-row { display: flex; gap: 6px; flex-wrap: wrap; }

.ghost {
    padding: 6px 12px; font-size: 13.5px; cursor: pointer;
    background: var(--surface-2); color: var(--ink-2);
    border: 1px solid transparent; border-radius: 7px;
}
.ghost:hover { border-color: var(--line); }
.ghost.is-on { background: var(--accent); color: var(--accent-ink); }

.swatches { display: flex; gap: 6px; }
.swatch {
    width: 30px; height: 30px; cursor: pointer; padding: 0;
    border: 2px solid var(--line); border-radius: 7px; background: var(--s, var(--surface-2));
}
.swatch--checker { background: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 10px 10px; }
.swatch.is-on { border-color: var(--accent); }
.swatch--pick { display: grid; place-items: center; overflow: hidden; }
.swatch--pick input { width: 200%; height: 200%; border: 0; padding: 0; cursor: pointer; background: none; }

.tint-pick { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px;
    background: var(--surface-2); border-radius: 7px; font-size: 13.5px; cursor: pointer; }
.tint-pick input { width: 26px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }

#padding { flex: 1; min-width: 120px; accent-color: var(--accent); }
#padding-value { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 38px; }

.download-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.download-button {
    flex: 1 1 auto; padding: 12px 18px; font-size: 15px; font-weight: 640; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius);
}
.download-button--soft { flex: 0 0 auto; background: var(--surface-2); color: var(--ink); }
.download-button:hover { filter: brightness(1.06); }
.export-note { margin: 0; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }


.source-note { font-size: 12.5px; color: var(--ink-3); margin: 16px 0; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tags a { padding: 4px 11px; font-size: 13px; background: var(--surface-2); border-radius: 999px; color: var(--ink-2); }
.detail-tags a:hover { background: var(--accent-soft); color: var(--accent); }

.related { margin-top: 52px; }
.section-head h2 { font-size: 21px; margin: 0 0 16px; }

/* ---------- Подвал ---------- */

.site-footer {
    border-top: 1px solid var(--line); background: var(--surface);
    padding: 26px 0; font-size: 13.5px; color: var(--ink-2);
}
.site-footer p { margin: 0 0 4px; }
.site-footer .muted { color: var(--ink-3); }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ---------- Разделы и указатель ---------- */

.category-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.category-card {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius);
    transition: border-color .15s, transform .15s;
}
.category-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-icon { font-size: 22px; line-height: 1; }
.category-name { flex: 1; font-weight: 600; font-size: 15px; }
.category-count { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.alphabet { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 24px; }
.alphabet a {
    display: grid; place-items: center; min-width: 36px; height: 36px;
    font-size: 14px; font-weight: 600; border-radius: 8px;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
}
.alphabet a:hover { border-color: var(--accent); color: var(--accent); }
.alphabet a.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
/* Буква, на которую тем нет: показываем, но не зовём нажимать. */
.empty-letter {
    display: grid; place-items: center; min-width: 36px; height: 36px;
    font-size: 14px; font-weight: 600; border-radius: 8px;
    background: transparent; border: 1px solid var(--line); color: var(--ink-3);
    opacity: .45; cursor: default;
}

.tag-index { gap: 7px; }

/* ---------- Текстовые страницы ---------- */

.article { max-width: 68ch; padding-top: 8px; }
.article h1 { font-size: clamp(24px, 3.2vw, 32px); margin: 0 0 18px; letter-spacing: -.02em; }
.article h2 { font-size: 20px; margin: 32px 0 10px; }
.article p { color: var(--ink-2); margin: 0 0 14px; }

/* ---------- Инструменты ---------- */

.tool-card { align-items: flex-start; }
/* Название инструмента всегда в две строки: у коротких («Сжать»)
   пояснение уезжало выше, чем у длинных, и ряд шёл лесенкой. */
.tool-card .category-name { display: block; min-height: calc(1.3em * 2); line-height: 1.3; }
.tool-note { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

.dropzone {
    display: grid; place-items: center; gap: 6px; cursor: pointer;
    padding: 56px 24px; text-align: center;
    background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-title { font-size: 17px; font-weight: 600; }
.dropzone-note { font-size: 13.5px; color: var(--ink-3); }

.tool-workspace {
    display: grid; gap: 24px; margin-top: 24px;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); align-items: start;
}
@media (max-width: 900px) { .tool-workspace { grid-template-columns: 1fr; } }
.tool-workspace .stage { min-height: 320px; }
.tool-workspace img { max-width: 100%; max-height: 60vh; }
.tool-stats { margin: 0 0 4px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Витрина разделов на главной ---------- */

.showcase { margin-bottom: 22px; }
.showcase-title { font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 0 0 10px; font-weight: 600; }
.showcase-row { display: flex; flex-wrap: wrap; gap: 8px; }
.showcase-row a {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 13px; font-size: 14px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
}
.showcase-row a:hover { border-color: var(--accent); color: var(--accent); }
.showcase-row b { font-weight: 500; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.showcase-all { font-weight: 600; color: var(--accent); }

/* ---------- Страница темы ---------- */
.topic-head { margin-bottom: 20px; }
.topic-intro { max-width: 78ch; font-size: 16px; line-height: 1.6; color: var(--ink-2); margin: 10px 0 14px; }
.topic-summary { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; }
.topic-summary div { display: flex; gap: 6px; font-size: 13.5px; }
.topic-summary dt { color: var(--ink-3); }
.topic-summary dd { margin: 0; font-weight: 600; }
.section-title { font-size: 15px; margin: 18px 0 8px; color: var(--ink-2); }
.tile-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: block; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; color: inherit; }
.tile:hover { border-color: var(--accent); }
.tile-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.tile-thumbs img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; background: var(--checker, #f3f3f3); }
.tile-name { display: block; font-size: 13.5px; font-weight: 600; }
.tile b { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.filters { margin: 18px 0 12px; }
.filters-toggle { display: none; cursor: pointer; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-weight: 600; }
.swatch-chip { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: var(--s); cursor: pointer; padding: 0; }
.swatch-chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.topic-text { max-width: 78ch; margin: 28px 0; }
.topic-text h2 { font-size: 18px; margin: 20px 0 8px; }
.topic-text p { line-height: 1.65; color: var(--ink-2); }
.topic-faq { max-width: 78ch; margin: 24px 0; }
.topic-faq h2 { font-size: 18px; margin-bottom: 8px; }
.topic-faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.topic-faq summary { cursor: pointer; font-weight: 600; }
.topic-faq p { margin: 8px 0 0; color: var(--ink-2); line-height: 1.6; }
@media (max-width: 720px) {
    .filters-toggle { display: block; }
    .filters:not([open]) .toolbar { display: none; }
    .tile-row { grid-template-columns: repeat(2, 1fr); }
}

/* Меню каталога в шапке: разделы с популярными категориями. */
/* Меню разворачивается от правого края кнопки, а не от левого: при ширине
   до 1080 пикселей левый вариант уезжал за правый край окна и включал
   горизонтальную прокрутку всей страницы. */
.header-inner { position: relative; }
.megamenu { position: static; display: inline-block; }
.megamenu > summary { cursor: pointer; list-style: none; }
.megamenu > summary::-webkit-details-marker { display: none; }
.megamenu > summary::after { content: "▾"; margin-left: 5px; opacity: .6; }
.megamenu[open] > summary { background: var(--surface-2, #eef1f5); }
.megamenu-body {
    position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% - 6px);
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px 22px; width: auto;
    max-height: 70vh; overflow-y: auto;
    padding: 18px 20px; border-radius: 14px;
    background: var(--surface, #fff); box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.megamenu-column { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.megamenu-column a { color: var(--muted, #64748b); text-decoration: none; padding: 1px 0; }
.megamenu-column a:hover { color: var(--accent, #2563eb); }
.megamenu-section { font-weight: 600; color: var(--text, #0f172a) !important; margin-bottom: 4px; }
@media (max-width: 720px) {
    .megamenu-body { position: static; width: 100%; max-height: none; box-shadow: none; padding: 12px 0; border: 1px solid var(--line); margin-top: 8px; }
}

/* Витрина разделов и списки категорий. */
.section-block { margin: 26px 0; }
/* Счётчик ставим сразу за названием раздела: прижатый к правому краю,
   он отрывался от заголовка на всю ширину страницы. */
.section-block .section-head { display: flex; align-items: baseline; justify-content: flex-start; gap: 10px; }
.section-block h2 { font-size: 19px; margin: 0 0 8px; }
.section-block h2 a { text-decoration: none; color: inherit; }
.section-icon { margin-right: 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-more { font-weight: 600; }

/* Карточка: кнопка скачивания, чипы, палитра, вопросы. */
.download-main {
    display: block; margin: 14px 0 10px; padding: 13px 18px;
    text-align: center; font-weight: 700; font-size: 16px;
    color: #fff; background: var(--accent, #2563eb); border-radius: 12px; text-decoration: none;
}
.download-main:hover { filter: brightness(1.08); }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 14px; padding: 0; font-size: 12px; }
.detail-chips li { padding: 3px 9px; border-radius: 999px; background: var(--surface-2, #eef1f5); color: var(--muted, #64748b); }
.palette { margin: 16px 0; }
.palette-title { font-size: 14px; margin: 0 0 8px; }
.palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
/* Своё имя класса: .swatch занят образцами фона в редакторе, и два разных
   правила на одном элементе ломали раскладку — подписи налезали друг на друга. */
.palette-swatch {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    width: auto; height: auto; padding: 0 0 5px;
    border: 1px solid var(--border, #e2e8f0); border-radius: 10px;
    background: transparent; cursor: pointer; font: inherit; font-size: 11px;
    line-height: 1.4; color: var(--muted, #64748b); font-variant-numeric: tabular-nums;
}
.palette-swatch::before { content: ""; display: block; width: 56px; height: 34px; border-radius: 9px 9px 0 0; background: var(--swatch); }
.palette-swatch > span { padding: 0 6px; white-space: nowrap; }
.palette-swatch.copied { border-color: var(--accent, #2563eb); color: var(--accent, #2563eb); }
.editor-box { margin: 16px 0; }
.editor-box > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.faq { margin: 28px 0; }
.faq details { border-top: 1px solid var(--border, #e2e8f0); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted, #475569); }
.download-sticky { display: none; }
/* Липкая кнопка показывается, только когда обычная ушла за верхний край.
   Раньше они были видны одновременно и накладывались друг на друга:
   замер 29.09 на 390×844 нашёл липкую на 779–832 точках и обычную на
   807–858, причём липкая закрывала начало описания. Класс ставит скрипт;
   без него кнопка просто остаётся видимой, как было. */
.download-sticky.is-hidden { opacity: 0; transform: translateY(120%); pointer-events: none; }
@media (max-width: 720px) {
    .download-sticky {
        display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30;
        transition: opacity .18s ease, transform .18s ease;
        padding: 14px; text-align: center; font-weight: 700; color: #fff;
        background: var(--accent, #2563eb); border-radius: 12px; text-decoration: none;
        box-shadow: 0 10px 24px rgba(37, 99, 235, .35);
    }
    .detail-page { padding-bottom: 76px; }
}

/* Страница скачивания: превью, отсчёт, выбор формата. */
.download-box { display: grid; grid-template-columns: 320px 1fr; gap: 26px; margin: 18px 0 30px; align-items: start; }
.download-preview { display: grid; place-items: center; padding: 14px; border-radius: 14px; }
.download-preview img { max-width: 100%; height: auto; }
.download-side h1 { font-size: 20px; margin: 0 0 6px; }
.download-facts { color: var(--muted, #64748b); font-size: 13px; margin: 0 0 14px; }
.download-options { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.download-options label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted, #64748b); }
.download-options select { padding: 8px 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 9px; font: inherit; }
.download-timer { font-weight: 600; margin: 12px 0 8px; }
.download-check { margin: 10px 0; }
.download-note { font-size: 12px; color: var(--muted, #94a3b8); margin-top: 10px; }
#download-button[disabled] { opacity: .55; cursor: default; }
@media (max-width: 720px) {
    .download-box { grid-template-columns: 1fr; }
}

/* Узкий экран: две колонки в сетке, короткие подписи, компактная шапка. */
@media (max-width: 480px) {
    .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .card-title {
        display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
        overflow: hidden; font-size: 12px; line-height: 1.3;
    }
    .card-meta { font-size: 11px; }
    .page-head h1 { font-size: 22px; line-height: 1.2; }
    .count { font-size: 13px; }
    .hints { font-size: 12px; }
    .showcase-row { gap: 8px; }
    .tile-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; gap: 14px; }
    .specs { font-size: 13px; }
    /* Фильтры на теме прячем за кнопкой: на узком экране они занимали экран целиком. */
    .filters > summary { padding: 10px 12px; border-radius: 10px; background: var(--surface-2, #eef1f5); font-weight: 600; }
    .filters[open] > summary { margin-bottom: 10px; }
    .megamenu-body { max-height: 60vh; }
}

/* Подсказки под поиском и подборки на главной. */
.hints { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin: 10px 0 0; color: var(--muted, #64748b); font-size: 13px; }
.hints a { color: var(--accent, #2563eb); text-decoration: none; }
.hints a:hover { text-decoration: underline; }
.collection { margin: 22px 0; }

/* Число внутри чипа — отдельной меткой, иначе оно слипается с названием
   («Акварель2» вместо «Акварель · 2»). */
.chip span {
    margin-left: 6px; padding: 1px 6px;
    /* 11 px давали контраст 3,46 к подложке метки при норме 4,5: число
       читалось хуже названия рядом с ним. Кегль и цвет подняты. */
    font-size: 12px; line-height: 1.5;
    color: var(--ink-2);
    background: var(--badge);
    border-radius: 999px;
}
.chip--on span, .chip.is-on span { background: rgba(255, 255, 255, .25); color: inherit; }
.chip { display: inline-flex; align-items: center; text-decoration: none; }

/* Шапка на узком экране: меню в одну строку, без переносов и лишней высоты. */
@media (max-width: 480px) {
    .site-nav { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .site-nav::-webkit-scrollbar { display: none; }
    /* Поля ужимаем, высоту цели — нет: попасть пальцем важнее, чем
       выгадать четыре точки высоты шапки. */
    .site-nav > a, .megamenu > summary { white-space: nowrap; font-size: 14px; padding: 4px 7px; min-height: 44px; }
    .megamenu > summary::after { content: ""; }
    /* Правила переключателя языков вынесены ниже: сворачивать его надо
       раньше, чем на 480 точках. */
}


/* ---------- Разделы: подзаголовок, плитки, счётчики ---------- */

/* Вводная строка под заголовком раздела и категории. Без неё описание
   шло тем же кеглем, что и остальной текст, и заголовок терялся. */
.lead { max-width: 78ch; margin: 8px 0 18px; color: var(--ink-2); font-size: 16px; }
.section-block .section-head b { font-size: 13px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.topic-more { margin: 24px 0 0; font-weight: 600; }
.topic-more a { color: var(--accent); }
.topic-more a:hover { text-decoration: underline; }
.topic-related, .topic-children { margin: 32px 0; }

/* Плитка категории в разделе. Если превью ещё не собраны, пустая рамка
   для миниатюр оставляла коробку высотой в половину плитки. */
.tile-thumbs:not(:has(img)) { display: none; }
/* Квадрат два на два: у одних категорий превью четыре, у других одно,
   и без заданных строк плитки в ряду расходились по высоте. */
/* Высоту плиток ровняем разметкой, а не стилями: пустые ячейки добиваются
   до четырёх в шаблоне, и блок миниатюр всегда занимает две строки.
   Прежний приём — aspect-ratio на самом грид-контейнере — Safari на
   телефоне не держал, картинки вылезали за карточку поверх подписи. */
.tile-thumbs img, .tile-blank { width: 100%; height: auto; aspect-ratio: 1; }
.tile-thumbs img { object-fit: contain; background: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 12px 12px; }
.tile-blank { display: block; }
.tile { display: flex; flex-direction: column; gap: 2px; background: var(--surface); overflow: hidden; }
.tile-name { margin-top: auto; }
.tile b { margin-top: 2px; }

/* ---------- Шапка на узком экране ---------- */

/* Логотип и языки в одну строку, поиск и меню — во всю ширину.
   Раньше шапка занимала четыре ряда и съедала пол-экрана. */
@media (max-width: 720px) {
    .header-inner { gap: 10px 12px; padding-top: 10px; padding-bottom: 10px; }
    .logo { order: 1; flex: 1 1 auto; font-size: 19px; }
    .lang-switch { order: 2; }
    .search-form { order: 3; flex: 1 1 100%; }
    .site-nav { order: 4; flex: 1 1 100%; }
    main { padding: 20px 0 48px; }
    .wrap { padding: 0 16px; }
}

/* ---------- Страница «Категории»: плитки разделов ---------- */

/* Плитка раздела и строчка ссылок под ней живут одной ячейкой сетки,
   иначе ссылки уезжают из-под своей плитки при разной высоте соседей. */
.tile-card { display: flex; flex-direction: column; gap: 6px; }
.tile-card .tile { flex: 1 0 auto; }

/* Самые крупные категории раздела — текстом под плиткой. Это ссылки, а не
   украшение: без них до категории пришлось бы идти через раздел. */
.tile-links {
    margin: 0; padding: 0 2px;
    font-size: 12.5px; line-height: 1.7; color: var(--ink-3);
}
.tile-links a { color: var(--ink-2); }
.tile-links a:hover { color: var(--accent); text-decoration: underline; }
.tile-links span { margin: 0 5px; opacity: .5; }

/* Поиск по названию раздела. Тридцать плиток глазами перебирать дольше,
   чем набрать три буквы. */
.filter-inline { display: block; margin: 0 0 18px; }
.filter-inline input {
    width: 100%; max-width: 380px; min-height: 44px;
    padding: 10px 14px; font: inherit; font-size: 15px;
    color: var(--ink); background: var(--surface);
    border: 1px solid var(--line); border-radius: 10px;
}
.filter-inline input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* На телефоне четыре миниатюры выстраиваем в одну полосу, а не квадратом
   два на два: страница «Категории» с двадцатью восемью разделами из-за
   квадратов вытягивалась почти на шесть экранов. Полоса вдвое ниже, а
   картинки всё так же видно. */
@media (max-width: 560px) {
    #section-tiles .tile-thumbs { grid-template-columns: repeat(4, 1fr); gap: 3px; }
    #section-tiles .tile-links { line-height: 1.55; }
}

/* Цели нажатия в выпадающем меню. Ссылок там больше двух сотен, и делать
   каждую в 44 точки — превратить меню в простыню; 40 достаточно, чтобы
   палец попадал, и список остаётся обозримым. */
.megamenu-body a { display: block; min-height: 40px; display: flex; align-items: center; }
.logo { display: inline-flex; align-items: center; min-height: 44px; }

/* Текстовые ссылки, которые стоят плотным рядом, всё равно должны быть
   целью для пальца. Высоту добираем полями, а не кеглем: строка остаётся
   такой же на вид, а попасть в неё становится можно. */
.tile-links a { display: inline-block; padding: 6px 0; }
.breadcrumbs a, .breadcrumbs span { display: inline-flex; align-items: center; min-height: 32px; }

/* Оставшиеся мелкие цели: подсказки под поиском, чипы фильтров, ссылки
   подвала и раскрывающиеся вопросы. Всюду добираем высоту полями —
   надпись остаётся прежней, а попасть в неё пальцем становится можно. */
.hints a { display: inline-flex; align-items: center; min-height: 32px; }
.chip { min-height: 32px; display: inline-flex; align-items: center; }
.footer-nav a { display: inline-flex; align-items: center; min-height: 32px; }
.faq summary { min-height: 40px; display: flex; align-items: center; }

/* ---------- Подвал ---------- */

/* Ссылок в подвале не было вовсе. Теперь их семь — раскладываем в строку
   с переносом, чтобы на телефоне они не вытянулись столбиком. */
.footer-nav {
    display: flex; flex-wrap: wrap; gap: 4px 18px;
    margin-bottom: 10px; font-size: 14px;
}
.footer-nav a { color: var(--ink-2); }
.footer-nav a:hover { color: var(--accent); text-decoration: underline; }

/* Крошки на телефоне: одна строка с прокруткой вместо переноса. При
   переносе последняя стрелка оставалась одна на второй строке, а вся
   цепочка занимала 72 точки высоты над картинкой. */
@media (max-width: 560px) {
    .breadcrumbs {
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
        scrollbar-width: none; margin-bottom: 12px;
    }
    .breadcrumbs::-webkit-scrollbar { display: none; }
    .breadcrumbs a, .breadcrumbs span { white-space: nowrap; flex: 0 0 auto; }
    /* Последнее звено — имя текущей страницы, оно длинное и упирается в
       край; обрезаем его, а не всю цепочку. */
    .breadcrumbs [aria-current="page"] { overflow: hidden; text-overflow: ellipsis; max-width: 55vw; display: block; }
}


/* Переключатель языков сворачивается до 720 точек, а не до 480: при 500
   шесть ссылок разворачивались в строку и выдавливали остальную шапку —
   на скриншоте прода их не было видно вовсе. 720 — та же граница, на
   которой появляется липкая кнопка скачивания, то есть «узкий экран». */
@media (max-width: 720px) {
    .lang-switch > summary { display: inline-flex; }
    .lang-switch:not([open]) .lang-switch-body { display: none; }
    /* Раскрытый список ложится поверх страницы, а не раздвигает шапку:
       иначе при выборе языка всё содержимое прыгает вниз. */
    .lang-switch[open] .lang-switch-body {
        position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
        flex-wrap: wrap; width: max-content; max-width: 70vw; gap: 2px;
        padding: 6px; background: var(--surface);
        border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    }
    .lang-switch a { min-width: 44px; font-size: 13px; }
}

/* ---------- Карта сайта для людей ---------- */

.sitemap-block { margin: 0 0 28px; }
.sitemap-block h2 {
    display: flex; align-items: baseline; gap: 10px;
    margin: 0 0 10px; font-size: 18px;
}
.sitemap-block h2 b { font-size: 12px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* Колонками: у крупного раздела сотня категорий, и в один столбец это
   простыня на несколько экранов. */
.sitemap-list {
    columns: 4 190px; column-gap: 26px;
    margin: 0; padding: 0; list-style: none; font-size: 14px;
}
.sitemap-list li { break-inside: avoid; padding: 5px 0; }
.sitemap-list a { color: var(--ink-2); }
.sitemap-list a:hover { color: var(--accent); text-decoration: underline; }
.sitemap-list span { margin-left: 6px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
