/* ===================================================================
   2026-10-12 経営コンサルティング 読み込み時の全画面導入
   全画面の文と札 → 走査線で絞り込み →「次の一手を、一緒に決める。」→ フェードアウトしながら見出しが現れる。
   動きは /assets/js/emt-open-motion.js。再生判定は <head> の小さなスクリプト（html.emt-open-pending）。
   JSなし・reduced-motion・#anchor・戻る/進むでは何も出さず、ページをそのまま見せる。
   =================================================================== */

/* JSが動き出すまでの黒い幕（JSの全画面が出たら外す） */
html.emt-open-pending:not(.emt-open-run)::after {
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: var(--bg-base, #0a0a0f);
  content: "";
}

/* 見出しまわりは導入が終わるまで隠し、終わったらふわっと出す */
html.emt-open-pending .story-scene--hero > :not(h1),
html.emt-open-pending #hero-title > span {
  opacity: 0;
}

html.emt-open-reveal .story-scene--hero > :not(h1),
html.emt-open-reveal #hero-title > span {
  animation: emt-open-rise 1.1s cubic-bezier(0.2, 0, 0, 1) both;
}

html.emt-open-reveal #hero-title > span:nth-child(1) { animation-delay: 0s; }
html.emt-open-reveal #hero-title > span:nth-child(2) { animation-delay: 0.16s; }
html.emt-open-reveal .story-scene--hero > .story-product { animation-delay: 0.3s; }
html.emt-open-reveal .story-scene--hero > .story-eyebrow { animation-delay: 0.36s; }
html.emt-open-reveal .story-scene--hero > .story-promise { animation-delay: 0.48s; }
html.emt-open-reveal .story-scene--hero > .story-lede { animation-delay: 0.6s; }
html.emt-open-reveal .story-scene--hero > .story-button { animation-delay: 0.72s; }

@keyframes emt-open-rise {
  from {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

.emt-open {
  --zoom: 1;
  position: fixed;
  z-index: 2001;
  inset: 0;
  overflow: hidden;
  background: var(--bg-base, #0a0a0f);
  pointer-events: none;
  transform: scale(var(--zoom));
  transition: opacity 0.32s ease;
}

.emt-open.is-done {
  opacity: 0 !important;
}

.emt-open__msg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1120px, calc(100vw - 32px));
  margin: 0;
  color: var(--text-primary, #f0ede8);
  font-family: "Noto Serif JP", serif;
  font-feature-settings: "palt" 1;
  font-size: clamp(30px, 5vw, 72px); /* 読み取れる大きさ。2026-10-12 CEO指示で拡大 */
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform, opacity, filter;
}

.emt-open__msg--a .emt-open__line {
  display: block;
}

.emt-open__msg--a .emt-open__line:first-child {
  margin-bottom: 0.4em;
  color: var(--text-secondary, #9e9bb0);
  font-size: 0.66em;
  letter-spacing: 0.12em;
}

.emt-open__msg span span,
.emt-open__msg--b > span {
  display: inline-block;
}

.emt-open__msg em {
  color: var(--gold-bright, #ecd28f);
  font-style: normal;
}

.emt-open__chip {
  --lit: 0;
  --rank: 0;
  --hi: 0;
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 0 15px;
  border: 1px solid rgb(214 173 85 / calc(0.24 + var(--hi) * 0.76));
  border-radius: 8px;
  background: rgb(14 14 20 / 0.86);
  box-shadow:
    0 0 0 1px rgb(214 173 85 / calc(var(--lit) * 0.7)),
    0 0 calc(var(--hi) * 26px) rgb(214 173 85 / calc(var(--hi) * 0.34));
  color: color-mix(in srgb, var(--gold-bright, #ecd28f) calc(var(--hi) * 100%), #e8e2d7);
  font-family: var(--font-body), sans-serif;
  font-weight: 500;
  letter-spacing: 0.06em;
  white-space: nowrap;
  opacity: 0;
  transform-origin: center;
  will-change: transform, opacity;
}

.emt-open__rank {
  color: var(--gold);
  font-family: var(--font-mono, "JetBrains Mono"), monospace;
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: var(--rank);
}

.emt-open__scan {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(transparent, var(--gold) 15%, var(--gold-bright, #ecd28f) 50%, var(--gold) 85%, transparent);
  box-shadow:
    0 0 18px rgb(214 173 85 / 0.7),
    -36px 0 48px rgb(214 173 85 / 0.16); /* 進行方向と逆に光の尾 */
  opacity: 0;
  will-change: transform, opacity;
}

.emt-open__pulse {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--gold-bright, #ecd28f);
  border-radius: 8px;
  box-shadow: 0 0 18px rgb(214 173 85 / 0.45);
  opacity: 0;
  transform-origin: center;
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .emt-open,
  html.emt-open-pending::after {
    display: none;
  }

  html.emt-open-pending .story-scene--hero > :not(h1),
  html.emt-open-pending #hero-title > span {
    opacity: 1;
  }
}
