/* Печать статьи в PDF (№ 1323, слово владельца 18.10): статья на бумаге — свёрстанный лист, а не снимок окна браузера.
   Наследник печатных блоков старого сайта (kadence-child/style.css 31, 61, 64, 65, 74; poleznoe-znanie-core 09, 26):
   те же цвета цитат (#F2F1ED, черта #D77B23), номера сносок оранжевые, дата по хиджре в шапке. Новое: своя шапка с
   знаком и названием (.pz-pl-shapka ставит pechat.js), строка источника в конце, белый лист без «карточки» и теней,
   номера страниц в поле листа (поля @page убирают колонтитулы браузера — адрес и дату в углах), все плавающие кружки
   (ИИ-ассистент, тема, «назад», «наверх») скрыты — pechat.js перед печатью метит всё fixed/sticky. Одинаково для
   poleznoeznanie.com и old.poleznoeznanie.com. */
.pz-pl-shapka,.pz-pl-istochnik,.pz-pl-chat{display:none}

@media print {
  @page {
    size: A4;
    margin: 16mm 16mm 17mm;
    @bottom-left { content: "Полезное знание · poleznoeznanie.com"; font: 8.5pt "PT Serif", Georgia, serif; color: #8A877F; }
    @bottom-right { content: counter(page) " / " counter(pages); font: 8.5pt "PT Serif", Georgia, serif; color: #8A877F; }
  }
  html, body { background: #FFFFFF !important; color: #242320 !important; }
  body * { box-shadow: none !important; text-shadow: none !important; }

  /* всё, что не статья */
  #masthead, .site-header, #mobile-drawer, .popup-drawer, #search-drawer, #colophon, .site-footer,
  .ct-share-container, .entry-related, .post-navigation, .comments-area, #comments, .entry-footer,
  .wp-block-kadence-tableofcontents, .kb-table-of-content-nav, .pz-print-hijri,
  .mwai-chatbot, .mwai-window, .mwai-chatbot-container, [class*="mwai-"],
  #pz-tema, .pz-pril-fon, .pz-pril-priglas, .pz-pril-nazad, #kt-scroll-up, #kt-scroll-up-reader, .kadence-scroll-to-top,
  #ios-print-toast, [data-pz-ne-pechat], .skip-link, iframe, video, audio { display: none !important; }

  /* лист вместо «карточки» на бежевом фоне */
  #wrapper, #inner-wrap, .site, .site-main, #primary, .content-area, .content-container, .site-container,
  .content-wrap, article.entry, .entry.content-bg, .content-bg, .entry-content-wrap, .single-content, .entry-content {
    background: transparent !important; border: 0 !important; border-radius: 0 !important;
    margin-left: 0 !important; margin-right: 0 !important; max-width: none !important; width: auto !important;
    padding-left: 0 !important; padding-right: 0 !important; float: none !important;
  }
  #primary, .content-area, .site-main, article.entry, .entry-content-wrap { margin-top: 0 !important; padding-top: 0 !important; }
  #primary .content-container { display: block !important; }
  aside, #secondary, .primary-sidebar { display: none !important; }

  /* шапка листа: знак и название слева, адрес и дата по хиджре справа, оранжевая черта */
  .pz-pl-shapka {
    display: flex !important; justify-content: space-between; align-items: flex-end; gap: 16px;
    border-bottom: 2px solid #D77B23; padding: 0 0 10px; margin: 0 0 22px;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .pz-pl-znak { display: flex; align-items: center; gap: 9px; }
  .pz-pl-znak img { height: 40px; width: auto; display: block; }
  .pz-pl-imya { display: block; font: 800 15pt/1.05 "Fira Sans", Inter, Arial, sans-serif; color: #000; letter-spacing: -.01em; }
  .pz-pl-pod { display: block; font: 600 6.6pt/1.2 "Fira Sans", Inter, Arial, sans-serif; color: #C4691A; letter-spacing: .16em; margin-top: 3px; }
  .pz-pl-sprava { text-align: right; font: 8.5pt/1.45 "PT Serif", Georgia, serif; color: #6B6862; white-space: nowrap; }

  /* заголовок и подпись статьи */
  .entry-header { margin: 0 0 14px !important; }
  .entry-taxonomies, .category-links { margin-bottom: 4px !important; }
  .entry-taxonomies a, .category-links a { color: #C4691A !important; text-decoration: none !important; font-size: 8pt !important; letter-spacing: .08em; }
  h1.entry-title { font-family: Inter, Arial, sans-serif !important; font-size: 21pt !important; line-height: 1.22 !important; color: #242320 !important; margin: 0 0 8px !important; }
  .entry-meta, .entry-meta a { font-size: 8.8pt !important; color: #6B6862 !important; text-decoration: none !important; }

  /* текст */
  .entry-content { font-family: "PT Serif", Georgia, serif !important; font-size: 11pt !important; line-height: 1.6 !important; color: #242320 !important; }
  .entry-content p, .entry-content li { orphans: 3; widows: 3; }
  .entry-content p { margin: 0 0 9px !important; }
  .entry-content h2, .entry-content h3, .entry-content h4 { font-family: Inter, Arial, sans-serif !important; color: #242320 !important; break-after: avoid; page-break-after: avoid; break-inside: avoid; }
  .entry-content h2 { font-size: 14.5pt !important; margin: 20px 0 8px !important; }
  .entry-content h3 { font-size: 12.5pt !important; margin: 16px 0 6px !important; }
  .entry-content a { color: #242320 !important; text-decoration: none !important; }
  .entry-content sup a, .entry-content a[href^="#"] sup, .entry-content .pz-fn { color: #D77B23 !important; }
  .entry-content blockquote, .entry-content .wp-block-quote {
    background: #F2F1ED !important; border-left: 4px solid #D77B23 !important; border-radius: 0 5px 5px 0 !important;
    padding: 9px 15px !important; margin: 12px 0 !important; break-inside: avoid; page-break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .entry-content hr { border: 0 !important; border-top: 1px solid #E8B27A !important; width: 60%; margin: 22px auto !important; }
  .entry-content img, .entry-content figure { max-width: 100% !important; height: auto !important; break-inside: avoid; }
  .entry-content table { border-collapse: collapse; }
  .entry-content td, .entry-content th { border: 1px solid #D1CFC9 !important; padding: 4px 8px !important; }

  /* строка источника под статьёй */
  .pz-pl-istochnik { display: block !important; margin-top: 26px; padding-top: 10px; border-top: 1px solid #E5DDD3;
    font: 8.8pt/1.5 "PT Serif", Georgia, serif; color: #6B6862; break-inside: avoid; }
  .pz-pl-istochnik b { color: #242320; font-weight: 700; }

  /* главная с ответом ассистента: на бумаге — только ответ мини-статьёй (pechat.js ставит .pz-pl-chat) */
  html.pz-pechat-chata body[class] #wrapper, html.pz-pechat-chata body[class] .site { display: none !important; }
  .pz-pl-chat { display: block !important; font-family: "PT Serif", Georgia, serif; color: #242320; }
  .pz-pl-chat .pz-pl-vid { font: 700 8pt/1 Inter, Arial, sans-serif; letter-spacing: .09em; text-transform: uppercase; color: #C4691A; margin: 0 0 8px; }
  .pz-pl-chat .pz-pl-zag { font: 700 21pt/1.22 Inter, Arial, sans-serif; color: #242320; margin: 0 0 18px; }
  .pz-pl-chat .pz-msg + .pz-msg { border-top: 1px solid #E5DDD3; padding-top: 20px; margin-top: 30px; }
  .pz-pl-chat .pz-body { font-size: 11pt; line-height: 1.6; }
  .pz-pl-chat .pz-body h1, .pz-pl-chat .pz-body h2, .pz-pl-chat .pz-body h3, .pz-pl-chat .pz-body h4 { font-family: Inter, Arial, sans-serif; line-height: 1.3; margin: 20px 0 8px; break-after: avoid; }
  .pz-pl-chat .pz-body h2 { font-size: 14pt; } .pz-pl-chat .pz-body h3 { font-size: 12.5pt; }
  .pz-pl-chat .pz-body p { margin: 8px 0; unicode-bidi: plaintext; text-align: start; orphans: 3; widows: 3; }
  .pz-pl-chat .pz-body ul, .pz-pl-chat .pz-body ol { margin: 8px 0; padding-left: 24px; }
  .pz-pl-chat .pz-body blockquote { margin: 12px 0; padding: 9px 15px; background: #F2F1ED; border-left: 4px solid #D77B23; font-style: italic; border-radius: 0 5px 5px 0; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pz-pl-chat .pz-body hr { display: none; }
  .pz-pl-chat .pz-body a { color: #242320; text-decoration: none; }
  .pz-pl-chat .pz-body .pz-url { color: #8A877F; font-size: 9pt; word-break: break-all; }
  .pz-pl-chat .pz-body .pz-fn, .pz-pl-chat .pz-body sup { color: #D77B23; }
  .pz-pl-chat .pz-body .pz-src-title { margin: 26px 0 10px; font-size: 12.5pt; }
  .pz-pl-chat .pz-body .pz-src-title::before { content: ""; display: block; width: 60%; margin: 0 auto 22px; border-top: 1px solid #E8B27A; }
  .pz-pl-chat .pz-pl-podpis { margin-top: 26px; padding-top: 10px; border-top: 1px solid #E5DDD3; font: 8.8pt/1.5 "PT Serif", Georgia, serif; color: #6B6862; }

  /* бежевый фон главной (body.page-id-… в style.css) — на бумаге белый */
  html:root body[class][class], html:root body[class][class] #wrapper, html:root body[class][class] #inner-wrap, html:root body[class][class] #primary, html:root body[class][class] #main,
  html:root body[class][class] .site-main, html:root body[class][class] .content-area, html:root body[class][class] .content-container, html:root body[class][class] .content-wrap,
  html:root body[class][class] article.entry, html:root body[class][class] .content-bg, html:root body[class][class] .entry-content-wrap, html:root body[class][class] .entry-content {
    background: #FFFFFF !important;
  }

  html:root:root { background: #FFFFFF !important; }
  /* главная держит подвал внизу экрана (min-height: 100vh, блок 32 style.css) — на бумаге это пустой второй лист */
  html:root body[class][class], html:root body[class][class] * { min-height: 0 !important; }
  html:root body[class][class] #wrapper, html:root body[class][class] #inner-wrap, html:root body[class][class] #primary, html:root body[class][class] .site-main,
  html:root body[class][class] .content-area, html:root body[class][class] .content-container, html:root body[class][class] .content-wrap { height: auto !important; min-height: 0 !important; }

  /* тёмная тема на бумагу не идёт */
  html.dark-mode .entry-content, body.dark-mode .entry-content, html.dark-mode h1.entry-title, body.dark-mode h1.entry-title { color: #242320 !important; }
}
