/* 공통 초기화 */
* { 
    margin: 0; padding: 0; box-sizing: border-box; 
    scrollbar-gutter: auto;  /* 스크롤바가 생겨도 레이아웃 밀림 방지 */
}

/* [2] 기본 브라우저 설정 (단독 페이지일 때 적용) */
html, body {
    width: 100%;
    height: auto !important;
    min-height: unset !important;
    overflow-x: hidden;
    background: #fff;
}

/* [3] iframe 내부일 때만 적용되는 스타일 (이중 스크롤 방지 핵심) */
html.is-iframe, 
body.is-iframe {
    overflow: hidden !important; /* 내부 스크롤 차단 */
}

/* iframe 내부일 때만 스크롤바 모양을 숨김 */
.is-iframe::-webkit-scrollbar,
.is-iframe ::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
}
.is-iframe {
    -ms-overflow-style: none; /* IE, Edge */
    scrollbar-width: none; /* Firefox */
}

body {
    background: #fff;
    display: block; 
    font-family: 'Pretendard', sans-serif;
}

#detail-payload {
    width: 100%;
    max-width: 1100px;
    min-height: unset !important;
    margin: 0 auto;
    padding: 0; /* 상하 여백 확보 */
    box-sizing: border-box;
    padding-bottom: 30px;
}

/* 1. 타이틀 정렬 */
.detail-header { position: relative; text-align: center; margin-bottom: 10px; }
.project-subtitle-en { font-size: 12px; color: #b5c1c0; margin-bottom: 5px; }
.project-title-ko { font-size: 25px; color: #0a4a44; font-weight: 500; margin: 0; letter-spacing: -0.05em; }
.list-btn-top { position: absolute; right: 0; bottom: 5px; padding: 5px 22px; border: 1px solid #333; text-decoration: none; color: #333; font-size: 13px; font-weight: 700; }

/* 2. 메인 이미지 (1.6:1 파노라마 비율 및 중앙 정렬) */
.main-content-area { width: 100%; margin-bottom: 20px; }
.main-img-box { 
    width: 100%; 
    aspect-ratio: 1.6 / 1; 
    overflow: hidden; 
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
}
.main-img-box img { 
    width: 100%; height: 100%; 
    object-fit: cover; 
    object-position: center; 
    display: block; 
}

/* 3. 하단 슬라이더 + 개요 (바닥 정렬 동기화) */
.bottom-grid-layout { display: flex; width: 100%; gap: 20px; align-items: flex-end; }
.slider-box { flex: 4; min-width: 0; position: relative; }
.slider-container { width: 100%; position: relative; }
.slider-wrapper { overflow: hidden; width: 100%; }

/* 이미지 사이 간격 추가 */
.sub-gallery-grid { 
    display: flex; 
    gap: 10px; /* 이미지 사이 간격 10px */
    transition: transform 0.4s ease; 
}

.sub-gallery-grid img {
    /* 모든 이미지에 기본적으로 투명한 outline을 설정해두면 전환이 부드럽습니다 */
    outline: 1px solid transparent;
    outline-offset: -1px;
    transition: outline 0.2s ease;
    
    /* 기존 설정 유지 */
    width: calc((100% - 30px) / 4); 
    flex-shrink: 0;
    aspect-ratio: 1.6 / 1; 
    object-fit: cover;
    cursor: pointer;
}

/* [핵심] 선택 이미지 강조 (크기 변화 없음) */
.sub-gallery-grid img.active {
    /* 1. 이미지 크기에 영향을 주지 않는 outline 사용 */
    outline: 1px solid #0a4a44;
    
    /* 2. 테두리가 이미지 안쪽으로 1px 들어오게 설정 (크기 변화 방지 핵심) */
    outline-offset: -1px; 
    
    /* 기존 border 및 shadow 제거 */
    border: none !important;
    box-shadow: none !important;
    
    /* 선택 시 시각적 구분을 위해 투명도 조절 제거 (선명하게 유지) */
    opacity: 1;
}

/* 화살표 오버레이 */
.nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    background: rgba(0, 0, 0, 0.2); color: #fff; border: none; padding: 12px 8px; cursor: pointer;
}
.nav-btn.prev { left: 0; }
.nav-btn.next { right: 0; }

/* 4. 개요 박스 (1칸) */
.info-box { flex: 1; min-width: 220px; }
.info-table { border-top: 2px solid #0a4a44; padding-top: 3px; }
.info-row { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 3px; 
    font-size: 12px; 
    border-bottom: 1px solid #f2f2f2; 
    padding-bottom: 4px; 
}
.label { font-weight: 700; color: #666; }
.value { color: #111; text-align: right; }



/* [모바일 대응] 화면이 작아지면 세로로 배치 */
@media (max-width: 1024px) {
    /* 1. 모바일에서도 상단 탭/헤더를 유지하기 위한 여백 확보 */
    #detail-payload { 
        padding: 0 0 10px 0 !important; /* 하단 패딩 최소화 */
    }

    /* 2. 제목 글씨 크기 축소 및 LIST 버튼과의 겹침 방지 */
    .detail-header {
        padding: 0 60px; /* 양옆 여백을 주어 LIST 버튼 공간 확보 */
    }
    .project-title-ko {
        font-size: 16px; /* 모바일 화면에 맞춰 제목 크기 축소 */
        line-height: 1.3;
        word-break: keep-all; /* 단어 단위 줄바꿈으로 가독성 향상 */
    }
    .project-subtitle-en { 
        font-size: 9px; /* 모바일 화면에 맞춰 제목 크기 축소 */
        line-height: 1.0;
        word-break: keep-all; /* 단어 단위 줄바꿈으로 가독성 향상 */
    }

    .list-btn-top {
        padding: 4px 12px;
        font-size: 10px;
        bottom: 2px; /* 위치 미세 조정 */
    }

    /* 3. 메인 이미지 조정 */
    .main-content-area {
        margin-bottom: 8px !important; /* 모바일에서 더 좁게 설정 */
    }

    /* 3. 하단 서브 이미지 4개 유지 및 크기 조정 */
    .bottom-grid-layout { 
        flex-direction: column; 
        align-items: stretch; 
        margin-bottom: 0 !important; /* 하단 마진 제거 */
        gap: 8px;
    }
    .sub-gallery-grid {
        gap: 5px; /* 모바일에서는 간격을 좁게 설정 */
    }
    .sub-gallery-grid img { 
        /* 모바일에서도 4개를 유지하기 위해 계산 (간격 5px * 3개 제외) */
        width: calc((100% - 15px) / 4) !important; 
        aspect-ratio: 1.6 / 1;
    }
    
    /* 개요 박스 너비 조정 */
    .info-box {
        width: 100%;
        min-width: unset;
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* 2. 개요 표 전체 영역의 상단 여백 제거 */
    .info-table {
        padding-top: 2px !important; /* 상단 선 바로 아래 붙도록 설정 */
        margin-top: 0 !important;
    }

    /* 3. 개요 항목 간격 95% 축소 (핵심) */
    .info-row {
        margin-bottom: 0px !important; /* 행 사이 외부 여백 제거 */
        padding-bottom: 1px !important; /* 행 사이 내부 여백을 1px로 최소화 */
        line-height: 1.8 !important; /* 줄 간격 축소 */
        font-size: 12px !important; /* 가독성을 위해 폰트 살짝 조정 */
    }

    .label, .value {
        padding: 0 !important;
        margin: 0 !important;
    }
}