/* =========================================
   オープニングアニメーション
========================================= */

/* オープニング全体のコンテナ */
.opening {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: transparent;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* 白い背景レイヤー */
.opening__background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #ffffff;
  z-index: 9998;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.opening__background.fade-out {
  opacity: 0;
}

/* テキストコンテナ */
.opening__text-container {
  position: relative;
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  font-size: clamp(20px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.05em;
  font-family: 'Noto Sans JP', 'Helvetica', 'Arial', 'system-ui', '-apple-system', 'BlinkMacSystemFont', sans-serif;
  will-change: contents;
  contain: layout;
  overflow: hidden;
}

/* 各文字のスタイル */
.opening__char {
  display: inline-block;
  color: #212121;
  opacity: 0;
  animation: charFadeIn 0.3s ease forwards;
  vertical-align: baseline;
  line-height: 1.5;
  will-change: opacity;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* 1文字ずつフェードイン */
@keyframes charFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* 文字色変更アニメーション */
.opening__char.color-change {
  animation: colorChange 0.5s ease forwards;
}

@keyframes colorChange {
  0% {
    color: #212121;
  }
  100% {
    color: #2A9CA1;
  }
}

/* 左から右へのカラーオーバーレイ */
.opening__overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 100vh;
  background: #2A9CA1;
  z-index: 10001;
  opacity: 1;
}

/* オーバーレイ展開アニメーション */
.opening__overlay.expand {
  animation: expandOverlay 0.15s ease forwards;
}

@keyframes expandOverlay {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

/* オーバーレイフェードアウト */
.opening__overlay.fade-out {
  animation: overlayFadeOut 0.8s ease forwards;
}

@keyframes overlayFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* オープニング表示中はスクロール無効 */
body.opening-active {
  overflow: hidden;
  height: 100vh;
}
