/*
 * TM School — стили печати: только контент записи/страницы, без навигации и сайдбаров.
 * Подключается с media="print" в functions.php (tm_school_assets).
 * Все правила внутри @media print {}.
 */

@media print {
  /* --- 1. Жестко скрываем всё служебное --- */
  header,
  footer,
  #tm-topbar,
  .tm-sticky,
  .tm-sidebar-left,
  .tm-vitrine,
  #tm-to-top,
  .tm-overlay,
  #tm-mobile-panel,
  .tm-modal,
  .tm-a11y-panel,
  .tm-copy,
  .tm-search-hint,
  .tm-pagination,
  .pagination,
  .comments-area,
  #comments,
  .tm-comments,
  .comment-respond,
  .comment-list,
  [class*="comment"],
  [id*="comment"],
  .tm-bnr,
  .tm-pos-banner,
  .tm-print-hide,
  .tm-socials,
  .tm-tag {
    display: none !important;
  }

  /* --- 2. Скрываем навигацию по соседним записям (внизу single.php) --- */
  nav:not(.tm-pagination) {
    display: none !important;
  }

  /* --- 3. Показываем только основной контент --- */
  .tm-site,
  .tm-container,
  .tm-layout {
    display: block !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .entry-content,
  .tm-news-hero,
  .tm-card {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* --- 4. Оформление текста --- */
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }

  /* --- 5. Внешние ссылки: URL в скобках --- */
  .entry-content a[href^="http"]:not([href*="localhost"]):not([href*="127.0.0.1"]):not([href*="sos23"]):not([href*="wp-content"])::after {
    content: " (" attr(href) ")" !important;
    font-size: 0.8em !important;
    color: #666 !important;
    word-break: break-all !important;
  }

  /* --- 6. Таблицы и картинки: не разрывать --- */
  .entry-content table,
  .entry-content img,
  .tm-table-scroll {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }

  .entry-content img {
    max-width: 100% !important;
    page-break-after: avoid !important;
  }

  /* --- 7. Скрываем служебные элементы внутри контента --- */
  .entry-content .tm-social-btn,
  .entry-content .tm-meta-chip:not(:first-child) {
    display: none !important;
  }
}