/* Hallmark · waive 37 · .rich code, .rich pre only · a monospace face for code samples inside post bodies; the page chrome keeps three families */
/* =========================================================
   content.css — 글 본문 모양 (블로그 상세 페이지 + 관리자 편집기가 같이 써요)
   그래서 "쓰는 화면" 과 "블로그에 보이는 모양" 이 똑같아요.
   색은 각 페이지의 색 변수(--accent 등)를 그대로 써요.
   ========================================================= */

/* 본문용 색·글꼴 변수: 블로그(styles.css)와 편집기(admin.css)의 변수를 빌려 쓰고, 없으면 괄호 안 기본값 */
:root {
  --c-line: var(--line, #2e2a26);
  --c-soft: var(--bg-soft, var(--panel, #1c1a18));
  --c-deep: var(--bg-deep, var(--bg, #0a0908));
  --c-dim:  var(--text-dim, #9a938a);
  --c-ink:  var(--text, #f5f2ec);
  --c-acc:  var(--accent, #c8a04e);
  --c-tip:  var(--green, #9cc48a);
  --c-warn: var(--red, #e98a74);
  --c-mono: Consolas, "D2Coding", monospace;   /* 코드 글꼴 */
}
.rich {
  overflow-wrap: break-word;
}
.rich > * + * { margin-top: 1em; }
.rich p:empty::before { content: "\200b"; }               /* 빈 줄도 높이 유지 */

/* 제목 */
.rich h2, .rich h3, .rich h4 { font-family: var(--head, sans-serif); font-weight: 600; line-height: 1.4; color: var(--c-ink); margin-top: 1.8em; text-wrap: balance; }
.rich h2 { font-size: 1.5em; }
.rich h3 { font-size: 1.22em; }
.rich h4 { font-size: 1.05em; }

/* 글자 꾸미기 */
.rich strong, .rich b { color: var(--c-ink); font-weight: 600; }
.rich a { color: var(--c-acc); text-decoration: underline; text-underline-offset: 3px; }
.rich u { text-underline-offset: 3px; }
.rich mark { background: var(--c-acc); color: var(--c-deep); padding: 0 2px; border-radius: 2px; }
.rich code { padding: 1px 6px; background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 4px; font-family: var(--c-mono); font-size: 0.9em; }

/* 목록 · 구분선 */
.rich ul, .rich ol { padding-left: 1.4em; }
.rich li + li { margin-top: 0.3em; }
.rich hr { border: none; border-top: 1px solid var(--c-line); margin: 2.4em 0; }

/* 인용 (+ 출처) */
.rich blockquote { padding: 4px 0 4px 18px; border-left: 3px solid var(--c-acc); color: var(--c-dim); font-style: italic; }
.rich blockquote cite { display: block; margin-top: 8px; font-style: normal; font-size: 0.88em; color: var(--c-acc); }

/* 코드 블록 */
.rich pre {
  padding: 18px 20px; overflow-x: auto;
  background: var(--c-deep); border: 1px solid var(--c-line); border-radius: 8px;
  font-family: var(--c-mono); font-size: 0.88em; line-height: 1.65; color: var(--c-ink);
  white-space: pre;
}
.rich pre code { padding: 0; background: none; border: 0; font-size: 1em; }

/* 사진 한 장: 크기(size-s/m/l/full) · 위치(align-left/center/right) */
.rich figure { margin: 2em 0; }
.rich figure img, .rich figure video { display: block; width: 100%; border-radius: 4px; }
.rich figure.img { width: 100%; margin-left: auto; margin-right: auto; }
.rich figure.size-s { width: 40%; }
.rich figure.size-m { width: 65%; }
.rich figure.size-l { width: 100%; }
.rich figure.size-full { width: 100%; }
.rich figure.align-left { margin-left: 0; margin-right: auto; }
.rich figure.align-right { margin-left: auto; margin-right: 0; }
.rich figure.align-center { margin-left: auto; margin-right: auto; }
.rich figcaption { margin-top: 10px; font-size: 0.85em; color: var(--c-dim); text-align: center; }

/* 사진 여러 장 (갤러리) */
.rich .gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rich figure.cols-2 .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rich figure.cols-4 .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rich .gallery-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 3px; }

/* 영상 · 음악 파일 */
.rich figure.audio { padding: 16px 20px; background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 10px; }
.rich figure.audio audio { width: 100%; }
.rich figure.audio figcaption { margin: 8px 0 0; text-align: left; }

/* 다른 사이트 화면: 유튜브 16:9 · 스포티파이 · 인스타그램 */
/* (예전 유튜브용 .embed 규칙(16:9 상자)이 스포티파이·인스타에까지 걸리지 않게 풀어 줘요) */
.rich figure.embed { aspect-ratio: auto; position: static; }
.rich figure.embed iframe { position: static; inset: auto; display: block; width: 100%; border: 0; border-radius: 8px; }
.rich figure.youtube iframe { aspect-ratio: 16 / 9; height: auto; }
.rich figure.spotify iframe { height: 152px; }
.rich figure.spotify.tall iframe { height: 380px; }
.rich figure.instagram { max-width: 480px; margin-left: auto; margin-right: auto; }
.rich figure.instagram iframe { height: 600px; background: var(--c-ink); }

/* 링크 미리보기 카드 */
.rich a.link-card {
  display: grid; grid-template-columns: minmax(0, 1fr) 160px; align-items: stretch;
  margin: 1.6em 0; overflow: hidden;
  background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 10px;
  color: var(--c-ink); text-decoration: none;
  transition: border-color 0.2s;
}
.rich a.link-card:hover { border-color: var(--c-acc); }
.rich a.link-card.no-image { grid-template-columns: minmax(0, 1fr); }
.rich .lc-text { display: grid; gap: 4px; align-content: center; padding: 16px 20px; min-width: 0; }
.rich .lc-title { font-weight: 600; line-height: 1.4; }
.rich .lc-desc { font-size: 0.85em; color: var(--c-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rich .lc-site { font-size: 0.78em; color: var(--c-acc); }
.rich a.link-card img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* 표 */
.rich table { width: 100%; border-collapse: collapse; font-size: 0.92em; display: block; overflow-x: auto; }
.rich table thead, .rich table tbody { display: table; width: 100%; border-collapse: collapse; }
.rich th, .rich td { padding: 10px 12px; border: 1px solid var(--c-line); text-align: left; vertical-align: top; min-width: 80px; }
.rich th { background: var(--c-soft); color: var(--c-ink); font-weight: 600; }

/* 강조 상자 (정보 · 팁 · 주의) */
.rich .callout { padding: 16px 20px; background: var(--c-soft); border-left: 4px solid var(--c-acc); border-radius: 0 8px 8px 0; }
.rich .callout > * + * { margin-top: 0.6em; }
.rich .callout.tip { border-left-color: var(--c-tip); }
.rich .callout.warn { border-left-color: var(--c-warn); }

/* 접는 글 */
.rich details.toggle { padding: 12px 16px; background: var(--c-soft); border: 1px solid var(--c-line); border-radius: 8px; }
.rich details.toggle summary { cursor: pointer; font-weight: 600; color: var(--c-ink); }
.rich details.toggle[open] summary { margin-bottom: 10px; }
.rich details.toggle > :not(summary) + * { margin-top: 0.6em; }

@media (max-width: 640px) {
  .rich figure.size-s, .rich figure.size-m { width: 100%; }
  .rich .gallery-grid, .rich figure.cols-4 .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rich a.link-card { grid-template-columns: minmax(0, 1fr); }
  .rich a.link-card img { height: 160px; order: -1; }
}
