@charset "utf-8";

/* --------------------------------------------------
  印刷用スタイル（印刷およびPDF保存時に適用）
-------------------------------------------------- */
@media print {
  /* 【レイアウト調整】サイドバーを消し、メインエリアをA4幅に広げる */
  .l-archive__side,     /* 指定のサイドバー */
  .l-single__side,
  #wpadminbar,          /* WordPress管理バー */
  .p-header-meta,
  .p-header-nav-content,
  .sns-share-buttons,
  #ricoh-smartchat-root {
    /* SNSボタン等 */
    display: none !important;
  }

  /* メインコンテンツを強制的に横幅100%にする */
  body,
  .l-container,
  .l-archive__main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    overflow: visible !important;
  }

  /* コンテンツの追従をやめる */
  .l-header {
    position: static;
  }

  .l-main {
    margin-top: 0;
  }

  .l-breadcrumb {
    margin-bottom: 20px;
  }

  .l-single {
    display: block;
  }

  /* 【A4最適化】用紙設定 */
  @page {
    size: A4 portrait; /* A4 縦向き */
    /* margin: 5mm 5mm; 上下左右の余白を確保し、プリンタの印字切れを防ぐ */
  }

  /* 【ページ分割対策】重要：要素の途中でページが切れるのを防ぐ */
  /* 記事内の段落、画像、見出し、表などは、可能な限りページを跨がないように制御 */
  .entry-content p,
  .entry-content h2,
  .entry-content h3,
  .entry-content h4,
  .entry-content img,
  .entry-content ul,
  .entry-content table,
  .wp-block-image {
    break-inside: avoid; /* 要素内での改ページを禁止 */
    page-break-inside: avoid; /* 古いブラウザ用 */
  }

  /* 見出しの直後で改ページされるのを防ぐ（見出しだけページの最後に取り残されないようにする） */
  h2,
  h3,
  h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  /* 【視認性向上】 */
  body {
    -webkit-print-color-adjust: exact; /* Chrome/Safari */
    print-color-adjust: exact; /* 標準仕様 */
    background-color: #fafafa;
    width: 790px !important;
    max-width: 790px !important;
    min-width: 790px !important;
    /* ページ中央に配置する場合 */
    margin-left: auto !important;
    margin-right: auto !important;
    /* はみ出し防止の保険 */
    box-sizing: border-box !important;
  }

  /* リンクURLの表示制御（URLの印字が不要な場合） */
  a[href]:after {
    /* content: none !important; */
  }

  iframe[src*="youtube"] {
    display: block !important;
    background-color: #eee !important; /* 背景グレー */
    border: 1px solid #ccc !important;
    /* 中身は空っぽになりますが、グレーの四角にはなります */
  }
}
