/* ==========================================================
   初回オープニング：白背景 → 赤い線が一周 → 円形にサイトが現れる
   01 全体 / 02 白背景 / 03 ロゴ / 04 赤い線 / 05 表示切替
   06 アニメーション / 07 動きを抑える設定
   クラスの追加・削除と初回判定には既存JavaScriptが必要です。
   ========================================================== */
/* 01 全体：最前面に表示。4秒後に強制的に操作を戻す */
.psl-opening {
  display: none;
}

html.psl-opening-active .psl-opening {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  overflow: hidden;
  pointer-events: auto;
  animation: psl-opening-failsafe 0s 4s forwards;
}

/* 02 サイトを覆う白背景 */
.psl-opening__disc {
  position: absolute;
  inset: 0;
  background: #fff;
}

/* 03 中央の大きさ・ロゴ */
.psl-opening__center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(190px, 28vw, 250px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.psl-opening__logo {
  position: absolute;
  width: 70%;
  height: 70%;
  left: 15%;
  top: 15%;
  object-fit: contain;
  border-radius: 50%;
  animation: psl-opening-appear .4s ease-out both;
}

/* 04 赤い線：色・太さ・一周する速度（SVGの円周に合わせた値） */
.psl-opening__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.psl-opening__ring circle {
  fill: none;
  stroke: #bf343b;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 722.567;
  stroke-dashoffset: 722.567;
  animation: psl-opening-draw 1.1s .2s cubic-bezier(.45, 0, .3, 1) forwards;
}

/* 05 サイト表示：中央の透明な穴を広げる */
@property --psl-hole {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

html.psl-opening-reveal .psl-opening__center {
  animation: psl-opening-vanish .35s ease both;
}

html.psl-opening-reveal .psl-opening__disc {
  -webkit-mask: radial-gradient(circle at center, transparent var(--psl-hole), #000 calc(var(--psl-hole) + 1px));
  mask: radial-gradient(circle at center, transparent var(--psl-hole), #000 calc(var(--psl-hole) + 1px));
  animation: psl-opening-hole .75s cubic-bezier(.7, 0, .25, 1) both;
}

/* 06 アニメーションの開始・終了状態 */
@keyframes psl-opening-appear {
  from {
    opacity: 0;
    transform: scale(.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }

}

@keyframes psl-opening-draw {
  to {
    stroke-dashoffset: 0;
  }

}

@keyframes psl-opening-vanish {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.08);
  }

}

@keyframes psl-opening-hole {
  from {
    --psl-hole: 0px;
  }

  to {
    --psl-hole: 150vmax;
  }

}

@keyframes psl-opening-failsafe {
  to {
    visibility: hidden;
    pointer-events: none;
  }

}

/* 07 OSで動きを抑える設定が有効な場合 */
@media (prefers-reduced-motion: reduce) {
  html.psl-opening-active .psl-opening {
    display: none;
  }

}
