/* 공통 스타일 */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Pretendard', sans-serif; color: #333333; background-color: #ffffff; line-height: 1.6; overflow-x: hidden; }
.container { max-width: 1200px; margin: 0 auto; padding: 40px 20px; text-align: center; }
.section-title { font-size: 2rem; margin-bottom: 50px; font-weight: 700; }

/* 1. Header (Full-width) */
header {
    width: 100%; position: fixed; top: 0; background: #fff;
    z-index: 1000; border-bottom: 1px solid #f0f0f0;
}
.header_wrapper {position: relative; width: 100%; display: flex; justify-content: space-between; align-items: center; margin:0 auto; box-sizing: border-box; padding: 10px 20px; }
.logo {width: auto; height: 20px; text-align: center;}
.logo a {display: block;}
.logo a img{width: auto; height: 20px;}
nav {display: flex; align-items: center; gap: 10px;}
nav a {margin: 0 10px; padding: 5px 15px; display: block; text-decoration: none; color: #333; font-weight: 500; font-size: 0.9rem; }
#mainNav a:hover {color: #ff4d4d;}

/* 2. Full-page Hero Section */
.hero-full { height: 100vh; width: 100%; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.hero-full.sticky-hero {
    position: fixed; /* 화면에 고정 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 1; /* 가장 뒤쪽에 배치 */
    will-change: opacity; /* 성능 최적화 */
    background-color: #000; /* 이미지 로딩 전 배경색 */
}
.hero-bg-slider { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 70%; transition: opacity 0.3s ease; will-change: transform, opacity }
.hero-slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; opacity: 0; }
.hero-slide.active { opacity: 1; }
.hero-text { position: fixed; top: 25%; left: 50%;  transform: translate(-50%, -50%); z-index: 5; text-align: center; transition: transform 0.3s ease-out; color: #ffffff; pointer-events: none; will-change: transform, opacity;}
.hero-text h1 { font-size: 4.5rem; font-weight: 800; margin-bottom: 10px; opacity: 0; transform: translateY(30px); transition: 1s ease; }
.hero-text p { font-size: 1.8rem; font-weight: 300; opacity: 0; transform: translateY(30px); transition: 1s ease 0.3s; }
.hero-text h1.visible, .hero-text p.visible { opacity: 1; transform: translateY(0); }

/* 3. Portfolio Parallel Layout */
.portfolio-section {
    position: relative;
    z-index: 10; /* Hero보다 위에 위치하여 위로 덮으며 올라옴 */
    margin-top: 60vh; /* Hero 섹션만큼 띄워줌 */
    background-color: #ffffff; /* 배경색이 있어야 아래 Hero를 가림 */
    padding: 100px 0;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1); /* 경계선을 부드럽게 */
}
.portfolio-parallel { padding: 120px 0; background: #fff; }
.container-parallel { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 60px; }
.portfolio-info { flex: 1; text-align: left; }
.portfolio-info h2 { font-size: 1.8rem; margin-bottom: 20px; }
.portfolio-info h3 { font-size: 1.2rem; margin-bottom: 15px; color: #666; }
.portfolio-info p { margin-bottom: 30px; }
.portfolio-visual { flex: 1;  max-width: 550px; width: 100%; margin: 0 auto;}
.slide-window { width: 100%; height: auto; aspect-ratio: 550 / 309; overflow: hidden; border: 1px solid #eee; position: relative; }
.slide-track { display: flex; width: 100%; height: 100%; transition: transform 0.6s ease-in-out; }
.p-slide { min-width: 100%; height: 100%; flex-shrink: 0;}
.p-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.view-btn { padding: 12px 30px; border: 1px solid #333; background: none; cursor: pointer; transition: 0.3s; }
.view-btn:hover { background: #333; color: #fff; }

/* 나머지 섹션들 배경색 확실히 지정 */
.services, .timeline-section, .contact {
    position: relative;
    z-index: 10;
    background-color: #ffffff;
}
/* 4. Services Grid */
.services {background: #fafafa; overflow: hidden; display: flow-root; width: 100%; padding: 30px 0;}
.service-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 17px; margin-top: 50px; width: 100%; }
.service-grid a {text-decoration: none;}
.service-card { width: 100%; /* 부모 그리드 너비에 맞춤 */}
.img-box { position: relative; width: 100%; aspect-ratio: 4/3; background: #eee; overflow: hidden; border-radius: 8px; align-items: center; justify-content: center;}
.img-box h3 { position: relative; z-index: 10; font-size: 1.1em; font-weight: 600; text-align: center; color: #ffffff; margin: 0; padding: 10px 0 10px; text-shadow: 0 1px 1px rgba(0,0,0,0.2); pointer-events: none;}
.img-box img { position: absolute;  top: 0; left: 0;  width: 100%; height: 100%; object-fit: cover; z-index: 1; transform-origin: center center; transition: transform 0.5s ease-out; }
.img-box:hover img { transform: scale(1.15);}

[cite_start]/* 5. Timeline [cite: 41-68] */
.timeline-section {  
    display: block;
    clear: both;
    position: relative;
    z-index: 20; 
    background-color: #ffffff; 
    overflow: hidden;
}
/* 1. 부모 컨테이너: 가로 배열 강제 */
.timeline-wrapper {
    display: flex !important;
    flex-direction: row !important; /* 무조건 가로로 */
    flex-wrap: nowrap !important;   /* 절대 아래로 줄바꿈 금지 */
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
    padding: 40px 0;
    
    /* 화면보다 길어질 경우를 대비한 가로 스크롤 활성화 */
    overflow-x: visible; 
    -webkit-overflow-scrolling: touch;
}

/* 2. 자식 요소 (각 단계): 너비 및 정렬 */
.timeline-wrapper .step {
    flex: 1; /* 늘어나되(1), 줄어들지 않고(0), 최소 140px 유지 */
    min-width: 0;
    max-width: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 3. 내부 요소 스타일링 */
.timeline-wrapper .step span {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background-color: #333;
    color: #fff;
    border-radius: 50%;
    margin-bottom: 15px;
    font-weight: 700;
}

.timeline-wrapper .step h4.highlight {
    font-size: 1.1rem;
    margin-bottom: 8px;
    white-space: nowrap; /* 제목 줄바꿈 방지 */
}

.timeline-wrapper .step p {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
    word-break: keep-all; /* 단어 단위 줄바꿈으로 깔끔하게 */
}

.scroll-indicator {
    display: none; /* 기본적으로 데스크탑에서는 숨김 */
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    color: #999;
    font-size: 1.1rem;
    font-weight: 500;
}

@keyframes slideArrow {
    0% { transform: translateX(0); }
    50% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

.arrow-icon {
    animation: slideArrow 1.5s infinite ease-in-out;
}
/* 6. Contact */
.contact { padding: 0 0; }
.narrow { max-width: 600px;}
form { margin-top: 40px; display: flex; flex-direction: column; gap: 12px; }
form input, form textarea { width: 100%; padding: 15px; border: 1px solid #ddd; outline: none; }
.submit-btn { background: #333; color: #fff; padding: 18px; border: none; cursor: pointer; font-size: 1rem; }
.form-msg {
    margin-top: 20px;
    font-size: 0.9rem;
    display: none; /* 평소엔 숨김 */
    padding: 10px;
    border-radius: 4px;
    text-align: center;
}
.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
.toast {
    position: fixed;
    bottom: -100px; /* 처음에는 화면 아래에 숨김 */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 16px 32px;
    border-radius: 50px;
    z-index: 11000;
    transition: bottom 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.toast.show {
    bottom: 50px; /* 활성화 시 위로 올라옴 */
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

#toast-icon {
    font-size: 20px;
}


footer { background-color: #ffffff;  padding: 20px; text-align: center; border-top: 1px solid #eee; font-size: 0.85rem; color: #999; }

/* --- 공통 모바일 메뉴 버튼 (X 애니메이션) --- */
.menu-trigger {
    display: none; 
    width: 20px;
    height: 20px;
    position: relative;
    cursor: pointer;
    z-index: 1001;
}

.menu-trigger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #333;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
    
}

.menu-trigger span:nth-child(1) { top: 9px; }
.menu-trigger span:nth-child(2) { top: 9px; }

.menu-trigger.active span:nth-child(1) { transform: rotate(45deg); }
.menu-trigger.active span:nth-child(2) { transform: rotate(-45deg); }

  

/* --- 히어로 섹션 높이 제한 --- */
.hero-full.sticky-hero {
    max-height: 932px;
    margin-bottom: 0;
}

/* ============================================================
   1. 태블릿 및 작은 데스크탑 (1024px 이하)
   ============================================================ */
@media (max-width: 1024px) {
    .container { padding: 50px 30px; }
    
    /* 포트폴리오 가로배치를 세로로 전환 */
    .container-parallel { 
        flex-direction: column; 
        text-align: center; 
        gap: 40px;
    }
    .hero-full.sticky-hero {
        height: 50svh;
        overflow: hidden;
    }
    .hero-text {
        position: fixed;
        top: 25%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 100%;
        text-align: center;
        z-index: 5;
        pointer-events: none;
        will-change: transform, opacity;
    }
    .hero-text h1 {font-size: 2.5em } 
    .hero-text p {font-size: 1.6em; } 
    .portfolio-section{  
        margin-top: 50vh; 
        position: relative;
        z-index: 10;
        background-color:#fff;
        padding: 60px 0;
        /* 섹션이 올라올 때 부드러운 느낌을 위해 상단 라운드 추가 */
        border-radius:2px 2px 0 0; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
    }}
    .portfolio-info { text-align: center; order: 2; }
    .portfolio-visual { flex: none; width: 100%; order: 1; }
    
    /* 타임라인 2열 배치 */
    .timeline-wrapper { 
        display: grid; 
        grid-template-columns: repeat(2, 1fr); 
        gap: 40px; 
    }
    
    /* 서비스 그리드 간격 미세 조정 */
    .service-grid { gap: 15px; }

/* ============================================================
   2. 스마트폰 (768px 이하)
   ============================================================ */
@media (max-width: 768px) {
    .header_wrapper {height: 100%;}
    /* 네비게이션 메뉴 활성화 */
    .menu-trigger { display: block; cursor: pointer; z-index: 100; transition: all 0.3s ease-in-out;}

 #mainNav {
    position: absolute;
    top: 100%; 
    left: 0;
    margin-top: 0 !important;
    width: 100%;
    height: auto;
    padding: 5px 0;
    
    background-color: rgba(255, 255, 255, 1); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 2px; /* 모서리를 둥글게 하여 박스 느낌 강조 */
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;

    /* 애니메이션 설정 */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden !important;
}

    #mainNav.active {
    top: 100%; /* 70px에서 80px로 살짝 내려오는 모션 */
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    
}
    #mainNav a {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    display: block;
    padding: 10px 20px;
    }

    
    .container { padding: 50px 15px; }
    
    /* 1. 부모 섹션 설정 */
    .hero-full.sticky-hero {
        display: flex;
        align-items: center;    /* 수직 중앙 */
        justify-content: center; /* 수평 중앙 */
        height: 100svh;
        /* 주소창 대응이 안 될 경우를 대비해 100svh 사용 권장 */
    }
    
    /* 1. Hero 섹션 높이 대응 */
    .hero-full {
        /* 일부 모바일 브라우저 툴바 대응 */
        height: 100svh; 
    }

    /* 2. Hero 텍스트 위치 및 크기 조정 */
    .hero-text {
        /* 부모가 fixed이므로 자식도 fixed로 기준을 잡는 것이 가장 확실합니다 */
        position: fixed; 
        top: 40%; 
        left: 50%;
        transform: translate(-50%, -50%); /* 정확한 정중앙 배치 */
        width: 100%;
        padding: 0 20px;
        z-index: 5;
        /* 스크롤 시 텍스트가 포트폴리오 섹션 아래로 들어가야 하므로 */
        pointer-events: none; 
        
    }
    
   .hero-text h1 {
        font-size: 1.5rem; /* 화면을 너무 꽉 채우지 않게 크기 축소 */
        line-height: 1.2;
        margin-bottom: 15px;
        word-break: keep-all; /* 한글 단어 잘림 방지 */
        white-space: nowrap;
    }

    .hero-text p {
        font-size: 1.1rem;
        line-height: 1.4;
    }
    
    /* 포트폴리오 섹션: 모바일에서 상단 여백을 줄여 콘텐츠 중심 배치 */
    .portfolio-section {
        margin-top: 65vh; 
        position: relative;
        z-index: 10;
        background-color: rgba(256,256,256, 0.95 );
        padding: 60px 0;
        /* 섹션이 올라올 때 부드러운 느낌을 위해 상단 라운드 추가 */
        border-radius:2px 2px 0 0; 
        box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
    }

    /* 서비스 섹션: 카드 사이 간격을 좁혀 모바일 화면 활용도 높임 */
    .services { 
        padding: 50px 0; 
    }

    /* 서비스 그리드 2열 고정 (요청 사항) */
    .service-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 10px;
    }
    .img-box { aspect-ratio: 1 / 1; height: auto; } /* 모바일에서 정사가형에 가깝게 조정 */
    
    .timeline-section {
        margin-top: 30px;
        padding: 50px 0;
    }

   .timeline-wrapper {
        /* 1. 가로 스크롤 활성화 */
        overflow-x: auto !important; 
        justify-content: flex-start !important; /* 왼쪽부터 차례대로 정렬 */
        gap: 25px; /* 모바일에서 아이템 간 간격 확보 */
        padding-left: 20px; /* 시작 지점 여백 */
        padding-right: 20px; /* 끝 지점 여백 */
        
        /* 터치 스크롤 최적화 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* 파이어폭스 스크롤바 숨기기 */
    }

    .timeline-wrapper::-webkit-scrollbar {
        display: none; /* 크롬/사파리 스크롤바 숨기기 (깔끔한 UI용) */
    }

    .timeline-wrapper .step {
        /* 2. 줄어들지 않도록 고정 너비 설정 */
        flex: 0 0 180px !important; /* 180px 너비를 유지하며 가로로 나열 */
        min-width: 180px;
    }

    .timeline-wrapper .step h4.highlight {
        white-space: normal; /* 모바일에서는 제목이 길면 줄바꿈 허용 */
        font-size: 1rem;
    }
    .scroll-indicator {
        display: flex;
    }
}
