/*---------------
印刷用スタイル

ver 20250718
------------------*/

@media print {

    /* ========================================
	   共通設定：非表示要素
	   ======================================== */
    aside,
    #secondary,
    #tertiary,
    .sidebar,
    .sidebar-area,
    .widget-area,
    .toc_container,
    .pagination,
    nav,
    .comment-area,
    .share-buttons,
    .modal,
    .c-infoBar,
    .p-toc,
    .l-header__customBtn,
    .l-header__menuBtn,
    #sp_menu,
    #index_modal,
    #search_modal,
    div.l-footer__widgetArea,
    ul.c-iconList,
    ul.l-footer__nav,
    .print-button {
        display: none !important;
    }

    /* ========================================
	   通常印刷設定
	   ======================================== */
    html[data-vertical-print="false"] header#header,
    html[data-vertical-print="false"] div#breadcrumb,
    html[data-vertical-print="false"] time.c-postTitle__date,
    html[data-vertical-print="false"] footer#footer {
        display: block !important;
    }

    html[data-vertical-print="false"] header#header {
        position: relative;
    }

    html[data-vertical-print="false"] div#breadcrumb {
        margin-left: 0;
    }

    html[data-vertical-print="false"] .l-header__inner {
        justify-content: center;
    }

    html[data-vertical-print="false"] .l-content {
        padding-top: 1em;
    }

    html[data-vertical-print="false"] .post_content,
    html[data-vertical-print="false"] .l-content {
        margin-bottom: 0 !important;
    }

    html[data-vertical-print="false"] footer#footer {
        margin-top: 1em;
    }

    /* ========================================
	   縦書き印刷設定
	   ======================================== */

    /* 用紙設定 */
    @page {
        size: A4 portrait;
        margin: 15mm 10mm;
    }

    /* 基本レイアウト：縦書き・段組設定 */
    html[data-vertical-print="true"],
    html[data-vertical-print="true"] body {
        writing-mode: vertical-rl !important;
        -webkit-writing-mode: vertical-rl !important;
        -ms-writing-mode: tb-rl !important;
        font-size: 10.5pt;
        line-height: 1.8;
        column-count: 2;
        column-gap: 2em;
        column-rule: 1px solid #333;
        word-wrap: break-word;
        overflow-wrap: anywhere;
        font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", sans-serif !important;
    }

    /* メインコンテンツエリア */
    html[data-vertical-print="true"] #primary,
    html[data-vertical-print="true"] article,
    html[data-vertical-print="true"] .entry-content {
        width: auto !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        column-span: all;
        vertical-align: top !important;
    }

    html[data-vertical-print="true"] .post_content {
        margin: 0.3em 0.2em 0 0 !important;
    }

    /* 見出し設定 */
    html[data-vertical-print="true"] h1,
    html[data-vertical-print="true"] h2,
    html[data-vertical-print="true"] h3,
    html[data-vertical-print="true"] h4,
    html[data-vertical-print="true"] h5,
    html[data-vertical-print="true"] h6 {
        padding: 0;
        text-orientation: mixed;
        break-after: avoid;
        margin: 0 1em 1em 0 !important;
        border-bottom: none !important;
        vertical-align: top !important;
    }

    html[data-vertical-print="true"] .post_content h2 {
        padding: 0.75em 0.5em;
    }

    html[data-vertical-print="true"] h3::before {
        display: none !important;
    }

    /* 段落とリスト */
    html[data-vertical-print="true"] .entry-content p,
    html[data-vertical-print="true"] .entry-content li,
    html[data-vertical-print="true"] .entry-content dt,
    html[data-vertical-print="true"] .entry-content dd {
        vertical-align: top !important;
    }

    /* 縦中横（数字・英字の横組み） */
    html[data-vertical-print="true"] .combine {
        text-orientation: upright;
        -webkit-text-combine: horizontal;
        -moz-text-combine-upright: all;
        -ms-text-combine-horizontal: all;
        text-combine-upright: all;
        /* display: inline-block;
		text-align: center;
		vertical-align: baseline; */
    }

    /* 上付き文字（フットノート等） */
    html[data-vertical-print="true"] sup {
        font-size: 60%;
        line-height: 1;
        vertical-align: super;
    }

    /* ========================================
	   画像・ギャラリー設定
	   ======================================== */

    /* ギャラリーブロック（Gutenberg/クラシック） */
    html[data-vertical-print="true"] .wp-block-gallery,
    html[data-vertical-print="true"] .gallery,
    html[data-vertical-print="true"] .blocks-gallery-grid {
        column-span: all;
        writing-mode: horizontal-tb !important;
        display: flex;
        flex-wrap: wrap;
        gap: 4mm;
        margin: 0 0 1.5em 0 !important;
        page-break-inside: avoid;
    }

    /* 個々の画像コンテナ */
    html[data-vertical-print="true"] .wp-block-gallery figure,
    html[data-vertical-print="true"] .gallery-item,
    html[data-vertical-print="true"] .blocks-gallery-item {
        width: calc(50% - 4mm);
        margin: 0 !important;
        break-inside: avoid;
    }

    /* 画像本体 */
    html[data-vertical-print="true"] .wp-block-gallery img,
    html[data-vertical-print="true"] .gallery-item img,
    html[data-vertical-print="true"] .blocks-gallery-item img {
        width: 100%;
        height: auto;
        object-fit: cover;
        border: none !important;
    }

    /* 画像キャプション */
    html[data-vertical-print="true"] figure figcaption,
    html[data-vertical-print="true"] .gallery-caption {
        font-size: 9pt;
        line-height: 1.4;
        margin-top: 1.5mm;
        text-align: start;
    }

    /* アイキャッチ画像 */
    html[data-vertical-print="true"] .p-articleThumb {
        margin: 0 0.5em 0 0.5em;
        float: inline-end;
    }

    html[data-vertical-print="true"] .p-articleThumb img {
        width: 50mm;
    }

    /* ネストされたギャラリー */
    html[data-vertical-print="true"] figure.wp-block-gallery.has-nested-images {
        max-width: 98vw !important;
    }

    /* ========================================
	   スライダー設定
	   ======================================== */

    /* スライダー本体（Swiper/Splide等） */
    html[data-vertical-print="true"] .swiper-wrapper,
    html[data-vertical-print="true"] .splide__list {
        column-span: all;
        writing-mode: horizontal-tb !important;
        display: flex;
        flex-wrap: wrap;
        gap: 4mm;
        margin: 0 0 1.5em 0 !important;
    }

    html[data-vertical-print="true"] .swiper-slide,
    html[data-vertical-print="true"] .splide__slide {
        width: calc(50% - 4mm);
        break-inside: avoid;
    }

    /* スライダーナビゲーション非表示 */
    html[data-vertical-print="true"] .swiper-button-prev,
    html[data-vertical-print="true"] .swiper-button-next,
    html[data-vertical-print="true"] .swiper-pagination,
    html[data-vertical-print="true"] .splide__arrows,
    html[data-vertical-print="true"] .splide__pagination {
        display: none !important;
    }

    /* ========================================
	   テーブル設定
	   ======================================== */
    html[data-vertical-print="true"] table {
        break-inside: avoid;
        page-break-inside: avoid;
        /* 必要に応じて回転を有効化 */
        /* transform: rotate(90deg) scale(0.85); */
        /* transform-origin: left top; */
    }

    /* ========================================
	   リンク設定
	   ======================================== */

    /* 画像リンクの装飾除去 */
    html[data-vertical-print="true"] .wp-block-gallery a,
    html[data-vertical-print="true"] .gallery a,
    html[data-vertical-print="true"] .blocks-gallery-item a,
    html[data-vertical-print="true"] .swiper-slide a,
    html[data-vertical-print="true"] .splide__slide a {
        text-decoration: none !important;
        color: inherit !important;
    }

    /* 全リンクの装飾除去 */
    html[data-vertical-print="true"] a,
    html[data-vertical-print="true"] a:visited {
        color: inherit !important;
        text-decoration: none !important;
    }

    html[data-vertical-print="true"] a::after {
        content: "" !important;
    }

    /* ========================================
	   その他の非表示要素（縦書き専用）
	   ======================================== */
    html[data-vertical-print="true"] .site-footer,
    html[data-vertical-print="true"] .p-toc,
    html[data-vertical-print="true"] .c-infoBar,
    html[data-vertical-print="true"] header,
    html[data-vertical-print="true"] footer,
    html[data-vertical-print="true"] .p-articleMetas {
        display: none !important;
    }

    /* 投稿タイトルのみ表示 */
    html[data-vertical-print="true"] .c-postTitle {
        display: block !important;
    }

    html[data-vertical-print="true"] p.indent {
        text-indent: 1em;
        /* 1em → “一字分”のインデント */
        margin-top: 0;
        margin-bottom: 1em;
    }
}