/* Main Visual */
.mainvisual {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  position: relative;
}

.main-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  animation: fadeInUp 1.8s ease-out forwards;
  animation-delay: 0.1s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  left: 120px;
  bottom: 5%;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  display: flex;
  align-items: center;
  gap: 20px;
  opacity: 0;
  animation: fadeInOpacity 1s ease forwards;
}

@keyframes fadeInOpacity {
  to {
    opacity: 1;
  }
}

.scroll-line {
  width: 1px;
  height: 250px;
  background: #222222;
  transform: scaleY(0);
  transform-origin: top;
  animation: growLine 1.5s ease forwards;
  animation-delay: 1s;
}

@keyframes growLine {
  to {
    transform: scaleY(1);
  }
}

.scroll-text {
  font-size: 0.8rem;
  letter-spacing: 2px;
  opacity: 0;
  animation: fadeInText 1s ease forwards;
  animation-delay: 2.5s;
}

@keyframes fadeInText {
  to {
    opacity: 1;
  }
}

/* Work セクション */
.works {
  padding: 100px 0;
  text-align: center;
  position: relative;
  z-index: 10;
}

.works .section-title {
  font-size: 24px;
  letter-spacing: 0.1em;
  color: #222;
  margin-bottom: 50px;
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin: 0;
}

.work-item {
  display: block;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translate(20px,20px);
  transition: transform 0.8s ease, opacity 0.8s ease;
}

.work-item.active {
  opacity: 1;
  transform: translate(0, 0);
}

/* 各列に delay を付ける */
.works-grid a:nth-child(5n+1).active { transition-delay: 0.3s; }
.works-grid a:nth-child(5n+2).active { transition-delay: 0.5s; }
.works-grid a:nth-child(5n+3).active { transition-delay: 0.7s; }
.works-grid a:nth-child(5n+4).active { transition-delay: 0.9s; }
.works-grid a:nth-child(5n+5).active { transition-delay: 1.1s; }

.work-item img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.work-item:hover img {
  opacity: 0;
}

/* hover時の画像（疑似要素で背景切替） */
.work-item::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  background-color: rgba(255, 255, 255, 0.05);
  transition: opacity 0.3s ease;
}

.work-item:hover::before {
  opacity: 1;
}

.work-item[data-hover="1"]::before {
  background-image: url('../img/logo-top-hover-01.png');
}
.work-item[data-hover="2"]::before {
  background-image: url('../img/logo-top-hover-16.png');
}
.work-item[data-hover="3"]::before {
  background-image: url('../img/logo-top-hover-03.png');
}
.work-item[data-hover="4"]::before {
  background-image: url('../img/logo-top-hover-04.png');
}
.work-item[data-hover="5"]::before {
  background-image: url('../img/logo-top-hover-05.png');
}
.work-item[data-hover="6"]::before {
  background-image: url('../img/logo-top-hover-06.png');
}
.work-item[data-hover="7"]::before {
  background-image: url('../img/logo-top-hover-07.png');
}
.work-item[data-hover="8"]::before {
  background-image: url('../img/logo-top-hover-08.png');
}
.work-item[data-hover="9"]::before {
  background-image: url('../img/logo-top-hover-09.png');
}
.work-item[data-hover="10"]::before {
  background-image: url('../img/logo-top-hover-10.png');
}
.work-item[data-hover="11"]::before {
  background-image: url('../img/logo-top-hover-11.png');
}
.work-item[data-hover="12"]::before {
  background-image: url('../img/logo-top-hover-12.png');
}
.work-item[data-hover="13"]::before {
  background-image: url('../img/logo-top-hover-13.png');
}
.work-item[data-hover="14"]::before {
  background-image: url('../img/logo-top-hover-14.png');
}
.work-item[data-hover="15"]::before {
  background-image: url('../img/logo-top-hover-15.png');
}

/* テキスト */
.work-item::after {
  content: attr(data-client) " / " attr(data-works) " / " attr(data-date);
  position: absolute;
  left: 10px;
  bottom: 10px;
  font-size: 12px;
  color: #A89F96;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* work-web セクション */
.work-web {
  max-width: 100%;
  padding: 100px 0;
  display: flex;
  flex-direction: column;
  gap: 100px;
}

/* work-web アイテム */
.work-web-item {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  height: 600px;
  transition: all 0.8s ease;
  cursor: pointer;
}

/* work-web 画像 */
.work-web-image {
  flex: 0 0 auto;
  max-width: 60%;
  height: 80%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.work-web-image img {
  height: 90%;
  width: auto; /* ← 横幅は auto にして比率維持 */
  border-radius: 10px;
  filter: grayscale(100%);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(50px);
  transition: all 1s ease;
  transition: filter 1s ease, transform 1s ease;
}

.work-web-image img.active {
  opacity: 1;
  transform: translateY(0);
}


/* work-web info */
.work-web-info {
  flex: 0 0 0%;
  max-width: 0%;
  opacity: 0;
  height: 600px;
  padding: 40px;
  box-sizing: border-box;
  border-radius: 10px;
  background: #f2f0ee;
  color: #222222;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition-property: flex, max-width, opacity;
  transition-duration: 1s;
  transition-timing-function: ease-in-out;
}

/* テキストの中身 */
.work-title {
  font-size: 28px;
  font-weight: bold;
  margin: 0;
}

.work-meta {
  font-size: 14px;
  letter-spacing: 0.05em;
  color: #666666;
}

.work-text {
  font-size: 16px;
  line-height: 1.6;
  color: #444444;
}

/* hover時 */
.work-web-item:hover .work-web-image {
  flex: 0 0 auto;
  transform: translateX(0);
}

.work-web-item:hover img {
  filter: grayscale(0%);
  transform: scale(1.02);
}

.work-web-item:hover .work-web-info {
  flex: 0 0 auto;
  max-width: 30%;
  opacity: 1;
}

/* reverseパターン 
.work-web-item.reverse {
  flex-direction: row-reverse;
}

.work-web-item.reverse:hover .work-web-image {
  transform: translateX(0);
}*/

@media (max-width: 900px) {
  .main-title {
    font-size: 1.8rem;
  }

  .scroll-indicator {
    left: 20px;
    bottom: 20px;
  }

  .works-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    justify-content: center; /* ← これで最後のアイテムを中央寄せ */
  }

  .works-grid .work-item:last-child {
    grid-column: span 2;
    justify-self: center;
    width: 50%;
  }
}

@media (max-width: 1300px) {
.work-web-item {
    flex-direction: column;
    width: 90%;
    padding: 0 20px; 
    overflow: visible; /* ← 切れを防ぐ */
  }

.work-web-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    margin-bottom: 20px;
  }

  .work-web-image img {
    width: 100%;
    height: auto;
    object-fit: contain; /* 画像が変形しないように */
  }

  .work-web-info {
    max-width: 95%;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    height: auto;
    flex: none;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .work-text {
  font-size: 12px;
  line-height: 1.6;
  color: #444444;
}

  .work-title {
    font-size: 22px;
  }

  .work-web .work-web-item:hover .work-web-image,
  .work-web .work-web-item:hover .work-web-image img,
  .work-web .work-web-item:hover .work-web-info {
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    transition: none !important;
  }

  .work-web-item:hover .work-web-info {
    max-width: 100%;
  }

  /* ホバー外も同じ見た目に固定する */
  .work-web-item .work-web-image img,
  .work-web-item .work-web-info {
    transform: none !important;
    filter: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}
