/**
 * ==========================================================
 *  記事コンテンツの見た目カスタマイズ用CSS
 *  （クライアントのサイトごとにこのファイルだけ調整してください）
 *
 *  .editor-body   = 管理画面の編集プレビュー
 *  .detail-body   = 公開側の詳細ページ・プレビュー
 *  同じ見た目になるよう、両方まとめて指定しています。
 * ==========================================================
 */

.editor-body, .detail-body {
    line-height: 1.8;
}

.editor-body h1, .detail-body h1 {
    font-size: 26px;
    margin: 24px 0 12px;
    line-height: 1.4;
}

/* ---- 見出し2〜4 共通（余白など） ---- */
.editor-body h2, .detail-body h2, #headingMenu .heading-opt-h2,
.editor-body h3, .detail-body h3, #headingMenu .heading-opt-h3,
.editor-body h4, .detail-body h4, #headingMenu .heading-opt-h4 {
    padding: 0 0 10px 0;
    margin: 10px auto;
    line-height: 1.4;
    font-weight: bold;
    /* 目次のアンカーリンクでジャンプした時に見出しが画面上端ぴったりにならないよう、
       スクロール時の余白を確保する（固定ヘッダー等が無くても見た目の余裕として有効）。 */
    scroll-margin-top: 50px;
}

/* ---- 見出し2（サイズ・色。編集ツールバーのプルダウンにも同じ値を反映） ---- */
.editor-body h2, /* 編集 */
.detail-body h2, /* 公開分 */
#headingMenu .heading-opt-h2 /* 編集ツールバー */
{
    background-size: 20px;
    padding: 0 0 0 30px;
    border: 0;
    margin: 0 auto;
    font-size: 22px;
    text-align: left;
    background-repeat: no-repeat;
    background-image: url(../../../img/icon_red_o_h2.png);
    font-weight: normal;
}

/* ---- 見出し3 ---- */
.editor-body h3, /* 編集 */
.detail-body h3, /* 公開分 */
#headingMenu .heading-opt-h3 /* 編集ツールバー */
{
    font-size: 120%;
    border: #cccccc solid;
    border-width: 0 0 1px 0;
    padding: 0 0 3px 0;
}

/* ---- 見出し4 ---- */
.editor-body h4, /* 編集 */
.detail-body h4, /* 公開分 */
#headingMenu .heading-opt-h4 /* 編集ツールバー */
{
    font-size: 100%;
}

.editor-body p, .detail-body p {
    margin: 0 0 12px;
}

ul, ol {
    margin: 10px auto;
    padding: 0 0 0 1.5em;;
}

/* ---- 画像・動画（本文中に挿入されたもの・エディタ側） ---- */
.editor-body img,
.editor-body video {
    width: 100%;
    height: auto;
    display: block;
    cursor: default;
}

/* 画像・動画自体にはmarginを持たせない（display:tableのラップ内で暗黙のtable-cellが
   生成され、marginの影響で実際のサイズより枠が大きくなり削除ボタンの位置がズレるため）。
   上下の余白は代わりにラップ側(.media-wrap)に持たせる。 */
.editor-body .media-wrap {
    margin: 8px 0;
}

/* 縦長(高さ>幅)の画像・動画は横長と同じwidth:100%だと縦に間延びしすぎるため、
   高さ基準(max-height:70vh)で縮小し、幅は成り行き(auto)にする。
   縦長かどうかはeditor.js側で読み込み後にimg-portrait/video-portraitクラスを付けて判定する。 */
.editor-body img.img-portrait,
.editor-body video.video-portrait {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 70vh;
}

/* 縦長の画像・動画は幅が本文いっぱいまで広がらないため、削除ボタン用のラップも
   実サイズに合わせて中央寄せする。上下marginは.media-wrapと同じ8pxをここでも
   明示している（display/max-width/横方向のautoだけの上書きにはしていない）。 */
.editor-body .media-wrap:has(> img.img-portrait),
.editor-body .media-wrap:has(> video.video-portrait) {
    display: table;
    margin: 8px auto;
    max-width: 100%;
}

.editor-body audio {
    max-width: 100%;
    display: block;
    margin: 8px 0;
}

.editor-body blockquote, .detail-body blockquote {
    border-left: solid #cccccc;
    border-left-width: 3px;
    margin: 8px 0 8px 8px;
    padding: 0 0 0 12px;
    color: #666666;
}

.editor-body pre, .detail-body pre {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
}

.editor-body hr, .detail-body hr {
    height: 1px;
    background: #cccccc;
    border: none;
    border-width: 0;
    margin: 5px 0;
}

/* ---- 動画（公開側・プレビュー） ---- */
.detail-body img,
.detail-body video {
    width: 100%;
    height: auto;
    display: block;
}

.detail-body img.img-portrait,
.detail-body video.video-portrait {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
}

/* ---- 画像のライトボックス表示（公開側・プレビュー） ---- */
.detail-body .lity-img-wrap {
    position: relative;
    display: block;
    width: 100%;
    background: #000000;
    overflow: hidden;
    cursor: pointer;
    margin: 10px auto;
}

.detail-body .lity-img-wrap:has(> img.img-portrait) {
    display: table;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
}

.detail-body .lity-img-wrap img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    transition: opacity .2s ease;
}

.detail-body .lity-img-wrap img.img-portrait {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 70vh;
}

.detail-body .lity-img-wrap:hover img {
    opacity: .8;
}

.detail-body .lity-img-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    bottom: 14px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, .55);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10' cy='10' r='7'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}

.detail-body .lity-img-wrap:hover::after {
    opacity: 1;
}