/* Homepage boot sequence and fixed environmental background layers. */

html {
  scrollbar-gutter: stable;
}

html.is-booting,
html.is-booting body {
  overflow: hidden !important;
  overflow-anchor: none;
  overscroll-behavior: none;
}

html.is-booting {
  scroll-behavior: auto !important;
}

#boot-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 47%, rgba(255, 255, 255, 0.98) 0%, rgba(242, 247, 251, 0.96) 34%, rgba(220, 231, 240, 0.98) 100%),
    #e5edf4;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  touch-action: none;
  overscroll-behavior: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#boot-overlay::before,
#boot-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#boot-overlay::before {
  z-index: 0;
  background-image:
    linear-gradient(rgba(45, 112, 166, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 112, 166, 0.075) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(circle at center, #000 0%, rgba(0, 0, 0, 0.72) 42%, transparent 82%);
  mask-image: radial-gradient(circle at center, #000 0%, rgba(0, 0, 0, 0.72) 42%, transparent 82%);
}

#boot-overlay::after {
  z-index: 0;
  inset: -18%;
  background:
    linear-gradient(112deg, transparent 38%, rgba(0, 153, 255, 0.06) 48%, rgba(255, 255, 255, 0.72) 50%, rgba(0, 85, 255, 0.055) 52%, transparent 62%),
    radial-gradient(ellipse at center, rgba(0, 153, 255, 0.055), transparent 54%);
  animation: bootLightSweep 4.8s ease-in-out infinite alternate;
}

#boot-overlay > * {
  position: relative;
  z-index: 1;
}

#boot-overlay.faded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-emblem {
  width: 32px;
  height: 32px;
  border: 2px solid var(--accent-electric, #0055ff);
  transform: rotate(45deg);
  margin-bottom: 24px;
  animation: emblemPulse 1.2s infinite alternate ease-in-out;
}

.boot-emblem::before,
.boot-emblem::after {
  content: "";
  position: absolute;
  inset: 50%;
  transform: translate(-50%, -50%);
}

.boot-emblem::before {
  width: 8px;
  height: 8px;
  background: var(--accent-electric, #0055ff);
  box-shadow: 0 0 10px rgba(0, 153, 255, 0.9);
}

.boot-emblem::after {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(0, 119, 255, 0.2);
}

@keyframes emblemPulse {
  from {
    transform: rotate(45deg) scale(0.92);
    border-color: #0b61ff;
    box-shadow: 0 0 10px rgba(0, 85, 255, 0.25), inset 0 0 8px rgba(0, 153, 255, 0.08);
  }
  to {
    transform: rotate(45deg) scale(1.08);
    border-color: var(--accent-cyan, #00a8ff);
    box-shadow: 0 0 24px rgba(0, 153, 255, 0.7), inset 0 0 12px rgba(0, 85, 255, 0.16);
  }
}

@keyframes bootLightSweep {
  from { transform: translate3d(-2.5%, 0, 0); }
  to { transform: translate3d(2.5%, 0, 0); }
}

.boot-title {
  font-family: var(--font-hud, 'Rajdhani', sans-serif);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--dv2-ink-strong);
  margin-bottom: 8px;
}

.boot-log {
  font-family: var(--font-hud, 'Rajdhani', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #466078;
  margin-bottom: 22px;
}

.boot-progress-bar {
  width: 248px;
  height: 4px;
  background: rgba(51, 88, 122, 0.14);
  border: 1px solid rgba(91, 135, 175, 0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.boot-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-electric, #0055ff), var(--accent-cyan, #00a8ff));
  box-shadow: 0 0 12px rgba(0, 153, 255, 0.62);
  transition: width 0.7s ease-out;
}

#webgl-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

#webgl-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.animus-glow-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.55) 0%, rgba(240, 245, 250, 0.25) 45%, rgba(160, 175, 190, 0) 80%);
  mix-blend-mode: screen;
}

.scanline-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.02) 50%);
  background-size: 100% 3px;
}

/* Sec04 氛圍背景由共用環境層負責，不屬於 Works 版面。 */
body[data-background-scene="sec04"] .animus-glow-layer,
body[data-view="sec04"] .animus-glow-layer,
body.sec04-active .animus-glow-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse 75% 65% at 58% 46%, rgba(255, 255, 255, 0.55) 0%, rgba(224, 242, 254, 0.2) 45%, transparent 75%),
    radial-gradient(ellipse 85% 35% at 50% 0%, rgba(255, 255, 255, 0.55) 0%, rgba(224, 242, 254, 0.18) 40%, transparent 70%);
  mix-blend-mode: screen;
}

.animus-god-rays-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.6s ease;
}

body[data-background-scene="sec04"] .animus-god-rays-layer,
body[data-view="sec04"] .animus-god-rays-layer,
body.sec04-active .animus-god-rays-layer {
  opacity: 1;
}

.god-ray {
  position: absolute;
  pointer-events: none;
  opacity: 0.35;
  filter: blur(10px);
}

.ray-v1 {
  top: 0;
  left: 17%;
  width: 100px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(210, 235, 255, 0.35) 60%, transparent 100%);
}

.ray-v2 {
  top: 0;
  left: 54%;
  width: 150px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(210, 235, 255, 0.45) 50%, transparent 100%);
}

.ray-v3 {
  top: 0;
  right: 21%;
  width: 120px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(210, 235, 255, 0.38) 60%, transparent 100%);
}

.ray-diag-1 {
  top: -15%;
  left: 28%;
  width: 90px;
  height: 130vh;
  transform: rotate(26deg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(210, 235, 255, 0.28) 55%, transparent 90%);
}

.ray-diag-2 {
  top: -15%;
  right: 24%;
  width: 100px;
  height: 130vh;
  transform: rotate(-24deg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(210, 235, 255, 0.28) 55%, transparent 90%);
}

.starburst-flare {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.starburst-flare::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ffffff 50%, transparent);
  box-shadow: 0 0 8px rgba(0, 153, 255, 0.9), 0 0 16px #ffffff;
}

.starburst-flare::after {
  content: '';
  position: absolute;
  height: 100%;
  width: 2px;
  background: linear-gradient(180deg, transparent, #ffffff 50%, transparent);
  box-shadow: 0 0 8px rgba(0, 153, 255, 0.9), 0 0 16px #ffffff;
}

.star-core {
  width: 6px;
  height: 6px;
  background: #ffffff;
  transform: rotate(45deg);
  box-shadow: 0 0 10px #ffffff, 0 0 20px rgba(0, 153, 255, 0.95);
}

.flare-1 { top: 95px; left: 340px; }
.flare-2 { top: 175px; left: 560px; transform: scale(1.3); }
.flare-3 { top: 125px; right: 260px; transform: scale(0.9); }
.flare-4 { top: 335px; right: 340px; transform: scale(1.25); }
.flare-5 { bottom: 210px; left: 420px; transform: scale(0.9); }

main {
  position: relative;
  z-index: 10;
}
