/*
 * iref.kz — «Переплёт и закладка» (site/DESIGN.md). Токены — §2, шрифт — §3, компоненты — §5.
 * Тело записи (.prose) — только оформление: разметку, текст и атрибуты тема не трогает (граница шага А).
 */

/* ---------- шрифт: Literata, пять подмножеств (unicode-range = site/tools/build-fonts.py) ---------- */
@font-face {
  font-family: Literata;
  src: url("fonts/literata-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00BB, U+00D7, U+00F7, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026,
    U+2039-203A, U+20AC, U+2122;
}
@font-face {
  font-family: Literata;
  src: url("fonts/literata-cyrillic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0401-044F, U+0451-045F, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Literata;
  src: url("fonts/literata-cyrillic-ext.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0492-0493, U+049A-049B, U+04A2-04A3, U+04AE-04AF, U+04BA-04BB, U+04D8-04D9, U+04E8-04E9;
}
@font-face {
  font-family: Literata;
  src: url("fonts/literata-extra.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+011E-011F, U+0130, U+014B, U+015E-015F, U+018F, U+0259;
}
@font-face {
  font-family: Literata;
  src: url("fonts/literata-greek-semicolon.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+037E;
}
/* Запасные с профилем метрик Literata (асцендер 1.177, десцендер 0.308, x-height 0.507), DESIGN.md §3 */
@font-face {
  font-family: "Literata Fb Noto";
  src: local("Noto Serif"), local("NotoSerif-Regular");
  size-adjust: 98.66%;
  ascent-override: 119.3%;
  descent-override: 31.22%;
  line-gap-override: 0%;
}
/* ГИПОТЕЗА: метрики Georgia взяты по памяти (2048 upm, асцендер 1878, десцендер 449, x-height 986) — пересчитать по
   файлу Georgia до теста шрифтов (DESIGN.md §3), иначе критерий CLS на Windows/macOS/iOS не проверяем */
@font-face {
  font-family: "Literata Fb Georgia";
  src: local("Georgia");
  size-adjust: 105.4%;
  ascent-override: 111.7%;
  descent-override: 29.2%;
  line-gap-override: 0%;
}

/* ---------- токены ---------- */
:root {
  color-scheme: light dark;
  --paper: oklch(0.988 0.004 170);
  --paper-2: oklch(0.962 0.008 170);
  --rule: oklch(0.885 0.012 170);
  --ink: oklch(0.245 0.014 175);
  --ink-2: oklch(0.455 0.016 175);
  --cloth: oklch(0.44 0.085 165);
  --cloth-deep: oklch(0.365 0.075 165);
  --cloth-wash: oklch(0.952 0.024 165);
  --ribbon: oklch(0.62 0.185 36);
  --ribbon-ink: oklch(0.53 0.165 34);
  --field: oklch(0.60 0.014 170);
  --link-hover: var(--cloth-deep);
  --btn-bg: var(--cloth);
  --btn-fg: var(--paper);
  --btn-hover: var(--cloth-deep);

  --sv-bg: oklch(0.195 0.012 170);
  --sv-bg-2: oklch(0.235 0.014 170);
  --sv-ink: oklch(0.93 0.008 170);
  --sv-ink-2: oklch(0.775 0.012 170);

  --f-text: Literata, "Literata Fb Georgia", "Literata Fb Noto", serif;
  --f-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --fs-body: clamp(1.125rem, 1.09rem + 0.18vw, 1.25rem);
  --fs-small: 0.9375rem;
  --fs-label: 0.8125rem;

  --r-xs: 3px;
  --r-sm: 6px;
  --r-md: 10px;
  --gutter: 16px;
  --wide: 1180px;
  --ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.195 0.012 170);
    --paper-2: oklch(0.235 0.014 170);
    --rule: oklch(0.335 0.014 170);
    --ink: oklch(0.93 0.008 170);
    --ink-2: oklch(0.775 0.012 170);
    --cloth: oklch(0.80 0.105 165);
    --cloth-deep: oklch(0.80 0.105 165);
    --cloth-wash: oklch(0.31 0.045 165);
    --ribbon: oklch(0.72 0.155 40);
    --ribbon-ink: oklch(0.72 0.155 40);
    --field: oklch(0.56 0.014 170);
    --link-hover: oklch(0.93 0.008 170);
    --btn-bg: oklch(0.80 0.105 165);
    --btn-fg: oklch(0.195 0.012 170);
    --btn-hover: oklch(0.93 0.008 170);
  }
}
@media (min-width: 720px) {
  :root { --gutter: 24px; }
}

/* ---------- основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-bottom: 72px; /* якорная реклама AdSense внизу экрана — уточнить по живой рекламе (DESIGN.md §5) */
}
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: var(--fs-body);
  line-height: 1.65;
  hyphens: manual;
  overflow-wrap: break-word;
  font-synthesis-weight: none;
}
img, svg, video { max-width: 100%; }
img { height: auto; }
svg { flex: none; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-text); color: var(--ink); text-wrap: balance; }
h2 { font-size: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem); font-weight: 700; line-height: 1.22; }
h3 { font-size: 1.1875rem; font-weight: 640; line-height: 1.3; }
p { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }

a { color: var(--cloth); text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:visited { color: var(--cloth-deep); }
@media (prefers-color-scheme: dark) { a:visited { color: var(--cloth); } }
@media (hover: hover) and (pointer: fine) {
  a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
}
:focus-visible { outline: 2px solid var(--cloth); outline-offset: 2px; border-radius: 2px; }
.main:focus { outline: none; }

.vh, .vh-sm {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
@media (min-width: 720px) {
  .vh-sm { position: static !important; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; clip-path: none; white-space: normal; }
}
.skip {
  position: absolute; left: var(--gutter); top: 8px; z-index: 20; transform: translateY(-200%);
  background: var(--paper); color: var(--cloth); padding: 10px 16px; border: 2px solid var(--cloth); border-radius: var(--r-sm);
  font: 500 1rem/1.35 var(--f-ui);
}
.skip:focus { transform: none; }

.wrap { width: 100%; max-width: calc(var(--wide) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* одноколоночные сетки: колонка не шире контейнера (иначе строка крошек с nowrap раздувает страницу вбок) */
.doc-head, .list-head, .home, .home-head, .after, .doc-foot, .search, .row-body, .top-b, .empty, .ft, .ent, .adj-a {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border: 0; border-radius: var(--r-sm);
  font: 500 1rem/1.2 var(--f-ui); text-decoration: none; cursor: pointer;
  transition: background-color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn--primary, .btn--primary:visited { min-height: 48px; padding: 12px 20px; background: var(--btn-bg); color: var(--btn-fg); }
.btn--quiet, .btn--quiet:visited { background: var(--paper-2); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { background: var(--btn-hover); color: var(--btn-fg); }
  .btn--quiet:hover { background: var(--cloth-wash); color: var(--ink); }
}

/* ---------- шапка ---------- */
.site-header { position: relative; border-bottom: 1px solid var(--rule); background: var(--paper); }
.hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding-block: 10px; }
.brand {
  display: inline-flex; align-items: baseline; min-height: 44px; padding-top: 4px;
  font: 760 1.75rem/1 var(--f-text); letter-spacing: -0.02em; text-decoration: none; color: var(--cloth);
}
.brand:visited { color: var(--cloth); }
.brand-i { color: var(--cloth); }
.brand-r { position: relative; }
.brand-ribbon { position: absolute; left: 0.4em; top: 0.32em; width: 4px; height: 14px; fill: var(--ribbon); }
.brand-tld { color: var(--ink-2); font-weight: 640; }
@media (hover: hover) and (pointer: fine) { .brand:hover { color: var(--cloth); } }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details > summary svg { transition: transform 160ms var(--ease); }
details[open] > summary svg { transform: rotate(180deg); }

.nav-desk { display: none; }
.nd { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nd > li { position: relative; }
.nd-link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 8px 12px; border-radius: var(--r-sm);
  font: 500 1rem/1.2 var(--f-ui); color: var(--ink); text-decoration: none;
}
a.nd-link:visited { color: var(--ink); }
.nd-link.is-here, .nd-link[aria-current] { background: var(--cloth-wash); }
.nd-link--quiet { color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) {
  .nd-link:hover { color: var(--cloth); text-decoration: underline; text-underline-offset: 0.18em; }
}
.dd--sub { position: relative; }
.dd-list {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 10; min-width: 240px; margin: 0; padding: 8px;
  list-style: none; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-md);
}
.dd-list--cols { columns: 2; column-gap: 8px; min-width: 520px; }
.dd-list li { break-inside: avoid; }
.dd-list a {
  display: block; padding: 10px 12px; border-radius: var(--r-sm); font: 500 1rem/1.3 var(--f-ui); text-decoration: none; color: var(--ink);
}
.dd-list a[aria-current] { background: var(--cloth-wash); }
@media (hover: hover) and (pointer: fine) { .dd-list a:hover { color: var(--cloth); text-decoration: underline; } }

.dd--nav { margin-left: auto; }
.hd-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: var(--r-sm);
  background: var(--paper-2); color: var(--ink); font: 500 1rem/1.2 var(--f-ui);
}
.dd--nav[open] .hd-btn { background: var(--cloth-wash); }
.nav-mob {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 10; padding: 8px var(--gutter) 16px;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.nm, .nm ul { list-style: none; margin: 0; padding: 0; }
.nm ul { padding: 0 0 8px 12px; }
.nm a, .nm summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 10px 12px;
  border-radius: var(--r-sm); font: 500 1.0625rem/1.3 var(--f-ui); color: var(--ink); text-decoration: none;
}
.nm a[aria-current] { background: var(--cloth-wash); }
.nm > li + li { border-top: 1px solid var(--rule); }

.hd-search { flex: 1 1 100%; padding-bottom: 4px; }
@media (min-width: 960px) {
  .nav-desk { display: block; }
  .dd--nav { display: none; }
  .hd { flex-wrap: nowrap; }
  .hd-search { flex: 0 1 280px; margin-left: auto; padding: 0; }
}

/* ---------- поиск ---------- */
.search { display: grid; gap: 8px; }
.search-label { font: 600 1rem/1.3 var(--f-ui); color: var(--ink); }
.search-row { display: flex; gap: 8px; }
.search-input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); font: 400 1rem/1.2 var(--f-ui);
}
.search-input::placeholder { color: var(--ink-2); opacity: 1; }
.search-input:focus-visible { outline: 2px solid var(--cloth); outline-offset: 1px; border-color: var(--cloth); }
.search-btn { flex: none; }
.search--header .search-input { height: 44px; }
.search--header .search-btn { min-height: 44px; padding: 8px 14px; }
.search--page { max-width: 640px; margin-top: 20px; }
@media (max-width: 419px) {
  /* узкий телефон: в «Найти» только значок (подпись остаётся для читалок), чтобы подсказка в поле читалась целиком —
     с подписью на 360px запас был 2px, на другом шрифте телефона подсказка обрезалась (human-qa 14.10.2026) */
  .search--page .search-btn { min-width: 48px; padding-inline: 14px; }
  .search--page .search-input { padding-inline: 12px; }
  .search--page .search-btn span {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
}

/* ---------- крошки, ярлыки, факты ---------- */
.crumbs { font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); }
.crumbs ol { display: flex; min-width: 0; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
.crumbs li { flex: none; }
.crumbs li:last-child { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.crumbs li + li::before { content: "›"; padding: 0 6px; color: var(--ink-2); }
.crumbs a { color: var(--ink-2); text-decoration-color: color-mix(in oklch, var(--ink-2) 50%, transparent); }
.crumbs a:visited { color: var(--ink-2); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag {
  display: inline-block; padding: 3px 8px; border-radius: var(--r-xs);
  font: 600 var(--fs-label)/1.2 var(--f-ui); color: var(--ink-2); background: var(--paper-2);
}
.tag--fmt { background: var(--cloth-wash); color: var(--ink); }

.facts { font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.facts .sep { padding-inline: 2px; }

.is-caps { letter-spacing: 0.01em; }

/* ---------- запись ---------- */
.doc, .after { max-width: calc(46rem + 2 * var(--gutter)); }
.doc-head { display: grid; gap: 12px; padding-top: 16px; }
.doc-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.doc-term { font: 500 1rem/1.3 var(--f-ui); }
.doc-title { font-size: clamp(1.625rem, 1.35rem + 1.4vw, 2.5rem); font-weight: 700; line-height: 1.16; letter-spacing: -0.01em; }
.doc-title.is-caps { font-size: clamp(1.375rem, 1.18rem + 1vw, 2rem); font-weight: 640; line-height: 1.22; letter-spacing: 0.01em; }
.doc-facts { margin-top: -2px; }
/* обложка статьи: своя пропорция, но не выше 28rem (вертикальные фото обрезаются по центру) */
.doc-cover { margin: 24px 0 0; }
.doc-cover-img { display: block; width: 100%; height: auto; max-height: 28rem; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
/* сток рефератов и слайдов (640×427): не шире своего размера и ниже — полосой 2:1, чтобы текст начинался на первом экране */
.doc-cover--stock .doc-cover-img { max-width: 640px; aspect-ratio: 2 / 1; }

.prose { max-width: 68ch; padding-top: 24px; }
/* абзац длиннее 30 тыс. знаков (23 записи) — запасные шрифты с метриками Literata, без вариативной (DESIGN.md §3) */
.prose--plain { font-family: "Literata Fb Georgia", "Literata Fb Noto", serif; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table, .prose figure, .prose pre { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.25em; }
.prose h2 { margin: 1.6em 0 0.6em; }
.prose h3, .prose h4 { margin: 1.4em 0 0.5em; }
.prose h4 { font-size: 1.0625rem; font-weight: 700; }
.prose strong, .prose b { font-weight: 640; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { padding-left: 16px; border-left: 3px solid var(--rule); color: var(--ink); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose table {
  display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; border: 0; /* рамка WP border="1" — outset браузера */
  font: 400 var(--fs-small)/1.45 var(--f-ui);
}
.prose th, .prose td { padding: 8px 10px; border: 1px solid var(--rule); vertical-align: top; text-align: left; }
.prose th { background: var(--paper-2); font-weight: 600; }
.prose iframe { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; }
.prose .wp-caption, .prose figure { max-width: 100%; }
.prose figcaption, .prose .wp-caption-text { font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); margin-top: 6px; }
.prose .aligncenter { display: block; margin-inline: auto; }
@media (min-width: 720px) {
  .prose .alignleft { float: left; margin: 0.3em 1.2em 0.8em 0; max-width: 50%; }
  .prose .alignright { float: right; margin: 0.3em 0 0.8em 1.2em; max-width: 50%; }
}
.prose::after { content: ""; display: table; clear: both; }

/* «Читайте также» — блок внутри текста, только CSS */
.prose .inline-related-post { margin: 0 0 1em; padding: 12px 16px; background: var(--paper-2); border-radius: var(--r-sm); }
.prose .inline-related-post a { display: block; text-decoration: none; }
.prose .inline-related-post a > span:first-child { display: block; font: 600 var(--fs-label)/1.3 var(--f-ui); color: var(--ink-2); margin-bottom: 2px; }
.prose .inline-related-post a > span + span { color: var(--cloth); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
@media (hover: hover) and (pointer: fine) {
  .prose .inline-related-post a:hover > span + span { text-decoration-thickness: 2px; color: var(--link-hover); }
}

/* галерея слайдов (DESIGN.md §5 «Лента слайдов») */
.prose .gallery { display: grid; grid-template-columns: 1fr; gap: 16px; margin: 0 0 1em; }
@media (min-width: 720px) { .prose .gallery { grid-template-columns: 1fr 1fr; } }
.prose .gallery-item { margin: 0; width: auto; max-width: none; float: none; }
.prose .gallery-icon { background: var(--paper-2); border-radius: var(--r-md); overflow: hidden; }
.prose .gallery-icon a { display: block; }
.prose .gallery img { display: block; width: 100%; height: auto; border: 0; }
.prose .gallery-caption { margin-top: 6px; font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); }
.prose .gallery br { display: none; }

.doc-foot { display: grid; gap: 24px; max-width: 68ch; margin-top: 32px; }
.to-top a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font: 500 1rem/1.2 var(--f-ui); }

.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-status { min-height: 1.5em; margin-top: 8px; font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink); }
.share-status:not(:empty) { display: inline-block; padding: 4px 10px; background: var(--paper-2); border-radius: var(--r-xs); }
.share-field { display: block; width: 100%; max-width: 480px; height: 44px; margin-top: 8px; padding: 0 12px; border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font: 400 1rem/1 var(--f-ui); }

.after { display: grid; gap: 40px; padding-top: 48px; }
.related h2 { margin-bottom: 8px; }
.related .row-title { font-size: 1.1875rem; }
.adj { display: grid; gap: 12px; }
@media (min-width: 720px) { .adj { grid-template-columns: 1fr 1fr; } .adj-a--next { grid-column: 2; text-align: right; } }
.adj-a { display: grid; gap: 4px; padding: 12px 0; text-decoration: none; }
.adj-l { display: inline-flex; align-items: center; gap: 6px; font: 500 1rem/1.3 var(--f-ui); color: var(--cloth); }
.adj-a--next .adj-l { justify-content: flex-end; }
.adj-t {
  color: var(--ink); font-weight: 640; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
@media (hover: hover) and (pointer: fine) { .adj-a:hover .adj-l { text-decoration: underline; text-underline-offset: 0.18em; } }
.all-in a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font: 500 1rem/1.3 var(--f-ui); }

/* закладка чтения: только CSS, где есть scroll-driven animations; иначе полосы нет */
.progress { display: none; }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .progress {
      display: block; position: fixed; inset: 0 0 auto 0; z-index: 30; height: 3px; background: var(--ribbon);
      transform-origin: 0 50%; transform: scaleX(0);
      animation: ir-read linear both; animation-timeline: scroll(root);
    }
  }
}
@keyframes ir-read { to { transform: scaleX(1); } }

/* ---------- списки ---------- */
.listing { padding-bottom: 16px; }
.listing > .top-sec { margin-top: 40px; }
.list-head { display: grid; gap: 10px; padding: 16px 0 8px; max-width: 46rem; }
.list-title { font-size: clamp(1.625rem, 1.35rem + 1.4vw, 2.5rem); font-weight: 700; line-height: 1.16; letter-spacing: -0.01em; }
.list-meta { font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.list-desc { color: var(--ink-2); }
.eyebrow { font: 600 var(--fs-small)/1.3 var(--f-ui); color: var(--ink-2); }
.lede { color: var(--ink-2); }

.rows { max-width: 52rem; border-top: 1px solid var(--rule); }
.row { display: grid; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.row--img { grid-template-columns: 96px 1fr; align-items: start; }
.row-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
.row-body { display: grid; gap: 6px; min-width: 0; }
.row-title { font-size: 1.1875rem; font-weight: 640; line-height: 1.3; }
.row-title.is-caps { font-size: 1.0625rem; }
.row-ex { display: none; font: 400 var(--fs-small)/1.5 var(--f-ui); color: var(--ink-2); }
@media (min-width: 720px) {
  .row--img { grid-template-columns: 120px 1fr; gap: 16px; }
  .row-ex { display: block; }
}

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips-h { font: 400 var(--fs-small)/1.2 var(--f-ui); color: var(--ink-2); }
.chips a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: var(--r-sm);
  background: var(--paper-2); font: 500 var(--fs-small)/1.2 var(--f-ui); color: var(--ink); text-decoration: none;
}
.chip-n { color: var(--ink-2); font-variant-numeric: tabular-nums; }

.empty { display: grid; gap: 8px; max-width: 46rem; padding: 16px 0 24px; }
.empty ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); }

/* пагинация */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 24px 0 8px; font: 500 1rem/1.2 var(--f-ui); }
.pager-of { color: var(--ink-2); font-variant-numeric: tabular-nums; padding-inline: 4px; }
.pager-pages { display: none; }
.pager-step:last-child { margin-left: auto; }
@media (min-width: 720px) {
  .pager-of { display: none; }
  .pager-pages { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 0; padding: 0; }
  .pager-step:last-child { margin-left: 0; }
}
.pager-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 8px;
  border-radius: var(--r-sm); color: var(--cloth); text-decoration: none; font-variant-numeric: tabular-nums;
}
a.pager-n:visited { color: var(--cloth); }
.pager-n[aria-current] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -3px 0 var(--ribbon); border-radius: 0; }
.pager-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 44px; color: var(--ink-2); }
@media (hover: hover) and (pointer: fine) { a.pager-n:hover { background: var(--paper-2); text-decoration: underline; } }

/* ---------- главная ---------- */
.home { display: grid; gap: 56px; padding-block: 24px 16px; }
.home-head { display: grid; gap: 8px; max-width: 46rem; }
.display { font-size: clamp(2.5rem, 1.9rem + 3vw, 4rem); font-weight: 760; line-height: 1; letter-spacing: -0.02em; color: var(--cloth); }
.home-head .search--page { margin-top: 16px; }
.ents { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 46rem; }
/* на главной компьютера — по колонкам «Популярного» ниже (тот же зазор 32px), а не 2/3 ширины */
@media (min-width: 960px) { .home-ents .ents { max-width: none; column-gap: 32px; } }
.ent { display: grid; gap: 4px; padding: 16px; background: var(--paper-2); border-radius: var(--r-md); }
.ent-t { font-size: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem); font-weight: 700; line-height: 1.2; }
.ent-n { font: 400 var(--fs-small)/1.45 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.home-sec > h2, .top-sec > h2 { margin-bottom: 16px; }
.top { display: grid; gap: 0 32px; counter-reset: none; }
@media (min-width: 960px) { .top { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(var(--top-rows, 6), auto); grid-auto-flow: column; } }
.top-i { display: grid; grid-template-columns: 2.25rem 1fr; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--rule); align-items: start; }
.top-n { font: 700 1.5rem/1.1 var(--f-text); color: var(--ribbon-ink); font-variant-numeric: tabular-nums lining-nums; text-align: right; padding-top: 2px; }
.top-b { display: grid; gap: 6px; min-width: 0; }
.top-t { font-size: 1.1875rem; font-weight: 640; line-height: 1.3; }
.top-t.is-caps { font-size: 1.0625rem; }
/* «Статьи» на главной: телефон — первая карточка с большой обложкой, остальные строкой с обложкой слева;
   ≥600px — две колонки, ≥960px — четыре по сетке «Популярного» (края 2-й и 3-й совпадают с его колонками) */
.cards { display: grid; gap: 16px; }
.card { position: relative; display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; align-content: start; }
.card:first-child, .card--text { grid-template-columns: 1fr; }
.card-img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: var(--r-sm); background: var(--paper-2); }
.card-b { display: grid; gap: 4px; min-width: 0; }
.card-k { font: 500 var(--fs-label)/1.3 var(--f-ui); color: var(--ink-2); }
.card-t { font-size: 1.0625rem; font-weight: 640; line-height: 1.3; }
.card-t a::after { content: ""; position: absolute; inset: 0; }
.card:first-child .card-t { font-size: 1.1875rem; }
@media (max-width: 599px) { .card:not(:first-child) .card-img { aspect-ratio: 4 / 3; } }
.cards + .rows { margin-top: 24px; }
@media (min-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; gap: 28px 32px; }
  .card, .card:first-child { grid-template-columns: 1fr; gap: 10px; }
  .card:first-child .card-t { font-size: 1.0625rem; }
}
@media (min-width: 960px) { .cards { grid-template-columns: repeat(4, 1fr); } }
@media (hover: hover) and (pointer: fine) { .card:hover .card-t a { color: var(--link-hover); text-decoration-thickness: 2px; } }
.secs { display: grid; gap: 0 32px; }
@media (min-width: 600px) { .secs { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .secs { grid-template-columns: 1fr 1fr 1fr; } }
.secs li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.secs a { font: 500 1.0625rem/1.3 var(--f-ui); }
.secs-n { flex: none; font: 400 var(--fs-small)/1.3 var(--f-ui); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.more { display: flex; flex-wrap: wrap; gap: 8px 12px; padding-top: 20px; }
.nf .ents, .listing > .ents { margin-top: 24px; }

/* ---------- подвал ---------- */
.site-footer { margin-top: 64px; background: var(--paper-2); font: 400 var(--fs-small)/1.5 var(--f-ui); color: var(--ink-2); }
.ft { display: grid; gap: 32px; padding-block: 40px 24px; }
@media (min-width: 960px) { .ft { grid-template-columns: 1fr 2fr 1fr; } }
.ft-brand { font: 760 1.25rem/1.2 var(--f-text); color: var(--ink); margin-bottom: 6px; }
.ft-brand a, .ft-brand a:visited { color: inherit; text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .ft-brand a:hover { text-decoration: underline; text-underline-offset: 0.15em; } }
.ft-h { font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.ft-nav ul { list-style: none; margin: 0; padding: 0; }
.ft-cols { columns: 2; column-gap: 24px; }
.ft-nav li { break-inside: avoid; }
.ft-nav a { display: inline-block; padding: 6px 0; }
.ft-nav a, .ft-nav a:visited { color: var(--cloth); }
.ft-bottom { padding-bottom: 24px; }
/* черта по ширине текста, а не по .wrap с полями */
.ft-bottom > p { padding-top: 16px; border-top: 1px solid var(--rule); }

/* ---------- просмотр слайдов (dialog создаёт site.js) ---------- */
.sv {
  width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0;
  background: var(--sv-bg); color: var(--sv-ink); font: 400 1rem/1.4 var(--f-ui);
}
.sv::backdrop { background: var(--sv-bg); }
.sv[open] { display: grid; grid-template-rows: auto 1fr auto; }
.sv-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; }
.sv-count { flex: 1; color: var(--sv-ink-2); font-variant-numeric: tabular-nums; }
.sv-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 0;
  border-radius: var(--r-sm); background: var(--sv-bg-2); color: var(--sv-ink); cursor: pointer;
}
.sv-btn:disabled { opacity: 0.35; cursor: default; }
.sv-btn:focus-visible, .sv-file:focus-visible { outline: 2px solid var(--sv-ink); outline-offset: 2px; }
.sv-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 8px; overflow: auto; }
.sv-img { display: block; max-width: min(100%, var(--sv-max-w, 100%)); max-height: 100%; width: auto; height: auto; object-fit: contain; background: var(--sv-bg-2); }
.sv-err { display: grid; gap: 8px; justify-items: center; text-align: center; }
.sv-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 12px 12px; }
.sv-cap { flex: 1 1 280px; color: var(--sv-ink); }
.sv-nav { display: flex; gap: 8px; }
.sv-file, .sv-file:visited { color: var(--sv-ink); }
@media (prefers-reduced-motion: no-preference) {
  .sv-img { animation: sv-in 180ms var(--ease); }
}
@keyframes sv-in { from { opacity: 0; } }

/* ---------- движение ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .btn:active { transform: none; }
}

/* ---------- печать ---------- */
@media print {
  :root {
    --paper: #fff; --paper-2: #f2f2f2; --rule: #ccc; --ink: #000; --ink-2: #333; --cloth: #000; --cloth-deep: #000;
    --cloth-wash: #eee;
  }
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-header, .site-footer, .skip, .crumbs, .search, .after, .doc-foot, .share, .progress, .pager, .ad, .sv,
  ins.adsbygoogle, .google-auto-placed { display: none !important; }
  .doc, .prose { max-width: none; }
  .doc-cover-img { max-height: 10cm; }
  .doc-cover--stock { display: none; }
  a { color: inherit; text-decoration: none; }
  .prose table { display: table; overflow: visible; }
  .prose thead { display: table-header-group; }
  .prose tr, .prose figure, .prose .gallery-item { break-inside: avoid; }
  .prose .gallery { grid-template-columns: 1fr; }
  .doc::after { content: attr(data-url); display: block; margin-top: 24pt; font: 9pt/1.3 var(--f-ui); }
}
