@charset "UTF-8";

/*!
Theme Name: Cocoon Child
Description: Cocoon専用の子テーマ
Theme URI: https://wp-cocoon.com/
Author: わいひら
Author URI: https://nelog.jp/
Template:    cocoon-master
Version:     1.1.3
*/

/************************************
** 子テーマ用のスタイルを書く
************************************/


/************************************
** 固定ページのタイトル
************************************/
.entry-title {
    font-size: 30px;
    line-height: 3;
    text-align: left;
    padding: 1em;
    margin-top: 10px;
    margin-bottom: 1em;
}


/* カテゴリーラベル非表示 */
.entry-card .cat-label {
    display: none;
}

/************************************
****　背景色
************************************/
body {
    background-color: #000;
    max-width: auto;
    margin-left: 0;
}


/************************************
****　レイアウトと見出し
************************************/

/* ---- 共通レイアウト変数 ---- */
.article {
    --gutter: clamp(4rem, 7vw, 14rem); /* 左の余白（本文の開始位置） */
    --content: 800px;                  /* 本文の最大幅 */
    --side: 2rem;                      /* 右の余白 */
}

/* ---- 親要素の余白をリセット（重要） ---- */
.article {
    padding-left: 0; /* 親の余白をなくし、子のmarginで位置を統一 */
}

/* h1～h6 共通 */
.article h1,
.article h2,
.article h3,
.article h4,
.article h5,
.article h6 {
    box-sizing: border-box;
    margin-left: var(--gutter);
    margin-right: var(--side);
    width: min(calc(100% - var(--gutter) - var(--side)), var(--content));
}

/* 見出しごとの固定幅インデント（全角1文字≒2ch） */
.article h2 { margin-left: calc(var(--gutter) + 2ch); } /* h1より全角1文字分下げ */
.article h3 { margin-left: calc(var(--gutter) + 4ch); } /* h2よりさらに全角1文字分下げ */
.article h4,
.article h5,
.article h6 { margin-left: calc(var(--gutter) + 6ch); } /* h3よりさらに全角1文字分下げ */

/* ---- 各見出しのスタイル ---- */
.article h1 {
    padding: 10px;
    border: 2px solid #176dab;
    box-shadow: 5px 5px #176dab;
    color: #000000;
    background: #83C3F0;
    margin-left: 4rem; /* h1だけは個別のマージンを設定（必要な場合） */
    box-sizing: border-box;
    max-width: 800px;
    margin-bottom: 20px;
}

.article h2 {
    line-height: 1 !important;
    background-color: #A7D2F0 !important;
    font-size: 24px !important;
    color: #000 !important;
    border-radius: 1px !important;
    border-left: 14px solid #636b64 !important;
    padding: .5em !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

.article h3 {
    line-height: 1 !important;
    background-color: #D7E6F0 !important;
    font-size: 22px !important;
    color: #333 !important;
    border-radius: 2px !important;
    border-left: 10px solid #8b968d !important;
    padding: .5em !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

.article h4 {
    position: relative;
    border-left: 4px solid #2589d0;
    border-bottom: 4px dotted #2589d0;
    background-color: #D7E6F0;
    color: #333333;
    font-size: 18px;
    line-height: 1.5em;
    padding: 0.2em 0.5em;
    margin-top: 5px;
    margin-bottom: 5px;
}

.article h5{
    line-height: 1.5em !important;
    background-color: #F0CBD8 !important;
    /*border-bottom: 4px solid #F083A9;*/
    border-left: 4px solid #F083A9;
    font-size: 18px !important;
    color: #333333 !important;
    border-radius: 2px !important;
    padding: 0.2em !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
}

.article h6{
    line-height: 1.5em;
    background-color: #FFF0F5; /*H6背景色の変更はこちら*/
    border-left: 4px solid #F083A9;
    border-bottom: 4px dotted  #FFB6C1;
    font-size: 16px;
    color:#333333;
    border-radius:1px;
    padding:0.2em !important;
    margin-top:5px !important;
    margin-bottom:5px !important;
}


/************************************
**** p, リスト, その他要素
************************************/

/* ---- 本文（p）は h6 よりさらに全角1文字（=2ch）下げる
       ※幅はインデント分+安全マージン(2ch)を差し引いてはみ出し防止 ---- */
.article p {
    box-sizing: border-box;
    margin-left: calc(var(--gutter) + 8ch); /* 左インデント: h6(6ch) + 2ch */
    margin-right: var(--side);
    width: min(
        calc(100% - var(--gutter) - var(--side) - 8ch - 2ch),
        calc(var(--content) - 8ch - 2ch)
    );
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 16px;
    overflow-wrap: anywhere; /* 長いURL等でもはみ出さない */
    word-break: break-word;
}

/* ---- リストは h6 と同じ位置に揃える ---- */
.article ul,
.article ol {
    box-sizing: border-box;
    margin-left: calc(var(--gutter) + 6ch);
    margin-right: var(--side);
    width: min(calc(100% - var(--gutter) - var(--side) - 6ch), var(--content));
    list-style-position: outside;
    padding-inline-start: 2em;
    margin-top: 10px;
    margin-bottom: 10px;
}

.article li {
    padding-inline-start: 0 !important;
    text-indent: 0 !important;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ---- 情報ボックス（kb-box） ---- */
.kb-box {
    margin-left: var(--gutter) !important; /* 本文列の開始位置に揃える */
    display: block;
    max-width: 800px;
    border: 2px solid #000;
    background-color: #c4d7e9;
    border-radius: 10px;
    padding: 10px;
}

/* テーブル */
.article table{
  box-sizing: border-box;
  margin-left: var(--gutter);
  margin-right: var(--side);
  width: min(60%, var(--content));
  max-width: 100%;
  border-collapse: collapse;
}
th, td {
    border: 1px #333 solid;
}


/************************************
**** モバイル表示（640px以下）
************************************/
@media (max-width: 640px) {
    /* ---- 変数をスマホ用に変更 ---- */
    .article {
        --gutter: 1rem;
        --side: .5rem;
        --content: 100%;
    }

    .article { padding-left: 0 !important; }

    /* 見出しはすべて同じ左右余白に */
    .article h1,
    .article h2,
    .article h3,
    .article h4,
    .article h5,
    .article h6 {
        margin-left: 1rem !important;
        margin-right: .5rem !important;
        width: calc(100% - 1rem - .5rem) !important;
        max-width: none !important;
        box-sizing: border-box;
    }

    /* 本文（p）は h6 よりさらに 1文字（2ch）右へ。
       幅は “左マージン＋右マージン” を引いた正味幅にして、はみ出し防止。
       さらに安全マージンとして -2ch しておく */
    .article p {
        box-sizing: border-box;
        margin-left: calc(1rem + 2ch) !important;
        margin-right: .5rem !important;
        width: calc(100% - (1rem + 2ch) - .5rem - 2ch) !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* リストは h6 と同じ位置（見出しと揃える） */
    .article ul,
    .article ol {
        box-sizing: border-box;
        margin-left: 1rem !important;
        margin-right: .5rem !important;
        width: calc(100% - 1rem - .5rem) !important;
    }

    .article li {
        padding-inline-start: 0 !important;
        text-indent: 0 !important;
    }

    /* 情報ボックス */
    .kb-box {
        margin-left: 1rem !important;
        margin-right: .5rem !important;
        width: calc(100% - 1rem - .5rem) !important;
        max-width: none !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .article table{
        box-sizing: border-box;
        margin-left: 1rem !important;
        margin-right: .5rem !important;
        width: calc(100% - 1rem - .5rem) !important;
        max-width: none !important;
    }
}

@media (max-width: 768px) {
  /* トグルボタンを基準にする */
  .mega-menu-toggle button.mega-toggle-animated {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
  }

  /* ラベルをボタン直下に固定配置 */
  .mega-menu-toggle button.mega-toggle-animated::after {
    content: "メニュー";          /* ← ここをお好みで */
    position: absolute;
    top: 100%;                    /* ボタンの直下に配置 */
    margin-top: 6px;              /* 距離（好みで調整） */
    left: 50%;
    transform: translateX(-50%);  /* 中央揃え */
    white-space: nowrap;          /* 折り返し防止 */
    font-size: 12px;
    line-height: 1;
    color: #fff;                  /* 白文字 */
    text-shadow: 0 0 3px rgba(0,0,0,.4); /* 視認性UP（任意） */
    pointer-events: none;
    z-index: 2;                   /* 念のため重なり勝ちに */
  }

  /* 親で切られないように＆ラベル分の余白を確保 */
  .mega-menu-toggle {
    overflow: visible;            /* 重要：はみ出しを隠さない */
    padding-bottom: 18px;         /* ラベル分のスペースを追加 */
    text-align: center;
  }
}
