/*
 * content.css — 발행본/에디터 본문(시맨틱 HTML)의 공통 디자인 (clean 기본 얼굴).
 * 적용 대상: 공개/대시보드 상세·미리보기(.prose), Summernote 에디터(.note-editable).
 *
 * 여기가 전 병원 "공통 골격 + 기본(clean) 얼굴"이다(참고 사이트 수준 타이포·컴포넌트 디자인).
 * 병원별 "얼굴"은 presets.css의 [data-preset] 스코프가 이 위에 덮는다(공통 + 프리셋 스킨).
 * 색 강조는 브랜드 토큰(--gb-primary/accent)만 사용 — 테마와 직교, 각 병원 색으로 자동 반영.
 *
 * 컴포넌트(생성 파이프라인 산출): .aipost-summary(핵심 요약) · .aipost-toc(목차) ·
 *   .aipost-faq(자주 묻는 질문) · .aipost-callout(강조). class는 core/sanitize 허용.
 */

.prose,
.note-editable {
    color: #29303b;
    line-height: 1.8;
    font-size: 1.0625rem;
    letter-spacing: -0.003em;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* ─────────────── 제목 계층 ─────────────── */

.prose h1,
.note-editable h1 {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin: 0 0 1.25rem;
    color: #0f141b;
}

.prose h2,
.note-editable h2 {
    font-size: 1.55rem;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: -0.017em;
    margin: 2.75rem 0 1rem;
    padding-bottom: 0.5rem;
    color: #141a22;
    border-bottom: 2px solid #eef1f5;
    position: relative;
}

/* h2 하단 라인 위에 브랜드색 짧은 강조 바(현대적 섹션 마커) */
.prose h2::after,
.note-editable h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 2.5rem;
    height: 2px;
    background: var(--gb-primary, #1d4ed8);
}

.prose h3,
.note-editable h3 {
    font-size: 1.24rem;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.012em;
    margin: 1.9rem 0 0.6rem;
    color: #1b222c;
}

.prose h4,
.note-editable h4 {
    font-size: 1.08rem;
    font-weight: 650;
    margin: 1.4rem 0 0.5rem;
    color: #1b222c;
}

/* ─────────────── 본문 요소 ─────────────── */

.prose p,
.note-editable p {
    margin: 0 0 1.15rem;
}

.prose ul,
.prose ol,
.note-editable ul,
.note-editable ol {
    margin: 0 0 1.2rem;
    padding-left: 1.4rem;
}

.prose ul,
.note-editable ul {
    list-style: none;
    padding-left: 0;
}

/* 기본 리스트도 밋밋한 disc 대신 브랜드색 마커(참고 사이트의 체크·불릿 느낌) */
.prose ul > li,
.note-editable ul > li {
    position: relative;
    padding-left: 1.5rem;
    margin: 0.45rem 0;
}

.prose ul > li::before,
.note-editable ul > li::before {
    content: "";
    position: absolute;
    left: 0.15rem;
    top: 0.72em;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 50%;
    background: var(--gb-primary, #1d4ed8);
    transform: translateY(-50%);
}

.prose ol,
.note-editable ol {
    list-style: decimal;
    padding-left: 1.5rem;
}

.prose li,
.note-editable li {
    margin: 0.45rem 0;
}

.prose ol > li::marker,
.note-editable ol > li::marker {
    color: var(--gb-primary, #1d4ed8);
    font-weight: 700;
}

.prose a,
.note-editable a {
    color: var(--gb-primary, #1d4ed8);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.prose a:hover,
.note-editable a:hover {
    color: var(--gb-accent, #0ea5e9);
}

.prose strong,
.note-editable strong {
    font-weight: 700;
    color: #0f141b;
}

/* 인용: 좌측 브랜드 바 + 옅은 배경 카드 */
.prose blockquote,
.note-editable blockquote {
    margin: 1.5rem 0;
    padding: 0.9rem 1.25rem;
    border-left: 3px solid var(--gb-primary, #1d4ed8);
    border-radius: 0 0.5rem 0.5rem 0;
    color: #3f4855;
    background: #f7f9fc;
    font-size: 1.02rem;
}

.prose blockquote p:last-child,
.note-editable blockquote p:last-child {
    margin-bottom: 0;
}

/* ─────────────── 표 (참고 사이트풍 모던 테이블) ─────────────── */

.prose table,
.note-editable table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5rem 0;
    font-size: 0.98rem;
    border: 1px solid #e5e9f0;
    border-radius: 0.6rem;
    overflow: hidden;
}

.prose th,
.prose td,
.note-editable th,
.note-editable td {
    padding: 0.7rem 0.95rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid #eef1f5;
}

.prose th,
.note-editable th {
    background: color-mix(in srgb, var(--gb-primary, #1d4ed8) 8%, #ffffff);
    color: #141a22;
    font-weight: 700;
    border-bottom: 1px solid color-mix(in srgb, var(--gb-primary, #1d4ed8) 22%, #ffffff);
}

.prose tbody tr:last-child td,
.note-editable tbody tr:last-child td {
    border-bottom: 0;
}

.prose tbody tr:nth-child(even) td,
.note-editable tbody tr:nth-child(even) td {
    background: #fafbfd;
}

.prose img,
.note-editable img {
    max-width: 100%;
    height: auto;
    border-radius: 0.6rem;
    margin: 1.4rem 0;
}

.prose hr,
.note-editable hr {
    margin: 2.25rem 0;
    border: 0;
    border-top: 1px solid #eef1f5;
}

/*
 * ─────────────── 시맨틱 컴포넌트 ───────────────
 * 생성 파이프라인(posts/services.py의 wrap_summary/wrap_toc/wrap_faq)이 산출.
 * 공통 골격·clean 얼굴. presets.css의 [data-preset]이 프리셋별로 덮는다.
 */

/* 핵심 요약 — 상단 브랜드 틴트 박스 + 브랜드색 라벨(참고: dimare) */
.prose .aipost-summary,
.note-editable .aipost-summary {
    margin: 1.5rem 0 1.75rem;
    padding: 1.15rem 1.4rem;
    border: 1.5px solid color-mix(in srgb, var(--gb-primary, #1d4ed8) 28%, #ffffff);
    border-radius: 0.9rem;
    background: color-mix(in srgb, var(--gb-primary, #1d4ed8) 5%, #ffffff);
}

.prose .aipost-summary > h3,
.note-editable .aipost-summary > h3 {
    margin: 0 0 0.5rem;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--gb-primary, #1d4ed8);
}

.prose .aipost-summary > h3::before,
.note-editable .aipost-summary > h3::before {
    content: "◆ ";
    font-size: 0.8em;
}

.prose .aipost-summary > :last-child,
.note-editable .aipost-summary > :last-child {
    margin-bottom: 0;
}

/* 목차 "오늘 글에서 확인할 내용" — 옅은 카드 + 브랜드 라벨 */
.prose .aipost-toc,
.note-editable .aipost-toc {
    margin: 1.5rem 0 1.75rem;
    padding: 1rem 1.3rem;
    border: 1px solid #e9edf3;
    border-radius: 0.75rem;
    background: #f8fafc;
}

.prose .aipost-toc > :first-child,
.note-editable .aipost-toc > :first-child {
    margin: 0 0 0.6rem;
    font-weight: 700;
    font-size: 0.98rem;
    color: #141a22;
}

.prose .aipost-toc ul,
.note-editable .aipost-toc ul {
    margin: 0;
}

.prose .aipost-toc ul > li,
.note-editable .aipost-toc ul > li {
    margin: 0.3rem 0;
}

/* 자주 묻는 질문(FAQ) — 섹션 타이틀 + Q/A 카드 스택 */
.prose .aipost-faq,
.note-editable .aipost-faq {
    margin: 2rem 0;
}

.prose .aipost-faq > h2,
.note-editable .aipost-faq > h2 {
    margin-bottom: 1rem;
}

.prose .aipost-faq h3,
.note-editable .aipost-faq h3 {
    margin: 0.75rem 0 0;
    padding: 0.85rem 1.1rem 0.85rem 2.4rem;
    position: relative;
    background: #f8fafc;
    border: 1px solid #e9edf3;
    border-radius: 0.6rem 0.6rem 0 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #141a22;
}

.prose .aipost-faq h3::before,
.note-editable .aipost-faq h3::before {
    content: "Q";
    position: absolute;
    left: 0.9rem;
    top: 0.8rem;
    width: 1.15rem;
    height: 1.15rem;
    line-height: 1.15rem;
    text-align: center;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
    color: #fff;
    background: var(--gb-primary, #1d4ed8);
}

.prose .aipost-faq h3 + p,
.note-editable .aipost-faq h3 + p {
    margin: 0 0 0.4rem;
    padding: 0.85rem 1.1rem;
    border: 1px solid #e9edf3;
    border-top: 0;
    border-radius: 0 0 0.6rem 0.6rem;
    background: #fff;
    color: #3f4855;
}

/* 콜아웃/강조 박스 */
.prose .aipost-callout,
.note-editable .aipost-callout {
    margin: 1.25rem 0;
    padding: 0.9rem 1.15rem;
    border-left: 4px solid var(--gb-accent, #0ea5e9);
    border-radius: 0 0.5rem 0.5rem 0;
    background: #f7f9fc;
}

.prose .aipost-callout > :first-child,
.note-editable .aipost-callout > :first-child {
    margin-top: 0;
}

.prose .aipost-callout > :last-child,
.note-editable .aipost-callout > :last-child {
    margin-bottom: 0;
}

/* 사례 강조(10f) — 일반화된 예시를 담는 카드형 박스(의료법 준수: 특정 환자 후기 아님) */
.prose .aipost-case,
.note-editable .aipost-case {
    margin: 1.75rem 0;
    padding: 1.1rem 1.3rem;
    border: 1px solid #e3e8ef;
    border-radius: 0.75rem;
    background: #fbfcfe;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.prose .aipost-case > h3,
.note-editable .aipost-case > h3 {
    margin: 0 0 0.6rem;
    padding-left: 1.95rem;
    position: relative;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gb-primary, #1d4ed8);
}

.prose .aipost-case > h3::before,
.note-editable .aipost-case > h3::before {
    content: "📋";
    position: absolute;
    left: 0;
    top: 0.05em;
    font-size: 1.05rem;
}

.prose .aipost-case > :last-child,
.note-editable .aipost-case > :last-child {
    margin-bottom: 0;
}
