/* MineView 3D — animated intro / loading screen.
   Full intro plays once per session (see intro.js); the overlay sits above
   everything (z 40) on a solid #080810 so first paint never flashes. */

#intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080810;
  pointer-events: auto;
  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

#intro.is-exiting {
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
}

#intro.is-done,
#intro.is-skip {
  display: none;
}

.intro-inner {
  text-align: center;
  padding: 0 24px;
  max-width: 100%;
}

.intro-title {
  color: #ece5d3;
  font-weight: 800;
  font-size: clamp(2.4rem, 8vw, 4.25rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
  animation: introTitleIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.intro-track {
  position: relative;
  width: min(320px, 62vw);
  height: 20px;
  margin: 16px auto 0;
}

.intro-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 2px;
  border-radius: 1px;
  background: rgba(236, 229, 211, 0.18);
  transform: scaleX(0);
  transform-origin: left center;
  animation: introLineIn 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

.intro-dot {
  position: absolute;
  top: 4px;
  left: 0;
  width: 12px;
  height: 12px;
  animation: introDotTravel 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}

.intro-dot-core {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e8c040;
  box-shadow: 0 0 14px rgba(232, 192, 64, 0.55);
  animation: introDotPulse 1.6s ease-in-out 1.4s infinite;
}

.intro-sub {
  margin-top: 14px;
  color: #8a8a95;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  animation: introSubIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.9s both;
}

.intro-title .intro-brand {
  color: #e8c040;
}

/* Live boot readout pinned near the bottom of the card: stage text +
   thin progress bar fed by the real boot stages (see setIntroProgress).
   This replaces the legacy "Fetching …" spinner during boot. */
.intro-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(52px, 8vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: introSubIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1.1s both;
}

.intro-status {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a8a95;
  min-height: 1em;
}

.intro-bar {
  width: min(280px, 58vw);
  height: 2px;
  border-radius: 1px;
  background: rgba(236, 229, 211, 0.12);
  overflow: hidden;
}

.intro-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 1px;
  background: #e8c040;
  box-shadow: 0 0 8px rgba(232, 192, 64, 0.55);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes introTitleIn {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes introLineIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes introDotTravel {
  0% { left: 0; }
  70% { left: calc(100% - 12px); }
  85% { left: calc(100% - 20px); }
  100% { left: calc(100% - 12px); }
}

@keyframes introDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.7; }
}

@keyframes introSubIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Company-selection entrance once the intro lifts: cards rise in with a
   short stagger. intro.js removes .intro-enter after the beat so later
   company switches re-render without replaying it. */
#company-map-wrap.intro-enter .cm-co-btn,
#company-map-wrap.intro-enter .mine-card {
  animation: introCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

#company-map-wrap.intro-enter .cm-co-btn:nth-child(2) { animation-delay: 0.05s; }
#company-map-wrap.intro-enter .cm-co-btn:nth-child(3) { animation-delay: 0.1s; }
#company-map-wrap.intro-enter .cm-co-btn:nth-child(4) { animation-delay: 0.15s; }
#company-map-wrap.intro-enter .cm-co-btn:nth-child(n+5) { animation-delay: 0.2s; }
#company-map-wrap.intro-enter .mine-card:nth-child(2) { animation-delay: 0.08s; }
#company-map-wrap.intro-enter .mine-card:nth-child(3) { animation-delay: 0.16s; }
#company-map-wrap.intro-enter .mine-card:nth-child(n+4) { animation-delay: 0.24s; }

@keyframes introCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Reduced motion: static title, simple fade, no travel or pulse. */
@media (prefers-reduced-motion: reduce) {
  #intro {
    transition: opacity 0.15s linear;
  }
  #intro.is-exiting {
    transform: none;
  }
  .intro-title,
  .intro-sub,
  .intro-line,
  .intro-dot,
  .intro-dot-core {
    animation: none;
  }
  .intro-line {
    transform: scaleX(1);
  }
  .intro-dot {
    left: calc(100% - 12px);
  }
  #company-map-wrap.intro-enter .cm-co-btn,
  #company-map-wrap.intro-enter .mine-card {
    animation: none;
  }
}
