﻿/* =======================================================
   共通スタイル / 北海道道徳教育研究会
   全ページ統一版 style.css
   ======================================================= */

/* ページ全体 */
body {
  margin: 1em;
  font-family: "MS PGothic", sans-serif;
  background-color: #ffffff;
  line-height: 1.6;
  color: #000;
}

/* ヘッダー見出し */
h1 {
  text-align: center;
  margin: 10px 0;
  font-size: 2em;
  color: #000;
}

h2 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-size: 1.5em;
}

h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-size: 1.2em;
}

/* =======================================================
   ナビゲーションバー
   ======================================================= */
.navbar {
  background-color: #2a5d99;
  display: flex;
  justify-content: center;
  border-top: 4px solid #1a3d66;
  border-bottom: 4px solid #1a3d66;
  flex-wrap: wrap;
  max-width: 1200px;
  min-width: 800px;
  margin: 0 auto;
  font-size: 14px;
}

.navbar a {
  flex: 1 1 auto;
  display: block;
  padding: 10px 0;
  text-align: center;
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  border-right: 1px solid #fff;
}

.navbar a:last-child {
  border-right: none;
}

.navbar a.active,
.navbar a:hover {
  background-color: #4477bb;
}

/* --- MENUボタン（追加） --- */
.menu-toggle {
  display: none;
  cursor: pointer;
  background-color: #2a5d99;
  color: #fff;
  font-size: 18px;
  border: none;
  padding: 12px 0;
  text-align: center;
  width: 100%;
  border-top: 4px solid #1a3d66;
  border-bottom: 4px solid #1a3d66;
}

/* =======================================================
   contentクラスで本文の左右余白を統一
   ======================================================= */
.content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 10px;
}

/* バナー */
.banner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
}

.banner img {
  width: 100%;
  height: auto;
  display: block;
}

/* カウンター */
.counter {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: flex-end;
  padding: 5px 0;
}

.counter img {
  height: 25px;
}

/* 区切り線 */
.section-line,
.divider {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 20px auto;
}

/* テーブル共通 */
table {
  border-collapse: collapse;
  line-height: 1.6;
  font-size: 16px;
  width: 100%;
}

table td,
table th {
  padding: 4px 6px;
  border: none;
  vertical-align: top;
}

/* NEWS 横並び */
.news-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
  margin: 0 auto;
  gap: 20px;
}

.news-box {
  flex: 1;
  min-width: 300px;
  background-color: #f8f8f8;
  border: 1px solid #ccc;
}

.news-header {
  background-color: #2a5d99;
  color: #fff;
  padding: 5px 10px;
  font-weight: bold;
  font-size: 14px;
}

.news-content {
  padding: 10px;
  font-size: 14px;
}

.news-item {
  margin-bottom: 10px;
}

.news-item img.icon {
  vertical-align: middle;
  margin-right: 5px;
}

.news-item a {
  color: #2a5d99;
  text-decoration: none;
}

.news-item a:hover {
  text-decoration: underline;
}

/* 号外・会報リンク */
.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.issue-grid li a {
  display: block;
  padding: 8px 12px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  text-align: center;
  text-decoration: none;
  color: #333;
  border-radius: 4px;
  transition: background 0.3s;
}

.issue-grid li a:hover {
  background: #336699;
  color: #fff;
}

/* リスト（支部リンク・活動報告など） */
.branch-list,
.report-list,
.bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.branch-list li,
.report-list li,
.bullet-list li {
  margin-bottom: 0.5em;
}

/* 共通：「・」付きリスト用 */
.bullet-list {
  list-style-type: disc;
  padding-left: 1.5em;
  margin: 0;
}

/* 会則ページのリスト全体（PCで右寄せ） */
.content ul {
  margin-left: 5em;
  padding-left: 0;
}

/* コピーライト */
footer {
  text-align: center;
  color: #555;
  font-size: 0.9em;
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid #ccc;
}

/* =======================================================
   スマホ表示 (600px以下)
   ======================================================= */
@media (max-width: 600px) {

  /* content幅調整 */
  .content {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    margin: 0;
  }

  /* MENUボタンを表示 */
  .menu-toggle {
    display: block;
  }

  /* 初期状態でナビを非表示 */
  .navbar {
    display: none;
    flex-direction: column;
    max-width: 100%;
    min-width: 0;
  }

  /* 開いたときだけ表示 */
  .navbar.active {
    display: flex;
  }

  /* 縦並びメニュー中央寄せ */
  .navbar a {
    flex: 1 1 100%;
    font-size: 16px;
    border-right: none;
    border-bottom: 1px solid #fff;
    text-align: center;
  }

  .navbar a:last-child {
    border-bottom: none;
  }

  /* table対応 */
  table, thead, tbody, th, td, tr {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    margin: 0.5em 0;
    padding: 0.6em;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
  }
  td {
    border: none;
    padding: 0.4em 0;
  }
  td::before {
    content: attr(data-label);
    font-weight: bold;
    display: block;
    margin-bottom: 0.2em;
    color: #333;
  }

  /* スマホで ul を左揃え */
  .content ul {
    margin-left: 0;
    padding-left: 1.5em;
  }
}

/* === スマホメニュー共通設定 === */
.menu-toggle {
  display: none;
  background-color: #2a5d99;
  color: white;
  padding: 10px 0;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* === PC表示 === */
.navbar {
  display: flex;
  justify-content: center;
  background-color: #2a5d99;
  transition: all 0.3s ease;
}

.navbar a {
  color: white;
  padding: 14px 16px;
  text-decoration: none;
  text-align: center;
}

/* === Safari/iPhone対応付きスマホ表示（アニメーション付き） === */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    width: 100%;
    max-width: 900px; /* MENU幅固定 */
    margin: 0 auto;
  }

  .navbar {
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px; /* MENUと同幅に統一 */
    margin: 0 auto;
    box-sizing: border-box;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition:
      max-height 0.4s ease,
      opacity 0.3s ease,
      visibility 0.3s ease;
    will-change: max-height, opacity, visibility;
  }

  .navbar.active {
    max-height: 500px; /* メニュー項目数に応じて調整 */
    opacity: 1;
    visibility: visible;
  }

  .navbar a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    border-bottom: 1px solid white;
    background-color: #2a5d99;
  }

  .navbar a:last-child {
    border-bottom: none;
  }
}
