* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
  background: #0c0c0c; 
  color: #fff; 
  font-family: "游明朝", "Yu Mincho", serif;
}

/* ギャラリーコンテナ */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr); 
  gap: 0px;
  width: 100%;
  padding-top: 120px;
  align-items: start;
}

/* 画像の初期状態：正方形を維持する設定 */
.gallery-item img {
  display: block;      /* 下のわずかな隙間を消す */
  width: 100%;
  aspect-ratio: 1 / 1; /* 正方形に固定 */
  object-fit: cover;   /* 比率を保って切り抜き */
  
  /* アニメーション用（既存） */
  opacity: 0;
  filter: blur(20px) grayscale(1);
  transform: scale(0.95);
  transition: opacity 1.5s ease, filter 1.8s ease, transform 1.2s ease;
}

/* 読み込み完了後に付与するクラス */
.gallery-item img.loaded {
  opacity: 1;
  filter: blur(0px) grayscale(1);
  transform: scale(1);
}

.gallery-item img.loaded:hover {
  filter: grayscale(0) brightness(1.1);
  transform: scale(1.03);
  z-index: 10;
}

/* 引用文 */
/* 引用文の枠：画像と同じ正方形にする */
.quote-item {
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* 重要：画像とサイズを完全に一致させる */
  width: 100%;
  aspect-ratio: 1 / 1; 
  
  /* 余白の設定（上下左右に20pxなど、お好みで調整してください） */
  padding: 20px; 
  box-sizing: border-box;

  opacity: 0;
  transform: translateY(20px);
  transition: all 1.5s ease 0.3s;
}

.quote-item.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* 引用文の中身：枠の中で高さを調整 */
.quote-inner {
  writing-mode: vertical-rl;
  text-orientation: mixed;

  display: flex;
  align-items: center;     /* 上下中央 */
  justify-content: center; /* 左右中央 */

  height: 100%;

  font-size: clamp(10px, 1.2vw, 14px);
  line-height: 2.2;
  letter-spacing: 0.2em;
  color: #d0d0d0;
}

/* ローディング画面 */
#loader {
  position: fixed;
  inset: 0;
  background: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loader.loaded { opacity: 0; visibility: hidden; }

.loader-spin {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* モーダル */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(15px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4000;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease, visibility 0.6s, filter 0.6s ease;
}

#modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  max-width: 90%;
  max-height: 85vh;
  transform: scale(0.9);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#modal.active .modal-content { transform: scale(1); }

#modal-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
}

/* 閉じるボタン */
.modal-close-btn {
  position: absolute;
  top: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
  z-index: 4100;
}

.modal-close-btn span {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 1px;
  background: #fff;
}

.modal-close-btn span:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
.modal-close-btn span:nth-child(2) { transform: translate(-50%, -50%) rotate(-45deg); }

/* レスポンシブ */
@media (max-width: 768px) {
  .gallery-container { grid-template-columns: repeat(2, 1fr); }
  .modal-close-btn { top: 20px; right: 20px; }
}