/* ===================================
   Hero Intro CSS - 메인 진입 인트로 · 등장 연출
   =================================== */

/* ---------- 1. 인트로 오버레이 (세션당 1회) ---------- */
.hero-intro {
  display: none;
}

.show-intro .hero-intro {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

.hero-intro-half {
  position: absolute;
  left: 0;
  right: 0;
  height: 50%;
  background: var(--dark);
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.18, 1);
}

.hero-intro-top {
  top: 0;
}

.hero-intro-bottom {
  bottom: 0;
}

.hero-intro-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-family: "Fira Code", "Source Code Pro", Consolas, Monaco, monospace;
  transition: opacity 0.3s ease;
}

.hero-intro-line {
  font-size: 0.95rem;
  color: var(--gray-light);
  min-height: 1.4em;
}

.hero-intro-line .prompt {
  color: var(--secondary);
  margin-right: 8px;
}

.hero-intro-cmd::after {
  content: "_";
  margin-left: 2px;
  animation: blink 0.8s infinite;
}

.hero-intro-percent {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 800;
  color: var(--white);
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.hero-intro-bar {
  width: min(280px, 60vw);
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.hero-intro-bar span {
  display: block;
  height: 100%;
  background: var(--primary-light);
  transform-origin: left;
  animation: heroIntroBar 1.2s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

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

.hero-intro.is-opening .hero-intro-content {
  opacity: 0;
}

.hero-intro.is-opening .hero-intro-top {
  transform: translateY(-100%);
}

.hero-intro.is-opening .hero-intro-bottom {
  transform: translateY(100%);
}

/* ---------- 2. 등장 전 숨김 상태 (html.hero-anim 일 때만) ---------- */
.hero-anim #main .hero-badge,
.hero-anim #main .hero-subtitle-wrapper,
.hero-anim #main .highlight-item,
.hero-anim #main .btn-resume-download {
  opacity: 0;
  animation: none;
}

.hero-anim #main .hero-title .line {
  animation: none;
}

.hero-anim #main .line-inner {
  transform: translateY(110%);
}

.hero-anim #main .hero-bg-animation {
  opacity: 0;
}

/* ---------- 3. 등장 애니메이션 (#main.is-revealed) ---------- */
.hero-title .line {
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.line-inner {
  display: inline-block;
}

.hero-anim #main.is-revealed .line-inner {
  animation: heroLineUp 1s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.hero-anim #main.is-revealed .line:nth-child(1) .line-inner { animation-delay: 0.15s; }
.hero-anim #main.is-revealed .line:nth-child(2) .line-inner { animation-delay: 0.3s; }
.hero-anim #main.is-revealed .line:nth-child(3) .line-inner { animation-delay: 0.45s; }

@keyframes heroLineUp {
  from { transform: translateY(110%) rotate(4deg); }
  to { transform: translateY(0) rotate(0); }
}

.hero-anim #main.is-revealed .hero-badge {
  animation: heroFadeDown 0.8s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.hero-anim #main.is-revealed .hero-subtitle-wrapper {
  animation: heroFadeUp 0.9s cubic-bezier(0.19, 1, 0.22, 1) 0.8s forwards;
}

.hero-anim #main.is-revealed .highlight-item {
  animation: heroPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.hero-anim #main.is-revealed .highlight-item:nth-child(1) { animation-delay: 1s; }
.hero-anim #main.is-revealed .highlight-item:nth-child(2) { animation-delay: 1.1s; }
.hero-anim #main.is-revealed .highlight-item:nth-child(3) { animation-delay: 1.2s; }

.hero-anim #main.is-revealed .btn-resume-download {
  animation: heroFadeUp 0.9s cubic-bezier(0.19, 1, 0.22, 1) 1.35s forwards;
}

.hero-anim #main.is-revealed .hero-bg-animation {
  animation: heroBgIn 2s ease 0.2s forwards;
}

@keyframes heroBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#main .code-rain {
  transition: transform 0.6s ease-out;
}

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

@keyframes heroFadeDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroPop {
  from { opacity: 0; transform: translateY(14px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.hero-anim #main.is-revealed .anim-done {
  opacity: 1;
  animation: none;
}

/* 이름 스크램블 중에는 코드 폰트로 */
.is-scrambling {
  font-family: "Fira Code", "Source Code Pro", Consolas, Monaco, monospace;
  letter-spacing: 0;
}

/* ---------- 4. 마우스 인터랙션 ---------- */
.hero-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: radial-gradient(
    420px circle at var(--spot-x, 50%) var(--spot-y, 50%),
    rgba(129, 140, 248, 0.12),
    transparent 70%
  );
}

#main:hover .hero-spotlight {
  opacity: 1;
}

.hero-inner {
  perspective: 1200px;
}

#main .hero-content {
  transform: translateY(30px) var(--tilt, rotateX(0deg) rotateY(0deg));
  transition: transform 0.4s ease-out;
  transform-style: preserve-3d;
}

#main .btn-resume-download {
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.25s ease-out;
}

/* 등장 후 count 숫자 폭 고정(흔들림 방지) */
[data-count] {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
  #main .hero-content {
    transform: translateY(25px);
  }
}

@media (max-width: 480px) {
  #main .hero-content {
    transform: translateY(20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-intro {
    display: none !important;
  }
}
