/* 변수 정의 */
:root {
    --site-bg: #efeae8;
    --creative-section-bg: #383734;
    --creative-section-text: #f8f9fa;
    --text-dark: #343a40;
    --accent-color: #007bff; /* 강조 색상 */
    --secondary-accent: #6c757d;
    --header-footer-text: #343a40;
    --menu-hover-color: #b0a9a6;
    --form-bg: #dfd6d3; /* 연락처 폼 배경색 변수화 */
    --button-bg: #c1b8b5; /* 버튼 배경색 변수화 */
    --button-hover-bg: #b0a9a6; /* 버튼 호버 배경색 변수화 */
    --grid-item-border: #383734; /* 그리드 아이템 테두리 색 변수화 */
}

/* 기본 스타일 */
*,
*::before,
*::after {
    box-sizing: border-box; /* 전역 box-sizing 적용 */
}

html {
    scroll-behavior: smooth; /* body 대신 html에 적용 */
}

body {
    font-family: 'Jura', sans-serif;
    line-height: 1.7;
    margin: 0;
    background-color: var(--site-bg);
    color: var(--text-dark);
    overflow-x: hidden;
}

.container {
    width: 85%;
    max-width: 1000px;
    margin-left: auto;  /* margin: auto 대신 좀 더 명시적 */
    margin-right: auto; /* margin: auto 대신 좀 더 명시적 */
    padding-top: 50px;
    padding-bottom: 50px;
}

/* 섹션 스타일 */
section {
    padding: 80px 0;
    /* margin, box-shadow, border-radius 등은 기본값이거나 body에서 상속받으므로 불필요 시 제거 가능 */
    /* transition: background-color 0.3s ease; 불필요 시 제거 */
    /* background-color: var(--site-bg); 기본값과 동일하면 제거 가능 */
}

#creative {
    background-color: var(--creative-section-bg);
    color: var(--creative-section-text); /* 하위 p, h2에 상속됨 */
}

#creative p { /* #creative h2는 color 상속받음, p는 기본 p 스타일을 덮어쓰기 위해 명시 */
    color: var(--creative-section-text);
    font-weight: 700;
    font-size: 0.85em;
    text-align: justify;
    text-align-last: center;
}
/* #creative h2::after는 유지 */
#creative h2::after {
    background-color: var(--accent-color);
}


/* 일반 제목 스타일 - h1(로고용), h2, h3 공통 속성 */
/* HTML 구조 변경으로 인해 h1 스타일은 로고에 맞춰 재조정, h2는 섹션 제목으로 사용 */
h1, h2, h3 { /* h1은 로고 이미지 컨테이너 역할 */
    font-weight: 700;
    margin-bottom: 25px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
}
h1 { /* 로고 컨테이너로서의 h1 */
    font-size: 1.4em; /* 이미지 크기에 영향 줄 수 있음, 필요시 조정 */
    text-align: center;
    /* color: var(--header-footer-text);  이미지에 직접 적용되지 않음 */
    /* text-shadow: 0 0px 0px rgba(0,0,0,0); 제거 */
    letter-spacing: 12px; /* 하위 span.lower-d 에만 영향, 로고 제목 자체에는 불필요할 수 있음 */
    text-transform: none; /* KIMYO dESIGN 텍스트 제목이 있다면 필요 */
    margin-top: 0; /* header padding으로 제어 */
    margin-bottom: 1px;
}
.lower-d {
    text-transform: lowercase;
}

h2 {
    font-size: 1.3em;
    text-align: center;
    letter-spacing: 10px;
    margin-bottom: 5px;
    position: relative;
    color: var(--text-dark); /* #creative h2는 해당 섹션에서 오버라이드 */
}
/* Creative 섹션의 h2를 제외한 나머지 h2의 파란색 막대기 제거 */
h2:not(#creative h2)::after {
    content: none;
}

.portfolio-subtitle {
    font-family: 'Jura', sans-serif;
    font-size: 0.7em;
    color: var(--secondary-accent);
    text-align: center;
    margin-top: 0;
    margin-bottom: 50px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    white-space: nowrap;
}

p {
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--text-dark); /* #creative p는 해당 섹션에서 오버라이드 */
    font-size: 0.85em;
    text-align: justify;
    text-align-last: center;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0; /* 추가: 일관성을 위해 마진도 0으로 */
}

ul li { /* 일반적인 리스트 아이템 스타일, 네비게이션은 nav ul li에서 구체화 */
    margin-bottom: 15px;
    /* padding-left: 0; ul에 padding:0 이 있으므로 중복 */
    /* position: relative; 필요시에만 */
    font-weight: 400;
    font-size: 1.05em;
}
/* ul li::before { content: none; } 불필요하여 제거 */


/* 헤더 및 내비게이션 스타일 */
header {
    background-color: var(--site-bg);
    color: var(--header-footer-text);
    padding: 2.5rem 0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* box-shadow: none; 기본값이므로 불필요 */
}

.header-logo {
    max-width: 150px;
    height: auto;
    padding-bottom: 10px; /* 로고와 네비게이션 간격 */
    margin-top: 65px;     /* 상단 여백 (h1으로 감싸면서 조정 필요할 수 있음) */
    margin-bottom: 15px;  /* 하단 여백 (줄임) */
    display: inline-block; /* a 태그 내부에 있으므로, 수직 정렬 등을 위해 */
}

nav { /* nav 태그에 직접 스타일 부여 */
    margin-top: 1px;
    margin-bottom: 0px;
}
nav ul {
    display: flex;
    justify-content: center;
}
nav ul li {
    margin: 0; /* 기본 ul li 스타일 초기화 */
    padding: 0 10px;
    position: relative;
    display: flex;
    align-items: center;
}
nav ul li:not(:last-child)::after {
    content: '/';
    color: var(--secondary-accent);
    margin-left: 10px;
}
nav ul li a {
    color: var(--header-footer-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.7em;
    letter-spacing: 3px;
    text-transform: uppercase;
    transition: color 0.3s ease;
    white-space: nowrap;
}
nav ul li a:hover {
    color: var(--menu-hover-color);
    /* font-weight: 600; 불필요 */
    /* transform: none; 불필요 */
}

/* 데스크탑 스크롤 마진 조정 */
#creative, #portfolio, #about, #contact {
    scroll-margin-top: 250px; /* 헤더 높이 재측정 후 값 조정 필요 (로고, h1 변경으로 높이 변동 가능성) */
}

/* 햄버거 메뉴 아이콘 */
.menu-icon { /* div에서 button으로 변경되었으므로, button 리셋 스타일 추가 가능 */
    display: none;
    color: var(--header-footer-text);
    font-size: 2.5em;
    cursor: pointer;
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
    background: none; /* button 기본 배경 제거 */
    border: none;     /* button 기본 테두리 제거 */
    padding: 0;       /* button 기본 패딩 제거 */
}

/* 반응형 내비게이션 */
@media (max-width: 900px) {
    #creative, #portfolio, #about, #contact {
        scroll-margin-top: 120px; /* 헤더 높이 재측정 후 값 조정 */
    }
    header {
        padding: 1.2rem 0;
    }
    .header-logo {
        max-width: 60px;
        margin-top: 15px; /* 조정 */
        margin-bottom: 0; /* 네비게이션이 아래로 가므로 조정 */
        padding-bottom: 0;
    }
    /* h1 관련 스타일은 전역 h1 스타일을 따르거나 여기서 오버라이드 */
    /* 현재 h1은 로고 이미지 컨테이너 역할 */

    nav ul {
        flex-direction: column;
        background-color: var(--site-bg);
        position: absolute;
        top: 100%; /* 헤더의 아래쪽부터 시작 */
        left: 0;
        width: 100%;
        display: none;
        padding: 20px 0;
        border-top: 1px solid rgba(0,0,0,0.08);
        margin-top: 0;
    }
    nav ul.active {
        display: flex;
    }
    nav ul li {
        text-align: center;
        padding: 15px 0;
        justify-content: center;
    }
    nav ul li a {
        font-size: 1.1em;
        letter-spacing: 0.5px;
    }
    nav ul li:not(:last-child)::after {
        content: none;
    }
    .menu-icon {
        display: block;
        /* top: 값 조정 필요. header의 padding과 로고 크기 변경으로 인해 */
    }
    .container {
        width: 90%; /* 95%에서 90%로 조정 (선호에 따라) */
        padding-top: 30px;
        padding-bottom: 30px;
    }
    section {
        padding: 60px 0;
    }
    h1 { /* 반응형에서 텍스트 제목을 쓴다면 여기서 조정 */
        /* 예: font-size: 1.2em; letter-spacing: 8px; */
        /* text-transform: uppercase; 이미 h1 기본값 */
    }
    /* h1 .lower-d는 전역 스타일 그대로 유지 */
    h2 {
        font-size: 1.2em; /* 1.3em에서 조정 */
    }
    /* p font-size는 기본값 유지 */
}

@media (max-width: 576px) {
    #creative, #portfolio, #about, #contact {
        scroll-margin-top: 100px; /* 헤더 높이 재측정 후 값 조정 */
    }
    /* header, .header-logo 등은 900px 스타일 상속 또는 여기서 추가 조정 */
    /* h1, h2, p 등 타이포그래피 추가 조정 가능 */
    .portfolio-subtitle {
        font-size: 0.6em; /* 더 작은 화면에 맞게 조정 */
        margin-bottom: 25px;
    }
    .menu-icon {
        right: 20px; /* 15px에서 조정 */
        font-size: 2.2em; /* 2em에서 조정 */
    }
    .container {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .contact-form {
        padding: 25px; /* 30px에서 조정 */
    }
    .contact-form label {
        font-size: 0.9em; /* 1em에서 조정 */
    }
}

/* 연락처 양식 */
.contact-form {
    max-width: 700px;
    margin: 40px auto 0;
    background-color: var(--form-bg); /* 변수 사용 */
    padding: 50px;
    border-radius: 8px;
}
.contact-form label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--text-dark);
    font-size: 0.85em;
    font-family: 'Jura', sans-serif;
}
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%; /* box-sizing: border-box 적용으로 calc 불필요 */
    padding: 14px;
    margin-bottom: 25px;
    background-color: var(--site-bg);
    border: 1px solid #ddd; /* 테두리 두께 명시 */
    border-radius: 6px;
    font-family: 'Jura', sans-serif;
    font-size: 1.05em;
    color: var(--text-dark);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    border-color: var(--accent-color); /* 변수 사용 */
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.25); /* var(--accent-color)의 rgba 형태로 변경 가능 */
    outline: none;
}
.contact-form textarea {
    resize: vertical;
    min-height: 150px;
}
.contact-form button {
    background-color: var(--button-bg); /* 변수 사용 */
    color: #fff;
    padding: 15px 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    font-family: 'Jura', sans-serif;
}
.contact-form button:hover {
    background-color: var(--button-hover-bg); /* 변수 사용 */
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* 푸터 스타일 */
footer {
    text-align: center;
    padding: 35px;
    background-color: var(--site-bg);
    color: var(--header-footer-text);
}
footer p {
    margin: 0;
    font-family: 'Jura', sans-serif;
    font-weight: 600;
    font-size: 0.85em;
    color: var(--text-dark);
}

/* 그리드 갤러리 스타일 */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}
.grid-item {
    position: relative;
    overflow: hidden;
    border: 5px solid var(--grid-item-border); /* 변수 사용 */
    transition: transform 0.3s ease, border-color 0.3s ease;
}
.grid-item:hover {
    transform: translateY(-5px);
    /* border-color: var(--accent-color); 예: 호버 시 테두리 색상 변경 */
}
.grid-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.grid-item:hover img {
    transform: scale(1.05);
}
.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 15px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    text-align: center;
    font-family: 'Jura', sans-serif;
    font-weight: 500;
    font-size: 0.9em;
}
.grid-item:hover .overlay {
    transform: translateY(0);
}
.item-title {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 5px;
}

/* 그리드 반응형 */
@media (max-width: 768px) { /* 포트폴리오 그리드 전용 반응형 */
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    .grid-item img {
        height: 200px;
    }
}
@media (max-width: 500px) { /* 포트폴리오 그리드 전용 반응형 */
    .portfolio-grid {
        grid-template-columns: 1fr; /* 단일 컬럼 */
        /* gap은 768px 스타일 상속 */
    }
    .grid-item img {
        height: 220px;
    }
}

/* 프로젝트 상세 페이지 스타일 */
.project-detail-container {
    width: 80%;
    max-width: 900px;
    margin: 60px auto;
    padding: 40px;
    background-color: var(--site-bg);
    border-radius: 8px;
    color: var(--text-dark);
}
.project-detail-container h1 { /* 상세 페이지의 h1은 페이지 제목 역할 */
    font-size: 2.5em; /* 다른 h1(로고)과 구분 */
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: normal; /* 상세페이지 h1은 기본 letter-spacing */
}
.project-detail-image {
    width: auto;
    max-width: 100%; /* 이미지가 컨테이너를 넘지 않도록 */
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 30px auto; /* 가운데 정렬 및 하단 마진 */
    border: 5px solid var(--secondary-accent); /* 테두리 유지 */
}
.project-additional-image {
    width: auto;
    max-width: 100%; /* 이미지가 컨테이너를 넘지 않도록 */
    height: auto;
    object-fit: contain;
    display: block;
    margin-top:20px;
    margin: 0 auto 30px auto; /* 가운데 정렬 및 하단 마진 */
    border: 5px solid var(--secondary-accent); /* 테두리 유지 */

}
.project-detail-content {
    font-size: 1.1em;
    line-height: 1.8;
    margin-bottom: 30px;
}
.project-meta {
    font-size: 0.9em;
    color: var(--secondary-accent);
    margin-bottom: 20px;
}
.project-meta span {
    display: block;
    margin-bottom: 5px;
    font-weight: 400;
}
.back-to-portfolio {
    display: block;
    width: fit-content;
    margin: 40px auto 0;
    padding: 12px 25px;
    background-color: var(--button-bg); /* 변수 사용 */
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
.back-to-portfolio:hover {
    background-color: var(--button-hover-bg); /* 변수 사용 */
    transform: translateY(-2px);
}

/* 상세 페이지 반응형 */
@media (max-width: 768px) {
    .project-detail-container {
        width: 90%;
        padding: 20px;
        margin-top: 40px;
    }
    .project-detail-container h1 {
        font-size: 1.8em;
    }
    .project-detail-content {
        font-size: 1em;
    }
}