/* Karpov Studio — блог, публичная часть (Фаза 4 плана объединения).
   Токены и утилиты (--ink/--accent/.wrap/.section/.page-head/.tag/.btn) —
   из styles.css, здесь не переопределяются. Классы контентных блоков ниже
   обязаны совпасть с тем, что реально генерируют App\Renderer\Blocks\*
   (проверено построчно при написании — см. PROGRESS.md, Фаза 4). */

/* --- Шапка раздела (лента/рубрика/тег/архив/поиск/серия) --- */
.taxonomy-hero { background: var(--ink); color: #fff; padding: clamp(140px, 16vw, 190px) 0 clamp(48px, 7vw, 80px); position: relative; overflow: hidden; }
.taxonomy-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 90, 31, .18), transparent 62%); filter: blur(20px); pointer-events: none; }
.taxonomy-hero .wrap { position: relative; z-index: 2; }
.taxonomy-hero h1 { color: #fff; max-width: 22ch; }
.taxonomy-hero .lead { color: rgba(255, 255, 255, .62); margin-top: 16px; }
.taxonomy-hero .eyebrow { color: rgba(255, 255, 255, .5); }

/* --- Форма поиска --- */
.search-form { display: flex; gap: 10px; max-width: 560px; margin-top: 28px; }
.search-form input[type="search"] { flex: 1; padding: 14px 18px; border-radius: 100px; border: 1px solid var(--line-dark); background: rgba(255, 255, 255, .06); color: #fff; font: inherit; }
.search-form input[type="search"]::placeholder { color: rgba(255, 255, 255, .4); }
.search-form input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Сетка карточек (лента/рубрика/тег/архив/поиск/серия) --- */
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 28px; }
.feed-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); transition: box-shadow .4s var(--ease), transform .4s var(--ease); }
.feed-card:hover { box-shadow: 0 24px 48px rgba(11, 11, 11, .08); transform: translateY(-3px); }
.feed-card .thumb { aspect-ratio: 16/10; overflow: hidden; background: var(--fog); }
.feed-card .thumb img, .feed-card .thumb picture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feed-card .thumb-empty { width: 100%; height: 100%; display: grid; place-items: center; background: #0c0c12; }
.feed-card .thumb-empty img { width: 28px; height: 28px; opacity: .85; }
.feed-card-body { padding: 22px 24px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.feed-card.pinned { border-color: var(--accent); }
.feed-card-meta { display: flex; align-items: center; gap: 10px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.feed-card-meta a.tag { text-decoration: none; }
.feed-card h3 { font-size: 19px; line-height: 1.25; margin: 0; }
.feed-card h3 a { color: inherit; text-decoration: none; }
.feed-card h3 a:hover { color: var(--accent); }
.feed-card .excerpt { color: var(--muted); font-size: 14.5px; line-height: 1.55; margin: 0; flex: 1; }
.feed-empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* --- Пагинация --- */
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 48px; justify-content: center; }
.pagination a, .pagination span { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 100px; border: 1px solid var(--line); font-family: var(--f-mono); font-size: 13px; text-decoration: none; color: var(--ink); }
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- Пост: обёртка + мета --- */
.post-hero { background: var(--ink); color: #fff; padding: clamp(140px, 16vw, 190px) 0 56px; position: relative; overflow: hidden; }
.post-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -180px; top: -220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 90, 31, .18), transparent 62%); filter: blur(20px); pointer-events: none; }
.post-hero .wrap { position: relative; z-index: 2; max-width: 860px; }
.post-hero h1 { color: #fff; }
.post-hero .tag { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .75); margin-bottom: 18px; }
.post-hero .lead { color: rgba(255, 255, 255, .62); margin-top: 16px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line-dark); }
.article-meta div span { display: block; font-size: 12px; color: var(--muted-dark); margin-bottom: 4px; }
.article-meta div b { font-family: var(--f-display); font-weight: 700; font-size: 15px; color: #fff; }

.post-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 56px; align-items: start; }
.post-layout .cover { grid-column: 1 / -1; border-radius: var(--r); overflow: hidden; margin-bottom: 8px; }
.post-layout .cover img { width: 100%; height: auto; display: block; }
.post-sidebar { position: sticky; top: 100px; display: flex; flex-direction: column; gap: 28px; }

/* --- Оглавление (переиспользует разметку App\Renderer\Blocks\TocRenderer) --- */
.toc { border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px; }
.toc::before { content: "На этой странице"; display: block; font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.toc a { color: var(--ink); text-decoration: none; font-size: 13.5px; line-height: 1.4; display: block; }
.toc a:hover { color: var(--accent); }
.toc .toc-level-3 { padding-left: 14px; }
.toc .toc-level-4, .toc .toc-level-5, .toc .toc-level-6 { padding-left: 28px; }

/* --- Статья: типографика контента --- */
.article-prose { max-width: 720px; font-size: 17px; line-height: 1.7; color: var(--ink); }
.article-prose > * + * { margin-top: 24px; }
.article-prose h2, .article-prose h3, .article-prose h4 { margin-top: 48px; scroll-margin-top: 100px; }
.article-prose h2 { font-size: 26px; }
.article-prose h3 { font-size: 21px; }
.article-prose h4 { font-size: 18px; }
.article-prose p { margin-bottom: 0; }
.article-prose ul, .article-prose ol { padding-left: 22px; }
.article-prose li + li { margin-top: 8px; }
.article-prose a { color: var(--accent); text-decoration-thickness: 1px; }
.article-prose blockquote { margin-right: 0; margin-bottom: 0; margin-left: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.article-prose blockquote footer { margin-top: 8px; font-style: normal; font-size: 13px; color: var(--muted); }
.article-prose figure { margin-right: 0; margin-bottom: 0; margin-left: 0; }
.article-prose > blockquote:first-child, .article-prose > figure:first-child { margin-top: 0; }
.article-prose figure figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.article-prose figure img, .article-prose figure picture img { width: 100%; height: auto; border-radius: 18px; display: block; }
.article-prose figure.img-normal { max-width: 100%; }
.article-prose figure.img-wide { width: calc(100% + 80px); margin-left: -40px; max-width: none; }
.article-prose figure.img-full { width: 100vw; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; max-width: 100vw; }
.article-prose figure.img-full img { border-radius: 0; }
.img-missing, .file-missing, .audio-missing { padding: 20px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 14px; text-align: center; }

/* --- Код --- */
.code-block { position: relative; margin: 0; border-radius: 16px; overflow: auto; background: var(--ink); padding: 20px 22px; }
.code-block code.hljs { background: none; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.6; }
.code-copy { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .06); cursor: pointer; }
.code-copy::before { content: "Скопировать"; position: absolute; inset: 0; display: block; text-indent: -9999px; }
.code-copy::after { content: ""; position: absolute; inset: 9px; border: 1.5px solid rgba(255, 255, 255, .8); border-radius: 3px; }
.code-copy:hover { border-color: var(--accent); }
.code-copy.copied::after { border-color: var(--accent); }

/* --- Коллбауты --- */
.callout { display: flex; gap: 14px; padding: 18px 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--fog); }
.callout-info { border-color: #B9D4F0; background: #EEF5FC; }
.callout-warning { border-color: #F0DDA8; background: #FBF3DF; }
.callout-danger { border-color: #F0BDB0; background: #FBE7E2; }
.callout-success { border-color: #B7DFC0; background: #E9F6EC; }

/* --- Файлы / аудио --- */
.file-block { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); }
.file-block:hover { border-color: var(--accent); }
.file-ext { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; background: var(--ink); color: #fff; padding: 4px 8px; border-radius: 6px; }
.file-name { font-weight: 600; }
.file-size { color: var(--muted); font-size: 13px; margin-left: auto; }
.audio-block { width: 100%; border-radius: 12px; }

/* --- Разделитель --- */
.content-divider { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }

/* --- Таблица --- */
.content-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.content-table th, .content-table td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; }
.content-table th { background: var(--fog); font-weight: 700; }

/* --- Чек-лист --- */
.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li::before { content: "✓"; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; margin-top: 1px; }

/* --- Галерея --- */
.gallery { display: grid; gap: 10px; }
.gallery-grid { grid-template-columns: repeat(3, 1fr); }
.gallery-masonry { grid-template-columns: repeat(2, 1fr); }
.gallery-slider { grid-auto-flow: column; grid-auto-columns: 80%; overflow-x: auto; scroll-snap-type: x mandatory; }
.gallery-slider .gallery-item { scroll-snap-align: start; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; display: block; }

/* --- Видео (фасад, реальный iframe грузит public/video-facade.js) --- */
.video-embed { position: relative; aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; background: var(--ink); display: grid; place-items: center; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-play { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); border: 0; cursor: pointer; position: relative; z-index: 2; }
.video-play::before { content: ""; position: absolute; left: 55%; top: 50%; transform: translate(-50%, -50%); border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff; }
.video-embed[data-loaded] .video-play { display: none; }

/* --- Серия --- */
.series-nav { display: flex; flex-direction: column; gap: 10px; }
.series-nav a { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); }
.series-nav a:hover { border-color: var(--accent); }
.series-nav a span.dir { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; color: var(--muted); }
.series-list { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.series-list a { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.series-list a:hover { background: var(--fog); }
.series-list .idx { font-family: var(--f-mono); color: var(--muted); font-size: 13px; flex: 0 0 auto; }
.series-list a.current { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

/* --- Похожие посты --- */
.related-posts { margin-top: 64px; padding-top: 48px; border-top: 1px solid var(--line); }
.related-posts h2 { margin-bottom: 24px; }

/* --- Автор --- */
.author-box { display: flex; gap: 16px; align-items: flex-start; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--r); margin-top: 48px; }
.author-box .ava { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.author-box b { display: block; font-family: var(--f-display); }
.author-box p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* --- Поделиться --- */
.share-buttons { display: flex; gap: 10px; margin-top: 28px; }
.share-buttons a { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); text-decoration: none; }
.share-buttons a:hover { border-color: var(--accent); color: var(--accent); }

/* --- CTA «Напишите нам» (App\Renderer\Blocks\CtaRenderer) --- */
.post-cta { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: clamp(24px, 4vw, 36px); border-radius: var(--r); color: #fff; }
.post-cta-accent { background: var(--accent); }
.post-cta-dark { background: var(--ink); }
.post-cta-body { flex: 1 1 320px; }
.post-cta-title { display: block; font-family: var(--f-display); font-size: 19px; margin-bottom: 6px; }
.post-cta-text { margin: 0; color: rgba(255, 255, 255, .82); }
.post-cta-btn { flex: 0 0 auto; }
/* Явный цвет текста кнопки — без этого .article-prose a { color: var(--accent) }
   (более специфичное правило, класс+тег против одного класса у голого .btn)
   красит текст в тот же оранжевый, что и фон кнопки, и текст пропадает —
   виден только при наведении, когда фон перекрывает тёмная подложка .btn::before. */
.post-cta .post-cta-btn { color: #fff; }
.post-cta .post-cta-btn:hover { color: var(--accent); }

/* --- Контакты в конце статьи (App\Renderer\Blocks\ContactsRenderer) --- */
.contacts-block { padding: 24px 28px; border: 1px solid var(--line); border-radius: var(--r); }
.contacts-block-title { display: block; font-family: var(--f-display); font-size: 17px; margin-bottom: 16px; }
.contacts-block-list { display: flex; flex-wrap: wrap; gap: 12px; }
.contacts-block-item { flex: 1 1 160px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); transition: border-color .3s; }
.contacts-block-item:hover { border-color: var(--accent); }
.contacts-block-item span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.contacts-block-item b { font-family: var(--f-display); font-size: 14.5px; }

/* --- Ссылка на материал (App\Renderer\Blocks\LinkcardRenderer) --- */
.link-card { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); transition: border-color .3s; }
.link-card:hover { border-color: var(--accent); }
.link-card-label { display: block; font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.link-card-title { display: block; font-family: var(--f-display); font-size: 16px; margin-bottom: 4px; }
.link-card-desc { margin: 0 0 6px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.link-card-host { display: block; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }

/* --- Индикатор прогресса чтения (public/reading-progress.js) --- */
.reading-progress { position: fixed; top: 0; left: 0; height: 3px; width: 100%; transform: scaleX(0); transform-origin: 0 50%; background: var(--accent); z-index: 130; }

/* --- Кнопка "наверх" (public/back-to-top.js) --- */
.back-to-top { position: fixed; right: 24px; bottom: 24px; width: 46px; height: 46px; border-radius: 50%; background: var(--ink); color: #fff; border: 0; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); z-index: 90; }
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top::before { content: ""; position: absolute; left: 50%; top: 55%; width: 9px; height: 9px; border-top: 2px solid #fff; border-left: 2px solid #fff; transform: translate(-50%, -50%) rotate(45deg); }

@media (max-width: 880px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-sidebar { position: static; order: -1; }
  .article-prose figure.img-wide { width: 100%; margin-left: 0; }
  .gallery-grid, .gallery-masonry { grid-template-columns: repeat(2, 1fr); }
}
