/* Load AFTER the site's style.css. All overrides are scoped to this hero. */
.brain-opening-background,
.brain-opening-stage {
  --bo-height: var(--hero-visual-h, 100svh);
  --bo-width: min(100vw, calc(var(--bo-height) * 3150 / 1882));
}

.hero-fixed-bg.brain-opening-background {
  position: fixed;
  inset: var(--topbar-h, 0px) 0 auto;
  height: var(--bo-height);
  overflow: hidden;
  /* Same background as the existing homepage, visible through the artwork. */
  background: linear-gradient(135deg, #1a3a78 0%, #3d5a9e 45%, #6b8fd4 100%);
  pointer-events: none;
  z-index: 0;
  display: grid;
  place-items: center;
}

.brain-opening-scene {
  width: var(--bo-width);
  aspect-ratio: 3150 / 1882;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.brain-opening-sprite {
  position: absolute;
  top: 0;
  height: 100%;
  background-image: url('./hero-artwork.webp');
  background-repeat: no-repeat;
}
.brain-opening-sprite--center {
  left: 26.0317460317%;
  width: 48.5714285714%;
  background-size: 205.8823529412% 100%;
  background-position: 50.6172839506% 0;
  z-index: 0;
}
.brain-opening-sprite--left {
  left: 0;
  width: 26.0317460317%;
  background-size: 384.1463414634% 100%;
  background-position: 0 0;
  z-index: 1;
}
.brain-opening-sprite--right {
  left: 74.6031746032%;
  width: 25.3968253968%;
  background-size: 393.75% 100%;
  background-position: 100% 0;
  z-index: 1;
}

.hero-stage.brain-opening-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  height: var(--bo-height);
  min-height: var(--bo-height);
  padding: 0;
  box-sizing: border-box;
}
.brain-opening-stage .hero-eyecatch {
  position: relative;
  width: var(--bo-width);
  aspect-ratio: 3150 / 1882;
  display: grid;
  place-items: center;
}
.brain-opening-stage .hero-eyecatch__inner {
  position: relative;
  z-index: 1;
  isolation: isolate;
  box-sizing: border-box;
  width: 49.2%;
  max-width: none;
  margin: 0;
  padding: clamp(16px, calc(var(--bo-width) * .028), 38px) 12px;
  border-radius: clamp(14px, calc(var(--bo-width) * .02), 26px);
  text-align: center;
  background: transparent;
  color: #fff;
  font-family: 'Noto Sans JP', 'Yu Gothic', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
}
.brain-opening-stage .hero-eyecatch__inner::before {
  /* Preserve the homepage's translucent, blurred, softly feathered glass. */
  content: "";
  position: absolute;
  z-index: -1;
  inset: clamp(-18px, -3vw, -28px);
  border-radius: clamp(22px, 4vw, 38px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09) 0%, transparent 42%),
    rgba(16, 36, 78, 0.44);
  backdrop-filter: blur(16px) saturate(118%);
  -webkit-backdrop-filter: blur(16px) saturate(118%);
  pointer-events: none;
  -webkit-mask-image: radial-gradient(
    ellipse 78% 84% at 50% 50%,
    #000 0%,
    #000 40%,
    rgba(0, 0, 0, 0.42) 66%,
    transparent 100%
  );
  mask-image: radial-gradient(
    ellipse 78% 84% at 50% 50%,
    #000 0%,
    #000 40%,
    rgba(0, 0, 0, 0.42) 66%,
    transparent 100%
  );
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.brain-opening-copy {
  position: relative;
}
.brain-opening-stage .hero-tagline-ja {
  margin: 0;
  color: #fff;
  font-size: clamp(18px, calc(var(--bo-width) * .042), 62px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.85),
    0 1px 3px rgba(0, 0, 0, 0.75),
    0 clamp(2px, 0.45vmin, 5px) clamp(1.1rem, 2.8vmin, 1.85rem) rgba(0, 0, 0, 0.58),
    0 0 clamp(1.75rem, 4.5vmin, 3.25rem) rgba(0, 0, 0, 0.32);
  word-break: keep-all;
  overflow-wrap: normal;
  animation: none;
  transform: none;
}
.brain-opening-stage .hero-tagline-en {
  margin: .42em 0 0;
  color: #fff;
  font-size: clamp(11px, calc(var(--bo-width) * .021), 28px);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  text-shadow:
    0 0 1px rgba(0, 0, 0, 0.8),
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 2px clamp(0.85rem, 2.8vmin, 1.35rem) rgba(0, 0, 0, 0.55),
    0 0 clamp(1.25rem, 3.5vmin, 2rem) rgba(0, 0, 0, 0.28);
  animation: none;
  transform: none;
}

/* Before playback: the two inner edges meet at the center of the artwork. */
.bo-preparing .brain-opening-sprite--left { transform: translateX(96.7073170732%); }
.bo-preparing .brain-opening-sprite--right { transform: translateX(-101.375%); }
.bo-preparing .brain-opening-sprite--center,
.brain-opening-stage.bo-preparing .hero-eyecatch__inner::before,
.brain-opening-stage.bo-preparing .brain-opening-copy { opacity: 0; }
.brain-opening-stage.bo-preparing .brain-opening-copy { clip-path: inset(-4rem 50% -4rem 50%); }

/* One run. Animation fill keeps the final state until another page load. */
.bo-playing .brain-opening-sprite--left {
  animation: bo-open-left 1.6s cubic-bezier(.4, 0, .4, 1) .55s both;
}
.bo-playing .brain-opening-sprite--right {
  animation: bo-open-right 1.6s cubic-bezier(.4, 0, .4, 1) .55s both;
}
.bo-playing .brain-opening-sprite--center {
  animation: bo-fade .8s ease-out .7s both;
}
.brain-opening-stage.bo-playing .hero-eyecatch__inner::before {
  animation: bo-fade .7s ease-out 1.05s both;
}
/* Only clip the text. Clipping/fading the glass's parent would break its blur
   and cut off the feathered edge extending outside the caption. */
.brain-opening-stage.bo-playing .brain-opening-copy {
  animation: bo-fade .7s ease-out 1.05s both, bo-caption-window 1.6s cubic-bezier(.4, 0, .4, 1) .55s both;
}
.brain-opening-stage.bo-playing .hero-tagline-ja {
  animation: bo-title-in .8s ease-out 1.18s both;
}
.brain-opening-stage.bo-playing .hero-tagline-en {
  animation: bo-title-in .7s ease-out 1.55s both;
}
@keyframes bo-open-left {
  from { transform: translateX(96.7073170732%); }
  to { transform: translateX(0); }
}
@keyframes bo-open-right {
  from { transform: translateX(-101.375%); }
  to { transform: translateX(0); }
}
@keyframes bo-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bo-caption-window {
  from { clip-path: inset(-4rem 50% -4rem 50%); }
  to { clip-path: inset(-4rem); }
}
@keyframes bo-title-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .brain-opening-stage .hero-eyecatch__inner {
    padding: 13px 8px;
    width: 50.5%;
    border-radius: 13px;
  }
  .brain-opening-stage .hero-tagline-ja {
    font-size: clamp(18px, 5.6vw, 28px);
    line-height: 1.28;
  }
  .brain-opening-stage .hero-tagline-en {
    font-size: clamp(11px, 2.9vw, 14px);
    line-height: 1.4;
  }
}
@media (prefers-reduced-motion: reduce) {
  .brain-opening-background .brain-opening-sprite,
  .brain-opening-stage .hero-eyecatch__inner::before,
  .brain-opening-stage .brain-opening-copy,
  .brain-opening-stage .hero-tagline-ja,
  .brain-opening-stage .hero-tagline-en {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    clip-path: none !important;
  }
}
