body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background-color: white;
  transition: background-color 0.5s ease-in-out;
}

#background {
  position: fixed;
  top: 2.5vw; 
  left: 3vw; 
  right: 3vw;
  bottom: 2.5vw;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  transition: background-image 1s ease-in-out, opacity 0.4s ease-in-out;
}

#button-container {
  position: absolute;
  bottom: 6.5rem;
  right: 7vw;
  z-index: 1500;
}

#copyright {
  font-family: 'Noto Sans Mono'; 
  position: absolute;
  bottom: 4.5rem;
  right: 7vw;
  font-size: 2vh;
  font-weight: 200;
  color: white;
  opacity: 0;
  transition: none;
}

/* コピーライトをロゴの右隣に配置するスタイル */
#copyright.logo-side {
  position: fixed;
  opacity: 0;
  font-size: 1.8vh;
  animation: copyrightAppear 1s ease forwards 4s; /* ロゴのアニメーション完了と同じタイミング */
}

/* スマートフォン用のコピーライト位置（ロゴの右隣） */
@media only screen and (max-width: 600px) {
  #copyright.logo-side {
    bottom: calc(2.1vw + 1.2rem);
    left: calc(3.5vw + 9vh + 1vw); /* ロゴ位置 + ロゴ幅*0.7 + マージン */
  }
}

/* デスクトップ用のコピーライト位置（ロゴの右隣） */
@media only screen and (min-width: 601px) {
  #copyright.logo-side {
    bottom: calc(2.5vw + 1.5vw + 2vh);
    left: calc(5.2vw + 10vh); /* ロゴ位置 + ロゴ幅 */
  }
}

/* デスクトップ版（モード切り替え時のコピーライト） */
@media only screen and (min-width: 601px) {
  #copyright.mode-switch {
    bottom: calc(2.5vw + 1.5vw + 2vh); /* 年フィルターと同じ高さ */
    left: calc(5.2vw + 10vh); /* ロゴ位置 + ロゴ幅 */
  }
}

/* コピーライト表示アニメーション */
@keyframes copyrightAppear {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* スマートフォン用のスタイル */
@media only screen and (max-width: 600px) {
  #button-container {
    bottom: calc(2.1vw + 1.2rem);
    right: 7vw;
  }
  #copyright {
    bottom: calc(2.1vw + 1.2rem);
    right: 7vw;
  }
  #logo {
    animation: logoAppear 1s ease forwards, logoDisappear 1s ease forwards 2s, spLogoMove 1s ease forwards 3s, spLogoAppearBottomLeft 1s ease forwards 4s;
  }
}

/* デスクトップ用のスタイル */
@media only screen and (min-width: 601px) {
  #button-container {
    bottom: calc(2.5vw + 1.5vw + 2vh);
    right: 7vw;
  }
  #copyright {
    bottom: calc(2.5vw + 2vw);
    right: 7vw;
  }
  #logo{
    animation: logoAppear 1s ease forwards, logoDisappear 1s ease forwards 2s, pcLogoMove 1s ease forwards 3s, pcLogoAppearBottomLeft 1s ease forwards 4s;
  }
}

button {
  font-family: 'Noto Sans Mono'; 
  font-size: 2vh;
  font-weight: 200;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  z-index: 1500;
}

.separater{
  color: white;
  font-family: 'Noto Sans Mono'; 
}

@keyframes logoAppear {
  0% {
    opacity: 0;
    bottom: 45%;
    left: 49vw;
    transform: translateY(-50%) translateX(-50%);
  }
  100% {
    opacity: 1;
    bottom: 45%;
    left: 49vw;
    transform: translateY(-50%) translateX(-50%);
  }
}

@keyframes logoDisappear {
  0% {
    opacity: 1;
    bottom: 45%;
    left: 49vw;
    transform: translateY(-50%) translateX(-50%);
  }
  100% {
    opacity: 0;
    bottom: 45%;
    left: 49vw;
    transform: translateY(-50%) translateX(-50%);
  }
}

@keyframes pcLogoMove {
  0% {
    opacity: 0;
    bottom: 45%;
    left: 49vw;
    transform: translateY(-50%) translateX(-50%);
  }
  100% {
    opacity: 0;
    bottom: calc(2.5vw + 2vw); /* 画面下部からの距離 */
    left: 5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    width: 7%;
  }
}

@keyframes pcLogoAppearBottomLeft {
  0% {
    opacity: 0;
    bottom: calc(2.5vw + 2vw); /* 画面下部からの距離 */
    left: 5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    width: 10vh;
    
  }
  100% {
    opacity: 1;
    bottom: calc(2.5vw + 2vw); /* 画面下部からの距離 */
    left: 5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    width: 10vh;
  }
}
@keyframes spLogoMove {
  0% {
    opacity: 0;
    bottom: 45%;
    left: 49%;
    transform: translateY(-50%) translateX(-50%);
    scale: 0.8;
  }
  100% {
    opacity: 0;
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    scale: 0.8;
  }
}

@keyframes spLogoAppearBottomLeft {
  0% {
    opacity: 0;
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    scale: 0.7;
  }
  100% {
    opacity: 1;
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw; /* 画面右部からの距離 */
    transform: translateY(0) translateX(0);
    scale: 0.7;
  }
}
#logo {
  color: white;
  position: fixed;
  display: block;
  opacity: 0;
  width: 10vh;
  transition: none;
}

/* モード切替時のロゴ（アニメーション省略） */
#logo.mode-switch {
  animation: none !important;
  opacity: 1;
}

/* 初期アニメーション完了後のロゴ */
#logo.animation-complete {
  animation: none !important;
  opacity: 1;
}

/* モード切替時のコピーライト（アニメーション省略） */
#copyright.mode-switch {
  animation: none !important;
  opacity: 1;
}

/* スマートフォン用のロゴ位置（モード切替時） */
@media only screen and (max-width: 600px) {
  #logo {
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw;
    scale: 0.7;
    opacity: 1;
  }
  
  #logo.mode-switch {
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw;
    scale: 0.7;
  }
  
  #copyright.mode-switch {
    bottom: calc(2.1vw + 1.2rem);
    left: calc(3.5vw + 9vh + 1vw);
    position: fixed;
    font-size: 1.8vh;
  }
}

/* デスクトップ用のロゴ位置（モード切替時） */
@media only screen and (min-width: 601px) {
  #logo {
    bottom: calc(2.5vw + 2vw);
    left: 5vw;
    opacity: 1;
  }
  
  #logo.mode-switch {
    bottom: calc(2.5vw + 2vw);
    left: 5vw;
  }
  
  #copyright.mode-switch {
    bottom: calc(2.5vw + 1.5vw + 2vh);
    left: calc(5vw + 10vh + 1vw);
    position: fixed;
    font-size: 1.8vh;
  }
}

#overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s ease;
  opacity: 0;
}

#overlay.fade {
  opacity: 1;
}

#play-icon, #pause-icon {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  z-index: 10000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 40px;
  color: rgba(255, 255, 255, 0.8);
  justify-content: center;
  align-items: center;
}

#play-icon.fade, #pause-icon.fade {
  opacity: 1;
}

/* モード切替ボタン */
#mode-toggle {
  position: fixed;
  top: 3.5vw;
  right: 4vw;
  z-index: 1100;
}

#mode-switch-btn {
  font-family: 'Material Symbols Outlined';
  border: none;
  color: white;
  font-size: 24px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
}

#mode-switch-btn:hover {
  color: orange;
  transform: scale(1.1);
}

#close-overlay {
  position: fixed;
  top: 3.5vw;
  right: 4vw;
  font-family: 'Material Symbols Outlined';
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  font-size: 24px;
  font-weight: normal;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
  z-index: 1200;
}

#close-overlay:hover {
  color: orange;
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.1);
}

/* 拡大表示時にモード切替ボタンを非表示 */
.expanded-mode #mode-toggle {
  display: none;
}

/* ギャラリーモード */
.gallery-mode {
  background-color: black !important;
  background-image: none !important;
}

.gallery-mode #background {
  opacity: 0 !important;
}

.gallery-mode #logo {
  opacity: 0 !important;
}

.gallery-mode #copyright {
  opacity: 0 !important;
}

.gallery-mode #play-icon, .gallery-mode #pause-icon {
  opacity: 0 !important;
}

.gallery-mode #overlay {
  opacity: 0 !important;
}

.hidden {
  display: none;
}

/* 一覧表示の基本レイアウト */
#gallery-container {
  position: fixed;
  top: 2.5vw;
  left: 3vw;
  right: 3vw;
  bottom: 2.5vw;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(3px);
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

#gallery-container.hidden {
  opacity: 0;
  visibility: hidden;
}

#gallery-container.visible {
  opacity: 1;
  visibility: visible;
}

#gallery-container::-webkit-scrollbar {
  display: none; /* WebKit */
}

#gallery-grid {
  display: grid;
  gap: 4px;
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.gallery-thumbnail-container {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
}

.gallery-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease, opacity 0.3s ease;
}

.gallery-thumbnail:hover {
  transform: scale(1.02);
}

.gallery-thumbnail.lazy {
  opacity: 0;
  background: #333;
}

/* 年度マーカー */
.year-marker {
  grid-column: 1 / -1;
  font-family: 'Noto Sans Mono', monospace;
  font-size: 2rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  text-align: left;
  padding: 20px 0 10px 0;
  margin-top: 20px;
}

.year-marker:first-child {
  margin-top: 0;
}

/* 拡大表示 */
#image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

#image-overlay.hidden {
  display: none;
}

#image-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#image-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(20px);
  opacity: 0.7;
  z-index: -1;
}

#expanded-container {
  position: absolute;
  top: 2.5vw;
  left: 3vw;
  right: 3vw;
  bottom: 2.5vw;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: all;
  padding: 0;
}

#expanded-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

/* 拡大表示用のロゴ */
#expanded-logo {
  position: fixed;
  color: white;
  width: 10vh;
  pointer-events: none;
  transition: none;
}

#expanded-logo svg {
  width: 100%;
  height: auto;
}

/* 拡大表示用のコピーライト */
#expanded-copyright {
  position: fixed;
  font-family: 'Noto Sans Mono';
  color: white;
  font-size: 1.8vh;
  font-weight: 200;
  pointer-events: none;
  transition: none;
}

/* スマートフォン用の拡大表示要素位置 */
@media only screen and (max-width: 600px) {
  #expanded-logo {
    bottom: calc(2.5vw + 1vw);
    left: 3.5vw;
    scale: 0.7;
  }
  
  #expanded-copyright {
    bottom: calc(2.1vw + 1.2rem);
    left: calc(3.5vw + 9vh + 1vw);
  }
}

/* デスクトップ用の拡大表示要素位置 */
@media only screen and (min-width: 601px) {
  #expanded-logo {
    bottom: calc(2.5vw + 2vw);
    left: 5vw;
  }
  
  #expanded-copyright {
    bottom: calc(2.5vw + 1.5vw + 2vh);
    left: calc(5.2vw + 10vh);
  }
}

.nav-left, .nav-right {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  cursor: pointer;
}

.nav-left {
  left: 0;
}

.nav-right {
  right: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  #gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    padding: 10px;
    gap: 2px;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  #gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  #gallery-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ギャラリーモードのレスポンシブ調整 */
@media only screen and (max-width: 600px) {
  /* ギャラリーコンテナの余白はスライドモードと同じ設定を使用 */
}