/* ============================================
   EAE UNIVERSITY - DESIGN SYSTEM
   Forest & Gold - Premium Edition
   "숲 속의 비밀 대학"
   ============================================ */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* === COLOR SYSTEM === */
  /* Primary - Deep Forest Green */
  --color-primary-50: #ecfdf3;
  --color-primary-100: #d1fae1;
  --color-primary-200: #a7f3c9;
  --color-primary-300: #6ee7a8;
  --color-primary-400: #34d37a;
  --color-primary-500: #1a5c38;
  --color-primary-600: #1a4d2e;
  --color-primary-700: #163d25;
  --color-primary-800: #14311f;
  --color-primary-900: #0f2518;
  --color-primary-950: #0a1a10;

  /* Accent - Royal Gold */
  --color-accent-50: #fffef0;
  --color-accent-100: #fff9c4;
  --color-accent-200: #fff176;
  --color-accent-300: #ffe94a;
  --color-accent-400: #ffd93d;
  --color-accent-500: #f5c542;
  --color-accent-600: #d4a520;
  --color-accent-700: #a67c00;
  --color-accent-800: #7a5a00;
  --color-accent-900: #4d3800;

  /* Neutral - Warm Earth */
  --color-neutral-50: #fdfcf7;
  --color-neutral-100: #f8f6ef;
  --color-neutral-200: #ede9dc;
  --color-neutral-300: #d9d3c2;
  --color-neutral-400: #a8a08a;
  --color-neutral-500: #7a7464;
  --color-neutral-600: #5a5548;
  --color-neutral-700: #3d3a32;
  --color-neutral-800: #252320;
  --color-neutral-900: #171612;
  --color-neutral-950: #0d0c0a;

  /* Semantic */
  --color-success: #22c55e;
  --color-warning: #f5c542;
  --color-error: #dc2626;

  /* === DARK THEME (Default) - Night Forest === */
  --bg-primary: #080c08;
  --bg-secondary: #0f1610;
  --bg-tertiary: #162016;
  --bg-elevated: rgba(22, 45, 30, 0.85);
  --bg-glass: rgba(10, 26, 16, 0.8);

  --text-primary: #f8f6ef;
  --text-secondary: #a8a08a;
  --text-tertiary: #7a7464;
  --text-inverse: #0a1a10;

  --border-subtle: rgba(245, 197, 66, 0.08);
  --border-default: rgba(245, 197, 66, 0.15);
  --border-strong: rgba(245, 197, 66, 0.25);

  /* === TYPOGRAPHY === */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', var(--font-sans);
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Font Sizes - Fluid Typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.9rem + 0.5vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.75vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);
  --text-3xl: clamp(1.875rem, 1.4rem + 2.375vw, 2.5rem);
  --text-4xl: clamp(2.25rem, 1.5rem + 3.75vw, 3.5rem);
  --text-5xl: clamp(3rem, 1.8rem + 6vw, 4.5rem);
  --text-6xl: clamp(3.75rem, 2rem + 8.75vw, 6rem);

  /* Font Weights */
  --font-light: 300;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.15;
  --leading-snug: 1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* === SPACING === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* === LAYOUT === */
  --max-width-xs: 20rem;
  --max-width-sm: 24rem;
  --max-width-md: 28rem;
  --max-width-lg: 32rem;
  --max-width-xl: 36rem;
  --max-width-2xl: 42rem;
  --max-width-3xl: 48rem;
  --max-width-4xl: 56rem;
  --max-width-5xl: 64rem;
  --max-width-6xl: 72rem;
  --max-width-7xl: 80rem;
  --max-width-full: 100%;

  --container-padding: clamp(1rem, 5vw, 3rem);

  /* === BORDERS === */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;

  /* === SHADOWS - Golden Glow === */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -4px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(245, 197, 66, 0.15);
  --shadow-glow-lg: 0 0 60px rgba(245, 197, 66, 0.25);
  --shadow-gold: 0 4px 20px rgba(245, 197, 66, 0.3);
  --shadow-forest: 0 4px 20px rgba(26, 77, 46, 0.4);

  /* === EFFECTS === */
  --blur-sm: 4px;
  --blur-md: 8px;
  --blur-lg: 16px;
  --blur-xl: 24px;
  --blur-2xl: 40px;
  --blur-3xl: 64px;

  /* === TRANSITIONS === */
  --ease-linear: linear;
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);

  --duration-75: 75ms;
  --duration-100: 100ms;
  --duration-150: 150ms;
  --duration-200: 200ms;
  --duration-300: 300ms;
  --duration-500: 500ms;
  --duration-700: 700ms;
  --duration-1000: 1000ms;

  /* === Z-INDEX === */
  --z-below: -1;
  --z-base: 0;
  --z-above: 1;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-overlay: 40;
  --z-modal: 50;
  --z-toast: 60;
  --z-tooltip: 70;
}

/* ============================================
   LIGHT THEME - Sunlit Forest
   ============================================ */
[data-theme="light"] {
  --bg-primary: #fdfcf7;
  --bg-secondary: #f8f6ef;
  --bg-tertiary: #ede9dc;
  --bg-elevated: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(253, 252, 247, 0.9);

  --text-primary: #14311f;
  --text-secondary: #3d5a3d;
  --text-tertiary: #5a7a5a;
  --text-inverse: #f8f6ef;

  --border-subtle: rgba(26, 77, 46, 0.08);
  --border-default: rgba(26, 77, 46, 0.15);
  --border-strong: rgba(26, 77, 46, 0.25);
}

/* ============================================
   BASE RESET & DEFAULTS
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Selection - Gold highlight */
::selection {
  background-color: var(--color-accent-500);
  color: var(--color-primary-900);
}

/* Focus - Gold ring */
:focus-visible {
  outline: 2px solid var(--color-accent-500);
  outline-offset: 2px;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-200) var(--ease-out);
}

/* Images */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Lists */
ul, ol {
  list-style: none;
}

/* Buttons */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* Inputs */
input, textarea, select {
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */
.text-display {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.text-gradient {
  background: linear-gradient(135deg, var(--color-accent-400), var(--color-accent-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-forest {
  background: linear-gradient(135deg, var(--color-primary-400), var(--color-accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-subtle {
  background: linear-gradient(135deg, var(--text-primary), var(--color-accent-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   GLASS MORPHISM - Forest Glass
   ============================================ */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--border-subtle);
}

.glass-strong {
  background: var(--bg-elevated);
  backdrop-filter: blur(var(--blur-xl));
  -webkit-backdrop-filter: blur(var(--blur-xl));
  border: 1px solid var(--border-default);
}

.glass-gold {
  background: rgba(245, 197, 66, 0.05);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid rgba(245, 197, 66, 0.2);
}

/* ============================================
   ANIMATION KEYFRAMES
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 197, 66, 0.3); }
  50% { box-shadow: 0 0 40px rgba(245, 197, 66, 0.6); }
}

@keyframes forestGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(26, 92, 56, 0.4); }
  50% { box-shadow: 0 0 40px rgba(26, 92, 56, 0.7); }
}

@keyframes goldPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.4);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(245, 197, 66, 0);
  }
}

@keyframes leafFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(2deg);
  }
  75% {
    transform: translateY(5px) rotate(-2deg);
  }
}

/* ============================================
   ANIMATION UTILITIES
   ============================================ */
.animate-fade-in {
  animation: fadeIn var(--duration-500) var(--ease-out) forwards;
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-500) var(--ease-out) forwards;
}

.animate-fade-in-down {
  animation: fadeInDown var(--duration-500) var(--ease-out) forwards;
}

.animate-slide-in-left {
  animation: slideInLeft var(--duration-500) var(--ease-out) forwards;
}

.animate-slide-in-right {
  animation: slideInRight var(--duration-500) var(--ease-out) forwards;
}

.animate-scale-in {
  animation: scaleIn var(--duration-300) var(--ease-out) forwards;
}

.animate-float {
  animation: float 3s var(--ease-in-out) infinite;
}

.animate-pulse {
  animation: pulse 2s var(--ease-in-out) infinite;
}

.animate-glow {
  animation: glow 2s var(--ease-in-out) infinite;
}

.animate-gold-pulse {
  animation: goldPulse 2s var(--ease-in-out) infinite;
}

/* Stagger delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-700 { animation-delay: 700ms; }
.delay-800 { animation-delay: 800ms; }

/* Initially hidden for animation */
[data-animate] {
  opacity: 0;
}

[data-animate].is-visible {
  opacity: 1;
}

/* ============================================
   SCROLLBAR - Forest Theme
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--color-primary-600), var(--color-primary-700));
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--color-accent-600), var(--color-accent-700));
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary-600) var(--bg-secondary);
}

/* ============================================
   WORLDVIEW SEMANTIC COLORS
   세계관 시맨틱 색상 시스템
   ============================================ */

:root {
  /* === 동서남북 방향 색상 === */
  --north-color: #22c55e;      /* 북 - 기능인 (Green/Growth) */
  --north-glow: rgba(34, 197, 94, 0.4);
  --north-gradient: linear-gradient(135deg, #22c55e, #16a34a);

  --east-color: #6366f1;       /* 동 - 표현자 (Indigo/Voice) */
  --east-glow: rgba(99, 102, 241, 0.4);
  --east-gradient: linear-gradient(135deg, #6366f1, #4f46e5);

  --south-color: #f59e0b;      /* 남 - 확장자 (Amber/Expansion) */
  --south-glow: rgba(245, 158, 11, 0.4);
  --south-gradient: linear-gradient(135deg, #f59e0b, #d97706);

  --west-color: #ec4899;       /* 서 - 플레이어 (Pink/Life) */
  --west-glow: rgba(236, 72, 153, 0.4);
  --west-gradient: linear-gradient(135deg, #ec4899, #db2777);

  --center-color: #f5c542;     /* 중앙 - HQ (Gold) */
  --center-glow: rgba(245, 197, 66, 0.5);
  --center-gradient: linear-gradient(135deg, #f5c542, #d4a520);

  /* === 삼위일체 색상 === */
  --spirit-color: #fbbf24;     /* 영성 - Gold/Sun */
  --spirit-glow: rgba(251, 191, 36, 0.4);
  --spirit-gradient: linear-gradient(135deg, #fbbf24, #f59e0b);

  --head-color: #3b82f6;       /* 지성 - Blue/Mind */
  --head-glow: rgba(59, 130, 246, 0.4);
  --head-gradient: linear-gradient(135deg, #3b82f6, #2563eb);

  --heart-color: #ef4444;      /* 감성 - Red/Heart */
  --heart-glow: rgba(239, 68, 68, 0.4);
  --heart-gradient: linear-gradient(135deg, #ef4444, #dc2626);

  /* === 학년 색상 (방향과 매핑) === */
  --grade-1: var(--north-color);
  --grade-2: var(--east-color);
  --grade-3: var(--south-color);
  --grade-4: var(--west-color);

  /* === 레이어/층 색상 === */
  --layer-1-bg: rgba(255, 255, 255, 0.03);
  --layer-2-bg: rgba(99, 102, 241, 0.08);
  --layer-3-bg: rgba(245, 158, 11, 0.08);
  --layer-4-bg: rgba(236, 72, 153, 0.08);

  /* === Pentagon 상태 색상 === */
  --status-confirmed: #22c55e;
  --status-reserved: #fbbf24;
  --status-candidate: #3b82f6;
  --status-open: #6366f1;

  /* === 의식/Ritual 색상 === */
  --ritual-glow: radial-gradient(circle, var(--center-glow), transparent 70%);
  --ritual-pulse: rgba(245, 197, 66, 0.6);
}

/* ============================================
   WORLDVIEW TYPOGRAPHY
   세계관 타이포그래피
   ============================================ */

/* 선언문 (Declaration) - 철학적 메시지 */
.text-declaration {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 300;
  letter-spacing: 0.03em;
  line-height: 1.4;
  color: var(--text-primary);
}

@media (min-width: 768px) {
  .text-declaration {
    font-size: var(--text-4xl);
  }
}

/* 인용문 (Quote) - 세계관 발췌 */
.text-quote {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.7;
  color: var(--color-accent-400);
  border-left: 2px solid var(--color-accent-500);
  padding-left: var(--space-4);
  margin: var(--space-6) 0;
}

/* 방향 라벨 (Direction) - 동서남북 */
.text-direction {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* 레이어 라벨 (Layer) */
.text-layer {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* 한글 강조 */
.text-korean-title {
  font-family: 'Pretendard Variable', 'Pretendard', var(--font-sans);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  word-break: keep-all;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .text-korean-title {
    font-size: var(--text-3xl);
  }
}

.text-korean-body {
  font-family: 'Pretendard Variable', 'Pretendard', var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.8;
  word-break: keep-all;
}

/* 철학 문구 */
.text-philosophy {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ============================================
   WORLDVIEW ANIMATIONS
   세계관 애니메이션
   ============================================ */

/* 숨쉬기 (Breathing) - 중앙 요소, Pentagon Center */
@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 30px var(--center-glow);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 60px var(--center-glow);
  }
}

.breathing {
  animation: breathe 4s ease-in-out infinite;
}

/* 나침반 바늘 흔들림 */
@keyframes compassNeedle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.compass-needle {
  animation: compassNeedle 3s ease-in-out infinite;
  transform-origin: center bottom;
}

/* 방향 펄스 */
@keyframes directionPulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

.direction-pulse {
  animation: directionPulse 2s ease-in-out infinite;
}

/* 연결선 흐름 */
@keyframes connectionFlow {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

.connection-flow {
  stroke-dasharray: 10 5;
  animation: connectionFlow 2s linear infinite;
}

/* 별 깜빡임 */
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.twinkle {
  animation: twinkle 3s ease-in-out infinite;
}

/* 별 랜덤 깜빡임 변형 */
.twinkle-1 { animation-delay: 0s; animation-duration: 2.5s; }
.twinkle-2 { animation-delay: 0.5s; animation-duration: 3.2s; }
.twinkle-3 { animation-delay: 1s; animation-duration: 2.8s; }
.twinkle-4 { animation-delay: 1.5s; animation-duration: 3.5s; }
.twinkle-5 { animation-delay: 0.3s; animation-duration: 2.2s; }

/* 의식적 열림 (Ritual Open) */
@keyframes ritualReveal {
  0% {
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
  }
  100% {
    clip-path: circle(100% at 50% 50%);
    opacity: 1;
  }
}

.ritual-reveal {
  animation: ritualReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 순환 회전 */
@keyframes cyclicRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.cycle-rotate {
  animation: cyclicRotate 60s linear infinite;
}

/* 에너지 흐름 */
@keyframes energyFlow {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.8);
  }
  50% {
    opacity: 1;
    transform: translateY(-20px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.8);
  }
}

.energy-particle {
  animation: energyFlow 2s ease-in-out infinite;
}

/* 부유 레이어 */
@keyframes layerFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.layer-float {
  animation: layerFloat 5s ease-in-out infinite;
}

/* 방향별 슬라이드 인 */
@keyframes slideFromNorth {
  from { opacity: 0; transform: translateY(-40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideFromEast {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

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

@keyframes slideFromWest {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideFromCenter {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.slide-from-north { animation: slideFromNorth 0.6s var(--ease-out) forwards; }
.slide-from-east { animation: slideFromEast 0.6s var(--ease-out) forwards; }
.slide-from-south { animation: slideFromSouth 0.6s var(--ease-out) forwards; }
.slide-from-west { animation: slideFromWest 0.6s var(--ease-out) forwards; }
.slide-from-center { animation: slideFromCenter 0.6s var(--ease-out) forwards; }

/* 숲 안개 효과 */
@keyframes forestMist {
  0%, 100% {
    opacity: 0.3;
    transform: translateX(0);
  }
  50% {
    opacity: 0.5;
    transform: translateX(20px);
  }
}

.forest-mist {
  animation: forestMist 8s ease-in-out infinite;
}

/* 별똥별 */
@keyframes shootingStar {
  0% {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(200px) translateY(200px);
  }
}

.shooting-star {
  animation: shootingStar 1s ease-in forwards;
}

/* 삼위일체 에너지 흐름 */
@keyframes trinityFlow {
  0% { stroke-dashoffset: 300; }
  100% { stroke-dashoffset: 0; }
}

.trinity-line {
  stroke-dasharray: 300;
  animation: trinityFlow 3s ease-in-out infinite;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .breathing,
  .compass-needle,
  .direction-pulse,
  .connection-flow,
  .twinkle,
  .cycle-rotate,
  .energy-particle,
  .layer-float,
  .forest-mist,
  .trinity-line {
    animation: none;
  }

  .ritual-reveal,
  .slide-from-north,
  .slide-from-east,
  .slide-from-south,
  .slide-from-west,
  .slide-from-center {
    animation-duration: 0.01ms;
  }
}

/* ============================================
   DIRECTION CARDS
   방향 카드 스타일
   ============================================ */

.direction-card {
  position: relative;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
}

.direction-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: width 0.3s var(--ease-out);
}

.direction-card--north::before { background: var(--north-gradient); }
.direction-card--east::before { background: var(--east-gradient); }
.direction-card--south::before { background: var(--south-gradient); }
.direction-card--west::before { background: var(--west-gradient); }
.direction-card--center::before { background: var(--center-gradient); }

.direction-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-default);
}

.direction-card:hover::before {
  width: 6px;
}

.direction-card--north:hover { box-shadow: 0 8px 30px var(--north-glow); }
.direction-card--east:hover { box-shadow: 0 8px 30px var(--east-glow); }
.direction-card--south:hover { box-shadow: 0 8px 30px var(--south-glow); }
.direction-card--west:hover { box-shadow: 0 8px 30px var(--west-glow); }
.direction-card--center:hover { box-shadow: 0 8px 30px var(--center-glow); }

/* 활성화 상태 */
.direction-card.is-active {
  transform: translateY(-6px) scale(1.02);
  border-color: var(--border-default);
}

.direction-card.is-active::before {
  width: 100%;
  opacity: 0.15;
}

.direction-card--north.is-active {
  box-shadow: 0 12px 40px var(--north-glow), inset 0 0 30px var(--north-glow);
  border-color: var(--north-color);
}

.direction-card--east.is-active {
  box-shadow: 0 12px 40px var(--east-glow), inset 0 0 30px var(--east-glow);
  border-color: var(--east-color);
}

.direction-card--south.is-active {
  box-shadow: 0 12px 40px var(--south-glow), inset 0 0 30px var(--south-glow);
  border-color: var(--south-color);
}

.direction-card--west.is-active {
  box-shadow: 0 12px 40px var(--west-glow), inset 0 0 30px var(--west-glow);
  border-color: var(--west-color);
}

.direction-card--center.is-active {
  box-shadow: 0 12px 40px var(--center-glow), inset 0 0 30px var(--center-glow);
  border-color: var(--center-color);
}

.direction-card.is-active .direction-card__icon {
  animation: directionPulse 1s ease-in-out infinite;
}

.direction-card__icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-3);
}

.direction-card__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.direction-card--north .direction-card__label { color: var(--north-color); }
.direction-card--east .direction-card__label { color: var(--east-color); }
.direction-card--south .direction-card__label { color: var(--south-color); }
.direction-card--west .direction-card__label { color: var(--west-color); }
.direction-card--center .direction-card__label { color: var(--center-color); }

.direction-card__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--text-primary);
}

.direction-card__subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.direction-card__description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ============================================
   LAYER SYSTEM
   레이어 시스템
   ============================================ */

.layer-indicator {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-glass);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.layer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  transition: all 0.2s var(--ease-out);
}

.layer-item--active {
  background: var(--layer-1-bg);
  color: var(--text-primary);
}

.layer-item--locked {
  opacity: 0.5;
  color: var(--text-tertiary);
}

.layer-item__number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}

.layer-item--active .layer-item__number {
  background: var(--color-accent-500);
  color: var(--color-primary-900);
}

/* ============================================
   RITUAL GATE
   의식적 진입
   ============================================ */

.ritual-gate {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: var(--space-8);
}

.ritual-gate__glow {
  position: absolute;
  width: 200px;
  height: 200px;
  background: var(--ritual-glow);
  border-radius: 50%;
  filter: blur(40px);
  animation: breathe 4s ease-in-out infinite;
}

.ritual-gate__lock {
  position: relative;
  z-index: 1;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 2px solid var(--border-default);
  border-radius: 50%;
  font-size: 2rem;
  margin-bottom: var(--space-4);
  transition: all 0.3s var(--ease-out);
}

.ritual-gate__lock:hover {
  border-color: var(--color-accent-500);
  box-shadow: var(--shadow-glow);
}

.ritual-gate__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.ritual-gate__subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  text-align: center;
  max-width: 280px;
}

/* ============================================
   GATE BUTTON
   지문 인식 버튼
   ============================================ */

.gate-button {
  position: relative;
  z-index: 1;
  width: 100px;
  height: 100px;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-bottom: var(--space-4);
  overflow: hidden;
  border-radius: 50%;
}

.gate-button-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-secondary));
  border: 2px solid var(--border-default);
  border-radius: 50%;
  transition: all 0.3s var(--ease-out);
}

.gate-button:hover .gate-button-bg {
  border-color: var(--color-accent-500);
  box-shadow: 0 0 30px var(--center-glow);
}

.gate-button-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: var(--space-2);
}

.fingerprint-icon {
  width: 40px;
  height: 40px;
  color: var(--text-secondary);
  transition: all 0.3s var(--ease-out);
}

.fingerprint-icon svg {
  width: 100%;
  height: 100%;
}

.gate-button:hover .fingerprint-icon {
  color: var(--color-accent-500);
  transform: scale(1.1);
}

.gate-button-text {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: var(--space-1);
  transition: color 0.3s;
}

.gate-button:hover .gate-button-text {
  color: var(--color-accent-500);
}

/* 스캔 라인 애니메이션 */
.scan-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-accent-500), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.gate-button:hover .scan-line,
.gate-button.scanning .scan-line {
  opacity: 1;
  animation: scanLine 1.5s ease-in-out infinite;
}

@keyframes scanLine {
  0% { top: 20%; }
  50% { top: 80%; }
  100% { top: 20%; }
}

/* ============================================
   GATE MODAL
   접근 인증 모달
   ============================================ */

.gate-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 8, 0.9);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease-out);
}

.gate-modal.active {
  opacity: 1;
  visibility: visible;
}

.gate-modal-content {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-primary));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  max-width: 340px;
  width: 90%;
  text-align: center;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s var(--ease-out);
}

.gate-modal.active .gate-modal-content {
  transform: translateY(0) scale(1);
}

.gate-modal.success .gate-modal-content {
  border-color: #22c55e;
  box-shadow: 0 0 40px rgba(34, 197, 94, 0.3);
}

.gate-header {
  margin-bottom: var(--space-6);
}

.gate-header .gate-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-4);
  color: var(--color-accent-500);
}

.gate-header h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.gate-subtitle {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.gate-input-container {
  position: relative;
  margin-bottom: var(--space-4);
}

.gate-input {
  width: 100%;
  padding: var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  letter-spacing: 0.2em;
  text-align: center;
  transition: all 0.3s var(--ease-out);
}

.gate-input:focus {
  outline: none;
  border-color: var(--color-accent-500);
  box-shadow: 0 0 0 3px var(--center-glow);
}

.gate-input.error {
  border-color: #ef4444;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.gate-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: #ef4444;
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.gate-actions {
  display: flex;
  gap: var(--space-3);
}

.gate-cancel,
.gate-submit {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.gate-cancel {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.gate-cancel:hover {
  background: var(--bg-tertiary);
}

.gate-submit {
  background: var(--color-accent-500);
  border: none;
  color: var(--color-primary-900);
}

.gate-submit:hover {
  background: var(--color-accent-400);
  box-shadow: 0 4px 15px var(--center-glow);
}

.gate-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   SCROLL ANIMATIONS
   스크롤 애니메이션
   ============================================ */

/* 페이드 인 업 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s var(--ease-out) forwards;
}

/* 페이드 인 스케일 */
@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-fade-in-scale {
  animation: fadeInScale 0.5s var(--ease-out) forwards;
}

/* 섹션 등장 */
section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Entry는 항상 보임 */
.entry {
  opacity: 1;
  transform: none;
}

/* 스무스 스크롤 */
html {
  scroll-behavior: smooth;
}

/* 스크롤 스냅 (선택적) */
@media (min-height: 600px) {
  .scroll-snap-container {
    scroll-snap-type: y proximity;
  }

  .scroll-snap-container > section {
    scroll-snap-align: start;
  }
}

/* ============================================
   MOBILE OPTIMIZATION
   모바일 최적화
   ============================================ */

/* 터치 피드백 */
@media (hover: none) and (pointer: coarse) {
  /* 모바일에서 호버 효과 제거, 탭 피드백으로 대체 */
  .direction-card:hover,
  .trinity__card:hover,
  .skill-card:hover {
    transform: none;
    box-shadow: none;
  }

  /* 액티브 상태로 피드백 */
  .direction-card:active,
  .trinity__card:active,
  .skill-card:active {
    transform: scale(0.98);
    opacity: 0.8;
  }

  /* 터치 하이라이트 색상 */
  * {
    -webkit-tap-highlight-color: rgba(245, 197, 66, 0.2);
  }
}

/* 모바일 네비게이션 (작은 화면) */
@media (max-width: 480px) {
  /* 텍스트 크기 조정 */
  .entry__declaration {
    font-size: var(--text-lg);
  }

  .entry__title {
    font-size: var(--text-3xl);
  }

  .compass__title,
  .trinity__title,
  .journey__title {
    font-size: var(--text-2xl);
  }

  /* 방향 카드 그리드 */
  .compass__grid {
    gap: var(--space-3);
  }

  .direction-card {
    padding: var(--space-4);
  }

  .direction-card__icon {
    font-size: 2rem;
  }

  .direction-card__title {
    font-size: var(--text-lg);
  }

  .direction-card__description {
    font-size: var(--text-xs);
  }

  /* 삼위일체 */
  .trinity__visual {
    max-width: 280px;
  }

  .trinity__cards {
    gap: var(--space-3);
  }

  .trinity__card {
    padding: var(--space-4);
  }

  /* 레벨 노드 */
  .journey__levels {
    padding: 0;
  }

  .journey__level-node {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }

  .journey__level-label {
    font-size: 9px;
    max-width: 50px;
  }

  /* 학년 순환 */
  .journey__cycle-visual {
    gap: var(--space-1);
  }

  .journey__cycle-item {
    padding: var(--space-1) var(--space-2);
    font-size: 10px;
  }

  .journey__cycle-arrow {
    font-size: var(--text-xs);
  }

  /* Gate */
  .gate-button {
    width: 80px;
    height: 80px;
  }

  .fingerprint-icon {
    width: 32px;
    height: 32px;
  }

  .gate-button-text {
    font-size: 7px;
  }

  /* 레이어 인디케이터 */
  .layer-indicator {
    padding: var(--space-3);
  }

  .layer-item {
    padding: var(--space-2);
    font-size: var(--text-xs);
  }
}

/* 가로 모드 최적화 */
@media (max-height: 500px) and (orientation: landscape) {
  .entry {
    min-height: auto;
    padding: var(--space-8) var(--space-4);
  }

  .entry__content {
    padding-top: var(--space-8);
  }

  .entry__scroll-hint {
    display: none;
  }

  .compass,
  .trinity,
  .journey {
    min-height: auto;
    padding: var(--space-8) var(--space-4);
  }
}

/* Safe Area (노치 대응) */
@supports (padding: max(0px)) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }

  .direction-header {
    padding-top: max(var(--space-4), env(safe-area-inset-top));
  }

  .direction-nav {
    padding-bottom: max(var(--space-8), env(safe-area-inset-bottom));
  }
}

/* 다크 모드 지원 (시스템 설정 따름) */
@media (prefers-color-scheme: light) {
  /* EAE는 기본 다크 테마이므로 라이트 모드에서도 다크 유지 */
  /* 필요시 여기에 라이트 테마 변수 추가 */
}

/* 모션 감소 (접근성) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .breathing,
  .twinkle,
  .compass-needle,
  .direction-pulse {
    animation: none;
  }
}
