.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
  max-width: 540px;
}

.thumbnail img {
  width: 100%;
  height: auto;
  margin: 0 0 -4px 0;
  cursor: pointer;
}

/* モーダル背景 */
.modal {
  opacity: 1;                  /* ← 表示非表示は opacity ではなく display で切り替える */
  pointer-events: auto;
  position: fixed;
  z-index: 10;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8); /* ← 背景即表示 */
  display: none;               /* ← 初期状態は非表示 */
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;               /* ← 表示時は即 flex */
}

/* モーダル本体 */
.modal-content {
  background-color: #fff;
  padding: 20px;
  border: 1px solid #888;
  width: 90%;
  max-width: 540px;
  position: relative;
  transform: scale(1);
  opacity: 1;
}

.modal-content img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.modal.withAnimation .modal-content {
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal.withAnimation.show .modal-content {
  transform: scale(1);
  opacity: 1;
}

/* 投稿番号 */
.modal-content .number {
  font-weight: bold;
  font-size: 1.2em;
  margin-top: 10px;
}

/* コメント */
.modal-content .comment {
  margin-top: 5px;
  font-size: 0.95em;
  color: #666;
}

/* 閉じるボタン */
.close {
  color: #aaa;
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover,
.close:focus {
  color: black;
}
.tags {
  margin-top: 5px;
  font-size: 0.9em;
  color: #336;
}

.tag {
  display: inline-block;
  background: #eef;
  color: #336;
  padding: 2px 6px;
  margin: 2px;
  border-radius: 4px;
}

.modal-content .tags {
  margin-top: 5px;
  font-size: 0.9em;
  color: #339;
}



.tag-filter a {
  font-size: 13px
}

.tag-filter a:hover {
  font-size: 13px
}
