/* ============================================================
   SOWONWEB AI — 라이트 파스텔 에디토리얼 v2 (전역 본문 스타일)
   목적: 전체 화면 폭 활용 + 세로 여백 확장 + 글자 간격 여유

   적용 범위
   - 본문 컨테이너: .wp-block-post-content, .entry-content
   - SOWONWEB AI 패턴이 들어간 그룹: .sowon-ai-pattern
   - 사이트 전역 배경: body, .wp-site-blocks

   설계 원칙
   1) 테마를 덮어쓰지 않는다. 본문 컨테이너 하위 선택자로만 한정한다.
   2) 패턴 자체의 인라인 스타일(색·여백)을 존중한다. 여기서는 타이포그래피·리듬만 다룬다.
   3) !important 를 쓰지 않는다. 인라인 스타일이 있으면 그쪽이 우선한다.
   ============================================================ */

.wp-block-post-content,
.entry-content,
.wp-block-group,
.wp-site-blocks {
    --sw-bg: #f8fafc;
    --sw-bg-soft: #f4f7fb;
    --sw-card: #ffffff;
    --sw-tint-blue: #eef4ff;
    --sw-tint-green: #f2f8f4;
    --sw-tint-warm: #fdf6ee;
    --sw-ink: #0f172a;
    --sw-sub: #475569;
    --sw-accent: #2563eb;
    --sw-accent-soft: #dbeafe;
    --sw-border: rgba(15, 23, 42, 0.08);
    --sw-border-soft: rgba(15, 23, 42, 0.05);
}

/*
 * ⚠️ [2026-11 실측] body 에 그라디언트를 걸면 테마의 콘텐츠 영역 폭까지만 칠해지고
 * 오른쪽이 흰색으로 남는 문제가 있었다(스크린샷: 우측 1/3 흰색).
 * body 배경은 단색으로 두고, 그라디언트는 본문 컨테이너에만 적용한다.
 * 또한 background-attachment: fixed 로 뷰포트 기준 고정해 스크롤 시 이음새가 생기지 않게 한다.
 */
body,
.wp-site-blocks {
    background-color: #f8fafc;
    color: #0f172a;
}

.wp-block-post-content,
.entry-content {
    background-color: #f8fafc;
    background-image: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 42%, #f8fafc 100%);
    color: #0f172a;
}

/* ---------- 1. 본문 기본 타이포그래피 ---------- */
.wp-block-post-content,
.entry-content {
    font-size: 17.5px;
    line-height: 1.92;
    letter-spacing: 0.012em;
    word-break: keep-all;
    color: #0f172a;
    font-feature-settings: "kern" 1;
    text-rendering: optimizeLegibility;
}

.wp-block-post-content p,
.entry-content p {
    margin-top: 1rem;
    letter-spacing: 0.012em;
}

.wp-block-post-content p:last-child {
    margin-bottom: 0;
}

/* ---------- 2. 제목 체계 + 넉넉한 상하 여백 ---------- */
.wp-block-post-content h1,
.entry-content h1 {
    font-size: clamp(1.85rem, 3.4vw, 2.6rem);
    line-height: 1.28;
    letter-spacing: -0.03em;
    font-weight: 700;
    margin: 0 0 1.1em;
    color: #0f172a;
}

.wp-block-post-content h2,
.entry-content h2 {
    font-size: clamp(1.42rem, 2.3vw, 1.85rem);
    line-height: 1.34;
    letter-spacing: -0.025em;
    font-weight: 700;
    color: #0f172a;
    padding: 0 0 0.55em;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    scroll-margin-top: 96px;
}

.wp-block-post-content h2:first-child,
.entry-content h2:first-child {
    margin-top: 0;
}

.wp-block-post-content h3,
.entry-content h3 {
    font-size: clamp(1.12rem, 1.6vw, 1.32rem);
    line-height: 1.44;
    letter-spacing: -0.012em;
    font-weight: 700;
    color: #0f172a;
    margin: 2.6em 0 0.9em;
    scroll-margin-top: 96px;
}

.wp-block-post-content h4,
.entry-content h4 {
    font-size: 1.05rem;
    line-height: 1.5;
    letter-spacing: -0.005em;
    font-weight: 700;
    color: #334155;
    margin: 2.1em 0 0.75em;
}

/* ---------- 3. 전체 화면 폭 + 텍스트 가독 폭 분리 ---------- */
/*
 * ⚠️ [2026-11 실측] alignfull 블록이 왼쪽으로 쏠리는 문제.
 *
 * 원인: 아래 `> *` 규칙이 모든 직계 자식에 max-width:820px + margin:auto 를 걸었다.
 * alignfull 블록(히어로 배경 등)은 화면 전체 폭을 써야 하는데, 이 규칙이 820px로 줄이고
 * margin:auto 로 가운데 정렬을 시도한다. 그런데 테마가 alignfull 에 이미
 * `margin-left: calc(-1 * var(--wp--style--root--padding-left))` 같은 음수 마진을 걸어 두면
 * auto 마진과 충돌해 좌측으로 밀린다(스크린샷: 히어로 배경이 왼쪽 2/3만 채움).
 *
 * 해결: alignfull / alignwide 블록은 폭 제한에서 제외하고, 음수 마진도 되돌린다.
 */
.wp-block-post-content > *,
.entry-content > * {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
}

/* 전체 폭 블록은 제한 해제 — 배경이 화면 끝까지 채워져야 한다 */
.wp-block-post-content > .alignfull,
.entry-content > .alignfull,
.wp-block-post-content > .wp-block-group.alignfull,
.entry-content > .wp-block-group.alignfull,
.wp-block-post-content > .wp-block-cover.alignfull,
.entry-content > .wp-block-cover.alignfull {
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* 넓은 폭 블록 */
.wp-block-post-content > .alignwide,
.entry-content > .alignwide {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
}

.wp-block-post-content > .wp-block-table,
.wp-block-post-content > .wp-block-columns,
.wp-block-post-content > .wp-block-group,
.wp-block-post-content > .wp-block-image,
.wp-block-post-content > .wp-block-embed,
.wp-block-post-content > figure,
.entry-content > .wp-block-table,
.entry-content > .wp-block-columns,
.entry-content > .wp-block-group,
.entry-content > .wp-block-image,
.entry-content > figure {
    max-width: 1180px;
}

/* ---------- 4. 세로 리듬 : 섹션·블록 간 여백 확장 ---------- */
.wp-block-post-content > * + *,
.entry-content > * + * {
    margin-top: 0;
}

.wp-block-post-content > p + p,
.entry-content > p + p {
    margin-top: 1.7rem;
}

.wp-block-post-content > .wp-block-spacer,
.entry-content > .wp-block-spacer {
    margin: 0 auto;
}

/* 히어로/첫 그룹 영역 상하 호흡 */
.wp-block-post-content > .wp-block-group:first-child,
.entry-content > .wp-block-group:first-child {
    padding-top: clamp(56px, 8vw, 112px);
    padding-bottom: clamp(48px, 7vw, 96px);
}

.wp-block-post-content > .wp-block-group,
.entry-content > .wp-block-group {
    padding-top: clamp(32px, 4vw, 48px);
    padding-bottom: clamp(32px, 4vw, 48px);
}

/* ---------- 5. 목록 · 인용 ---------- */
.wp-block-post-content ul,
.wp-block-post-content ol,
.entry-content ul,
.entry-content ol {
    padding-left: 1.35em;
    margin: 1.5em 0 1.9em;
}

.wp-block-post-content li,
.entry-content li {
    margin-bottom: 0.7em;
    line-height: 1.85;
    letter-spacing: 0.012em;
}

.wp-block-post-content li::marker,
.entry-content li::marker {
    color: #2563eb;
}

.wp-block-post-content blockquote,
.entry-content blockquote {
    margin: 2.6em 0;
    padding: 28px 32px;
    background: #eef4ff;
    border-left: 3px solid #93b6f5;
    border-radius: 0 16px 16px 0;
    color: #1e3a5f;
    font-size: 1.02rem;
    line-height: 1.85;
    letter-spacing: 0.008em;
}

.wp-block-post-content blockquote p:last-child,
.entry-content blockquote p:last-child {
    margin-bottom: 0;
}

/* ---------- 6. 표 : 파스텔 헤더 + 넉넉한 셀 여백 ---------- */
.wp-block-post-content table,
.entry-content table {
    width: 100%;
    margin: 2.8rem auto;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.7;
    letter-spacing: 0.006em;
    background: #ffffff;
}

.wp-block-post-content th,
.wp-block-post-content td,
.entry-content th,
.entry-content td {
    padding: 18px 22px;
    border: 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    vertical-align: top;
    text-align: left;
    letter-spacing: 0.006em;
}

.wp-block-post-content thead th,
.entry-content thead th {
    background: #eef4ff;
    color: #1e3a5f;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.02em;
    border-bottom: 1px solid rgba(37, 99, 235, 0.16);
}

.wp-block-post-content tbody tr:nth-child(even),
.entry-content tbody tr:nth-child(even) {
    background: #fbfdff;
}

.wp-block-post-content tbody tr:last-child td,
.entry-content tbody tr:last-child td {
    border-bottom: 0;
}

.wp-block-post-content figcaption,
.entry-content figcaption {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.7;
    letter-spacing: 0.01em;
    color: #64748b;
    text-align: center;
}

/* ---------- 7. 이미지 · 미디어 ---------- */
.wp-block-post-content img,
.entry-content img {
    border-radius: 18px;
    height: auto;
}

/* ---------- 8. 코드 · 인라인 ---------- */
.wp-block-post-content code,
.entry-content code {
    background: #f1f5f9;
    color: #1e40af;
    padding: 0.16em 0.45em;
    border-radius: 6px;
    font-size: 0.9em;
    letter-spacing: 0;
}

.wp-block-post-content pre,
.entry-content pre {
    background: #f4f7fb;
    color: #0f172a;
    padding: 24px 26px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow-x: auto;
    font-size: 14.5px;
    line-height: 1.75;
    letter-spacing: 0;
    margin: 2.4rem 0;
}

/* ---------- 9. 강조 텍스트 ---------- */
.wp-block-post-content strong,
.entry-content strong {
    font-weight: 700;
    color: #0f172a;
    letter-spacing: 0.004em;
}

.wp-block-post-content a,
.entry-content a {
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* ---------- 10. 버튼 · 링크 카드 ---------- */
.wp-block-post-content .wp-block-button__link,
.entry-content .wp-block-button__link {
    border-radius: 999px;
    padding: 16px 34px;
    font-size: 16px;
    letter-spacing: 0.02em;
    font-weight: 600;
    background-color: #2563eb;
    color: #ffffff;
}

/* ---------- 11. 구분선 ---------- */
.wp-block-post-content hr,
.entry-content hr {
    margin: 4rem auto;
    border: 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    max-width: 260px;
}

/* ---------- 12. 반응형 ---------- */
@media (max-width: 1024px) {
    .wp-block-post-content,
    .entry-content {
        font-size: 17px;
        line-height: 1.9;
    }
    .wp-block-post-content > *,
    .entry-content > * {
        max-width: 100%;
    }
    .wp-block-post-content h2,
    .entry-content h2 {
        margin-top: 2.8em;
    }
    .wp-block-post-content th,
    .wp-block-post-content td,
    .entry-content th,
    .entry-content td {
        padding: 15px 18px;
    }
}

@media (max-width: 768px) {
    .wp-block-post-content,
    .entry-content {
        font-size: 16.5px;
        line-height: 1.88;
        letter-spacing: 0.014em;
        padding-left: 0px;
        padding-right: 0px;
    }

    .wp-block-post-content h3,
    .entry-content h3 {
        margin-top: 2.1em;
    }
    .wp-block-post-content p,
    .entry-content p {
        margin-bottom: 1em;
    }
    .wp-block-post-content blockquote,
    .entry-content blockquote {
        padding: 22px 22px;
        margin: 2rem 0;
    }
    .wp-block-post-content table,
    .entry-content table {
        margin: 2.2rem auto;
        font-size: 15px;
    }
    .wp-block-post-content th,
    .wp-block-post-content td,
    .entry-content th,
    .entry-content td {
        padding: 13px 15px;
    }
    .wp-block-post-content hr,
    .entry-content hr {
        margin: 2.8rem auto;
    }
}
