:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --accent-color: #000000;
    --gray-light: #f9f9f9;
    --spacing: 40px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Header & Navigation */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px var(--spacing);
    /* Reduced from var(--spacing) (40px) to 20px vertically */
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 1000;
}

.logo {
    font-size: 1.6rem;
    /* Matches hamburger menu height */
    font-weight: 800;
    /* Double the previous 500 */
    letter-spacing: 0.1em;
    cursor: pointer;
    line-height: 1;
    /* Ensure height is strictly defined by font-size */
}

nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.3s;
}

nav ul li a:hover {
    opacity: 0.5;
}

/* Main Content Area */
main {
    margin-top: 80px;
    /* Reduced from 120px */
    min-height: calc(100vh - 80px);
    padding: 0 var(--spacing) var(--spacing);
}

section {
    display: none;
    animation: fadeIn 0.8s ease-in-out;
}

section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Home Section (Random Feed) */
.home-feed-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 80px;
    /* 이미지 간 넓은 여백 */
}

.home-feed-item {
    width: 100%;
    display: flex;
    justify-content: center;
}

.home-feed-item img {
    max-width: 100%;
    height: auto;
    /* 원본 비율 유지 */
    display: block;
}

/* Works Grid */
.works-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.work-item {
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 20px;
}

.work-thumb-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    /* 1:1 Aspect Ratio */
    background-color: var(--gray-light);
}

.work-thumb-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.work-item:hover img {
    transform: scale(1.05);
}

.work-title-small {
    margin-top: 8px;
    font-size: 0.75rem;
    color: #666;
    text-align: left;
}

/* CV Section */
.cv-container {
    max-width: 800px;
    margin: 40px auto;
}

.cv-section {
    margin-bottom: 40px;
}

.cv-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.cv-list {
    list-style: none;
}

.cv-list li {
    font-size: 0.9rem;
    margin-bottom: 8px;
    word-break: keep-all;
    /* 한글 띄어쓰기 단위 줄바꿈 적용 */
    overflow-wrap: break-word;
    display: flex;
    align-items: flex-start;
}

.cv-item-prefix {
    white-space: nowrap;
    margin-right: 0.5em;
    /* 연도/구분 뒤의 간격 */
    flex-shrink: 0;
}

.cv-item-content {
    flex-grow: 1;
}

/* Contact Section */
.contact-container {
    max-width: 600px;
    margin: 40px auto;
}

.artist-info {
    text-align: center;
    margin-bottom: 40px;
}

.artist-info h2 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 10px;
}

.artist-info p {
    font-size: 1rem;
    color: #666;
}

.email-button-container {
    text-align: center;
    margin-top: 20px;
}

.email-button-container p {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 25px;
}

.email-btn-large {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    text-decoration: none;
    padding: 15px 50px;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity 0.3s;
}

.email-btn-large:hover {
    opacity: 0.7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 2000;
    overflow-y: auto;
    padding: var(--spacing);
}

.modal-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-images-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    /* Default to 1 column */
    gap: 20px;
    margin-bottom: 20px;
}

/* If multiple images, use flexbox to center them */
.modal-images-grid.multi {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.modal-images-grid img {
    height: auto;
    max-height: 92vh;
    object-fit: contain;
    cursor: pointer;
    display: block;
    margin: 0 auto;
}

.modal-images-grid:not(.multi) img {
    width: 100%;
}

.modal-images-grid.multi img {
    flex: 1 1 auto;
    max-width: calc(50% - 10px);
}

/* 이미지 3개인 경우 3열 배치 강제 */
.modal-images-grid.count-3 img {
    width: calc(33.333% - 14px);
    max-width: none;
    flex: 0 0 auto;
}

/* Mobile: stack images vertically */
@media (max-width: 768px) {
    .modal {
        padding: 40px 15px;
        /* 모달 전체 좌우 여백 축소 */
    }

    .modal-images-grid.multi {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        /* 이미지 간 간격 축소 */
    }

    .modal-images-grid.multi img,
    .modal-images-grid.count-3 img {
        width: 100%;
        max-width: none;
    }

    .modal-info {
        margin-top: 20px;
        /* 텍스트와의 여백 축소 */
    }
}

.modal-info {
    margin-top: 30px;
    text-align: center;
}

.modal-info h2 {
    font-size: 1.2rem;
    font-weight: 400;
    margin-bottom: 10px;
}

.modal-info p {
    font-size: 0.9rem;
    color: #666;
}

/* 햄버거 버튼 기본 숨김 (데스크톱) */
header .hamburger {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: row;
        /* 로고와 햄버거 버튼 가로 정렬 유지 */
        padding: 20px var(--spacing);
        /* 데스크톱과 동일하게 20px로 축소 */
        align-items: center;
    }

    .logo {
        margin-bottom: 0;
    }

    /* 햄버거 버튼 스타일 (명시적 선택자 사용) */
    header .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        /* 약간 조정 */
        cursor: pointer;
        z-index: 1001;
    }

    header .hamburger span {
        display: block;
        width: 100%;
        height: 2px;
        background-color: var(--text-color);
        transition: all 0.3s ease;
    }

    /* 활성화된 햄버거 애니메이션 (정교화) */
    header .hamburger.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    header .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    header .hamburger.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* 모바일 네비게이션 메뉴 */
    nav#main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background-color: var(--bg-color);
        padding: 100px 40px;
        transition: right 0.4s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
        z-index: 1000;
        display: block;
        /* 명시적 표시 */
    }

    nav#main-nav.active {
        right: 0;
    }

    nav ul {
        flex-direction: column;
        gap: 30px;
        display: flex;
    }

    nav ul li a {
        font-size: 1.2rem;
        display: inline-block;
    }

    main {
        margin-top: 80px;
        /* Reduced from 120px */
        padding: 0 20px 100px;
        /* 하단 여백 추가 확보 */
    }

    .works-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

/* 저작권 표기 스타일 (더 견고하게 수정) */
.copyright {
    position: fixed;
    bottom: 20px;
    right: 30px;
    font-size: 0.75rem;
    color: #999;
    letter-spacing: 0.02em;
    z-index: 999;
    /* 충분한 우선순위 */
    pointer-events: none;
    background: transparent;
    text-align: right;
    width: auto;
    left: auto;
}

/* 모바일에서의 저작권 위치 조정 */
@media (max-width: 768px) {
    .copyright {
        bottom: 15px;
        right: 20px;
        font-size: 0.65rem;
    }
}