body {
  position: relative;
  min-height: 100vh;
  background-image: url("https://rakutano-school.com/img/school/kanazawa_izumigaoka_hs01.jpg");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 0;
}
.bg {
  position: relative; /* 必須 */
  border-radius: 16px;
  width: 95%;
  margin: 30px auto;
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 1; /* ::before より前面 */
  padding: 10px 0 10px 0;
}

.title {
  text-align: center;
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: bold;
}

/* コンテナ全体 */

h3,
p {
  white-space: pre-line; /* 改行文字 \n を表示 */
}

#eventList {
  display: grid;
  gap: 16px;
  width: 95%;
  margin: 10px auto;
}
#eventList {
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 1000px) {
  #eventList {
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  }
}

.event-item {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 12px;
  margin: 0px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.event-item.その他 {
  background-color: rgba(255, 255, 255, 0.9);
}

.event-item.催事 {
  background-color: rgba(255, 91, 91, 0.7);
}

.event-item.模擬店 {
  background-color: rgba(123, 121, 255, 0.7);
}

.event-item.野外劇 {
  background-color: rgba(91, 255, 99, 0.7);
}

.event-item.有志発表 {
  background-color: rgba(117, 255, 248, 0.7);
}

/* 各イベントカード */
.row {
  display: flex;
  align-items: flex-start; /* 上端を揃える */
  gap: 2px; /* icon と本文、time の間隔 */
}

.iconcontainer {
  width: 120px; /* 正方形に制限 */
  height: 120px;
  margin-right: 12px; /* テキストとの間隔 */
  flex: 0 0 auto; /* 横幅は固定 */
  overflow: hidden; /* はみ出た画像を隠す */
  border-radius: 8px; /* 枠の角を丸く */
  display: flex; /* 中央配置 */
  justify-content: center;
  align-items: center;
}

.iconcontainer img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 枠内にフィット、切り抜き */
  border-radius: 0; /* 子要素の角丸は不要 */
  margin-top: 0; /* 親が中央揃えするため不要 */
}

.iconcontainer:empty {
  display: none; /* 中身が空なら消す */
}

.row > div:last-child {
  flex: 1; /* 本文エリアを広げる */
}

h3,
p {
  margin: 0;
}

.row > div:last-child h3 {
  font-size: 2em;
  margin-bottom: 4px;
}

.icon-element {
  display: flex;
  gap: 8px; /* 要素間の間隔 */
  align-items: center; /* 垂直方向に中央揃え */
}

.meta {
  margin-top: 6px; /* row の下にスペース */
  display: flex;
  flex-direction: column; /* 説明とメディアを縦並び */
}

.event-media {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.media-cell {
  height: 150px; /* 高さは固定 */
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: transparent;
  overflow: hidden;
  border-radius: 8px;

  flex: 0 1 auto; /* 幅は中身に合わせる、必要以上に伸びない */
  min-width: 120px; /* 最小幅は保証 */
}

.media-cell img,
.media-cell video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* 縦横比維持 */
  border-radius: 8px;
}

/* モーダル表示 */
.zoomable {
  cursor: pointer;
  transition: transform 0.2s;
  max-width: 100%;
  height: auto;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  padding: 16px;
  box-sizing: border-box;
  overflow: hidden; /* はみ出し防止 */
}

.modal-content-wrapper {
  position: relative;
  max-width: 85vw; /* 少し小さく */
  max-height: 85vh; /* 少し小さく */
  width: auto;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* はみ出し防止 */
}

.modal-content-wrapper img,
.modal-content-wrapper video {
  max-width: 100%;
  max-height: 85vh; /* 高さも制限 */
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 30px;
  cursor: pointer;
  user-select: none;
}

.filterdiv {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin-bottom: 20px;
}

.filter-button {
  background-color: transparent;
  border: 2px solid #ffffffff;
  padding: 10px 20px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s ease;
  white-space: nowrap;
  min-width: 100px; /* 追加: ボタンの最小幅 */
}

.filter-button[data-type="all"] {
  --border-color: #005f96ff;
  border: 2px solid var(--border-color);
}

.filter-button[data-type="催事"] {
  --border-color: rgba(255, 91, 91, 1);
  border: 2px solid var(--border-color);
}

.filter-button[data-type="模擬店"] {
  --border-color: rgba(123, 121, 255, 1);
  border: 2px solid var(--border-color);
}

.filter-button[data-type="野外劇"] {
  --border-color: rgba(91, 255, 99, 1);
  border: 2px solid var(--border-color);
}

.filter-button[data-type="有志発表"] {
  --border-color: rgba(117, 255, 248, 1);
  border: 2px solid var(--border-color);
}

.filter-button[data-type="その他"] {
  --border-color: #ffffffff;
  border: 2px solid var(--border-color);
}

.filter-button:hover,
.filter-button.active {
  background-color: var(--border-color);
  color: white;
}

.filter-button:hover:is([data-type="催事"], [data-type="有志発表"], [data-type="その他"]),
.filter-button.active:is([data-type="催事"], [data-type="有志発表"], [data-type="その他"]) {
  color: black;
}

.text {
  margin: 20px;
  display: inline-block;
}
