/* style.css */

/* --- CSS 변수 --- */
/* 다크 모드/라이트 모드 테마 관리를 위한 변수 */
:root {
    /* 라이트 모드 기본 설정 */
    --background-color: #f0f2f5;
    --card-background: rgba(255, 255, 255, 0.7);
    --text-color: #333;
    --heading-color: #2c3e50;
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --border-color: rgba(200, 200, 200, 0.5);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --gradient-start: #a1c4fd;
    --gradient-end: #c2e9fb;
    --navbar-bg: rgba(255, 255, 255, 0.8);
    --navbar-border: rgba(200, 200, 200, 0.3);
    --btn-bg: #007bff;
    --btn-text: #fff;
    --btn-hover-bg: #0056b3;
    --progress-bar-bg: linear-gradient(to right, #6dd5ed, #2193b0);
}

/* 다크 모드 활성화 시 변수 재정의 */
body.dark-mode {
    --background-color: #1a1a2e;
    --card-background: rgba(29, 30, 48, 0.7);
    --text-color: #e0e0e0;
    --heading-color: #f0f0f0;
    --link-color: #8be9fd;
    --link-hover-color: #50fa7b;
    --border-color: rgba(50, 50, 50, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --gradient-start: #0f0c29;
    --gradient-end: #302b63;
    --navbar-bg: rgba(29, 30, 48, 0.8);
    --navbar-border: rgba(50, 50, 50, 0.3);
    --btn-bg: #8be9fd;
    --btn-text: #1a1a2e;
    --btn-hover-bg: #50fa7b;
    --progress-bar-bg: linear-gradient(to right, #8be9fd, #50fa7b);
}

/* --- 기본 스타일 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background 0.5s ease, color 0.5s ease; /* 테마 전환 애니메이션 */
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    color: var(--heading-color);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.section-title {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
    padding-bottom: 10px;
}

.section-title .underline {
    width: 80px;
    height: 4px;
    background: var(--link-color);
    margin: 0 auto;
    border-radius: 2px;
}

/* --- 그라데이션 및 글래스모피즘 스타일 --- */
.glassmorphism {
    background: var(--card-background);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: background 0.5s ease, border 0.5s ease, box-shadow 0.5s ease;
}

/* --- 네비게이션 바 --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--navbar-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--navbar-border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: center; /* 중앙 정렬 */
    align-items: center;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.navbar nav ul {
    display: flex;
    gap: 2rem;
}

.navbar nav ul li a {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--heading-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.navbar nav ul li a:hover {
    background: rgba(0, 123, 255, 0.1);
    color: var(--link-color);
    transform: translateY(-2px);
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--heading-color);
    margin-left: 2rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.theme-toggle:hover {
    color: var(--link-color);
    transform: rotate(30deg);
}

/* --- Hero 섹션 --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    margin-bottom: 0; /* Hero 섹션은 전체 페이지 배경과 연결되므로 하단 마진 제거 */
    border-radius: 0; /* Hero 섹션은 전체 화면을 차지하므로 border-radius 제거 */
    box-shadow: none; /* Hero 섹션은 전체 화면을 차지하므로 그림자 제거 */
    border: none; /* Hero 섹션은 전체 화면을 차지하므로 테두리 제거 */
}

.hero-content {
    max-width: 800px;
    animation: fadeIn 1.5s ease-out;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(45deg, #007bff, #00c6ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGradientAnim 3s infinite alternate;
}

.hero-content .tagline {
    font-size: 1.8rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
}

.hero-content .intro {
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    color: var(--text-color);
}

.highlight {
    font-weight: 700;
    color: var(--link-color);
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.btn:hover {
    background: var(--btn-hover-bg);
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 123, 255, 0.5);
}

/* --- 섹션 공통 스타일 --- */
section {
    padding: 6rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 0; /* Intersection Observer를 위한 초기 상태 */
    transform: translateY(50px); /* Intersection Observer를 위한 초기 상태 */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- About Me 섹션 --- */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* --- Skills 섹션 --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.skill-card {
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--glass-shadow), 0 0 20px rgba(0, 123, 255, 0.2);
}

.skill-card h3 {
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.progress-bar-container {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
    height: 15px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.progress-bar {
    height: 100%;
    background: var(--progress-bar-bg);
    border-radius: 10px;
    width: 0; /* JavaScript로 너비 설정 */
    animation: fillProgress 1.5s ease-out forwards;
}

.skill-card .progress-text {
    font-weight: 600;
    color: var(--link-color);
}


/* --- Portfolio/Projects 섹션 --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--glass-shadow), 0 0 25px rgba(0, 123, 255, 0.3);
}

.project-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-color);
    transition: transform 0.5s ease;
}

.project-card:hover img {
    transform: scale(1.05);
}

.project-card h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-size: 1.5rem;
    color: var(--heading-color);
}

.project-card p {
    font-size: 0.95rem;
    color: var(--text-color);
    flex-grow: 1; /* 설명 텍스트가 공간을 채우도록 */
    margin-bottom: 1.5rem;
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: auto; /* 하단 정렬 */
}

.project-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.3s ease, transform 0.3s ease;
}

.project-link-btn:hover {
    background: var(--btn-hover-bg);
    transform: translateY(-3px);
}

/* --- Contact 섹션 --- */
.contact-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.contact-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--heading-color);
    transition: color 0.3s ease, transform 0.3s ease;
}

.contact-item i {
    font-size: 1.4rem;
    color: var(--link-color);
    transition: color 0.3s ease;
}

.contact-item:hover {
    color: var(--link-hover-color);
    transform: translateY(-3px);
}

.contact-item:hover i {
    color: var(--link-hover-color);
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--navbar-bg);
    border-top: 1px solid var(--navbar-border);
    color: var(--text-color);
    font-size: 0.9rem;
    margin-top: 4rem;
    transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

/* --- 애니메이션 --- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes textGradientAnim {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

@keyframes fillProgress {
    from {
        width: 0;
    }
    to {
        /* JavaScript에서 설정할 너비로 채워짐 */
    }
}


/* --- 반응형 디자인 (미디어 쿼리) --- */

/* 작은 화면 (모바일) */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem 1rem;
        flex-direction: column; /* 모바일에서 수직 정렬 */
    }

    .navbar nav ul {
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
        text-align: center;
        width: 100%; /* 너비 100%로 설정 */
    }

    .navbar nav ul li a {
        padding: 0.8rem;
        font-size: 1rem;
        display: block; /* 링크 전체를 클릭 가능하도록 */
    }

    .theme-toggle {
        margin-left: 0;
        margin-top: 1rem;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content .tagline {
        font-size: 1.4rem;
    }

    .hero-content .intro {
        font-size: 1rem;
    }

    .btn {
        padding: 0.8rem 2rem;
        font-size: 1rem;
    }

    .section-title h2 {
        font-size: 2rem;
    }

    section {
        padding: 4rem 1rem;
    }

    .skills-grid, .portfolio-grid {
        grid-template-columns: 1fr; /* 모바일에서는 한 줄에 하나씩 */
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }

    .contact-item {
        justify-content: center; /* 중앙 정렬 */
    }
}

/* 중간 화면 (태블릿) */
@media (min-width: 769px) and (max-width: 1024px) {
    .navbar nav ul {
        gap: 1.5rem;
    }

    .hero-content h1 {
        font-size: 3rem;
    }

    .hero-content .tagline {
        font-size: 1.6rem;
    }

    .skills-grid, .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}