/* ==========================================================================
   components.css — 여러 곳에서 쓰는 공통 요소 (cb- 접두어)
   ========================================================================== */

/* --------------------------------------------------------------------------
   아이콘 (icons.svg 스프라이트)
   -------------------------------------------------------------------------- */
.icon {
    display: inline-block;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: middle;
}

/* --------------------------------------------------------------------------
   버튼
   - 기본: 높이 46px (헤더 견적 문의)
   - .is-lg: 높이 54px (모바일 메뉴 · CTA)
   - .is-block: 가로 꽉 채움
   -------------------------------------------------------------------------- */
.cb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 22px;
    border-radius: var(--radius-btn);
    background: var(--color-button);
    color: var(--text-on-dark);
    font-size: var(--fs-body);
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    transition: background-color var(--duration) var(--ease);
}

.cb-btn:hover {
    background: var(--color-button-hover);
}

.cb-btn.is-lg {
    min-height: 54px;
    font-size: var(--fs-body-lg);
}

.cb-btn.is-block {
    display: flex;
    width: 100%;
}

/* 어두운 배경 위 테두리 버튼 (CTA 전화 상담) */
.cb-btn.is-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: transparent;
    color: var(--text-on-dark);
    font-weight: 600;
}

.cb-btn.is-outline-light:hover {
    border-color: var(--text-on-dark);
    background: rgba(255, 255, 255, 0.08);
}

/* 흰 버튼 (남색 배경 위, 메인 S05 "CS 대행 자세히 보기") */
.cb-btn.is-white {
    background: var(--bg-white);
    color: var(--color-primary-dark);
}

.cb-btn.is-white:hover {
    background: var(--bg-primary-light);
}

/* --------------------------------------------------------------------------
   글자 링크 + 화살표 (전체 글 보기 등)
   -------------------------------------------------------------------------- */
.cb-more-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--tap-min);
    color: var(--color-primary);
    font-size: var(--fs-body);
    font-weight: 700;
}

.cb-more-link .icon {
    transition: transform var(--duration) var(--ease);
}

.cb-more-link:hover .icon {
    transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   로고 타일 (메인 S06 · 서비스 V06)
   - 모바일 3개 → 768px 4개 → PC 7개씩, 마지막 줄은 가운데 정렬
   - 로고 이미지는 모두 500 × 200px(5:2, 투명 배경, 가운데 정렬)로 만들어 넣음
     → HTML에 width · height 없이 크기는 여기서 한 번에 관리
   -------------------------------------------------------------------------- */
.cb-logo-grid {
    --cols: 3;
    --gap: 8px;

    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--gap);
}

.cb-logo-grid > li {
    display: flex;
    flex: 0 0 calc((100% - var(--gap) * (var(--cols) - 1)) / var(--cols));
    align-items: center;
    justify-content: center;
    min-height: 64px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-white);
}

.cb-logo-grid img {
    width: 100%;
    max-width: 150px;   /* 로고 이미지 최대 크기 (높이는 비율로 60px) */
    height: auto;
    aspect-ratio: 5 / 2; /* 이미지를 불러오기 전에도 자리를 잡아 화면이 덜컹거리지 않게 */
    object-fit: contain; /* 비율이 다른 파일이 섞여도 찌그러지지 않게 */
}

.cb-logo-note {
    margin-top: 16px;
    color: var(--text-sub);
    font-size: var(--fs-xs);
    text-align: center;
}

@media (min-width: 768px) {
    .cb-logo-grid {
        --cols: 4;
        --gap: 12px;
    }

    .cb-logo-grid > li {
        min-height: 80px;
        padding: 0 16px;
    }
}

@media (min-width: 1024px) {
    .cb-logo-grid {
        --cols: 7;
    }

    .cb-logo-grid > li {
        min-height: 88px;
        padding: 0 12px;
    }

    .cb-logo-note {
        margin-top: 24px;
    }
}

/* --------------------------------------------------------------------------
   흰 정보 카드 목록 (메인 S06-2 · 서비스 V05)
   - 모바일 1열 → 768px 2열 → PC 4열
   -------------------------------------------------------------------------- */
.cb-info-grid {
    display: grid;
    gap: 12px;
}

.cb-info-grid > li {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-white);
}

.cb-info-grid .title {
    font-size: var(--fs-card);
}

.cb-info-grid .desc {
    color: var(--text-sub);
    line-height: 1.65;
}

@media (min-width: 768px) {
    .cb-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
}

@media (min-width: 1024px) {
    .cb-info-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .cb-info-grid > li {
        gap: 14px;
        padding: 36px 30px;
    }
}

/* --------------------------------------------------------------------------
   진행 단계 4개 (메인 S09 · 서비스 V09 · 문의하기)
   - 모바일 · 태블릿: 세로로 쌓고 카드 사이 아래 화살표,
     카드 안은 왼쪽 단계 번호 / 오른쪽 제목 · 설명
   - PC: 가로 4칸, 카드 사이 오른쪽 화살표
   - 마지막 단계는 남색 카드 (.is-last)
   -------------------------------------------------------------------------- */
.cb-steps {
    display: grid;
    gap: 36px;
}

.cb-steps > li {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 18px;
    row-gap: 6px;
    padding: 24px 22px;
    border-radius: var(--radius);
    background: var(--bg-white);
}

/* 카드 사이 화살표 (장식, 테두리 두 변을 돌려서 그림: 모바일 ↓ / PC →) */
.cb-steps > li + li::before {
    content: "";
    position: absolute;
    top: -26px;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    border-right: 2.4px solid #8fa9bd;
    border-bottom: 2.4px solid #8fa9bd;
    border-radius: 1px;
    transform: rotate(45deg);
}

/* 단계 번호: 모바일 · 태블릿은 왼쪽 칸에 번호 위 · STEP 아래 */
.cb-steps .num {
    display: flex;
    grid-row: 1 / 3;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--color-primary);
}

.cb-steps .num strong {
    font-size: 2.25rem; /* 36px */
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.cb-steps .num span {
    font-size: 0.75rem; /* 12px */
    font-weight: 700;
    letter-spacing: 0.1em;
}

.cb-steps .title {
    align-self: end;
    font-size: var(--fs-card);
}

.cb-steps .desc {
    color: var(--text-sub);
    font-size: var(--fs-small);
    line-height: 1.65;
}

.cb-steps > li.is-last {
    background: var(--color-primary-dark);
}

.cb-steps .is-last .num {
    color: var(--color-accent-on-dark);
}

.cb-steps .is-last .title {
    color: var(--text-on-dark);
}

.cb-steps .is-last .desc {
    color: var(--text-on-dark-sub);
}

@media (min-width: 1024px) {
    .cb-steps {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 44px; /* 카드 사이 화살표 자리 (시안: 화살표 28px + 간격 8px × 2) */
    }

    .cb-steps > li {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 32px 28px 34px;
    }

    .cb-steps .num {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
    }

    .cb-steps > li + li::before {
        top: 50%;
        left: -26px;
        margin: -6px 0 0;
        transform: rotate(-45deg);
    }

    .cb-steps .num strong {
        font-size: 2.75rem; /* 44px */
    }

    .cb-steps .title {
        align-self: auto;
        margin-top: 6px;
    }
}

/* --------------------------------------------------------------------------
   매거진 글 카드 (메인 S11 · 매거진 목록 · 관련 글)
   -------------------------------------------------------------------------- */
.cb-post-card {
    height: 100%;
}

.cb-post-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--bg-white);
}

.cb-post-card .thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #dce5ec;
}

.cb-post-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}

.cb-post-card a:hover .thumb img {
    transform: scale(1.04);
}

/* 썸네일이 없을 때 (작업용 회색 자리) */
.cb-post-card .thumb.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5966;
    font-size: 0.875rem;
}

.cb-post-card .body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 22px 24px;
}

.cb-post-card .cat {
    color: var(--color-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.cb-post-card .title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 1.125rem; /* 18px */
    font-weight: 700;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2; /* 제목은 두 줄까지 (넘치면 …) */
    line-clamp: 2;
    transition: color var(--duration) var(--ease);
}

.cb-post-card a:hover .title {
    color: var(--color-primary);
}

.cb-post-card .date {
    color: var(--text-sub);
    font-size: 0.875rem;
}

@media (min-width: 1024px) {
    .cb-post-card .body {
        gap: 10px;
        padding: 24px 26px 28px;
    }

    .cb-post-card .title {
        font-size: 1.1875rem; /* 19px */
    }
}

/* --------------------------------------------------------------------------
   본문 글 (워드프레스 편집기 출력 HTML을 그대로 꾸밈)
   - 글 상세 본문 · 개인정보처리방침 · 앞으로 만들 일반 페이지(page.php)
   -------------------------------------------------------------------------- */
.cb-prose {
    color: var(--text-body);
    font-size: var(--fs-body-lg);
    line-height: 1.85;
}

.cb-prose > * + * {
    margin-top: 1.25em;
}

.cb-prose h2 {
    margin-top: 2.4em;
    padding-top: 0.2em;
    font-size: 1.375rem; /* 22px */
    line-height: 1.45;
}

.cb-prose h3 {
    margin-top: 1.9em;
    font-size: 1.1875rem; /* 19px */
    line-height: 1.5;
}

.cb-prose h2,
.cb-prose h3 {
    scroll-margin-top: 1.5rem; /* 목차로 이동할 때 제목이 헤더에 붙지 않게 */
}

.cb-prose h2 + *,
.cb-prose h3 + * {
    margin-top: 0.75em;
}

.cb-prose > :first-child {
    margin-top: 0;
}

.cb-prose a {
    color: var(--color-button);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cb-prose a:hover {
    color: var(--color-button-hover);
}

.cb-prose ul,
.cb-prose ol {
    padding-left: 1.4em;
}

.cb-prose li + li {
    margin-top: 0.4em;
}

.cb-prose li::marker {
    color: var(--color-primary);
}

.cb-prose blockquote {
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--color-accent);
    color: var(--text-title);
    font-weight: 500;
}

.cb-prose img {
    border-radius: var(--radius);
}

.cb-prose figure {
    margin-block: 2em;
}

.cb-prose figcaption {
    margin-top: 10px;
    color: var(--text-sub);
    font-size: 0.875rem;
    text-align: center;
}

/* 표는 좁은 화면에서 가로 스크롤 (워드프레스 표 블록: figure.wp-block-table > table) */
.cb-prose .wp-block-table {
    overflow-x: auto;
}

.cb-prose table {
    width: 100%;
    min-width: 480px;
    border-top: 2px solid var(--color-primary);
    font-size: var(--fs-small);
    line-height: 1.6;
}

/* 칸마다 얇은 선 + 머리 칸 옅은 회색 */
.cb-prose th,
.cb-prose td {
    padding: 12px 14px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.cb-prose th {
    background: #f3f5f7;
    color: var(--text-title);
    font-weight: 700;
}

.cb-prose hr {
    margin-block: 2.5em;
    border: 0;
    border-top: 1px solid var(--line);
}

@media (min-width: 1024px) {
    .cb-prose h2 {
        font-size: 1.625rem; /* 26px */
    }

    .cb-prose h3 {
        font-size: 1.25rem; /* 20px */
    }
}

/* --------------------------------------------------------------------------
   스크롤하면 나타나기 (common.js)
   - .cb-reveal: 그 요소 하나 / .cb-reveal-group: 바로 아래 자식들이 차례로
   - html.has-reveal은 JS가 정상 실행될 때만 붙음 → JS가 실패해도 내용은 보임
   - "움직임 줄이기" 설정 사용자는 숨기지 않고 바로 보임
   -------------------------------------------------------------------------- */
/* 속도 조절 */
.has-reveal {
    --reveal-duration: 0.9s;  /* 나타나는 시간 */
    --reveal-stagger: 150ms;  /* 카드 사이 간격 */
}

@media (prefers-reduced-motion: no-preference) {
    .has-reveal .cb-reveal,
    .has-reveal .cb-reveal-group > * {
        opacity: 0;
        transform: translateY(20px);
        transition:
            opacity var(--reveal-duration) var(--ease),
            transform var(--reveal-duration) var(--ease);
        transition-delay: calc(var(--i, 0) * var(--reveal-stagger));
    }

    .has-reveal .cb-reveal.is-visible,
    .has-reveal .cb-reveal-group > .is-visible {
        opacity: 1;
        transform: none;
    }
}

/* 페이지를 열 때 아래에서 올라오며 나타나기 (CSS만, 메인 히어로 등) */
@keyframes cb-fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   [확인 필요] 표시 (정적 HTML 작업용 · 테마로 옮길 때 삭제)
   -------------------------------------------------------------------------- */
.cb-todo {
    display: inline-block;
    padding: 1px 8px;
    border: 1px dashed #8a96a3;
    border-radius: 4px;
    color: var(--text-sub);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.6;
    letter-spacing: 0;
    vertical-align: middle;
}

.is-dark .cb-todo {
    border-color: #7f9aae;
    color: #c9d6e1;
}

/* --------------------------------------------------------------------------
   기본 페이지 (page.php: 전용 템플릿이 없는 페이지의 편집기 본문)
   - 본문 폭은 글 상세와 같은 800px
   -------------------------------------------------------------------------- */
.page-doc .cb-inner {
    max-width: calc(800px + var(--inner-pad) * 2);
}

/* 404 (404.php): 안내 문구 아래 버튼 · 링크 */
.page-404 .links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.75rem;
    margin-top: 2rem;
}
