@charset "UTF-8";

/* ==========================================================================
   print.css — 日本学術会議ホームページ 印刷用スタイル

   方針
   1. 内容理解に必要な情報（本文・見出し・画像・表・注釈・日付）は残す
   2. 閲覧操作専用のUI（ナビ・検索・SNS・ページトップ等）は非表示
   3. 原則1カラム。固定幅・サイドカラム・画面用グリッドを解除
   4. 装飾目的の背景は省略。情報上意味のある色のみ維持
   5. 見出し・画像・表が不自然に分割されないよう改ページを制御
   6. URL表示は外部リンクのみ

   ※ 既存CSSが `@media print, screen and (min-width:768px)` を多用しており
     印刷時にもPC用レイアウトが適用されるため、本ファイルは最後に読み込み、
     必要箇所で !important を用いて上書きする。
   ========================================================================== */

@media print {

  /* ------------------------------------------------------------------
     1. ページ設定
     ------------------------------------------------------------------ */
  @page {
    size: A4 portrait;
    margin: 15mm 14mm;
  }

  /* ------------------------------------------------------------------
     2. 基本設定（配色・文字サイズ）
     ------------------------------------------------------------------ */
  :root {
    color-scheme: light only;
  }

  /* 1rem = 10.5pt。既存CSSはrem基準のため、ここが全体の文字サイズの起点になる */
  html {
    font-size: 10.5pt;
    background: #fff !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    line-height: 1.7;
  }

  /* 装飾（影・グラデーション・背景画像）を一括で除去 */
  *,
  *::before,
  *::after {
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    animation: none !important;
    transition: none !important;
  }

  /* 情報上意味を持つ色は維持する（下記 6. で個別に指定） */

  /* 画面追従系の解除 */
  .c-header,
  .c-footer,
  .c-lower-head,
  .c-side-navigation {
    position: static !important;
  }

  /* ------------------------------------------------------------------
     3. 非表示にする要素（閲覧操作専用UI）
     ------------------------------------------------------------------ */
  .c-header-alert,                    /* 緊急告知バー */
  .c-header__top,                     /* SNS・言語切替の帯 */
  .c-header__group-nav,               /* グローバルナビ */
  .c-header__button-group,            /* 検索・ハンバーガー */
  .c-header__search,
  .c-header__hamburger,
  .c-header-detail,
  .c-header-language,
  .c-search-modal,
  dialog,
  .c-footer__pagetop,                 /* ページトップ */
  .c-footer__nav-list,                /* フッターナビ */
  .c-footer__info-sns,
  .c-anchor-nav,                      /* ページ内アンカーナビ */
  .c-side-navigation,                 /* サイドナビ */
  .o-section__side-nav,
  .c-back-button,
  .c-event-article__back-button,
  .c-search-result__sort,             /* 絞り込み・並べ替えUI */
  .c-pagination,
  .js-table-toggle-button,            /* 表の表示切替ボタン */
  .c-table-toggle-button,
  .c-table-scroll-button,
  [class*="carousel"] button,
  .swiper-button-prev,
  .swiper-button-next,
  .swiper-pagination,
  [aria-label*="Cookie"],
  #flonnect-my-app {                  /* 拡張機能が挿入する要素 */
    display: none !important;
  }

  /* スクリーンリーダー専用テキストは印刷でも非表示のまま */
  .u-visually-hidden,
  .visually-hidden,
  .sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip-path: inset(50%) !important;
  }

  /* 埋め込みコンテンツ（動画・地図）は印刷不可のため非表示 */
  iframe,
  video,
  embed,
  object {
    display: none !important;
  }

  /* ------------------------------------------------------------------
     4. 残す要素（出典として必要な情報）
     ------------------------------------------------------------------ */
  .c-header {
    display: block !important;
    border-bottom: 1px solid #999;
    padding-bottom: 4mm;
    margin-bottom: 4mm;
  }

  .c-header__main,
  .c-header__main-inner {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .c-header__title-logo {
    max-height: 12mm !important;
    width: auto !important;
  }

  /* パンくず＝階層情報として残す */
  .c-breadcrumbs {
    font-size: 0.8rem;
    margin-bottom: 3mm;
  }

  .c-breadcrumbs__list {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.5em;
  }

  /* フッターは組織情報と著作権表示のみ残す */
  .c-footer {
    display: block !important;
    background: none !important;
    color: #000 !important;
    font-size: 0.8rem !important;
    border-top: 1px solid #999;
    padding: 4mm 0 0 !important;
    margin-top: 6mm;
  }

  .c-footer__inner,
  .c-footer__inner-top,
  .c-footer__inner-bottom,
  .c-footer__inner-left {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    max-width: none !important;
  }

  .c-footer__inner-right {
    display: none !important;
  }

  .c-footer a {
    color: #000 !important;
  }

  /* ------------------------------------------------------------------
     5. レイアウト（1カラム化・固定幅解除）
     ------------------------------------------------------------------ */
  .o-inner {
    width: auto !important;
    max-width: none !important;
    padding-inline: 0 !important;
    margin-inline: 0 !important;
  }

  .o-section {
    display: block !important;
    padding-block: 0 !important;
  }

  /* サイドナビ付きレイアウトのグリッドを解除 */
  .o-section--side-nav {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
  }

  .o-section__main {
    order: 0 !important;
    width: auto !important;
  }

  .c-lower-head,
  .c-lower-head__inner {
    background: none !important;
    padding-inline: 0 !important;
  }

  .c-lower-head::after {
    display: none !important;      /* 見出し帯の装飾画像 */
  }

  .c-lower-head__text,
  .c-lower-head__text--mono {
    color: #000 !important;
  }

  .c-bg-gray-faf,
  .c-info-detail,
  .c-search-result {
    background: none !important;
  }

  /* リンクカード一覧：枠と余白を落として一覧性を優先（2段組は維持） */
  .c-card-link-list {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 2mm 6mm !important;
  }

  .c-card-link-list__link {
    display: block !important;
    border: 0 !important;
    border-bottom: 1px dotted #999 !important;
    border-radius: 0 !important;
    padding: 1.5mm 0 !important;
    background: none !important;
  }

  /* ------------------------------------------------------------------
     6. 意味のある配色の維持
     ------------------------------------------------------------------ */
  .c-tag,
  th,
  .c-rounded-table__term,
  .c-table-vertical th {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
  }

  /* ------------------------------------------------------------------
     7. リンクとURL表示
     ------------------------------------------------------------------ */
  a {
    color: #000 !important;
    text-decoration: underline;
    text-decoration-thickness: 1px !important;
    word-break: break-all;
  }

  /* 外部リンクのみURLを併記する。
     内部リンク（相対パス・ルート相対パス・自ドメイン）は印刷物上で
     辿れないため対象外。PDFリンクは本文テキストに「（PDF形式：○○KB）」が
     入るため、URLは表示しない。 */
  main a[href^="http"]:not([href*="scj.go.jp"]):not([href*="cenfy.com"])::after {
    content: "（" attr(href) "）";
    font-size: 0.8em;
    font-weight: 400;
    word-break: break-all;
  }

  /* 内部PDFリンクはURLを出さない（テキスト側の表記に委ねる） */
  main a[href*="scj.go.jp"]::after,
  main a[href^="/"]::after,
  main a[href^="#"]::after {
    content: none !important;
  }

  /* ------------------------------------------------------------------
     8. タブ・アコーディオンの全展開
     ------------------------------------------------------------------ */
  details {
    display: block !important;
  }

  details > summary {
    list-style: none;
    font-weight: 700;
  }

  details:not([open]) > *:not(summary) {
    display: block !important;
  }

  /* Chrome 131+ 向け */
  details::details-content {
    content-visibility: visible !important;
    block-size: auto !important;
  }

  [role="tabpanel"],
  [role="tabpanel"][hidden],
  [role="tabpanel"][aria-hidden="true"],
  .c-tab__panel {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
  }

  /* タブUIそのもの（ボタン列）は不要 */
  [role="tablist"] {
    display: none !important;
  }

  /* ------------------------------------------------------------------
     9. 表
     ------------------------------------------------------------------ */
  .js-table-wrapper,
  [class*="table-wrapper"],
  [class*="table-scroll"] {
    overflow: visible !important;
    width: auto !important;
  }

  table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    break-inside: auto;       /* 長い表はページをまたいで良い */
  }

  /* ページをまたぐ表は各ページに見出し行を繰り返す */
  thead {
    display: table-header-group;
  }

  tfoot {
    display: table-footer-group;
  }

  tr,
  th,
  td {
    break-inside: avoid;
  }

  th,
  td {
    border: 1px solid #666 !important;
    padding: 1.5mm 2mm !important;
  }

  /* ------------------------------------------------------------------
     10. 画像
     ------------------------------------------------------------------ */
  img {
    max-width: 100% !important;
    height: auto !important;
    break-inside: avoid;
  }

  figure {
    break-inside: avoid;
    margin-inline: 0 !important;
  }

  /* ------------------------------------------------------------------
     11. 改ページ制御
     ------------------------------------------------------------------ */
  h1, h2, h3, h4, h5, h6,
  .c-heading-lv2,
  dt {
    break-after: avoid;
    break-inside: avoid;
  }

  p, li, dd {
    orphans: 3;
    widows: 3;
  }

  .c-note,
  .c-rounded-table__item,
  .c-press-release-item,
  .c-event-article__head {
    break-inside: avoid;
  }

  /* 余白の詰め（画面用の大きな余白を印刷向けに縮める） */
  .o-gap {
    gap: 4mm !important;
  }

  .o-gap--large,
  .o-gap--extra-large {
    gap: 6mm !important;
  }
}
