/* =========================================
   common.css
   - 全ページ共通スタイル
   ========================================= */

:root {
  --header-height: 60px; /* ヘッダーの実際の高さに合わせて調整 */
}

/* -----------------------------------------
   1. ベース設定
   ----------------------------------------- */

html {
  scroll-behavior: smooth;
}

/* 横スクロール防止もここに集約 */
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    "YuGothic",
    "メイリオ",
    sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
  padding-top: 60px;
}

/* リンク共通（ボタン系は個別CSSで上書き） */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  /*text-decoration: underline;*/
}

/* -----------------------------------------
   2. レイアウト・セクション共通
   ----------------------------------------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  min-height: 60vh;
  background: #fff;
  /* サブページでは各ページCSS側で padding を指定 */
}

/* セクション基本レイアウト */
section {
  padding: 24px 16px;
  margin-bottom: 24px;
}

section:last-child {
  margin-bottom: 0;
}

/* セクション見出し基本（ページごとの個別セクションで打ち消しも可） */
section h2 {
  font-size: 20px;
  margin-bottom: 8px;
  border-left: 4px solid #333;
  padding-left: 8px;
}

/* 共通ページタイトル（サブページ用） */
.page-header {
  margin-bottom: 24px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
}

.page-header h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

#about,
#members,
#bulletin,
#contact-info,
.page-header {
  scroll-margin-top: calc(var(--header-height) + 8px);
}

/* -----------------------------------------
   3. ヘッダー・グローバルナビ
   ----------------------------------------- */

.site-header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9000;
}

.header-inner {
  max-width: 1100px;
  height: 60px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  font-size: 36px;
  font-weight: 700;
  white-space: nowrap;
}

.site-title a {
  display: flex;
  place-items: baseline;
  gap: 1rem;
}

.site-title a .lang_E {
  font-size: 20px;
  line-height: 1rem;
}

/* ハンバーガーボタン（PCでは非表示） */
.nav-toggle {
  display: none; /* PC: 非表示。SPはメディアクエリで上書き */
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;

  /* ここを縦方向フレックスにするのがポイント */
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0;
  gap: 5px;
}

.nav-toggle-bar {
  display: block;
  width: 24px;           /* 100% → 24px にしてアイコンっぽく */
  height: 2px;
  background-color: #333;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* メニュー展開時のアニメ（任意） */
.site-header.is-nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-header.is-nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.site-header.is-nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* グローバルナビ（PC表示用） */
.global-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.global-nav a {
  position: relative;
  padding: 4px 0;
}

/* 下線アニメーション（ヘッダー内ナビのみ） */
.global-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: #333;
  transition: width 0.2s ease;
}

.global-nav a:hover::after {
  width: 100%;
}

/* -----------------------------------------
   4. フッター
   ----------------------------------------- */

.site-footer {
  background: #000;
  color: #fff;
  padding: 16px;
  position: relative;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  min-height: 60px;
}

.footer-left {
  font-size: 14px;
  font-weight: 600;
}

.footer-right {
  font-size: 13px;
  text-align: right;
}

.footer-right a {
  color: #fff;
  text-decoration: underline;
}

/* コピーライト */
.copyright {
  display: block;
  font-size: 11px;
  color: #ccc;
  margin-top: 4px;
}

/* -----------------------------------------
   5. ページ上部へ戻るボタン
   ----------------------------------------- */

#page-top-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: none;
  background: #333;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
}

#page-top-btn:hover {
  background: #555;
}

/* 非表示用クラス（JSで切り替え） */
#page-top-btn.is-hidden {
  display: none;
}

/* -----------------------------------------
   6. レスポンシブ対応
   ----------------------------------------- */

@media (max-width: 768px) {
  .header-inner {
    /*flex-direction: column;
    align-items: flex-start;*/
    padding: 8px 12px;
  }

  .site-title {
    font-size: 24px;
  }

  .site-title a {
    gap: 0;
    flex-flow: column;
  }

  .site-title a .lang_J {
    line-height: 2rem;
  }

  .site-title a .lang_E {
    font-size: 16px;
  }

  /* ハンバーガーを表示 */
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* ナビはデフォルト非表示（ハンバーガーで開閉） */
  .global-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    display: none;
  }

  .global-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .global-nav li {
    border-top: 1px solid #eee;
  }

  .global-nav a {
    display: block;
    padding: 10px 16px;
  }

  /* .site-header に is-nav-open が付いたら表示 */
  .site-header.is-nav-open .global-nav {
    display: block;
  }

  main {
    padding: 16px 12px 80px;
  }

  .footer-inner {
    flex-direction: row;
    gap: 8px;
  }
}

/* ======== ハンバーガー：オーバーレイ ======== */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 80;
}

/* ======== メニューアニメ ======== */
@media (max-width: 768px) {

  .global-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #ddd;
    display: block;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 90;
  }

  /* 開いたとき */
  .site-header.is-nav-open .global-nav {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  /* オーバーレイの表示 */
  .site-header.is-nav-open ~ .nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }
}

