/**
 * Main Layout Styles
 * 글로벌 레이아웃 스타일만 포함 (페이지별 스타일은 제외)
 */

/* ========================================
   Import Core Styles (기본 스타일)
   ======================================== */
@import '../core/variables.css';
@import '../core/reset.css';
@import '../core/typography.css';

/* ========================================
   Import Reusable Components (재사용 컴포넌트)
   ======================================== */
@import '../components/navbar.css';
@import '../components/footer.css';
@import '../components/buttons.css';
@import '../components/forms.css';
@import '../components/cards.css';

/* ========================================
   Global Layout Styles
   ======================================== */

/* Body - 깊은 네이비 블루 배경 + 그라데이션 */
body {
    background: var(--gradient-bg);
    min-height: 100vh;
    color: var(--text-primary);
    position: relative;
}

/* 배경 글로우 효과 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(30, 64, 175, 0.1) 0%, transparent 50%);
    animation: floatBackground 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatBackground {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-5deg); }
}

/* Main Content Wrapper */
.main-content {
    min-height: calc(100vh - var(--navbar-height));
}

/* ========================================
   Container System
   ======================================== */
.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--container-padding);
}

/* ========================================
   Section Utilities (공통 섹션 스타일)
   ======================================== */
.section {
    padding: var(--space-20) 0;
}

.section-sm {
    padding: var(--space-12) 0;
}

.section-lg {
    padding: var(--space-32) 0;
}

/* Section with padding-top for navbar */
.section-with-nav {
    padding-top: calc(var(--navbar-height) + var(--space-20));
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-subtitle {
    color: var(--color-primary);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-2);
}

.section-title {
    font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
    font-weight: var(--font-extrabold);
    color: var(--text-primary);
    margin-bottom: var(--space-4);

    /* 🎯 섹션 제목 줄맞춤 최적화 */
    text-align: center;
    word-break: keep-all;
    line-height: 1.3;
}

.section-description {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.8;

    /* 🎯 섹션 설명 줄맞춤 최적화 */
    text-align: center;
    word-break: keep-all;
}

/* ========================================
   Grid System
   ======================================== */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ========================================
   Flex Utilities
   ======================================== */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ========================================
   Spacing Utilities
   ======================================== */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.pt-0 { padding-top: 0; }
.pt-4 { padding-top: var(--space-4); }
.pt-6 { padding-top: var(--space-6); }
.pt-8 { padding-top: var(--space-8); }

.pb-0 { padding-bottom: 0; }
.pb-4 { padding-bottom: var(--space-4); }
.pb-6 { padding-bottom: var(--space-6); }
.pb-8 { padding-bottom: var(--space-8); }

/* ========================================
   Background Colors
   ======================================== */
.bg-primary-gradient {
    background: var(--gradient-gold);
}

.bg-dark-gradient {
    background: var(--gradient-dark);
}

.bg-primary {
    background: var(--bg-primary);
}

.bg-secondary {
    background: var(--bg-secondary);
}

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

.bg-card {
    background: var(--bg-card);
}

/* ========================================
   Loader (로딩 화면)
   ======================================== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-size: var(--text-6xl);
    font-weight: var(--font-extrabold);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-6);
    animation: pulse 2s ease-in-out infinite;
}

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

.loader-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loader-progress {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0; }
    50% { width: 100%; }
    100% { width: 0; }
}

/* ========================================
   Section Scroll Animations
   ======================================== */

/* 1. Fade In + Slide Up (기본) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Fade In + Scale (확대) */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 3. Slide In from Left (좌측에서) */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 4. Slide In from Right (우측에서) */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 5. Zoom In (확대 등장) */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 6. Fade In with Blur (블러 제거) */
@keyframes fadeInBlur {
    from {
        opacity: 0;
        filter: blur(10px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* 7. Pulse Glow (맥동 광채) */
@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.8;
        box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
    }
}

/* 8. Rotate In (회전 등장) */
@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-5deg) scale(0.9);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* ========================================
   Animation Classes (적용 클래스)
   ======================================== */

/* 기본 상태 (애니메이션 전) */
.animate-on-scroll {
    opacity: 0;
    will-change: transform, opacity;
}

/* 애니메이션 트리거됨 */
.animate-on-scroll.animated {
    animation-duration: 0.8s;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    animation-fill-mode: both;
}

/* 각 애니메이션 타입 */
.animate-fade-up.animated {
    animation-name: fadeInUp;
}

.animate-scale.animated {
    animation-name: fadeInScale;
}

.animate-slide-left.animated {
    animation-name: slideInLeft;
}

.animate-slide-right.animated {
    animation-name: slideInRight;
}

.animate-zoom.animated {
    animation-name: zoomIn;
}

.animate-blur.animated {
    animation-name: fadeInBlur;
}

.animate-pulse.animated {
    animation-name: pulseGlow;
}

.animate-rotate.animated {
    animation-name: rotateIn;
}

/* Staggered Animation (순차 애니메이션) */
.stagger-item {
    opacity: 0;
}

.stagger-item.animated {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Delay Classes (순차 딜레이) */
.delay-100 { animation-delay: 0.1s; }
.delay-150 { animation-delay: 0.15s; }
.delay-200 { animation-delay: 0.2s; }
.delay-250 { animation-delay: 0.25s; }
.delay-300 { animation-delay: 0.3s; }
.delay-350 { animation-delay: 0.35s; }
.delay-400 { animation-delay: 0.4s; }
.delay-450 { animation-delay: 0.45s; }
.delay-500 { animation-delay: 0.5s; }
