/* ============================================================
   BUILD DESIGN — HERO SECTION
   Premium Architecture Studio · 빌드디자인
   v2.0 — Fixed class names, dark background, performance-safe
   ============================================================ */

/* ── Hero section ─────────────────────────────────────────── */
.hero-section {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 640px;
  overflow: hidden;
  display: flex;
  align-items: center;
  /* Dark background is visible before canvas loads */
  background-color: var(--bg-primary);
  /* No transition — prevents flash when theme toggles */
}

/* ── Canvas container (div#hero-canvas-container.hero-canvas) */
/* Three.js injects <canvas> inside this div                  */
.hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* Canvas element injected by hero-3d.js */
.hero-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 0.8s ease !important;
}

/* Canvas revealed after first Three.js frame */
.hero-canvas canvas.is-ready {
  opacity: 1;
}

/* ── Skeleton UI ────────────────────────────────────────────── */
.hero-skeleton {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #07090e;
  overflow: hidden;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

/* Scan-line shimmer */
.hero-skeleton::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(200, 169, 110, 0.04) 3px,
    rgba(200, 169, 110, 0.04) 4px
  );
}

/* Moving highlight sweep */
.hero-skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(200, 169, 110, 0.06) 40%,
    rgba(200, 169, 110, 0.12) 50%,
    rgba(200, 169, 110, 0.06) 60%,
    transparent 100%
  );
  animation: skeleton-sweep 2.2s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  0%   { left: -60%; }
  100% { left: 160%; }
}

/* Faded "로딩중" indicator */
.hero-skeleton-label {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display, 'Montserrat', sans-serif);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: rgba(200, 169, 110, 0.4);
  text-transform: uppercase;
  animation: skeleton-pulse 1.8s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.9; }
}

/* Hidden state — triggered by JS after canvas is ready */
.hero-skeleton.is-hidden {
  opacity: 0;
}

/* ── Vignette layer over canvas ───────────────────────────── */
.hero-section::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, rgba(7,12,20,0.85) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 0%,   rgba(7,12,20,0.45) 0%, transparent 70%),
    linear-gradient(to right, rgba(7,12,20,0.35) 0%, transparent 30%, transparent 70%, rgba(7,12,20,0.35) 100%);
}

/* Light mode: 3D canvas is always dark — keep vignette dark too */
[data-theme="light"] .hero-section::after {
  background:
    radial-gradient(ellipse 80% 65% at 50% 100%, rgba(5,8,14,0.80) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 0%,   rgba(5,8,14,0.30) 0%, transparent 70%);
}

/* ── Hero overlay / content layer ────────────────────────── */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: var(--nav-height) var(--space-8) var(--space-20);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  /* Center horizontally while staying position:absolute */
  left: 50%;
  transform: translateX(-50%);
}

/* ── Hero eyebrow label ───────────────────────────────────── */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: var(--space-6);

  opacity: 0;
  transform: translateY(16px);
  animation: heroFadeUp 0.8s var(--ease-out) 0.3s forwards;
}

.hero-eyebrow::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: var(--accent-primary);
  flex-shrink: 0;
}

/* ── Hero text always light (canvas bg is always dark) ───── */
[data-theme="light"] .hero-eyebrow { color: var(--accent-primary); }
[data-theme="light"] .hero-title   { color: #ffffff; text-shadow: 0 2px 24px rgba(0,0,0,0.9); }
[data-theme="light"] .hero-sub     { color: rgba(200, 220, 255, 0.82); }

/* ── Hero title ───────────────────────────────────────────── */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(80px, 12vw, 180px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--text-primary);

  opacity: 0;
  transform: translateY(24px);
  animation: heroFadeUp 1s var(--ease-out) 0.5s forwards;
}

/* ── Accent word ──────────────────────────────────────────── */
.hero-title-accent {
  font-style: normal;
  -webkit-text-stroke: 1px var(--accent-primary);
  color: transparent;
  display: inline-block;
  filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.3));
}

[data-theme="light"] .hero-title-accent {
  filter: drop-shadow(0 0 20px rgba(0, 85, 170, 0.25));
}

/* ── Hero subtitle ────────────────────────────────────────── */
.hero-sub {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 500px;
  margin-top: var(--space-6);
  margin-bottom: var(--space-8);

  opacity: 0;
  transform: translateY(16px);
  animation: heroFadeUp 0.8s var(--ease-out) 0.75s forwards;
}

/* ── Hero action buttons ──────────────────────────────────── */
.hero-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;

  opacity: 0;
  transform: translateY(16px);
  animation: heroFadeUp 0.8s var(--ease-out) 0.95s forwards;
}

/* ── Primary button ───────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 14px 36px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bg-primary);
  background: var(--accent-primary);
  border: none;
  clip-path: polygon(14px 0%, 100% 0%, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0% 100%, 0% 14px);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s, background 0.2s;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.2) 50%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.4s var(--ease-inout);
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 212, 255, 0.35);
}

.btn-primary:hover::before {
  transform: translateX(100%);
}

.btn-primary:active {
  transform: translateY(0) scale(0.99);
}

.btn-primary svg {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.btn-primary:hover svg {
  transform: translateX(3px);
}

.btn-primary--lg {
  padding: 18px 44px;
  font-size: 1rem;
}

/* ── Secondary button ─────────────────────────────────────── */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 13px 32px;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}

.btn-secondary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-glow);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.btn-secondary:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateY(-1px);
}

.btn-secondary:hover::before {
  transform: scaleX(1);
}

/* ── 라이트 모드: hero 배경은 항상 어두운 3D씬 → 버튼 강제 밝게 ──────── */
[data-theme="light"] .hero-section .btn-secondary {
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.45);
}
[data-theme="light"] .hero-section .btn-secondary:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ── Outline button ───────────────────────────────────────── */
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px 28px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  white-space: nowrap;
  transition: background 0.2s, transform 0.2s;
}

.btn-outline:hover {
  background: var(--accent-glow);
  transform: translateY(-2px);
}

/* ── Hero badge stats ─────────────────────────────────────── */
.hero-badges {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-10);

  opacity: 0;
  transform: translateY(12px);
  animation: heroFadeUp 0.8s var(--ease-out) 1.15s forwards;
}

.hero-badge__num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-primary);
  line-height: 1;
}

.hero-badge__lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.hero-badge-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Scroll indicator ─────────────────────────────────────── */
.hero-scroll-indicator {
  position: absolute;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  z-index: 3;
  cursor: pointer;

  opacity: 0;
  animation: heroFadeUp 0.8s var(--ease-out) 1.5s forwards;
}

.hero-scroll-indicator span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.3em;
  color: var(--text-muted);
}

/* Animated scroll line — uses infinite but lightweight opacity change */
.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--accent-primary), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

/* ── Mobile background fallback (shows when canvas unavailable) */
.hero-mobile-bg {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    160deg,
    #070c14 0%,
    #0d1520 35%,
    #0a1830 65%,
    #070c14 100%
  );
}

.hero-mobile-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 70% 30%, rgba(0, 85, 204, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 20% 70%, rgba(0, 212, 255, 0.08) 0%, transparent 70%);
}

/* ── Keyframe animations ──────────────────────────────────── */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll line: opacity pulse — cheap GPU op, no layout change */
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); transform-origin: top; }
  50%       { opacity: 1;   transform: scaleY(1);   transform-origin: top; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero-title {
    font-size: clamp(64px, 10vw, 120px);
  }

  .hero-scroll-indicator {
    bottom: var(--space-6);
  }
}

@media (max-width: 768px) {
  .hero-overlay {
    padding: calc(var(--nav-height) + var(--space-4)) var(--space-6) var(--space-8);
    align-items: flex-end;
    left: 0;
    transform: none;
    max-width: 100%;
  }

  .hero-title {
    font-size: clamp(60px, 16vw, 96px);
    line-height: 0.92;
  }

  .hero-sub {
    font-size: 0.9375rem;
    max-width: 100%;
  }

  .hero-actions {
    flex-wrap: wrap;
    gap: var(--space-3);
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 24px;
    font-size: 0.75rem;
  }

  .hero-badges {
    display: none;
  }

  /* 3D 캔버스 로딩 전 스켈레톤 shimmer만 보임 — canvas는 is-ready 후 fade-in */
  .hero-scroll-indicator {
    display: none;
  }

  .hero-eyebrow {
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: clamp(52px, 18vw, 80px);
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary,
  .btn-secondary {
    justify-content: center;
    width: 100%;
  }
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hero-eyebrow,
  .hero-title,
  .hero-sub,
  .hero-actions,
  .hero-badges,
  .hero-scroll-indicator {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .scroll-line {
    animation: none;
    opacity: 0.5;
  }
}
