/* ==========================================================================
   layout.css — 공통 레이아웃
   1. 헤더 (PC 가로 메뉴 / 모바일 전체 화면 메뉴)
   2. 서브 상단 (배경 이미지 + 제목 + 현재 위치 띠)
   3. CTA 띠
   4. 푸터
   5. 빠른 상담: PC 플로팅 퀵바 / 모바일 하단 고정 바 + 맨 위로
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 헤더
   -------------------------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--bg-white);
    border-bottom: 1px solid var(--line);
    transition: box-shadow var(--duration) var(--ease);
}

/* 스크롤 내려가면 옅은 그림자 (common.js에서 클래스 추가) */
.site-header.is-scrolled {
    box-shadow: 0 2px 12px rgba(15, 36, 51, 0.08);
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: var(--header-h);
    padding-right: 8px; /* 모바일: 메뉴 버튼(48px) 자체 여백이 있어 오른쪽은 좁게 */
}

/* 로고 */
.site-header .logo {
    display: flex;
    align-items: center;
}

.site-header .logo img {
    width: auto;
    height: 26px;
}

/* 모바일 메뉴 버튼 */
.site-header .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--text-title);
}

.menu-toggle .ico-close,
.menu-toggle[aria-expanded="true"] .ico-menu {
    display: none;
}

.menu-toggle[aria-expanded="true"] .ico-close {
    display: block;
}

/* 메뉴 영역: 모바일에서는 닫혀 있다가 열리면 헤더 아래 화면 전체를 덮음 */
.site-header .site-menu {
    display: none;
    position: fixed;
    top: calc(var(--header-h) + 1px); /* 헤더 아래 선이 가려지지 않게 */
    right: 0;
    bottom: 0;
    left: 0;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-white);
}

.is-menu-open .site-header .site-menu {
    display: flex;
}

/* 메뉴가 열린 동안 뒤쪽 본문 스크롤 막기 */
html.is-menu-open {
    overflow: hidden;
}

/* 주 메뉴 (모바일) */
.site-menu .gnb {
    padding: 8px var(--inner-pad) 0;
}

.gnb .gnb-list > li {
    border-bottom: 1px solid var(--line);
}

.gnb .gnb-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 68px;
    color: var(--text-title);
    font-size: 1.375rem; /* 22px */
    font-weight: 700;
}

.gnb .gnb-list .icon {
    color: var(--text-sub);
}

.gnb .gnb-list a[aria-current="page"],
.gnb .gnb-list a[aria-current="page"] .icon {
    color: var(--color-primary);
}

/* 모바일 메뉴 아래 상담 문의 상자 */
.site-menu .menu-contact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: auto var(--inner-pad) 28px;
    padding: 24px;
    border-radius: var(--radius);
    background: var(--bg-warm);
}

.menu-contact .title {
    color: var(--text-title);
    font-size: var(--fs-small);
    font-weight: 700;
}

.menu-contact .desc {
    margin: -4px 0 4px;
    color: var(--text-sub);
    font-size: 0.875rem; /* 14px */
}

.menu-contact .tel {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    color: var(--text-title);
    font-size: 1.125rem; /* 18px */
    font-weight: 700;
}

.menu-contact .tel.is-main {
    font-size: 1.625rem; /* 26px */
    font-weight: 800;
}

.menu-contact .tel .icon {
    color: var(--color-primary);
    stroke-width: 1.9;
}

.menu-contact .cb-btn {
    margin-top: 14px;
}

/* 헤더 오른쪽 전화 · 견적 (PC 전용) */
.site-header .header-actions {
    display: none;
}

/* ---- PC (1024px 이상) ---- */
@media (min-width: 1024px) {
    .site-header .header-inner {
        padding-right: var(--inner-pad);
    }

    .site-header .logo img {
        height: 34px;
    }

    .site-header .menu-toggle {
        display: none;
    }

    .site-header .site-menu {
        display: block;
        position: static;
        overflow: visible;
        background: none;
    }

    .site-menu .gnb {
        padding: 0;
    }

    .gnb .gnb-list {
        display: flex;
        gap: 44px;
    }

    .gnb .gnb-list > li {
        border-bottom: 0;
    }

    .gnb .gnb-list a {
        min-height: 0;
        padding: 6px 0;
        font-size: var(--fs-body-lg);
        font-weight: 600;
        transition: color var(--duration) var(--ease);
    }

    .gnb .gnb-list a:hover {
        color: var(--color-primary);
    }

    .gnb .gnb-list a[aria-current="page"] {
        box-shadow: inset 0 -2px 0 var(--color-primary);
    }

    .gnb .gnb-list .icon,
    .site-menu .menu-contact {
        display: none;
    }

    .site-header .header-actions {
        display: flex;
        align-items: center;
        gap: 20px;
    }

    /* 전화번호: 1024px에서는 자리가 좁아 숨기고 1280px부터 표시 */
    .header-actions .header-tel {
        display: none;
        flex-direction: column;
        color: var(--text-title);
        line-height: 1.25;
    }

    .header-tel .label {
        color: var(--text-sub);
        font-size: 0.75rem; /* 12px */
        font-weight: 500;
    }

    .header-tel .num {
        font-size: 1.125rem; /* 18px */
        font-weight: 700;
    }
}

@media (min-width: 1280px) {
    .header-actions .header-tel {
        display: flex;
    }
}

/* --------------------------------------------------------------------------
   2. 서브 상단
   - 배경 이미지는 <img class="bg">로 넣고 object-fit으로 채움
     (예전 background-image 방식과 보이는 건 같지만, 워드프레스에서 이미지 교체 ·
      반응형 이미지(srcset) · 먼저 불러오기(fetchpriority)를 쓰기 쉬움)
   - 덮개 진하기 · 이미지 위치는 페이지마다 style="--sub-dim: 0.6" 처럼 바꿀 수 있음
   - .is-plain: 이미지 없는 가벼운 상단 (매거진)
   -------------------------------------------------------------------------- */
.sub-visual {
    --sub-dim: 0.6;
    --sub-pos: center 40%;

    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: var(--sub-visual-h);
    padding: 0 var(--inner-pad) var(--location-h);
    overflow: hidden;
    isolation: isolate; /* 배경 이미지를 z-index: -1로 깔아도 섹션 밖으로 빠지지 않게 */
    background: #07131d;
    color: var(--text-on-dark);
    text-align: center;
}

/* 배경 이미지 + 남색 덮개 */
.sub-visual .bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--sub-pos);
    z-index: -1; /* 덮개 · 글자보다 아래 */
}

.sub-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, var(--sub-dim));
}

.sub-visual .text {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sub-visual .title {
    color: var(--text-on-dark);
    font-size: var(--fs-sub-title);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.035em;
}

.sub-visual .desc {
    color: var(--text-on-dark-sub);
    font-size: var(--fs-small);
}

/* 이미지 없는 상단 (매거진) */
.sub-visual.is-plain {
    background: var(--color-primary-dark);
}

.sub-visual.is-plain::before {
    content: none;
}

/* 현재 위치 띠 */
.sub-visual .location {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--location-h);
    background: rgba(7, 19, 29, 0.55);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.location .cb-inner {
    height: 100%;
}

.location .location-list {
    display: flex;
    align-items: center;
    height: 100%;
    color: var(--text-on-dark-sub);
    font-size: var(--fs-xs);
    text-align: left;
}

.location .location-list li {
    display: flex;
    align-items: center;
}

/* 구분 기호 ›  ( / "" : 스크린 리더는 읽지 않게) */
.location .location-list li + li::before {
    content: "›";
    content: "›" / "";
    margin: 0 8px;
}

.location .location-list a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-on-dark-sub);
}

.location .location-list a:hover {
    color: var(--text-on-dark);
}

.location [aria-current="page"] {
    color: var(--text-on-dark);
    font-weight: 600;
}

/* ---- 768px 이상 ---- */
@media (min-width: 768px) {
    .sub-visual .text {
        gap: 12px;
    }

    .sub-visual .desc {
        font-size: 1.125rem; /* 18px */
    }

    .location .location-list {
        font-size: 0.875rem; /* 14px */
    }
}

/* --------------------------------------------------------------------------
   3. CTA 띠 (모든 페이지 맨 아래 공통, 문의하기 · 글 상세 제외)
   - 기본: 위아래 여백 PC 80px (서브 페이지)
   - .is-main: 메인 S12, 위아래 여백 PC 112px
   -------------------------------------------------------------------------- */
.cb-cta {
    position: relative;
    padding: var(--cta-space) var(--inner-pad);
    overflow: hidden;
    isolation: isolate;
    background: #07131d;
    color: var(--text-on-dark);
    text-align: center;
}

.cb-cta.is-main {
    padding-block: var(--section-space);
}

.cb-cta .bg {
    position: absolute;
    inset: 0;
    z-index: -2; /* 덮개(-1)보다 아래 */
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 75%;
}

.cb-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(16, 40, 57, 0.72);
}

.cb-cta .cta-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    max-width: var(--inner-max);
    margin: 0 auto;
}

.cb-cta .title {
    color: var(--text-on-dark);
    font-size: var(--fs-cta);
    font-weight: 800;
    line-height: 1.45;
    letter-spacing: -0.03em;
}

/* 줄 단위(.line)는 항상 줄바꿈, 그 안의 덩어리(span)는 중간에서 끊기지 않게 */
.cb-cta .title .line {
    display: block;
}

.cb-cta .title .line span {
    display: inline-block;
}

.cb-cta .buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

@media (min-width: 768px) {
    .cb-cta .cta-inner {
        gap: 28px;
    }

    .cb-cta .title {
        line-height: 1.4;
    }

    .cb-cta .buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .cb-cta .cb-btn {
        min-height: 56px;
        padding: 0 32px;
    }
}

/* --------------------------------------------------------------------------
   4. 푸터
   -------------------------------------------------------------------------- */
.site-footer {
    /* 모바일: 하단 고정 바(64px)에 가려지지 않게 아래 여백 추가 */
    padding: 40px var(--inner-pad) calc(40px + var(--bottombar-h));
    background: var(--bg-footer);
    color: var(--text-footer);
    font-size: 0.8125rem; /* 13px */
}

.site-footer .footer-inner {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: var(--inner-max);
    margin: 0 auto;
}

.site-footer .footer-top {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* 회사 정보 */
.site-footer .footer-company {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-company .name {
    color: var(--text-on-dark);
    font-size: 1.125rem; /* 18px */
    font-weight: 800;
}

.footer-company .info {
    line-height: 1.8;
}

.footer-company .info .row {
    display: block;
}

/* 같은 줄 항목 사이 · 구분점 */
.footer-company .info .item + .item::before {
    content: "·";
    content: "·" / "";
    margin: 0 6px;
}

/* 모바일에서만 줄바꿈하는 항목 (사업자등록번호) */
.footer-company .info .item.is-break-m {
    display: block;
}

.footer-company .info .item.is-break-m::before {
    content: none;
}

.footer-company .info a:hover {
    color: var(--text-on-dark);
}

/* 상담 문의 */
.site-footer .footer-contact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-contact .title {
    color: var(--text-on-dark);
    font-size: 0.875rem; /* 14px */
    font-weight: 700;
}

.footer-contact .desc {
    margin: -4px 0 4px;
}

.footer-contact .tel {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
    color: var(--text-on-dark);
    font-size: 1.0625rem; /* 17px */
    font-weight: 700;
}

.footer-contact .tel.is-main {
    font-size: 1.375rem; /* 22px */
    font-weight: 800;
}

.footer-contact .tel .icon {
    color: var(--color-accent-on-dark);
    stroke-width: 1.9;
}

/* 맨 아래 줄: 모바일 = 링크 줄 → 저작권 / PC = 저작권 왼쪽 · 링크 오른쪽 */
.site-footer .footer-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    font-size: 0.75rem; /* 12px */
}

.footer-bottom .links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.footer-bottom .privacy {
    color: var(--text-on-dark);
    font-size: 0.8125rem; /* 13px */
    font-weight: 700;
}

.footer-bottom .sns {
    display: flex;
    gap: 4px;
    margin-right: -6px;
}

/* SNS 아이콘: 누르는 영역 32px (WCAG 2.5.8 최소 24px 충족) */
.footer-bottom .sns a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-footer);
    transition: color var(--duration) var(--ease);
}

.footer-bottom .sns a:hover,
.footer-bottom .sns a:focus-visible {
    color: var(--text-on-dark);
}

.footer-bottom .sns .icon {
    stroke-width: 1.8;
}

/* ---- 768px 이상 ---- */
@media (min-width: 768px) {
    .site-footer .footer-top {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 48px;
    }

    .footer-bottom .links {
        justify-content: flex-start;
    }
}

/* ---- PC (1024px 이상) ---- */
@media (min-width: 1024px) {
    .site-footer {
        padding: 64px var(--inner-pad) 40px; /* PC는 하단 고정 바 없음 */
        font-size: 0.875rem; /* 14px */
    }

    .site-footer .footer-inner {
        gap: 40px;
    }

    .site-footer .footer-company {
        gap: 18px;
    }

    .footer-company .name {
        font-size: 1.25rem; /* 20px */
    }

    .footer-company .info {
        line-height: 1.9;
    }

    .footer-company .info .item.is-break-m {
        display: inline;
    }

    .footer-company .info .item.is-break-m::before {
        content: "·";
        content: "·" / "";
    }

    .site-footer .footer-contact {
        gap: 10px;
    }

    .footer-contact .title {
        font-size: var(--fs-small);
    }

    .footer-contact .tel {
        font-size: 1.125rem; /* 18px */
    }

    .footer-contact .tel.is-main {
        font-size: 1.5rem; /* 24px */
    }

    .site-footer .footer-bottom {
        flex-direction: row-reverse;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        padding-top: 24px;
        font-size: 0.8125rem; /* 13px */
    }

    .footer-bottom .links {
        gap: 16px;
    }
}

/* --------------------------------------------------------------------------
   5. 빠른 상담 (.cb-quick)
   - 모바일(~1023px): 하단 고정 바 2칸 + 바 위 오른쪽 맨 위로 버튼
   - PC(1024px~): 오른쪽 아래 동그란 버튼 3개 (전화 · 견적 · 맨 위로)
   - .is-tel-only: 문의하기 페이지 (견적 버튼 숨김)
   - 맨 위로 버튼은 스크롤을 조금 내린 뒤에만 보임 (common.js)
   - 채널톡이 있으면(html.has-channel, common.js)
     모바일: 하단 바 위 [채널톡] → 그 위에 [맨 위로] / PC: [전화 · 견적 · 맨 위로] 아래에 [채널톡]
   -------------------------------------------------------------------------- */

/* 모바일: 하단 고정 바 */
.cb-quick .quick-links {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: var(--z-quickbar);
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: var(--bottombar-h);
    background: var(--bg-white);
    box-shadow: 0 -4px 16px rgba(15, 36, 51, 0.1);
}

.quick-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--fs-body);
    font-weight: 700;
}

.quick-links .quick-tel {
    border-top: 1px solid var(--line);
    color: var(--color-primary);
}

.quick-links .quick-quote {
    background: var(--color-button);
    color: var(--text-on-dark);
}

/* 맨 위로 */
.cb-quick .quick-top {
    position: fixed;
    right: 16px;
    bottom: calc(var(--bottombar-h) + 16px);
    z-index: var(--z-quickbar);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(15, 36, 51, 0.22);
    color: var(--text-on-dark);
    opacity: 0;
    visibility: hidden; /* 숨김 상태에서는 Tab 초점도 가지 않음 */
    transform: translateY(calc(var(--quick-push, 0px) * -1)); /* 푸터 맨 아래 줄에 닿으면 밀려 올라감 (common.js) */
    transition: opacity var(--duration) var(--ease), visibility var(--duration);
}

.cb-quick .quick-top.is-visible {
    opacity: 1;
    visibility: visible;
}

/* 채널톡 버튼(44px) + 간격 12px 위로 */
.has-channel .cb-quick .quick-top {
    bottom: calc(var(--bottombar-h) + 16px + 44px + 12px);
}

.quick-top .icon {
    stroke-width: 2.2;
}

/* 문의하기 페이지: 전화 상담 1칸 */
.cb-quick.is-tel-only .quick-links {
    grid-template-columns: 1fr;
}

.cb-quick.is-tel-only .quick-quote {
    display: none;
}

/* 모바일 메뉴가 열린 동안 숨김 */
.is-menu-open .cb-quick {
    display: none;
}

/* PC에서만 숨기는 글자 */
.quick-links .pc-hidden {
    display: inline;
}

/* ---- PC (1024px 이상): 플로팅 퀵바 ---- */
@media (min-width: 1024px) {
    .cb-quick {
        position: fixed;
        right: 24px;
        bottom: 96px; /* 푸터 맨 아래 줄을 가리지 않게 */
        z-index: var(--z-quickbar);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* 채널톡 버튼(56px, 96px 자리) + 간격 8px 위로 */
    .has-channel .cb-quick {
        bottom: calc(96px + 56px + 8px);
    }

    .cb-quick .quick-links {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: auto;
        background: none;
        box-shadow: none;
    }

    .quick-links a,
    .cb-quick .quick-top {
        position: static;
        transform: none;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        box-shadow: 0 6px 18px rgba(15, 36, 51, 0.18);
    }

    /* 맨 위로 버튼: 숨김 상태에서는 높이 0 → 전화 · 견적이 아래(96px)에 붙어 있다가
       버튼이 나타나면 위로 같이 밀려 올라감
       - 나타날 때: 자리가 먼저 생기고(0.25초) → 버튼이 투명도 0 → 1로 나타남(0.25초)
       - 사라질 때: 버튼이 먼저 투명해지고(0.2초) → 자리가 줄어듦(0.25초)
       (높이가 커지는 동안 동그라미가 찌그러져 보이지 않게 순서를 나눔) */
    .cb-quick .quick-top {
        height: 0;
        margin-top: -8px; /* 숨김 상태에서는 버튼 사이 간격(gap 8px)도 없앰 */
        overflow: hidden;
        transition:
            opacity 0.2s var(--ease),
            height var(--duration) var(--ease) 0.2s,
            margin-top var(--duration) var(--ease) 0.2s,
            visibility 0s linear 0.45s;
    }

    .cb-quick .quick-top.is-visible {
        height: 56px;
        margin-top: 0;
        transition:
            height var(--duration) var(--ease),
            margin-top var(--duration) var(--ease),
            opacity var(--duration) var(--ease) var(--duration),
            visibility 0s;
    }

    .quick-links .quick-tel {
        border-top: 0;
        background: var(--bg-white);
    }

    .quick-links .quick-quote {
        font-size: 0.8125rem; /* 13px */
        transition: background-color var(--duration) var(--ease);
    }

    .quick-links .quick-quote:hover {
        background: var(--color-button-hover);
    }

    /* PC: 전화는 아이콘만, 견적은 "견적" 글자만 보이고 나머지는 스크린 리더용 */
    .quick-links .quick-quote .icon {
        display: none;
    }

    .quick-links .pc-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}
