/* 公明党草加市議団 — 共通ナビゲーション
 * 使い方: <nav class="site-nav" data-site-nav data-root="../" data-current="member"></nav>
 *         <script src="../js/site-nav.js" defer></script>
 * data-root: サイトルートへの相対パス（トップなら ""、member/ なら "../"）
 * data-current: top | member | activity | gikai | achievement | news
 */

.site-nav {
  --nav-top: #b4d92a;
  --nav-mid: #7cbc2a;
  --nav-bottom: #4f9a1a;
  --nav-line: rgba(255, 255, 255, 0.22);
  --nav-font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3",
    "Yu Gothic", YuGothic, "メイリオ", Meiryo, "ＭＳ Ｐゴシック", "MS PGothic",
    sans-serif;

  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--nav-font);
  background: linear-gradient(180deg, var(--nav-top) 0%, var(--nav-mid) 48%, var(--nav-bottom) 100%);
  border-bottom: 2px solid #3a7208;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.site-nav__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__list > li {
  margin: 0;
  padding: 0;
  border-right: 1px solid var(--nav-line);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.site-nav__list > li:nth-child(3n) {
  border-right: none;
}

.site-nav__list > li:nth-last-child(-n + 3) {
  border-bottom: none;
}

.site-nav a,
.site-nav span.is-current {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 46px;
  padding: 10px 8px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: #fff;
  text-shadow: 0 1px 2px rgba(20, 50, 5, 0.42);
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: #fff59a;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  outline: none;
}

.site-nav a:hover::after,
.site-nav a:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.site-nav a:active {
  transform: translateY(1px);
}

.site-nav span.is-current {
  background: rgba(0, 0, 0, 0.16);
  box-shadow: inset 0 -3.5px 0 #ffeb3b;
  cursor: default;
}

@media (min-width: 960px) {
  .site-nav__list {
    grid-template-columns: repeat(6, 1fr);
  }

  .site-nav__list > li {
    border-bottom: none;
  }

  .site-nav__list > li:nth-child(3n) {
    border-right: 1px solid var(--nav-line);
  }

  .site-nav__list > li:last-child {
    border-right: none;
  }

  .site-nav a,
  .site-nav span.is-current {
    min-height: 40px;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 4px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 420px) {
  .site-nav__list {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-nav__list > li:nth-child(3n) {
    border-right: 1px solid var(--nav-line);
  }

  .site-nav__list > li:nth-child(2n) {
    border-right: none;
  }

  .site-nav__list > li:nth-last-child(-n + 3) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  }

  .site-nav__list > li:nth-last-child(-n + 2) {
    border-bottom: none;
  }

  .site-nav a,
  .site-nav span.is-current {
    min-height: 48px;
    font-size: 0.90rem;
    padding: 10px 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav a,
  .site-nav a::after {
    transition: none;
  }

  .site-nav a:active {
    transform: none;
  }
}
