@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

button {
  -webkit-tap-highlight-color: transparent;
  outline: none;
  -webkit-appearance: none;
  user-select: none;
}

:root {
  --bg: #faf8f5;
  --text: #2a2218;
  --accent: #c97b4b;
  --grid-gap: 10px;
}

body {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  padding: 40px 24px 24px;
  text-align: center;
}

header h1 {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
}

header p {
  margin-top: 6px;
  font-size: 0.85rem;
  opacity: 0.5;
  letter-spacing: 0.1em;
}

header .byline {
  margin-top: 10px;
  font-size: 0.9rem;
  opacity: 0.65;
  letter-spacing: 0.08em;
}

header .byline a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

header .byline a:hover {
  border-bottom-color: var(--accent);
}

/* ── ツールバー ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 12px;
}

.count {
  font-size: 0.85rem;
  opacity: 0.5;
  letter-spacing: 0.05em;
}

.sort-buttons {
  display: flex;
  gap: 6px;
}

/* ── 並び替えボタン ── */
.sort-btn {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
  letter-spacing: 0.05em;
}

.sort-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ── ギャラリーグリッド ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--grid-gap);
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  background: #e8e4de;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
  opacity: 0.85;
}

.gallery-item::after {
  content: '🔍';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* ── ライトボックス (洗練されたアニメーション演演出・画像角丸解除版) ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

/* 💡 枠の全体角丸(border-radius)とoverflow: hiddenを削除し、画像の端を丸めないように修正 */
.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(720px, 85vw);
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);

  transform: translateY(15px);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease-out;
  animation: floatLightbox 6s ease-in-out infinite;
}

/* 💡 画像自体の角を完全に立たせます */
.lightbox img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  display: block;
  border-radius: 0; 
}

/* 💡 下部のキャプション部分の左右下端だけを滑らかに角丸にします */
.lightbox-caption {
  width: 100%;
  background: rgba(20, 20, 20, 0.95); /* 高級感のある濃いめの黒 */
  color: #fff;
  text-align: center;
  padding: 14px 20px;
  font-size: 0.88rem;
  line-height: 1.6;
  letter-spacing: 0.06em;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  
  /* 💡 キャプションの下部だけ角丸にする */
  border-radius: 0 0 12px 12px; 
  position: relative;
  margin-top: 0; 
  z-index: 2;
}

/* コメントが空のときは非表示 */
.lightbox-caption:empty {
  display: none;
}

/* 操作用ナビゲーションボタン */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: scale(0.8);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.35);
  transform: scale(1.1) !important;
}

/* 閉じるボタンの位置調整 */
.lightbox-close {
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  z-index: 1010;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* 前後ボタンの位置調整 */
.lightbox-prev,
.lightbox-next {
  top: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.6rem;
  margin-top: -24px;
}
.lightbox-prev { left: 24px; transform: translateX(-10px) scale(0.8); }
.lightbox-next { right: 24px; transform: translateX(10px) scale(0.8); }

/* ── JavaScriptと連動するフェードイン演出 ── */
.lightbox-content.lb-in {
  transform: translateY(0);
  opacity: 1;
}
.lightbox-close.lb-in {
  opacity: 0.7;
  transform: scale(1);
  transition-delay: 0.1s;
}
.lightbox-prev.lb-in {
  opacity: 0.6;
  transform: translateX(0) scale(1);
  transition-delay: 0.15s;
}
.lightbox-next.lb-in {
  opacity: 0.6;
  transform: translateX(0) scale(1);
  transition-delay: 0.15s;
}

/* キーフレーム：穏やかな浮遊感 */
@keyframes floatLightbox {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* ── フッター ── */
footer {
  text-align: center;
  padding: 32px 16px;
  font-size: 0.8rem;
  opacity: 0.4;
  letter-spacing: 0.08em;
}

/* ── モバイル向け調整 ── */
@media (max-width: 580px) {
  .lightbox-prev, .lightbox-next {
    display: none;
  }
  .lightbox-content {
    max-width: 92vw;
  }
  .lightbox img {
    max-height: 65vh;
  }
  .lightbox-close {
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
}
