/* 写真ギャラリーブロック - フロントエンド用スタイル */
.c-earth-photo-gallery-container {
  margin: 32px auto;
  max-width: 100%;
  box-sizing: border-box;
}

/* ギャラリータイトル */
.gallery-title {
  font-size: 1.8em;
  font-weight: bold;
  color: #333;
  margin-bottom: 20px;
  text-align: center;
  font-family: "Noto Sans JP", Helvetica, sans-serif;
  border-bottom: 2px solid #12a265;
  padding-bottom: 10px;
}

/* ギャラリーグリッド */
.photo-gallery {
  display: grid;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

/* ギャラリーアイテム */
.gallery-item {
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  background: #fff;
}

.gallery-item:hover {
  transform: translateY(-2px);
}

/* 画像ラッパー */
.image-wrapper {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* ライトボックストリガー */
.has-lightbox .image-wrapper {
  cursor: pointer;
}

.has-lightbox .image-wrapper:hover img {
  transform: scale(1.05);
}

.lightbox-trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.gallery-item:hover .lightbox-trigger {
  opacity: 1;
}

.expand-icon {
  font-size: 16px;
  color: #333;
}

/* 画像キャプション */
.image-caption {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.4;
  color: #555;
  background: #fff;
  font-family: "Noto Sans JP", Helvetica, sans-serif;
}

/* ライトボックス */
.c-earth-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.c-earth-lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}

/* ライトボックス画像 */
.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ライトボックスコントロール */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #333;
  z-index: 10001;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: #fff;
  transform: scale(1.1);
}

.lightbox-close {
  top: 20px;
  right: 20px;
  font-size: 24px;
}

.lightbox-prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

/* ライトボックスキャプション */
.lightbox-caption {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 12px 20px;
  border-radius: 20px;
  font-size: 14px;
  max-width: 80%;
  text-align: center;
  font-family: "Noto Sans JP", Helvetica, sans-serif;
}

/* ライトボックスカウンター */
.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 16px;
  border-radius: 16px;
  font-size: 14px;
  font-family: "Noto Sans JP", Helvetica, sans-serif;
}

/* レスポンシブデザイン */
@media (max-width: 1200px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .c-earth-photo-gallery-container {
    margin: 20px auto;
  }
  
  .gallery-title {
    font-size: 1.5em;
    margin-bottom: 16px;
  }
  
  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 8px;
  }
  
  .image-caption {
    padding: 10px 12px;
    font-size: 13px;
  }
  
  .lightbox-content {
    padding: 20px;
  }
  
  .lightbox-close,
  .lightbox-prev,
  .lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .lightbox-close {
    top: 15px;
    right: 15px;
  }
  
  .lightbox-prev {
    left: 15px;
  }
  
  .lightbox-next {
    right: 15px;
  }
  
  .lightbox-caption {
    bottom: 20px;
    font-size: 13px;
    max-width: 90%;
  }
  
  .lightbox-counter {
    top: 15px;
    left: 15px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .photo-gallery {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 6px;
  }
  
  .lightbox-trigger {
    width: 28px;
    height: 28px;
    top: 8px;
    right: 8px;
  }
  
  .expand-icon {
    font-size: 14px;
  }
  
  .image-caption {
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* 1カラム対応 */
.photo-gallery[data-columns="1"] {
  grid-template-columns: 1fr !important;
  max-width: 600px;
  margin: 0 auto;
}

.photo-gallery[data-columns="1"] .image-wrapper {
  aspect-ratio: 16/9;
}

/* 6カラム以上の場合の調整 */
@media (min-width: 1400px) {
  .photo-gallery[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr) !important;
  }
  
  .photo-gallery[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr) !important;
  }
}

/* アニメーション効果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item {
  animation: fadeInUp 0.5s ease forwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.1s; }
.gallery-item:nth-child(2) { animation-delay: 0.2s; }
.gallery-item:nth-child(3) { animation-delay: 0.3s; }
.gallery-item:nth-child(4) { animation-delay: 0.4s; }
.gallery-item:nth-child(5) { animation-delay: 0.5s; }
.gallery-item:nth-child(6) { animation-delay: 0.6s; }

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
  .gallery-item,
  .lightbox-trigger,
  .image-wrapper img {
    animation: none;
    transition: none;
  }
}

/* フォーカス対応 */
.has-lightbox .image-wrapper:focus {
  outline: 2px solid #12a265;
  outline-offset: 2px;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
  outline: 2px solid #12a265;
  outline-offset: 2px;
} 