/* =============================================
   Mobile Responsive Styles (모바일 전용 반응형)
   모든 페이지에 공통 적용되는 모바일 오버라이드
   ============================================= */

/* --- 햄버거 메뉴 버튼 (모바일 전용) --- */
.mobile-menu-btn {
    display: none; /* 데스크탑에서는 숨김 */
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: currentColor;
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 햄버거 → X 변환 */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}
.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* --- 모바일 오버레이 메뉴 --- */
.mobile-overlay-menu {
    display: none; /* 데스크탑에서는 숨김 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* 모바일 주소창 대응 */
    background-color: #fff;
    z-index: 190;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.mobile-overlay-menu.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-overlay-menu a {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none;
    color: #B0B0B0;
    letter-spacing: 1px;
    transition: color 0.2s ease;
}

.mobile-overlay-menu a.active,
.mobile-overlay-menu a:hover {
    color: #000;
}

/* 어두운 테마용 (홈페이지) */
body.home-body .mobile-overlay-menu,
body.loading .mobile-overlay-menu {
    background-color: #050505;
}
body.home-body .mobile-overlay-menu a,
body.loading .mobile-overlay-menu a {
    color: rgba(255,255,255,0.4);
}
body.home-body .mobile-overlay-menu a.active,
body.home-body .mobile-overlay-menu a:hover,
body.loading .mobile-overlay-menu a.active,
body.loading .mobile-overlay-menu a:hover {
    color: #fff;
}

/* ========================
   모바일 브레이크포인트 시작
   ======================== */
@media (max-width: 768px) {

    /* --- 커스텀 커서 숨기기 (터치 디바이스) --- */
    .cursor,
    .cursor-follower {
        display: none !important;
    }

    body {
        cursor: auto !important;
    }

    /* --- 햄버거 버튼 표시 --- */
    .mobile-menu-btn {
        display: block;
        color: #000; /* 기본 검정 */
    }

    .mobile-overlay-menu {
        display: flex;
    }

    /* 홈페이지는 흰색 버튼 */
    body.home-body .mobile-menu-btn {
        color: #fff;
        mix-blend-mode: difference;
    }

    /* ==================================
       홈페이지 (index.html) 모바일 레이아웃
       ================================== */
    body.home-body {
        overflow: hidden;
    }

    .home-layout-wrapper {
        padding: 20px;
    }

    /* 로고 축소 */
    .nav-logo {
        top: 20px !important;
        left: 20px !important;
        font-size: 20px !important;
    }

    /* 카운터 (Seoul / KR) 상단 중앙에 유지하되 작게 */
    .nav-counter {
        top: 22px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    .counter-main {
        font-size: 16px !important;
    }

    .counter-sub {
        font-size: 9px !important;
    }

    /* No.001 숨기기 (우측 상단은 햄버거 메뉴가 차지) */
    .nav-grid-btn {
        display: none !important;
    }

    /* 하단 네비게이션 링크 — 간소화 */
    .nav-menu-list {
        bottom: 20px !important;
        left: 20px !important;
        right: 20px !important;
        gap: 10px !important;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .nav-link-item {
        font-size: 16px !important;
    }

    /* 하단 우측 프로젝트 제목 — 하단에 배치 */
    .nav-title {
        bottom: 20px !important;
        right: 20px !important;
        font-size: 14px !important;
        max-width: 45%;
    }

    .nav-title::before {
        font-size: 8px !important;
    }

    /* 오버레이 메뉴 모바일 조정 */
    .overlay-menu {
        padding-left: 30px;
    }

    .overlay-nav-item a {
        font-size: clamp(2rem, 8vw, 3rem) !important;
    }

    /* ===================================
       내부 페이지 공통: 우측 사이드 네비 숨기기
       =================================== */

    /* about.css의 3컬럼 그리드 → 1컬럼 */
    .minimal-grid-container {
        display: block !important;
        padding: 20px !important;
    }

    .col-left {
        position: static !important;
        margin-bottom: 24px;
    }

    .minimal-logo {
        font-size: 22px !important;
    }

    /* 우측 네비게이션 컬럼 숨기기 (모바일에서는 햄버거 사용) */
    .col-right {
        display: none !important;
    }

    /* 인라인 스타일로 position:fixed된 네비도 숨기기 */
    /* Works / Project / Contact 페이지에서 사용하는 인라인 네비 */
    div[style*="position: fixed"][style*="right: 40px"][style*="text-align: right"] {
        display: none !important;
    }

    /* 고정 로고 모바일 크기 조정 */
    a.minimal-logo[style*="position: fixed"] {
        top: 20px !important;
        left: 20px !important;
        font-size: 20px !important;
    }

    /* ===================================
       About 페이지 모바일
       =================================== */
    .minimal-section {
        margin-bottom: 60px;
    }

    .minimal-text-block {
        font-size: 15px !important;
    }

    .minimal-list li {
        font-size: 13px !important;
        margin-bottom: 12px;
    }

    .minimal-heading {
        margin-top: 40px;
        font-size: 13px;
    }

    .minimal-intro {
        font-size: 12px !important;
        margin-bottom: 40px !important;
    }

    /* ===================================
       Works / Project 페이지 모바일 (split layout)
       =================================== */
    .split-container {
        flex-direction: column !important;
        height: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
    }

    body.loading {
        overflow: auto !important;
    }

    .image-pane {
        width: 100% !important;
        height: 40vh !important;
        position: relative !important;
    }

    .content-pane {
        width: 100% !important;
        height: auto !important;
        min-height: 60vh;
        padding: 20px !important;
        padding-top: 10px !important;
    }

    .work-list-area {
        /* 스크롤 페이드 제거 — 모바일에서는 전체 보이기 */
        mask-image: none !important;
        -webkit-mask-image: none !important;
        max-height: none;
        overflow-y: visible !important;
    }

    .work-list-content {
        padding-bottom: 40px !important;
    }

    .work-item {
        opacity: 0.6 !important;
        margin-bottom: 16px !important;
    }

    .work-item.active {
        opacity: 1 !important;
    }

    .w-title {
        font-size: 15px !important;
    }

    .desc-text {
        font-size: 18px !important;
    }

    .bottom-text-area {
        padding-top: 20px !important;
        border-top: 1px solid #eee !important;
    }

    /* ===================================
       Education 페이지 모바일
       =================================== */
    .col-center {
        max-width: 100% !important;
        padding-right: 0 !important;
    }

    .edu-gallery-scroll-container {
        margin-top: 20px !important;
        padding-bottom: 20px !important;
    }

    .edu-gallery-track {
        gap: 20px !important;
    }

    .edu-item {
        width: 260px !important;
    }

    /* ===================================
       Lab 페이지 모바일
       =================================== */
    .lab-item-content {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .lab-item {
        height: auto !important;
        min-height: 70px;
        padding: 16px 0 !important;
    }

    .lab-item.active {
        height: auto !important;
        min-height: auto;
    }

    .lab-item-right {
        height: 220px !important;
        margin-top: 12px;
    }

    .lab-img {
        height: 220px !important;
    }

    .lab-issue-title {
        font-size: 18px !important;
    }

    .lab-item.active .lab-issue-title {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }

    .lab-collapsed-title {
        font-size: 12px !important;
        width: 50% !important;
    }

    .lab-headline {
        font-size: 14px !important;
    }

    .gaf-page-title {
        font-size: 18px !important;
    }

    .gaf-page-desc {
        font-size: 12px !important;
    }

    .lab-arrow-btn {
        bottom: -10px !important;
        left: -10px !important;
        width: 40px !important;
        height: 40px !important;
    }

    /* ===================================
       Contact 페이지 모바일
       =================================== */
    .contact-content-wrapper {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 80px 20px 40px !important;
        pointer-events: auto !important;
    }

    .contact-address-top {
        font-size: 11px !important;
        padding: 0 !important;
        margin-top: 20px !important;
        text-align: left !important;
    }

    .big-email-link {
        font-size: clamp(2rem, 10vw, 4rem) !important;
    }

    .contact-center-email {
        padding-top: 40px !important;
        padding-bottom: 40px !important;
    }

    .contact-socials-bottom {
        text-align: left !important;
        margin-bottom: 40px !important;
    }

    .social-big-link {
        font-size: clamp(1.2rem, 4vw, 1.8rem) !important;
    }

    /* ===================================
       Works 상세 페이지 모바일 (works/ 하위)
       =================================== */
    .work-meta-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .work-content {
        grid-template-columns: 1fr !important;
    }

    .work-text {
        grid-column: 1 !important;
        font-size: 1.1rem !important;
    }

    .page-title {
        font-size: clamp(2rem, 8vw, 4rem) !important;
    }

    .next-project {
        font-size: clamp(2rem, 10vw, 6rem) !important;
    }

    /* Footer 모바일 */
    .footer {
        padding: 4rem 0 2rem !important;
    }

    .footer-email {
        font-size: clamp(1.5rem, 6vw, 3rem) !important;
        margin-bottom: 3rem !important;
    }

    .footer-links {
        flex-direction: column !important;
        gap: 1rem;
        align-items: flex-start !important;
    }

    .socials {
        gap: 1.5rem !important;
    }
}

/* ========================
   작은 모바일 (375px 이하)
   ======================== */
@media (max-width: 375px) {
    .nav-menu-list {
        display: none !important;
        /* 아주 작은 화면에서는 하단 네비 숨기고 햄버거만 사용 */
    }

    .nav-title {
        left: 20px !important;
        right: 20px !important;
        max-width: 100% !important;
        text-align: left !important;
    }

    .big-email-link {
        font-size: 1.8rem !important;
    }

    .edu-item {
        width: 220px !important;
    }
}
