/* リセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Sans JP", sans-serif;
  background-color: #f5f5f5;
}

/* ヘッダー */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #333;
  color: white;
  padding: 1em;
  position: relative;
}

.logo {
  font-size: 1.5em;
  font-weight: bold;
}

/* ===== PC用ナビゲーション ===== */
.nav ul {
  display: flex;
  list-style: none;
}

.nav li {
  margin-left: 1.5em;
}

.nav a {
  color: white;
  text-decoration: none;
  transition: color 0.3s;
}

.nav a:hover {
  color: #ff9800;
}

/* ===== ハンバーガーアイコン ===== */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  z-index: 1001; /* メニューより前面に表示 */
}

.hamburger span {
  background: white;
  height: 3px;
  width: 25px;
  margin: 4px 0;
  transition: 0.4s;
}

/* ===== メインレイアウト ===== */
.container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  padding: 1em;
}

.box {
  background: white;
  flex: 1 1 300px;
  padding: 1em;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ===== フッター ===== */
.footer {
  text-align: center;
  padding: 1em;
  background: #333;
  color: white;
}

/* ===== スマホ表示用 ===== */
@media (max-width: 768px) {
  .nav ul {
    flex-direction: column;
    padding: 2em 1em;
  }

  .nav li {
    margin: 1em 0;
  }

  /* ハンバーガーを表示 */
  .hamburger {
    display: flex;
  }

  /* 右からスライドメニュー */
  .nav {
    position: fixed;
    top: 0;
    right: -250px; /* 初期状態では画面外 */
    width: 250px;
    height: 100%;
    background: #333;
    transition: right 0.4s ease;
    z-index: 1000;
  }

  /* メニューがアクティブのとき */
  .nav.active {
    right: 0;
  }

  /* ハンバーガーのアニメーション */
  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* 背景の薄暗いオーバーレイ */
  body.menu-open::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
  }
}
