body {
  margin: 0;
}

.term {
  height: 600vh; /*200vh*3枚*/
  view-timeline-name: --term;
}

.scene {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.all-panel {
  display: flex; 
  width: 600vw; /*200vh*3枚*/
  height: 100vh;
  animation: scene linear both;
  animation-timeline: --term;
  animation-range: contain 0% contain 100%;
}

.panel {
  width: 200vw; /*200vh*/
  height: 100vh;
  place-items: center;
  font-size: 2rem;
  color: white;
}

@keyframes scene {
  from {transform: translateX(0);}
  to {transform: translateX(-450vw);} /*200vh*(3-1)枚*/
}

.wave1-2 {
  position: absolute;
  top: 0;
  left: 95%;
  height: 100vh;
  z-index: 10;
}

.castle {
  position: absolute;
  top: 0px;
  left: -200px;
  height: 100vh;
  z-index: 10;
  opacity: 0.1;
  opacity: 0;
  animation: fadeInBox 1.2s ease-out forwards;
}

@keyframes fadeInBox {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.4;
  }
}

.panel {
  position: relative;
}

.square {
  position: relative;
  z-index: 100;
  width: 50px;
  height: 50px;
  animation: square linear both;
  animation-timeline: --term;
  animation-range:contain 0% contain 100%;
}


@keyframes square {
  from {
    transform: translateX(var(--placex)) rotate(180deg);
    background-color: rgba(220, 253, 166, 0.568);
  }
  to {
    transform: translateX(calc(var(--placex) - 500px)) rotate(0deg);
    background-color: rgb(156, 226, 135);
  }
}

.s1 {
  background: azure;
  --placex: -300px;
  top :120px;
}

.s2 {
  background: rgb(33, 161, 61);
  --placex: 400px;
  top :80px;
}

.s3 {
  background: rgb(197, 100, 83);
  --placex: 700px;
  top :-290px;
}

.s4 {
  background: rgba(25, 34, 167, 0.514);
  --placex: 1000px;
  top :10px;
}

.wave2-3 {
  position: absolute;
  top: 0;
  left: 95%;
  height: 100vh;
  z-index: 10;
}

.galleries {
  position: relative;
  top: 40%;
  left: -400px;

  animation: galleries linear both;
  animation-timeline: --term;
  animation-range: contain 80% contain 90%;
}

.galleries::after {
  content: "";
  position: absolute;
  left: 40%;
  transform: translateX(-40%);
  bottom: -8px;
  
  width: 250px;
  height: 3px;
  background-color: #333;
}

@keyframes galleries {
  from {
    opacity: 0;
    transform: translateX(100px); 
  }
  to {
    opacity: 1;
    transform: translateX(-300px);
  }
}

.welcome {
  position: relative;
  top: 35%;
  left: 400px;

  animation: galleries linear both;
  animation-timeline: --term;
  animation-range: contain 0% contain 20%;
}

.nothing {
  position: relative;
  top: 40%;
  left: 0px;
  font-size: 1.5rem;
}

@media (max-width: 768px) {
  .image-grid {
    left: 0;
    max-width: 100%;
    padding: 0 20px;
  }
}

.image-grid {
  position: relative;
  top: 60px;
  left: -50px;

  display: grid;
  grid-template-columns: repeat(2, 1fr); 
  gap: 60px; 
  max-width: 500px; 
}


.image-grid img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.frame {
  position: relative;
  top: 60px;
  left: -50px;

  padding: 8px;
  background: #fcfdd0; 
  border: 2px solid #555;
  outline: 1px solid #aaa; 
  outline-offset: -5px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  width: 300px;
  height: auto;
}