html, body {
}

/* 2. containerも100%に広げる */
/* デフォルト（共通設定） */
#container {
    display: flex;
    flex-direction: column;
    margin: 0 auto;
}

/* 単体で開いたときのスタイル */
.standalone-mode {
    width: 80vw; /* 80%の幅で見やすく */
}

/* index.html に埋め込まれたときのスタイル */
.embedded-mode {
    width: 100%; /* 親のデザインに合わせて広げる */
}

/* 4. main要素（中身）だけを独立してスクロールさせる */
#main__blog {
    flex-grow: 1;      /* 残りの高さをすべて使う */
    box-sizing: border-box;
}

/* ボタンの名称表示位置を常に真ん中に揃える */
body button {
   
}

/* mainにつけたmodeに応じてボタンの表示・非表示を切り替える */

#container[data-mode='list'] #listBtn{
      background-color : gray;
      color : white;
      pointer-events: none;
}

/* Editor basic styles */

#editBtn{
    white-space : nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
}

.editor-content {
    height : 100%; /*高さをめいいっぱい伸ばしたい */
    min-height: 450px;
    border: 1px solid #ddd;
    padding: 1.5rem;
    border-radius: 0.5rem;
    background: white;
    line-height: 1.8;
}

.editor-content:focus {
    outline: 2px solid #3b82f6;
    border-color: transparent;
}

/* *******************************************
     toolbar
*********************************************/

#toolbar {
    justify-content : space-between;
    position: sticky;
    top: 60px;
    z-index: 10;
    /* 背景色を不透明にして、背後にスクロールした文字が透けないようにする */
    background-color: #f9fafb; /* bg-gray-50 と同色 */
    /* 固定時の視認性を上げるために影をつける */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#toolbar span{
    white-space : nowrap;
}

#toolbar .partition {
    display : flex;
    flex-direction : row;
    align-items : center;
    /*     flex: 1 1 0%;  */
    /* 画像用に使っていた魔法のコードをここにも適用！ */
    min-width: 0;
    column-gap : 0.5rem;
}

#toolbar .partition button,
#toolbar .partition label {
    flex-shrink: 0;
}

/* Responsive design */
@media screen and (max-width : 767px) and (orientation: portrait){
    #toolbar {
        flex-direction : column;
	row-gap : 2px;
    }

    #toolbar .partition{
	flex: 0 0 100%;
	column-gap : 2px;
    }

     #toolbar  .partition{
	 justify-content : flex-start;
     }

    #toolbar .partition--fe button{
	padding : 2px 1rem;
    }
}


/* Post detail view */
#post-display-content{
    overflow-wrap: break-word; /*文字のはみ出し禁止 */
}

/* Modal background */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}



/* postimg-wrapper */
.postimg-wrapper {
    border : 1px solid red;
}

.postimg-wrapper:not(:has(img)){
    border : 0px solid transparent;
}

/*記事内の画像のクラス*/
.postimg{
    margin: 10px 10px;
}


/* Flexbox内で綺麗に画像を並べる */
.image-flex-container .postimg{
    flex : 1;
    min-width : 0;  /* magical code */
    object-fit: cover;
    margin : 0px 5px;
}

/* ★変更: :focus ではなく .is-active クラスが追加された時のスタイル */
.image-flex-container.is-active {
    border: 2px solid red; 
    background-color: rgba(255, 0, 0, 0.05); 
}

/* 表示する画像のサイズをコントロールしたいっす */

#main__blog[data-imgsize="full"] .postimg{
    width : auto;
    height : auto;
}

#main__blog[data-imgsize="half"] .postimg{
    max-width: 50vw;
    width : auto;
    height : auto;
}

#main__blog[data-imgsize="quarter"] .postimg{
    max-width : 25vw;
    width : auto;
    height : auto;
}

@media screen and (max-width : 767px) and (orientation: portrait){
    #main__blog[data-imgsize="half"] .postimg{
    max-width: 100%;
    width : auto;
    height : auto;
    }
    
    #main__blog[data-imgsize="quarter"] .postimg{
	max-width : 100%;
	width : auto;
	height : auto;
    }
}

/* Toast message animation */
@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.toast-msg {
    animation: slideUp 0.3s ease-out;
    transition: opacity 0.5s ease;
}

/* Thumbnail crop settings */
.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* updateの表示 */

.update_p {
    display : none;
}

#post-display-update{
    display : none;
}

/* Post Detail View の記事一覧に戻るの表示 */

/* 1. コンテナ自体が画面からはみ出さないようにし、中身のスクロールを管理する */
#view-post:not(.hidden) {
    display: flex;
    flex-direction: column;
    height: 100%; /* 修正: mainの高さ100%に合わせる */
    overflow: hidden; 
}

/* 3. article部分だけをスクロール可能にする */
#view-post article {
    flex-grow: 1; /* 残りのスペースを全て使う */
    overflow-y: auto; /* ここだけスクロールさせる */
    padding: 2rem; /* 読みやすい余白 */
    box-sizing: border-box;
}

/* a Tag */
.linkInPost{
    color : blue;
    transition : 0.5s;
}

.linkInPost:hover{
/*	font-size : 1.5rem;  対して効果的でないので無効化 */
}

/* Draft */

#draft{
    border : 1px solid red;
    overflow : hidden;
    display : flex;
    flex-direction : column;
    gap : 2px;
    width : 100%;
    height : auto;
}

/* 記事の一時保管ファイル一覧から記事を削除するためのボタン等 */
.list-item-container{
    width : 100%;
    height : auto;
    display : flex;
    flex-direction : row;
    border : 1px #aaaaaa solid;
    border-radius : 5px;
    overflow : hidden;
 }

.listItem{
    display : flex;
    flex-direction : row;
    padding : 1rem;
    flex : 4 1 95%;
    overflow : hidden;
    cursor : pointer;
}

.killbtn{
    display : flex;
    flex-direction : row;
    justify-content : center;
    align-items : center;
    width : 1%;
    min-width : 2rem;
    background-color : red;
    overflow : hidden;
    transition : 0.5s;
}
    
.killbtn button{
    display: flex;
    justify-content: center;
    align-items: center;
    color : red;
    overflow : hidden;
    font-weight : 600;
}

.killbtn:hover {
    width : 10%;
}

.killbtn:hover  button{
	color : white;
}

/* 不活性化したボタンの表示 */
button:disabled{
    background-color : gray;
    color : white;
    cursor : defult;
}

/* btnwrapper */
#div__btnwrapper{
}

/* Administrator buttons */

#adminBtn{
    display : flex;
    flex-direction : row;
    column-gap : 1rem;
    justify-content : flex-end;
    align-items : center;
    width : 1rem;
    min-width : 1rem;
    background-color : #2563eb; 
    overflow : hidden;
    transition : 0.5s;
    border : 0px solid transparent;
    border-radius : 5px;
}
    
#adminBtn button{
    color : #2563eb;
    overflow : clip;
    font-weight : 600;
    white-space : nowrap;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action : none;
    user-select : none;
    -webkit-user-select : none;
}

/* ***********************************/

/* PCでのホバー、またはスマホでのタップ（フォーカス）で展開 */
#adminBtn:hover,
#adminBtn:focus-within {
    width : 25%;
    background-color : white;
}

#adminBtn:hover button,
#adminBtn:focus-within button {
    color : white;
}

/* スマホ用のメディアクエリ内も同様に */
@media screen and (max-width : 767px) and (orientation: portrait){
    #adminBtn:hover,
    #adminBtn:focus-within {
        width : 50%; /* ボタンが3つあるので、文字切れに注意してください */
    }
}

/* Extendable Button Group */

.btn-container{
    background-color : gray;
    border : 1px solid blue;
    border-radius : 5px;
    overflow : clip;
    display : flex;
    flex-direciton : row;
    justify-content  : space-between;
    align-items : center;
    padding : 0;
}

.btn-container   button{
	border-radius : 5px;
	overflow : clip;
	white-space : nowrap;
/*	border : 1px solid white; */
	flex : 1 0 auto;
	display: flex;
	justify-content: center;
	align-items: center;
}

.btn-container span{
    flex : 3 0 70%;
}

.btn-group{
    padding : 1px 1rem;
    width : fit-content;
    display : flex;
    flex : 2 0 auto;
    flex-direction : row;
    column-gap : 2rem;
    justify-content : space-between;
    background-color : skyblue;
    border : 0px solid transparent;
    border-radius : 5px;
}

.btn-group--extend{
    padding : 1px 1rem;
    width : 1%;
    display : flex;
    flex : 0 0 auto;
    flex-direction : row;
    column-gap : 1rem;
    background-color : red;
    border : 0px solid transparent;
    border-radius : 5px;
    overflow : clip;
    transition : 1s ease-in;
    flex-wrap : nowrap;
    justify-content : space-between;
}

.btn-group--extend btn-group{
    background-color : red;
}

.btn-group--extend button{
    color :red;
    overflow : hidden;
}

.btn-group--extend:hover{
    width : 15%;
}

 .btn-group--extend:hover button{
	color :white;
}

 /* blognavのタイトル部分のflex割合の指定  */

 #div__topmenu{
     justify-content : flex-end;
     flex : 0 1 45%;
 }

.flex--3-0-50{
    flex : 0 1 50%;
}

.video-icon-inline {
  width: 50px;
  height: 50px;

  /* SVGコードを直接埋め込み */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='100' height='100' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2' ry='2' /%3E%3Cpolygon points='10,8 16,12 10,16' /%3E%3C/svg%3E");
  
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Responsive design */
@media screen and (max-width : 767px) and (orientation: portrait){
    #container {
        width : 100%;
    }
    
    #blognav{
        flex-direction : row;
        align-items : center;
        padding : 0 0;
        flex-wrap : wrap;
    }
    
    #titleBox{
        flex : 0 0 100%;
	display : none;
    }
    
    #div__topmenu{
        max-width : 100%;
        justify-content : flex-start;
        flex : 1 1 20%;
	margin : 5px 0;
    }

    #div__topmenu button{
        white-space : nowrap;
        flex : 0 1 auto;
    }

    #reloadBtn{
        display : none;
    }

    #adminBtn:hover,#adminBtn:focus-within {
        width : 50%; /* ボタンが3つあるので、文字切れに注意してください */
    }
    
    #adminBtn button{
        white-space : nowrap;
    }

    #adminBtn:hover button{
        color : white;
    }

    .killbtn:hover {
	width : 20%;
    }
    
    /* 💡 Post Log Viewer 用の設定を、正しくスマホ用の@mediaの中に移動します */
    #log-nav{
        flex-direction : column; /* スマホ時は縦並びに */
    }

    #log-list{
        width : 100%; /* スマホ時のみ、幅を100%にして全幅表示にする */
    }
    
    #view-chart{
        height : auto;
    }
} 

/*------- Auth-modal ----------- */

#auth-modal{
    z-index : 2000;
}


/* --- 横並び画像プレースホルダー用のスタイル --- */
.image-placeholder-container {
    display: flex;
    gap: 1rem;
    width: 100%;
    margin: 1rem 0;
}

.image-placeholder-box {
    flex: 1;
    border: 2px dashed #d1d5db; /* 点線枠 */
    background-color: #f9fafb;
    min-height: 150px; /* ドロップしやすいように最低限の高さを確保 */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* 画像がはみ出た部分をカット */
    cursor: pointer;
}

/* ① CSSで案内テキストを表示する（HTML内には文字データを持たない） */
.image-placeholder-box::before {
    content: "画像を挿入できます";
    color: #9ca3af;
    font-size: 0.9rem;
    pointer-events: none; /* テキストがクリックの邪魔をしないようにする */
    text-align: center;
    padding: 1rem;
}

/* ② 画像 (img) が中に入ったときの状態変化（ :has() を使用 ） */
.image-placeholder-box:has(img) {
    border: none; /* 画像が入ったら点線枠を消す */
    background-color: transparent;
}

/* ③ 画像 (img) が中に入ったら、案内テキストを消去する */
.image-placeholder-box:has(img)::before {
    display: none;
}

/* ④ 挿入された画像を枠いっぱいに広げる */
.image-placeholder-box img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 縦横比を保ちつつ、枠を埋め尽くす */
    display: block;
}

/* Image Flex Box */
/* Flexコンテナの基本スタイル */
.image-flex-container {
    display: flex;
    justify-content : center;
    width: 100%;
    min-height : 150px;
    margin: 1rem 0;
    border : 1px dashed yellow; 
    caret-color : red;
    padding: 10px; /* 画像が満杯でもクリックできる「内側の余白」 */
    box-sizing: border-box; 
    transition: all 0.3s ease; /* 色のフワッとした切り替え用（お好みで） */
}

.image-flex-container:has(img){
    border-color : transparent; /*画像が入っている場合は枠線を表示しない*/
}


@media screen and (max-width : 767px) and (orientation: portrait){
    .image-flex-container {
	flex-direction : column;
	min-height : 50px;
    }
}

/* Toolbar */

@media screen and (max-width : 767px) and (orientation: portrait){
    /* 必要に応じてスマホ時のみ固定位置を調整 */
    #toolbar {
        top: 50px; /* 例: スマホ時のナビゲーションバーの高さに合わせる */
    }
}


/*見出し用*/
#editor h2, #post-display-content h2{
            font-size: 1.5rem;
            font-weight: bold;
            border-bottom: 3px solid #3b82f6;
}

#editor h3, #post-display-content h3{
    font-size: 1.25rem;
    font-weight: bold;
    border-bottom: 2px solid #e5e7eb;
    padding-left: 0.5rem;
}

/* ページング表示 */

#pagination-controls{
}

@media screen and (max-width : 767px) and (orientation: portrait){
    #pagination-controls{
/*	flex-wrap : wrap; */
    }
}
