/*-------------------------------------------
    サブスクサービスサイト/問い合わせフォーム用header
    ・対象: common/layout.twig / layout_business.twig
-------------------------------------------*/

/*-------------------------------------------
    運用ルール
    ・クラスはすべて main-header / main-header__* を使い、既存の header 用クラス
      （service-header / sp_nav / hum-nav / sp_nav_type0x / sp_nav_bond / pc_nav / nav_type0x 等）は使わない
    ・ハンバーガーの開閉は共通 JS（script.js / accessibility.js）が行うため、以下は残す
        id="sp-menu" … 開閉ボタン（クリック・Enter キーで開閉）
        clicked      … 開いた状態。#sp-menu とヘッダー内のすべての ul に付与される
        メニュー本体は #sp-menu の兄弟要素の div にし、#sp-menu.clicked ~ で表示を切り替える
        （JS は header 内のすべての ul にも clicked を付けるが、本体を div にすることで既存の ul 用ルールの影響を受けない）
    ・#sp-menu.clicked は common.css の body:has(#sp-menu.clicked) でチャットボットを隠す処理にも使われている
    ・法人（layout_business.twig）のメニュー本体には JS 用に sp_nav クラスを残す
      （script.js が /business で .sp_nav a 押下時にメニューを閉じるため。既存 CSS は ul.sp_nav にのみ当たる）
    ・ブレイクポイント: PC 1281px〜 / タブレット 768px〜1280px / SP 〜767px
-------------------------------------------*/

/*-------------------------------------------
    ハンバーガーメニュー（タブレット・SP）
    マークアップ:
      <div id="sp-menu">…</div>
      <div class="main-drawer">                       … #sp-menu の後ろに兄弟要素として置く
        <div class="main-drawer__inner">
          <a class="main-drawer__logo">…</a>
          <nav class="main-drawer__nav">
            <ul class="main-drawer__list">…</ul>       … メインのリンク
            <div class="main-drawer__buttons">…</div>  … 申込ボタン / LINE ボタン
            <div class="main-drawer__sub">             … 2列の小さいリンク
              <ul class="main-drawer__list main-drawer__list--sub">…</ul>
            </div>
          </nav>
        </div>
      </div>
    ・表示は #sp-menu.clicked ~ .main-drawer で切り替える（.main-drawer は JS の clicked 付与対象外の div）
    ・中の ul には common.css / subsc.css / business-new.css の header:not(.exclusion) ul（詳細度 0,1,2）、
      ul li（0,1,3）、ul li a（0,1,4）が当たるため、.main-drawer から書き始めて打ち消す
    ・法人では business.css（SP）の header.business:not(.exclusion) ul（詳細度 0,2,2）も当たるため、
      ul 自体の指定はクラス3つ（0,3,0）で書く
-------------------------------------------*/
/* PC では表示しない */
.main-drawer {
  display: none;
}

@media screen and (max-width: 1280px) {
  .main-drawer {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    overflow-y: auto;
    background: #2C2C2C;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
  }

  #sp-menu.clicked ~ .main-drawer {
    opacity: 1;
    visibility: visible;
  }
  #sp-menu.clicked {
    margin: -12px 3% 0 0;
  }

  .main-drawer .main-drawer__inner {
    box-sizing: border-box;
    width: min(270px, 100% - 40px);
    margin: 0 auto;
    padding: 32px 0 60px;
  }

  /* ロゴは画面中央に置く */
  .main-drawer .main-drawer__logo {
    display: block;
    width: fit-content;
    margin-inline: auto;
  }

  .main-drawer .main-drawer__logo img {
    display: block;
    width: 130px;
    height: auto;
  }

  /* リンクリスト（header:not(.exclusion) ul の全画面固定などを打ち消す） */
  /* メインのリンクは、リストの幅を中身に合わせて画面中央に置く（文字は左揃え）
     business.css（SP）の header.business:not(.exclusion) ul（詳細度 0,2,2）にも勝つよう、クラス3つで指定する */
  .main-drawer .main-drawer__nav .main-drawer__list {
    position: static;
    display: flex;
    flex-direction: column;
    row-gap: 18px;
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    margin-block: 55px 0;
    padding: 0;
    background: none;
    opacity: 1;
    visibility: inherit;
    transform: none;
    overflow: visible;
  }

  .main-drawer .main-drawer__list li {
    position: static;
    width: auto;
    text-align: left;
    text-indent: 0;
    letter-spacing: 0.05em;
    list-style: none;
  }

  .main-drawer .main-drawer__list li a {
    color: #FFFFFF;
    font-size: 1.2rem;
    line-height: 1;
    text-decoration: none;
    transition: color .3s;
    font-weight: 400;
  }

  .main-drawer .main-drawer__list li a:hover {
    color: #FFE000;
  }

  /* 申込ボタン / LINE ボタン */
  .main-drawer .main-drawer__buttons {
    display: flex;
    flex-direction: column;
    row-gap: 25px;
    margin-top: 55px;
  }

  .main-drawer .main-drawer__button {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    column-gap: 10px;
    box-sizing: border-box;
    min-height: 44px;
    padding: 8px 36px;
    border-radius: 999px;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    transition: color .3s, background-color .3s;
  }

  .main-drawer .main-drawer__button:hover {
    background: #1E1E1E;
    color: #FFE400;
  }

  /* 右端の ▶ */
  .main-drawer .main-drawer__button::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    border-style: solid;
    border-width: 5px 0 5px 7px;
    border-color: transparent transparent transparent currentColor;
    transform: translateY(-50%);
  }

  .main-drawer .main-drawer__button--entry {
    background: #E6006B;
    color: #FFFFFF;
  }

  .main-drawer .main-drawer__button--line {
    background: #FFFFFF;
    color: #17B802;
  }

  .main-drawer .main-drawer__button--line::after {
    border-left-color: #17B802;
  }

  .main-drawer .main-drawer__button--line:hover {
    background: #FFE000;
    color: #17B802;
  }

  .main-drawer .main-drawer__line-em {
    font-size: 1.6rem;
  }

  .main-drawer .main-drawer__button--consult {
    background: #026ABD;
    color: #FFFFFF;
  }

  .main-drawer .main-drawer__button--entry,
  .main-drawer .main-drawer__button--consult {
    font-size: 1.6rem;
  }

  .main-drawer .main-drawer__button--entry,
  .main-drawer--business .main-drawer__button {
    box-shadow: 3px 3px 0 #FFE400;
  }

  .main-drawer .main-drawer__line-icon {
    width: 32px;
    height: auto;
    border-radius: 6px;
  }

  /* 2列の小さいリンク（メインのリンクと同じ列幅に収め、ボタン幅からはみ出さないようにする） */
  .main-drawer .main-drawer__sub {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 10px;
    width: 200px;
    max-width: 100%;
    margin: 50px auto 0;
  }

  /* 小さいリンクの行間はメインのリンクより詰める */
  .main-drawer .main-drawer__sub .main-drawer__list--sub {
    row-gap: 12px;
    width: auto;
    margin: 0;
  }

  .main-drawer .main-drawer__list--sub li a {
    font-size: 1.2rem;
  }
}

@media screen and (max-width: 767px) {
  #sp-menu.clicked {
    margin: -12px -12px 0 0;
  }
}