/* 공통 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 헤더 스타일 */
header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 2rem;
    font-weight: bold;
}

.craftx-red {
    color: #dc3545;
}

/* 로고의 C, X 만 조금 더 굵게.
   Arial 은 Bold 위 굵기가 없어 font-weight 를 900 으로 올려도 그대로이므로,
   글자 색과 같은 외곽선을 얹어 획 두께를 늘립니다. */
.craftx-cap {
    -webkit-text-stroke: 1.4px currentColor;
    paint-order: stroke fill;
}

/* 햄버거 버튼 (기본: 숨김, 모바일에서만 표시) */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 16px;
    height: 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.hamburger-btn span {
    display: block;
    height: 1.5px;
    width: 100%;
    background-color: #333;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.hamburger-btn.open span:nth-child(1) {
    transform: translateY(5.25px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-5.25px) rotate(-45deg);
}

/* 네비게이션 (데스크톱: 가로) */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2rem;
    padding: 0;
    margin: 0;
}

.main-nav a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

.main-nav a:hover {
    background-color: #f8f9fa;
}

.main-nav a.active {
    background-color: #dc3545;
    color: white;
}

/* 데스크톱에서는 햄버거 전용 요소 숨김 */
.nav-divider,
.nav-auth-item,
.main-nav .auth-link {
    display: none;
}

/* 인증 버튼 */
.auth-buttons {
    display: flex;
    gap: 1rem;
}

.auth-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #dc3545;
    background-color: #dc3545;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    transition: background-color 0.3s;
}

.auth-btn:hover {
    background-color: #c82333;
}

/* 오버레이 (모바일 전용) */
.hamburger-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1040;
}

.hamburger-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* 메인 콘텐츠 */
main {
    margin-top: 80px;
    min-height: calc(100vh - 160px);
    padding: 2rem;
}

.page {
    display: none;
    max-width: 1200px;
    margin: 0 auto;
}

.page.active {
    display: block;
}

/* 히어로 섹션 */
.hero-section {
    text-align: center;
    padding: 4rem 0;
    background: url('/backGround.jpg') center/cover no-repeat;
    color: white;
    border-radius: 8px;
    margin-bottom: 3rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hero-section h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    word-break: keep-all;
    overflow-wrap: break-word;
    padding: 0 0.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

.hero-section p {
    font-size: 1.2rem;
    opacity: 0.9;
    word-break: keep-all;
    overflow-wrap: break-word;
    padding: 0 0.5rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* 기능 카드 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.feature-card h3 {
    color: #dc3545;
    margin-bottom: 1rem;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #000;
}

/* 폼 스타일 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.submit-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

.submit-btn:hover {
    background-color: #c82333;
}

/* 푸터 */
footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: 3rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .header-container {
        padding: 1rem;
    }

    /* 햄버거 버튼 표시 */
    .hamburger-btn {
        display: flex;
    }

    /* 데스크톱 인증 버튼 숨김 (햄버거 안에 포함됨) */
    .auth-buttons {
        display: none;
    }

    /* 네비게이션을 우측 슬라이드 패널로 */
    .main-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: 150px;
        max-width: 60%;
        height: auto;
        max-height: calc(100vh - 60px);
        top: 60px;
        background-color: #fff;
        box-shadow: -2px 4px 10px rgba(0, 0, 0, 0.15);
        border-bottom-left-radius: 10px;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1050;
        padding: 0.5rem 0.4rem;
        overflow-y: auto;
    }

    .main-nav.open {
        transform: translateX(0);
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0.2rem;
    }

    .main-nav li {
        width: 100%;
    }

    .main-nav .nav-auth-item {
        display: list-item;
    }

    /* 로그인/프로필/로그아웃 auth 항목은 가로로 배치 */
    .main-nav ul {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .main-nav li:not(.nav-auth-item) {
        flex: 0 0 100%;
    }

    .main-nav .nav-auth-item:not(.nav-divider) {
        flex: 0 0 calc(50% - 2px);
        width: calc(50% - 2px) !important;
        min-width: 0;
    }

    .main-nav .nav-divider {
        flex: 0 0 100%;
    }

    .main-nav .nav-auth-item .auth-link {
        text-align: center;
        padding-left: 0.2rem;
        padding-right: 0.2rem;
    }

    .main-nav a,
    .main-nav .auth-link {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 0.25rem 0.4rem;
        border-radius: 5px;
        text-align: left;
        font-size: 0.6rem;
        line-height: 1.2;
        font-weight: 600;
        color: #222;
        cursor: pointer;
        font-family: inherit;
        text-decoration: none;
        white-space: nowrap;
        background: linear-gradient(180deg, #ffffff 0%, #e6e9ef 100%);
        border: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.9) inset,
            0 -2px 0 rgba(0, 0, 0, 0.08) inset,
            0 4px 6px rgba(0, 0, 0, 0.15),
            0 1px 2px rgba(0, 0, 0, 0.1);
        text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
        transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
    }

    .main-nav a:hover,
    .main-nav .auth-link:hover {
        background: linear-gradient(180deg, #ffffff 0%, #dfe3eb 100%);
    }

    .main-nav a:active,
    .main-nav .auth-link:active {
        transform: translateY(2px);
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.6) inset,
            0 1px 2px rgba(0, 0, 0, 0.2);
    }

    .main-nav a.active {
        background: linear-gradient(180deg, #e85a68 0%, #c82333 100%);
        color: #fff;
        border-color: rgba(0, 0, 0, 0.15);
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.35) inset,
            0 -2px 0 rgba(0, 0, 0, 0.2) inset,
            0 4px 8px rgba(200, 35, 51, 0.35);
    }

    .main-nav .auth-link {
        background: linear-gradient(180deg, #ff7280 0%, #dc3545 100%);
        color: #fff;
        border-color: rgba(0, 0, 0, 0.15);
        text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
        box-shadow:
            0 1px 0 rgba(255, 255, 255, 0.3) inset,
            0 -2px 0 rgba(0, 0, 0, 0.2) inset,
            0 4px 6px rgba(200, 35, 51, 0.3),
            0 1px 2px rgba(0, 0, 0, 0.1);
    }

    .main-nav .auth-link:hover {
        background: linear-gradient(180deg, #ff7280 0%, #c82333 100%);
    }

    .nav-divider {
        display: block;
        height: 1px;
        background-color: #e9ecef;
        margin: 0.5rem 0;
        list-style: none;
    }

    .hamburger-overlay {
        display: block;
    }

    .hero-section {
        padding: 2rem 0.5rem;
    }

    .hero-section h2 {
        font-size: clamp(1.1rem, 5.5vw, 1.6rem);
        line-height: 1.3;
    }

    .hero-section p {
        font-size: clamp(0.8rem, 3.5vw, 1rem);
    }

    .features {
        grid-template-columns: 1fr;
    }

    main {
        padding: 1rem;
    }
}

/* 초소형 화면 (iPhone SE 등) */
@media (max-width: 360px) {
    .hero-section h2 {
        font-size: clamp(1rem, 5vw, 1.3rem);
    }

    .hero-section p {
        font-size: clamp(0.75rem, 3vw, 0.9rem);
    }
}
