/* --- CORE DESIGN SYSTEM --- */
:root {
    --font-main: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    
    --color-background: #F5F5F7; 
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #6e6e73;
    
    /* 파비콘에서 영감을 받은 시그니처 컬러 */
    --gradient-color-1: #a794e0;
    --gradient-color-2: #89b8ff;
    --gradient-color-3: #9bebb4;
    
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- BASE & TYPOGRAPHY --- */
html { 
    scroll-behavior: smooth;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

/* --- INTERACTIVE BACKGROUND --- */
.interactive-light {
    position: fixed;
    top: 0; 
    left: 0;
    width: 500px; 
    height: 500px;
    background: radial-gradient(circle, rgba(106, 17, 203, 0.3), transparent 75%);
    border-radius: 50%;
    pointer-events: none;
    filter: blur(120px);
    z-index: -1;
    transition: transform 0.2s ease-out;
}

/* --- LAYOUT SECTIONS --- */
.section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 120px 0;
    width: 100%;
    position: relative;
}

/* ================================
   SITE HEADER - 모든 페이지 공통
   ================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: rgba(255, 255, 255, 0.342);
    backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transition: all 0.3s ease;
}

/* 스크롤 시 배경 강화 */
.site-header.scrolled {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(30px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 로고 */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.header-logo:hover {
    opacity: 0.7;
}

.logo-icon {
    width: 35px;
    height: auto;
    mix-blend-mode: multiply;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 500;
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 네비게이션 */
.header-nav {
    display: flex;
    align-items: center;
    gap: 35px;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--gradient-color-1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2));
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* AI 드롭다운 */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 10px;
    min-width: 180px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--color-text-primary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(167, 148, 224, 0.1), rgba(137, 184, 255, 0.1));
    color: var(--gradient-color-1);
}

/* 헤더 높이만큼 스페이서 */
.header-spacer {
    height: 70px;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .site-header {
        height: 60px;
    }

    .header-spacer {
        height: 60px;
    }

    .header-container {
        padding: 0 20px;
    }

    .logo-text {
        display: none;
    }

    .logo-icon {
        width: 30px;
    }

    .header-nav {
        gap: 20px;
    }

    .nav-link {
        font-size: 0.85rem;
    }

    /* Hide dropdown menu on mobile - AI button redirects to main page instead */
    .dropdown-menu {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    .nav-dropdown:hover .dropdown-menu {
        display: none !important;
    }
}

/* --- HERO SECTION for reducing space --- */
#hero {
    min-height: 100vh;
    padding-bottom: 30vh; /* 또는 25vh, 30vh */
}

#ai-tools {
    padding-top: 60px;
}

/* --- HERO SECTION --- */
#hero h1 {
    font-size: clamp(3rem, 12vw, 8.5rem);
    font-weight: 200;
    letter-spacing: -0.025em;
    margin: 0;
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2), var(--gradient-color-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* 부처님 아이콘 스타일 */
.buddha-icon {
    /* 크기 조절 */
    width: 310px;
    height: auto;

    /* 흰색/회색 배경 제거 */
    mix-blend-mode: multiply;
    background: transparent;

    /* 빛 효과 */
    filter: drop-shadow(0 0 8px rgba(167, 148, 224, 0.4));
    opacity: 0.85;

    /* Welcome to와의 간격 */
    margin-bottom: 30px;

    /* 배경 글로우를 위한 포지셔닝 */
    position: relative;
    z-index: 1;

    /* 부드러운 등장 */
    animation: fadeInScale 1s ease-out;
}

/* 황금빛 글로우 배경 */
.buddha-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 140%;
    height: 140%;
    background: radial-gradient(
        circle,
        rgba(255, 215, 0, 0.15) 0%,
        rgba(255, 223, 127, 0.1) 30%,
        rgba(255, 235, 180, 0.05) 50%,
        transparent 70%
    );
    border-radius: 50%;
    z-index: -1;
    animation: goldenPulse 4s ease-in-out infinite;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 0.85;
        transform: scale(1);
    }
}

@keyframes goldenPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.05);
    }
}

/* 호버 효과 */
.buddha-icon:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(167, 148, 224, 0.7));
    transition: var(--transition-smooth);
}

.buddha-icon:hover::before {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
    transition: var(--transition-smooth);
}

#hero p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 400;
    color: var(--color-text-secondary);
    margin: 10px 0 0 0;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    opacity: 0.7;
}

/* --- AI TOOLS (CARD UI) SECTION --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
}

.card {
    display: block;
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-decoration: none;
    color: var(--color-text-primary);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(135deg, var(--gradient-color-1), var(--gradient-color-2), var(--gradient-color-3));
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 1;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: transparent;
}

.card:hover::before { 
    opacity: 1; 
}

.card-content {
    position: relative; 
    z-index: 2;
    transition: var(--transition-smooth);
}

.card:hover .card-content {
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.card h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.card p {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    word-break: keep-all;
}

/* --- ACKNOWLEDGEMENT SECTION --- */
#acknowledgement .content-block {
    max-width: 720px;
    text-align: left; 
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text-secondary);
    margin-left: auto;
    margin-right: auto;
}

#acknowledgement .content-block p {
    letter-spacing: -0.025em;
}

.content-block h4, 
.gratitude {
    text-align: center;
}

.content-block h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 40px 0 15px 0;
}

.gratitude {
    margin-top: 40px;
    font-style: italic;
    word-break: keep-all;
}

/* --- EXPERIENCE LAB SECTION --- */
#experience-lab {
    padding: 100px 0;
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 500;
    color: var(--color-text-primary);
    margin: 0 0 10px 0;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin: 0 0 40px 0;
}

.experience-card {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 50px 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.experience-card::before {
    content: '';
    position: absolute;
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    background: linear-gradient(135deg, var(--gradient-color-1), var(--gradient-color-2), var(--gradient-color-3));
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 1;
}

.experience-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: transparent;
}

.experience-card:hover::before {
    opacity: 1;
}

.experience-content {
    position: relative;
    z-index: 2;
    transition: var(--transition-smooth);
}

.experience-card:hover .experience-content {
    color: white;
}

.experience-card h4 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.experience-card p {
    font-size: 1.1rem;
    margin: 0 0 20px 0;
    opacity: 0.9;
}

.cta-arrow {
    display: inline-block;
    font-size: 1rem;
    font-weight: 500;
    transition: transform 0.3s ease;
}

.experience-card:hover .cta-arrow {
    transform: translateX(5px);
}

/* --- FLOATING ACTION BUTTON --- */
.fab {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-color-1), var(--gradient-color-2));
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999;
    color: white;
}

.fab:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

.fab:active {
    transform: scale(0.95);
}

.fab-icon {
    font-size: 24px;
    line-height: 1;
}

.fab-text {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-content {
    background: var(--color-background);
    border-radius: 20px;
    padding: 60px 50px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- EPHEMERAL SENTENCES --- */
.ephemeral-header {
    text-align: center;
    margin-bottom: 40px;
}

.ephemeral-header h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 500;
    margin: 0 0 15px 0;
    background: linear-gradient(90deg, var(--gradient-color-1), var(--gradient-color-2), var(--gradient-color-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ephemeral-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.ephemeral-input-wrapper {
    position: relative;
    min-height: 300px;
    margin-bottom: 40px;
}

#ephemeral-canvas {
    /* 🎨 글씨 색상 커스터마이징
     * 현재: 황금빛 글씨 (사경 회향과 동일)
     * 변경하려면:
     * - color: 글자 기본 색상
     * - text-shadow: 빛나는 효과 (첫번째 값: 흐림 정도, 두번째: 색상)
     */
    color: rgba(218, 165, 32, 0.9); /* 황금빛 */
    text-shadow: 0 0 20px rgba(218, 165, 32, 0.4), 0 0 40px rgba(218, 165, 32, 0.2); /* 이중 황금 빛나는 효과 */
    
    /* 🎨 폰트 커스터마이징
     * 현재: 얇고 우아한 Pretendard
     * 변경하려면:
     * - font-weight: 100 (가장 얇음) ~ 900 (가장 굵음)
     * - letter-spacing: 글자 간격 (음수면 좁게, 양수면 넓게)
     */
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 200; /* 매우 얇음 */
    letter-spacing: 0.02em; /* 살짝 넓게 */
    
    line-height: 1.8;
    padding: 30px;
    min-height: 300px;
    outline: none;
    border: 2px solid transparent;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
    word-break: keep-all;
}

#ephemeral-canvas:focus {
    border-color: rgba(167, 148, 224, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

#ephemeral-canvas:empty:before {
    content: attr(placeholder);
    color: rgba(167, 148, 224, 0.3);
    text-shadow: none;
    pointer-events: none;
}

/* 🎨 찰나의 문장 - 사경 회향과 완전히 동일한 애니메이션 */
#ephemeral-char-container {
    position: relative;
}

#ephemeral-char-container span.char-fade-ephemeral {
    animation: charSmokeAway 1.2s ease-out forwards;
    transition: none;
    will-change: transform, opacity, filter;
    display: inline-block;
}

/* 사경과 완전히 동일한 keyframes */
@keyframes charSmokeAway {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
        -webkit-filter: blur(0);
    }
    25% {
        opacity: 0.85;
        transform: translateY(-10px) scale(1.03);
        filter: blur(0.5px);
        -webkit-filter: blur(0.5px);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-30px) scale(1.08);
        filter: blur(1.5px);
        -webkit-filter: blur(1.5px);
    }
    75% {
        opacity: 0.25;
        transform: translateY(-60px) scale(1.12);
        filter: blur(3px);
        -webkit-filter: blur(3px);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.15);
        filter: blur(5px);
        -webkit-filter: blur(5px);
    }
}

/* 옵션 1: 아래로 떨어지며 사라지기 (사용하려면 위 animation을 charFadeDown으로 변경) */
@keyframes charFadeDown {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(50px) scale(0.8);
        filter: blur(8px);
    }
}

/* 옵션 2: 회전하며 사라지기 */
@keyframes charFadeSpin {
    0% {
        opacity: 1;
        transform: rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: rotate(360deg) scale(0.5);
        filter: blur(10px);
    }
}

/* 옵션 3: 파티클처럼 부서지기 (클래스 추가 필요) */
/* 옵션 3: 파티클처럼 부서지기 */
.particle-break {
    animation: particleBreak 1.5s ease-out forwards;
}

@keyframes particleBreak {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
        filter: blur(0px);
    }
    30% {
        opacity: 0.8;
        filter: blur(2px);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.3);
        filter: blur(10px);
    }
}

@keyframes particleBreak {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
        filter: blur(0px);
    }
    50% {
        opacity: 0.7;
        filter: blur(3px);
    }
    100% {
        opacity: 0;
        /* 랜덤 방향으로 흩어지는 효과는 JS에서 동적 생성 */
        transform: translate(var(--tx), var(--ty)) scale(0.3);
        filter: blur(10px);
    }
}

.ephemeral-footer {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.dhamma-quote {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    font-style: italic;
    margin: 0;
}

/* --- FOOTER SECTION --- */
footer {
    padding: 60px 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* --- SCROLL ANIMATION --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1), transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .fab {
        width: 60px;
        height: 60px;
        bottom: 30px;
        right: 30px;
    }
    
    .fab-icon {
        font-size: 20px;
    }
    
    .fab-text {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    .container { 
        padding: 0 20px; 
    } 
    
    .section { 
        padding: 80px 0; 
    }
    
    #ai-tools { 
        padding-top: 40px; 
    }
    
    #experience-lab {
        padding: 80px 0;
    }
    
    .experience-card {
        padding: 40px 30px;
    }
    
    .modal-content {
        padding: 40px 30px;
        width: 95%;
    }
    
    .modal-close {
        top: 20px;
        right: 20px;
    }
    
    #ephemeral-canvas {
        font-size: 1.5rem;
        padding: 20px;
        min-height: 250px;
    }
    
    #acknowledgement .content-block { 
        font-size: 1rem; 
    }
}