/* 1. Baskerville 2 서브페이지 보조 헤더/검은 판 레이어 완전 박멸 */
html body #page header.site-header #site-navigation-secondary,
html body #page header.site-header .navigation-secondary,
html body #page header.site-header .header-widget-region,
html body #page .secondary-navigation,
html body #page #tertiary,
html body #page #secondary {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    height: 0 !important;
    max-height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* 이미지 위젯 및 컨테이너 회색 배경 제거 */
.elementor-widget-image,
.elementor-widget-image .elementor-widget-container,
.elementor-widget-image img {
    background-color: transparent !important;
    background: none !important;
}

/* 2. 상단 강제 여백 및 Baskerville 2 상단 빈 검은 헤더 틀 완전 삭제 */
html body #page header.site-header,
header.site-header {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* 3. 전체 본문 폰트/줄높이 */
body, p, div, span, li, h1, h2, h3, h4, h5, h6 {
    line-height: 1.6 !important;
    letter-spacing: normal !important;
}

/* 4. TablePress 표 폰트 및 여백 최적화 */
.tablepress {
    font-size: 16px !important;
    line-height: 1.6 !important;
}
.tablepress th,
.tablepress td {
    padding: 10px 12px !important;
    font-size: 16px !important;
}

/* 5. 하단 스크롤 걸림 방지 */
.elementor-page {
    padding-bottom: 70vh !important;
}

/* ==========================================
   6. 헤더 / 푸터 / 메인 로고 철저히 보호 (절대 안 커짐)
   ========================================== */
header img, footer img,
.site-header img, .site-footer img,
.elementor-location-header img, .elementor-location-footer img,
.gt-selector img, .gt_switcher img,
.polylang-switcher img, .elementor-nav-menu img {
    height: auto !important;
    max-height: none !important;
    width: auto !important;
    max-width: 100% !important;
}

.gt-selector img, .gt_switcher img, .polylang-switcher img {
    max-width: 24px !important;
    max-height: 24px !important;
}

/* ==========================================
   7. 질병 페이지 본문 및 앵커 정렬 (헤더/푸터 제외 본문만 적용)
   ========================================== */

/* 앵커 스크롤 위치 (고정 헤더 가림 방지) */
[id^="d"], [id*="-d"],
[id^="LI"], [id*="-LI"] {
    scroll-margin-top: 80px !important;
}

/* [핵심] 오직 본문 영역(#content, .elementor-location-single) 안의 이미지 높이만 62vh로 조정 */
#content .elementor-widget-image img,
.elementor-location-single .elementor-widget-image img,
.single-page #content img {
    height: 62vh !important;
    max-height: 62vh !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
}

/* 제목과 질환 그림 사이 간격 밀착 */
.elementor-page #content .elementor-widget-heading {
    margin-bottom: 2px !important;
}

/* 예외: 독맥 등 big-image 수동 적용 페이지 제한 해제 */
.big-image img,
.elementor-widget-image.big-image img {
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
}
/* ==========================================
   모바일 화면 전용 완벽 일직선 정렬 (767px 이하)
   ========================================== */
@media (max-width: 767px) {

    /* 1. 모바일 앵커 스크롤 위치 */
    [id^="d"], [id*="-d"],
    [id^="LI"], [id*="-LI"] {
        scroll-margin-top: 60px !important;
    }

    /* 2. 모바일 본문 이미지 높이 최적화 */
    #content .elementor-widget-image img,
    .elementor-location-single .elementor-widget-image img,
    .single-page #content img {
        height: auto !important;
        max-height: 50vh !important;
        width: auto !important;
        max-width: 100% !important;
    }

    /* 3. [핵심] 모바일 푸터 영역 완벽 일직선(일열횡대) 중앙 정렬 */
    .elementor-location-footer,
    .elementor-location-footer *,
    .site-footer,
    .site-footer * {
        box-sizing: border-box !important;
    }

    /* 푸터 내 모든 컨테이너와 위젯을 세로 1줄 및 중앙 배치 */
    .elementor-location-footer .elementor-container,
    .elementor-location-footer .elementor-row,
    .elementor-location-footer .elementor-column,
    .elementor-location-footer .elementor-widget-wrap,
    .elementor-location-footer .elementor-widget {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* 푸터 내 모든 텍스트, 제목, 아이콘 목록 중앙 정렬 */
    .elementor-location-footer h1,
    .elementor-location-footer h2,
    .elementor-location-footer h3,
    .elementor-location-footer p,
    .elementor-location-footer span,
    .elementor-location-footer a,
    .elementor-location-footer li,
    .elementor-location-footer .elementor-icon-list-items {
        text-align: center !important;
        justify-content: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* 4. 모바일 푸터 로고 및 태극기 크기 고정 */
    .elementor-location-footer img {
        max-width: 90px !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto 10px auto !important;
    }

    /* 5. 모바일 푸터 글자 크기 및 줄간격 정돈 */
    .elementor-location-footer .elementor-heading-title,
    .elementor-location-footer p {
        font-size: 15px !important;
        line-height: 1.5 !important;
        word-break: keep-all !important; /* 모바일 단어 끊김 방지 */
    }
}