/*──── ベース ──────────────────────────────────────────────────────────*/
html, body {
  margin: 0; height: 100%; background: #f3f3f3;
}
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.wrapper {
  padding: 10px;
}

/*──── ヘッダー ───────────────────────────────────────────────────────*/
.header-wrapper {
  position: relative;
  background: #fff; border-bottom: 2px solid #E0E0E0;
}
header {
  font-size: 26px; font-weight: bold; text-align: center;
  color: #222; line-height: 1.2; padding: 20px;
}

/*──── ハンバーガー ─────────────────────────────────────────────────*/
.hamburger {
  display: none; position: absolute; top: 18px; right: 20px;
  width: 30px; height: 24px; background: none; border: none;
  cursor: pointer; z-index: 1000; padding: 0;
}
.hamburger span {
  display: block; height: 3px; margin-bottom: 5px;
  background: #555; border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/*──── ナビゲーション（共通） ──────────────────────────────────────*/
.main-nav {
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
nav .main-menu {
  display: flex; justify-content: center;
  list-style: none; margin: 0; padding: 0;
}
nav .main-menu > li {
  position: relative; margin: 0 24px;
}
nav a,
/* ── 変更後 ── */
nav a,
.submenu-btn {
  display: block;           /* ブロック化して高さを揃える */
  width: auto;              /* リストの幅いっぱいに */
  text-align: center;       /* 中央寄せ */
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;         /* ボタン内の行間を統一 */
  color: #555;
  background: none;
  border: none;
  cursor: pointer;
  padding: 16px 8px;
  transition: color 0.3s;  
  margin: 0 auto;        /* ← これを追加 */
}

/* リンク特有の装飾は別ルールで */
nav a {
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

/* hover 状態も揃える */
nav a:hover,
.submenu-btn:hover {
  color: #000;
  border-bottom-color: #000;
}

/*── モバイル時の余白調整（もし必要なら） ──*/
@media (max-width: 768px) {
  .main-menu > li > a,
  .main-menu > li > .submenu-btn {
    /* mobile 用に余白を変えている場合も display:block を維持 */
    padding: 12px 16px;
    
  }
}
nav a {
  text-decoration: none; border-bottom: 3px solid transparent;
}
nav a:hover,
.submenu-btn:hover {
  color: #000; border-bottom-color: #000;
}

/*── サブメニュー（共通／クリックで開閉） ─────────────────────────*/
nav .submenu {
  position: absolute; top: 100%; left: 0;
  display: none; background: #fff;
  border: 1px solid #DDD; border-radius: 2px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  list-style: none; padding: 8px 0; white-space: nowrap;
}
nav .submenu li { margin: 0; }
nav .submenu a {
  display: block; padding: 8px 16px;
  color: #444; font-weight: 500;
}
nav .submenu a:hover {
  background: #F0F0F0;
}
/* ホバーで出すルールを削除 */
/* デスクトップもクリックで開閉 */
.has-submenu.open > .submenu {
  display: block;
}

/*──── メイン ────────────────────────────────────────────────────────*/
main {
  overflow: auto; margin-top: 10px;
  border-bottom: 2px solid #E0E0E0;
}
.main-content {
  min-height: 300px; width: 100%; box-sizing: border-box;
  padding: 40px 20px; background: #fff;
  border: 1px solid #EEE; border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

/*──── フッター ──────────────────────────────────────────────────────*/
footer {
  margin: 0 20px 20px; font-size: 13px; color: #777;
  text-align: center;
}



/*── 画像ボタン ──────────────────────────────────────────────────────────*/
/* 画像ボタン群 */ .image-buttons {
   display: grid; /* 列幅をすべて 170px に固定し、できる限り並べる */ 
   grid-template-columns: repeat(auto-fit, 170px); 
   justify-content: start; /* 行内揃え */ 
   gap: 24px; padding: 40px; 
  } 
   .image-button {
     box-sizing: border-box; /* padding／border を含めて幅を扱う */ 
     width: 170px; /* 固定したい幅を指定 */ 
     display: flex; 
     flex-direction: column; 
     align-items: center; 
     background-color: #FFF; border: 
     1px solid #DDD; border-radius: 8px; 
     padding: 12px; text-decoration: none; 
     transition: box-shadow 0.3s, transform 0.3s; 
    } 
    .image-button:hover { 
      box-shadow: 0 4px 12px rgba(0,0,0,0.1);
      transform: translateY(-2px); 
    } 
    .image-button img 
    { max-height: 180px; 
      width: auto;
       object-fit: contain;
       border-radius: 4px; 
    } 
    .image-button span { 
      margin-top: 10px; 
      font-size: 15px;
       color: #222;
       text-align: center; 
    }
/*──── モバイル（768px以下） ───────────────────────────────────────*/
@media (max-width: 768px) {
  .header-wrapper> header {
    font-size: 18px;
  }
  .hamburger { display: block; }

  .main-nav .main-menu {
    display: none; flex-direction: column;
    position: static; width: auto;
    max-height: calc(100vh - 60px); overflow-y: auto;
    background: #fff; border-top: 1px solid #DDD;
  }
  .main-nav.open .main-menu {
    display: flex;
  }

  .main-menu > li {
    margin: 0; width: auto;
  }
  .main-menu > li > a,
  .main-menu > li > .submenu-btn {
    padding: 12px 16px; border-bottom: 1px solid #EEE;
  }

  /* サブメニュー縦展開 */
  nav .submenu {
    position: static; display: none; width: auto;
    background: #FAFAFA; border: none;
    box-shadow: none; white-space: normal;
  }
  .has-submenu.open > .submenu {
    display: block;
  }
  .submenu li a {
    padding: 10px 32px; font-size: 14px;
    border-bottom: 1px solid #EEE;
  }

  .main-content{
    padding:20px 10px;
  }
  .main-content > h2{
    font-size: 20px;
  }
  .image-buttons {
   display: grid; /* 列幅をすべて 170px に固定し、できる限り並べる */ 
   grid-template-columns: repeat(auto-fit, 110px); 
   justify-content: start; /* 行内揃え */ 
   gap: 12px; padding:0px ; 
  }
    .image-button {
    max-width: 110px;
    padding: 8px;
    font-size: 0.9rem; /* 必要に応じて文字サイズも調整 */
  }    
  .image-button>img 
    { max-height: 110px; 
      width: auto;
       object-fit: contain;
       border-radius: 4px; 
    } 
  .image-button >span { 
      margin-top: 5px; 
      font-size: 11px;
    }
}