/* 블로그 (/blog/): 목록·글·쓰기. 버튼·대화상자·마크다운 본문 모양은 개발 노트(til/til.css)를 함께 씀 */

/* ---------- 목록 ---------- */
.blog-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; }
.blog-head__tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.blog-layout { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: 2rem; margin-top: 1.75rem; align-items: start; }
.blog-side { position: sticky; top: calc(var(--top-offset, 0px) + 1rem); display: grid; gap: 1.25rem; transition: top .28s cubic-bezier(.2, .8, .2, 1); }
.blog-cats { display: grid; gap: 0.15rem; }
.blog-cat { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; width: 100%; padding: 0.45rem 0.7rem; border: 0; border-radius: 8px; background: none; color: var(--ink-soft); font: inherit; font-size: 0.9375rem; font-weight: 600; text-align: left; cursor: pointer; }
.blog-cat:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.blog-cat[aria-pressed="true"] { background: color-mix(in srgb, var(--seal) 16%, transparent); color: var(--ink); }
.blog-cat__n { color: var(--ink-soft); font-size: 0.8125rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.blog-cat:focus-visible, .blog-tag:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.blog-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.blog-tag { padding: 0.2rem 0.55rem; border: 1px solid var(--rule); border-radius: 999px; background: none; color: var(--ink-soft); font: inherit; font-size: 0.8125rem; text-decoration: none; cursor: pointer; }
.blog-tag:hover { border-color: var(--ink-soft); color: var(--ink); }
.blog-tag[aria-pressed="true"] { border-color: var(--seal); color: var(--ink); background: color-mix(in srgb, var(--seal) 14%, transparent); }
.blog-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-bottom: 1rem; }
.blog-search { flex: 1 1 16rem; min-width: 0; max-width: 26rem; /* 좁은 휴대폰(320px)에서 페이지가 옆으로 넓어지지 않게 (넓어지면 말풍선이 화면 밖으로 밀림) */ padding: 0.55rem 0.8rem; border: 1px solid var(--field-line, var(--rule)); border-radius: 10px; background: var(--tile); color: inherit; font: inherit; }
.blog-search:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.blog-count { margin: 0; min-height: 1.5rem; color: var(--ink-soft); font-size: 0.875rem; }
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.blog-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--rule); border-radius: 14px; background: var(--tile); transition: border-color .15s, transform .15s; }
.blog-card:hover { border-color: color-mix(in srgb, var(--ink-soft) 70%, var(--rule)); transform: translateY(-2px); }
.blog-card:has(.blog-card__title a:focus-visible) { outline: 3px solid var(--seal); outline-offset: 2px; }
.blog-card__cover { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 1px solid var(--rule); background: var(--sk-base); }
.blog-grid { container: blog-grid / inline-size; }
/* 대표 사진: 자르지 않고 전체를 보임. 여러 칸이면 4:3 칸 안에 담고 남는 곳은 같은 사진을 흐리게 채움 */
.blog-card__media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-bottom: 1px solid var(--rule); background: var(--sk-base); }
.blog-card__media .blog-card__cover { position: relative; z-index: 1; width: 100%; height: 100%; aspect-ratio: auto; border: 0; background: none; object-fit: contain; }
.blog-card__blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(18px) brightness(.72) saturate(1.1); opacity: 0.9; transform: scale(1.2); pointer-events: none; }
/* 한 칸 목록(좁은 화면): 원래 비율 그대로. 아주 긴 세로 사진은 화면 높이에 맞춰 담음 */
@container blog-grid (max-width: 31rem) {
  .blog-card__media { aspect-ratio: var(--ar, 4 / 3); max-height: min(36rem, 78vh); }
}
.blog-card__cover--none { display: grid; place-items: center; color: color-mix(in srgb, var(--ink) 30%, transparent); font-size: 2.5rem; font-weight: 800; background: linear-gradient(135deg, color-mix(in srgb, var(--seal) 14%, var(--tile)), var(--tile)); }
.blog-card__body { display: flex; flex: 1; flex-direction: column; gap: 0.4rem; padding: 0.9rem 1rem 1rem; }
.blog-card--sk .blog-card__body { gap: 0.6rem; }
.blog-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; min-height: 1.2em; margin: 0; font-size: 0.8125rem; }
.blog-card__cat { color: var(--seal); font-weight: 700; }
.blog-card__title { margin: 0; font-size: 1.0625rem; font-weight: 750; line-height: 1.45; }
.blog-card__title a { color: inherit; text-decoration: none; }
.blog-card__title a::after { content: ""; position: absolute; inset: 0; }
.blog-card__title a:focus-visible { outline: none; }
.blog-card__summary { display: -webkit-box; overflow: hidden; margin: 0; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; color: var(--ink-soft); font-size: 0.9375rem; line-height: 1.6; }
.blog-card__foot { display: flex; gap: 0.75rem; margin: auto 0 0; padding-top: 0.35rem; color: var(--ink-soft); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.blog-badge { font-size: 0.6875rem; }
.blog-badge.is-scheduled { border-color: #3B8EEA; color: #3B8EEA; }
.blog-empty { grid-column: 1 / -1; display: grid; place-content: center; min-height: 22rem; padding: 2.5rem 1rem; border: 1px dashed var(--rule); border-radius: 14px; color: var(--ink-soft); text-align: center; } /* 뼈대 카드 자리만큼 높이를 남겨 빈 목록에서 바닥글이 끌려 올라오지 않게 */
.blog-empty p { margin: 0; }
.blog-more { margin-top: 1.25rem; text-align: center; }
@media (max-width: 760px) {
  .blog-layout { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .blog-side { position: static; gap: 0.6rem; }
  .blog-cats { display: flex; gap: 0.35rem; overflow-x: auto; scrollbar-width: none; }
  .blog-cats .sk--pill { --h: 2.45rem; } /* 뼈대를 실제 칩 높이와 같게 (불러온 뒤 아래가 밀리지 않게) */
  .blog-cats::-webkit-scrollbar { display: none; }
  .blog-cat { flex: none; width: auto; border: 1px solid var(--rule); border-radius: 999px; padding: 0.35rem 0.8rem; }
  .blog-tags { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .blog-tags::-webkit-scrollbar { display: none; }
  .blog-tag { flex: none; }
}

/* 카테고리 관리 */
.blog-catdlg { width: min(30rem, calc(100vw - 2rem)); }
.blog-catedit { display: grid; gap: 0.4rem; margin: 1rem 0; padding: 0; list-style: none; }
.blog-catedit li, .blog-catedit__add { display: flex; gap: 0.35rem; }
.blog-catedit input, .blog-catedit__add input { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--field-line, var(--rule)); border-radius: 8px; background: var(--tile); color: inherit; font: inherit; }

/* ---------- 글 ---------- */
.blog-article { max-width: 46rem; margin: 0 auto; }
.blog-article__head { padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); }
.blog-article__cat { color: var(--seal); font-size: 0.9375rem; font-weight: 700; text-decoration: none; }
.blog-article__cat:hover { text-decoration: underline; }
.blog-article h1 { margin: 0.5rem 0 0.75rem; font-size: clamp(1.75rem, 4.5vw, 2.5rem); font-weight: 800; line-height: 1.3; letter-spacing: -0.03em; }
.blog-article__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }
.blog-article__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0 0; }
.blog-body { margin-top: 2rem; }
.blog-article__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 2.5rem 0 0; }
.blog-react { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.75rem; margin: 2.5rem 0 0; padding: 1.5rem 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.blog-like { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border: 1px solid var(--rule); border-radius: 999px; background: none; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; transition: border-color .15s, background .15s; }
.blog-like svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.blog-like:hover { border-color: #E5484D; }
.blog-like.is-on { border-color: #E5484D; background: color-mix(in srgb, #E5484D 14%, transparent); }
.blog-like.is-on svg { fill: #E5484D; stroke: #E5484D; }
.blog-like:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.blog-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.5rem; }
.blog-pager__link { display: grid; gap: 0.2rem; padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: 12px; color: inherit; text-decoration: none; }
.blog-pager__link:hover { border-color: var(--ink-soft); }
.blog-pager__link.is-newer { text-align: right; }
.blog-pager__label { color: var(--ink-soft); font-size: 0.8125rem; }
.blog-pager__title { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 블로그 표기: 인용구 (blog/blocks.js) ---------- */
.md .bq { margin: 1.75rem 0; padding: 0; border: 0; background: none; color: var(--ink); font-style: normal; }
.md .bq p { margin: 0 0 0.5rem; }
.md .bq p:last-of-type { margin-bottom: 0; }
.bq__cite { display: block; margin-top: 0.6rem; color: var(--ink-soft); font-size: 0.875em; font-style: normal; }
.bq__cite::before { content: "— "; }
.md .bq--line { padding: 0.2rem 0 0.2rem 1.1rem; border-left: 4px solid var(--seal); }
.md .bq--mark { position: relative; padding: 1.4rem 1rem 0.5rem 3rem; font-size: 1.1em; }
.md .bq--mark::before { content: "“"; position: absolute; left: 0.2rem; top: -0.4rem; color: var(--seal); font-family: Georgia, "Times New Roman", serif; font-size: 4.5rem; line-height: 1; }
.md .bq--bubble { position: relative; margin-bottom: 2.4rem; padding: 1.1rem 1.3rem; border-radius: 18px; background: color-mix(in srgb, var(--seal) 13%, var(--tile)); }
.md .bq--bubble::after { content: ""; position: absolute; left: 2rem; bottom: -0.7rem; border: 0.7rem solid transparent; border-top-color: color-mix(in srgb, var(--seal) 13%, var(--tile)); border-bottom: 0; }
.md .bq--box { padding: 1.1rem 1.3rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--tile); }
.md .bq--big { padding: 1rem 0; text-align: center; font-size: 1.35em; font-weight: 750; line-height: 1.55; letter-spacing: -0.02em; }
.md .bq--big::before, .md .bq--big::after { content: ""; display: block; width: 2.5rem; height: 3px; margin: 0 auto 1rem; border-radius: 2px; background: var(--seal); }
.md .bq--big::after { margin: 1rem auto 0; }

/* 구분선 */
.md .bhr { margin: 2.5rem auto; border: 0; height: auto; background: none; overflow: visible; text-align: center; color: var(--ink-soft); }
.md .bhr--line { height: 1px; background: var(--rule); }
.md .bhr--double { height: 6px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.md .bhr--short { width: 4rem; height: 3px; border-radius: 2px; background: var(--seal); }
.md .bhr--dots::before { content: "•  •  •"; letter-spacing: 0.4em; font-size: 1.1rem; white-space: pre; }
.md .bhr--diamond { position: relative; height: 1px; background: linear-gradient(90deg, transparent, var(--rule) 20%, var(--rule) 80%, transparent); }
.md .bhr--diamond::before { content: ""; position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; background: var(--seal); transform: translate(-50%, -50%) rotate(45deg); box-shadow: 0 0 0 5px var(--paper); }
.md .bhr--wave { height: 10px; background: radial-gradient(circle at 6px -2px, transparent 5px, var(--rule) 5.5px 6.5px, transparent 7px) 0 0 / 12px 10px repeat-x; max-width: 14rem; }

/* 사진 배치 */
.md .bg { display: grid; gap: 6px; margin: 1.75rem 0; }
.md .bg__item { position: relative; margin: 0; overflow: hidden; border-radius: 8px; background: var(--sk-base); }
.md .bg__item img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.md .bg__item figcaption { margin-top: 0.35rem; color: var(--ink-soft); font-size: 0.875rem; text-align: center; }
.md .bg--single .bg__item { background: none; }
.md .bg--single .bg__item img { height: auto; border-radius: 8px; object-fit: contain; }
.md .bg--single.bg--small { max-width: 60%; margin-inline: auto; }
.md .bg--single.bg--wide { margin-inline: calc(min(0px, (46rem - 100vw) / 2 + var(--gutter))); }
@media (min-width: 900px) { .md .bg--single.bg--wide { margin-inline: -6rem; } }
.md .bg--row { grid-auto-flow: column; grid-auto-columns: 1fr; }
.md .bg--row .bg__item { aspect-ratio: 1 / 1; }
.md .bg--row .bg__item figcaption, .md .bg--collage .bg__item figcaption, .md .bg--slide .bg__item figcaption { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 1.2rem 0.6rem 0.4rem; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font-size: 0.8125rem; text-align: left; }
.md .bg--collage { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 9rem; }
.md .bg--collage .bg__item:first-child { grid-column: span 2; grid-row: span 2; }
.md .bg--collage.bg--n2 { grid-template-columns: 1fr 1fr; grid-auto-rows: 14rem; }
.md .bg--collage.bg--n2 .bg__item:first-child { grid-column: auto; grid-row: auto; }
.md .bg--collage.bg--n4 .bg__item:first-child { grid-row: span 3; }
@media (max-width: 560px) { .md .bg--collage { grid-auto-rows: 6rem; } .md .bg--row { grid-auto-flow: row; grid-template-columns: 1fr 1fr; } }
.bg-slide { position: relative; margin: 1.75rem 0; }
.md .bg--slide { display: flex; gap: 0; margin: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 10px; }
.md .bg--slide::-webkit-scrollbar { display: none; }
.md .bg--slide .bg__item { flex: 0 0 100%; aspect-ratio: 4 / 3; border-radius: 0; scroll-snap-align: start; }
.bg-slide__btn { position: absolute; top: 50%; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.5rem; line-height: 1; transform: translateY(-50%); cursor: pointer; }
.bg-slide__btn.is-prev { left: 0.6rem; }
.bg-slide__btn.is-next { right: 0.6rem; }
.bg-slide__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bg-slide__count { position: absolute; right: 0.7rem; bottom: 0.6rem; padding: 0.15rem 0.5rem; border-radius: 999px; background: rgba(0, 0, 0, .5); color: #fff; font-size: 0.75rem; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .blog-card { transition: none; } .blog-card:hover { transform: none; } }
@media print { .blog-side, .blog-react, .blog-pager, .bg-slide__btn { display: none !important; } }

/* ---------- 쓰기 (/blog/write/): 개발 노트 쓰기 화면(tw-*)에 더한 것 ---------- */
.bw .tw-editor { position: relative; }
.bw-meta { align-items: end; }
.bw-select, .bw-schedule input { padding: 0.45rem 0.6rem; border: 1px solid var(--field-line, var(--rule)); border-radius: 8px; background: var(--tile); color: inherit; font: inherit; font-weight: 400; }
.bw-meta small { color: var(--ink-soft); font-weight: 400; }
.tw-toolbar button.bw-tool { display: inline-flex; align-items: center; gap: 0.3rem; width: auto; min-width: 2rem; height: 2rem; padding: 0 0.55rem; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font-weight: 700; white-space: nowrap; cursor: pointer; }
.tw-toolbar button.bw-tool:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); color: var(--ink); }
.tw-toolbar .bw-tool span { font-size: 0.8125rem; font-weight: 600; }
.tw-toolbar button.bw-tool[aria-expanded="true"] { background: color-mix(in srgb, var(--seal) 18%, transparent); color: var(--ink); }
.bw-menu { position: absolute; z-index: 30; display: grid; gap: 2px; min-width: 13rem; max-height: 22rem; overflow: auto; padding: 0.35rem; border: 1px solid var(--rule); border-radius: 12px; background: var(--tile); box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55); }
.bw-menu[hidden] { display: none; }
.bw-menu__item { display: grid; grid-template-columns: 5.5rem 1fr; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; font-size: 0.875rem; text-align: left; cursor: pointer; }
.bw-menu__item:not(:has(.bw-menu__sample)) { grid-template-columns: 1fr; }
.bw-menu__item:hover, .bw-menu__item:focus-visible { background: color-mix(in srgb, var(--ink) 8%, transparent); outline: none; }
.bw-menu__sample { display: block; overflow: hidden; font-size: 0.6875rem; line-height: 1.3; pointer-events: none; }
.bw-menu__sample.md blockquote { margin: 0 !important; padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: 0.6875rem !important; }
.bw-menu__sample.md .bq--mark::before { font-size: 1.8rem; top: -0.25rem; }
.bw-menu__sample.md .bq--mark { padding: 0.35rem 0.3rem 0.1rem 1.4rem; }
.bw-menu__sample.md .bq--big::before, .bw-menu__sample.md .bq--big::after { width: 1rem; height: 2px; margin: 0.15rem auto; }
.bw-menu__sample.md .bq--bubble { margin-bottom: 0.45rem !important; padding: 0.3rem 0.5rem; }
.bw-menu__sample.md .bq--bubble::after { left: 0.7rem; bottom: -0.4rem; border-width: 0.4rem; }
.bw-menu__sample.md hr { margin: 0.4rem auto; }
.bw-menu__note { margin: 0; padding: 0.5rem 0.6rem; color: var(--ink-soft); font-size: 0.8125rem; line-height: 1.5; }

/* ---------- 보이는 대로 편집 (blog/rich.js, 2단계) ---------- */
.bw-mode { display: inline-flex; margin-right: 0.4rem; padding: 2px; border: 1px solid var(--rule); border-radius: 8px; }
.bw-mode button { padding: 0.2rem 0.7rem; border: 0; border-radius: 6px; background: transparent; color: var(--ink-soft); font-size: 0.8125rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.bw-mode button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tw-editor[data-mode="rich"] #body, .tw-editor[data-mode="md"] .bw-rich { display: none; }
.tw-editor[data-mode="rich"] .tw-panes { grid-template-columns: minmax(0, 1fr); }
.tw-editor[data-mode="rich"] .tw-pane--preview { display: none !important; }
.tw-editor[data-mode="rich"] .tw-pane--write { display: block !important; background: var(--paper); }
.tw-editor[data-mode="rich"] .tw-tabs { display: none; }
.bw-rich { position: relative; max-width: 50rem; min-height: max(26rem, calc(100vh - 15rem)); margin: 0 auto; padding: 1.25rem clamp(1rem, 4vw, 2.5rem) 4rem; outline: none; caret-color: var(--seal); }
.bw-rich.blog-body { margin-top: 0; }
.bw-rich > :first-child { margin-top: 0; }
.bw-rich.is-empty::before { content: attr(data-placeholder); position: absolute; left: clamp(1rem, 4vw, 2.5rem); right: 1rem; top: 1.25rem; color: var(--ink-soft); opacity: 0.8; white-space: pre-line; pointer-events: none; }
.bw-rich a { cursor: text; }

.rt-w { position: relative; margin: 2.2rem 0 1.6rem; border-radius: 10px; outline: 1px dashed transparent; outline-offset: 6px; cursor: default; }
.rt-w:hover { outline-color: var(--rule); }
.rt-w.is-sel, .rt-w:focus { outline: 2px solid var(--seal); }
.rt-w__bar { position: absolute; z-index: 3; right: 0; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 1px; padding: 2px; border: 1px solid var(--rule); border-radius: 8px; background: var(--tile); box-shadow: 0 8px 20px -12px rgba(0, 0, 0, .6); font-size: 0.75rem; opacity: 0; pointer-events: none; transition: opacity .12s; white-space: nowrap; }
.rt-w:hover .rt-w__bar, .rt-w.is-sel .rt-w__bar, .rt-w:focus-within .rt-w__bar { opacity: 1; pointer-events: auto; }
.rt-w__kind { padding: 0 0.45rem; color: var(--ink-soft); font-weight: 700; }
.rt-w__btn { padding: 0.25rem 0.5rem; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.rt-w__btn:hover, .rt-w__btn:focus-visible { background: color-mix(in srgb, var(--ink) 10%, transparent); outline: none; }
.rt-w__btn[data-act="remove"] { color: var(--seal); }
.md .rt-w .bq, .md .rt-w .bg { margin-top: 0; margin-bottom: 0; }
.md .rt-w .bhr { margin: 1.4rem auto; }
.md .rt-quote .bq--bubble { margin-bottom: 0.8rem; }
.rt-q, .rt-cite { min-height: 1.6em; outline: none; white-space: pre-wrap; cursor: text; }
.rt-q:empty::before { content: attr(data-ph); color: var(--ink-soft); opacity: 0.7; }
.bq__cite.rt-cite:empty::before { content: "— " attr(data-ph); opacity: 0.6; }
.rt-gallery .bg__item { position: relative; }
.rt-x { position: absolute; z-index: 1; top: 0.4rem; right: 0.4rem; width: 1.7rem; height: 1.7rem; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .6); color: #fff; font-size: 1.05rem; line-height: 1; cursor: pointer; opacity: 0; }
.bg__item:hover .rt-x, .rt-x:focus-visible, .rt-w.is-sel .rt-x { opacity: 1; }
/* 사진 순서: 왼쪽 위 앞/뒤 단추, 끌 때 놓일 자리 표시 */
.rt-ph { position: absolute; z-index: 1; top: 0.4rem; left: 0.4rem; display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(0, 0, 0, .6); opacity: 0; }
.rt-ph__btn { width: 1.6rem; height: 1.6rem; border: 0; border-radius: 50%; background: none; color: #fff; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.rt-ph__btn:hover, .rt-ph__btn:focus-visible { background: rgba(255, 255, 255, .22); outline: none; }
.bg__item:first-child .rt-ph__btn[data-act="photo-prev"], .bg__item:last-child .rt-ph__btn[data-act="photo-next"] { opacity: 0.3; cursor: default; }
.bg__item:hover .rt-ph, .rt-ph:focus-within, .rt-w.is-sel .rt-ph { opacity: 1; }
.rt-gallery .bg--n1 .rt-ph { display: none; }
.rt-gallery .bg:not(.bg--n1) .bg__item img { cursor: grab; }
.rt-gallery .bg__item.is-dragging { opacity: 0.4; }
.rt-gallery .bg__item.is-drop-before { box-shadow: inset 4px 0 0 var(--seal); }
.rt-gallery .bg__item.is-drop-after { box-shadow: inset -4px 0 0 var(--seal); }
@media (hover: none) { .rt-x, .rt-ph { opacity: 1; } .rt-w { outline-color: var(--rule); } .rt-w:hover:not(.is-sel):not(:focus-within) .rt-w__bar { opacity: 0; pointer-events: none; } }
.rt-cap { display: block; width: 100%; margin-top: 0.3rem; padding: 0.25rem 0.4rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink-soft); font: inherit; font-size: 0.875rem; text-align: center; }
.rt-cap:hover, .rt-cap:focus { border-color: var(--rule); background: var(--tile); outline: none; }
.rt-gallery .bg:not(.bg--single) .rt-cap { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 0.9rem 0.6rem 0.35rem; border: 0; border-radius: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font-size: 0.8125rem; text-align: left; }
.rt-gallery .bg:not(.bg--single) .rt-cap::placeholder { color: rgba(255, 255, 255, .7); }
.rt-gallery .bg--single .bg__item img { margin-inline: auto; }
.rt-code { padding: 0.6rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--tile); }
.rt-code__lang { width: 15rem; max-width: 100%; margin-bottom: 0.45rem; padding: 0.25rem 0.5rem; border: 1px solid var(--rule); border-radius: 6px; background: transparent; color: inherit; font: 0.8125rem var(--mono); }
.tw-pane--write .rt-code__text { height: auto; min-height: 4.5rem; } /* 쓰기 칸 textarea 규칙(높이 가득)을 덮음 */
.rt-code__text { display: block; width: 100%; min-height: 4.5rem; padding: 0.65rem 0.75rem; border: 0; border-radius: 6px; background: color-mix(in srgb, var(--ink) 5%, transparent); color: inherit; font: 0.875rem/1.65 var(--mono); resize: vertical; tab-size: 2; overflow: auto; }
.rt-code__lang:focus, .rt-code__text:focus { outline: 2px solid color-mix(in srgb, var(--seal) 60%, transparent); outline-offset: 1px; }
.rt-uploading { margin: 0; padding: 2rem 1rem; border: 2px dashed var(--rule); border-radius: 10px; color: var(--ink-soft); text-align: center; }
.bw-link { display: flex; gap: 0.4rem; padding: 0.2rem; min-width: min(22rem, 80vw); }
.bw-link input { flex: 1; min-width: 0; padding: 0.4rem 0.55rem; border: 1px solid var(--field-line, var(--rule)); border-radius: 8px; background: var(--paper); color: inherit; font: inherit; font-size: 0.875rem; }
@media (max-width: 640px) { .bw-mode button { padding-inline: 0.5rem; } }

/* ---------- 카드: 링크·장소·책·영화 (blog/blocks.js, 3단계) ---------- */
.md .bc { display: flex; margin: 1.75rem 0; overflow: hidden; border: 1px solid var(--rule); border-radius: 12px; background: var(--tile); color: var(--ink); line-height: 1.55; }
.md .bc__body { display: flex; flex: 1; flex-direction: column; gap: 0.25rem; min-width: 0; padding: 1rem 1.15rem; }
.md .bc__title { overflow: hidden; font-size: 1.0625rem; font-weight: 750; text-overflow: ellipsis; }
.md .bc__desc { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; color: var(--ink-soft); font-size: 0.9375rem; }
.md .bc__host, .md .bc__sub { color: var(--ink-soft); font-size: 0.875rem; }
.md .bc__memo { margin-top: 0.3rem; font-size: 0.9375rem; }
.md .bc__kind { color: var(--seal); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; }
/* 링크 카드: 카드 전체가 링크 */
.md .bc--link .bc__a { display: flex; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.md .bc--link .bc__a:hover .bc__title { text-decoration: underline; text-underline-offset: 3px; }
.md .bc--link .bc__a:focus-visible { outline: 3px solid var(--seal); outline-offset: -3px; }
.md .bc--link .bc__title { white-space: nowrap; }
.md .bc--link .bc__host { margin-top: auto; padding-top: 0.2rem; }
.md .bc__thumb { flex: 0 0 auto; width: clamp(6.5rem, 28%, 11rem); margin: 0; border-left: 1px solid var(--rule); border-radius: 0; object-fit: cover; }
/* 장소 카드: 위에 작은 지도 */
.md .bc--place { flex-direction: column; }
.md .bc-map { position: relative; height: 11.5rem; overflow: hidden; border-bottom: 1px solid var(--rule); background: #dfe7df; }
.md .bc-map__tiles { position: absolute; width: 1024px; height: 512px; }
.md .bc-map__tiles img { position: absolute; width: 256px; height: 256px; max-width: none; margin: 0; border-radius: 0; pointer-events: none; user-select: none; }
:root[data-theme="dark"] .md .bc-map__tiles, :root:not([data-theme="light"]) .md .bc-map__tiles { filter: brightness(.82) contrast(1.05) saturate(.85); }
.md .bc-map__pin { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: var(--seal); box-shadow: 0 3px 8px rgba(0, 0, 0, .35); transform: translate(-50%, -100%) rotate(-45deg); }
.md .bc-map__credit { position: absolute; right: 0; bottom: 0; padding: 0.1rem 0.4rem; border-top-left-radius: 6px; background: rgba(255, 255, 255, .8); color: #333; font-size: 0.6875rem; text-decoration: none; }
.md .bc__links { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.35rem; font-size: 0.875rem; }
.md .bc__links a { color: var(--seal); font-weight: 600; }
/* 책·영화 카드: 왼쪽에 표지 */
.md .bc__cover { flex: 0 0 auto; width: 6.5rem; aspect-ratio: 2 / 3; margin: 0.9rem 0 0.9rem 0.9rem; border-radius: 6px; object-fit: cover; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .6); }
.md .bc__cover--none { display: grid; place-items: center; background: color-mix(in srgb, var(--seal) 12%, var(--paper)); font-size: 2rem; }
.md .bc-stars { color: #f2b230; font-size: 1rem; letter-spacing: 0.08em; }
.md .bc-stars__off { color: color-mix(in srgb, var(--ink-soft) 40%, transparent); }
@media (max-width: 520px) {
  .md .bc__thumb { width: 6rem; }
  .md .bc__cover { width: 5rem; }
  .md .bc-map { height: 9.5rem; }
}

/* 쓰기 화면: 카드 위젯과 카드 창 */
.md .rt-card .bc { margin: 0; }
.rt-card__empty, .bw-card__empty { margin: 0; padding: 1.25rem; border: 2px dashed var(--rule); border-radius: 10px; color: var(--ink-soft); text-align: center; }
.bw-carddlg { width: min(36rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; }
.bw-carddlg h2 { margin-bottom: 0.75rem; }
.bw-card__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 0.8rem; }
.bw-card__field { display: grid; gap: 0.25rem; min-width: 0; }
.bw-card__field--url, .bw-card__field--title, .bw-card__field--desc, .bw-card__field--image, .bw-card__field--name, .bw-card__field--address, .bw-card__field--memo, .bw-card__field--cover, .bw-card__field--actors { grid-column: 1 / -1; }
.bw-card__field label, .bw-card__label { color: var(--ink-soft); font-size: 0.8125rem; font-weight: 600; }
.bw-card__row { display: flex; gap: 0.4rem; min-width: 0; }
.bw-carddlg input:not([type="file"]), .bw-carddlg select { flex: 1; min-width: 0; padding: 0.45rem 0.6rem; border: 1px solid var(--field-line, var(--rule)); border-radius: 8px; background: var(--paper); color: inherit; font: inherit; font-size: 0.9375rem; }
.bw-card__search { margin-bottom: 0.9rem; }
.bw-card__results { display: grid; gap: 2px; margin: 0.4rem 0 0; padding: 0; list-style: none; }
.bw-card__pick { display: grid; width: 100%; gap: 0.1rem; padding: 0.45rem 0.6rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bw-card__pick:hover, .bw-card__pick:focus-visible { border-color: var(--seal); outline: none; }
.bw-card__pick span { color: var(--ink-soft); font-size: 0.8125rem; }
.bw-card__hint { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.75rem; }
.bw-card__note { min-height: 1.2em; margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 0.8125rem; }
.bw-card__label { margin: 0.6rem 0 0.25rem; }
.bw-cardprev { max-height: 22rem; overflow: auto; padding: 0.1rem; }
.bw-cardprev.blog-body { margin-top: 0; }
.md.bw-cardprev .bc { margin: 0; }
@media (max-width: 520px) { .bw-card__fields { grid-template-columns: 1fr; } }

/* ---------- 영상·강조 상자·형광펜·여행 일정 ---------- */
/* 영상 (YouTube): 누르기 전에는 미리보기 그림 */
.md .bvw { margin: 1.75rem 0; }
.md .bv { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #000; }
.md .bv--short { max-width: 22rem; margin-inline: auto; aspect-ratio: 9 / 16; }
.md .bv__a { position: absolute; inset: 0; display: block; }
.md .bv__a img { width: 100%; height: 100%; margin: 0; border-radius: 0; object-fit: cover; cursor: pointer; }
.md .bv__play { position: absolute; left: 50%; top: 50%; width: 68px; height: 48px; border-radius: 14px; background: rgba(20, 20, 20, .78); transform: translate(-50%, -50%); transition: background .15s; }
.md .bv__play::after { content: ""; position: absolute; left: 50%; top: 50%; border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff; transform: translate(-35%, -50%); }
.md .bv__a:hover .bv__play, .md .bv__a:focus-visible .bv__play { background: #f00; }
.md .bv__a:focus-visible { outline: 3px solid var(--seal); outline-offset: -3px; }
.md .bv iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.md .bvw__cap { margin: 0.45rem 0 0; color: var(--ink-soft); font-size: 0.875rem; text-align: center; }
.md .rt-card .bvw { margin: 0; }

/* 형광펜·글자색 */
.md mark.hl { padding: 0 0.12em; border-radius: 3px; color: inherit; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hl--yellow { background: rgba(255, 212, 0, .42); }
.hl--green { background: rgba(80, 200, 90, .38); }
.hl--pink { background: rgba(255, 100, 170, .36); }
.hl--blue { background: rgba(70, 160, 255, .38); }
.tc--red { color: #f0605a; }
.tc--orange { color: #f0973a; }
.tc--green { color: #48b878; }
.tc--blue { color: #5b9cff; }
.tc--gray { color: var(--ink-soft); }
:root[data-theme="light"] .tc--red { color: #d0312d; }
:root[data-theme="light"] .tc--orange { color: #c2620d; }
:root[data-theme="light"] .tc--green { color: #1d7f45; }
:root[data-theme="light"] .tc--blue { color: #1f62d6; }
.bw-menu__sample mark, .bw-menu__sample .tc { font-size: 0.875rem; font-weight: 700; }
.bw-menu__sample.md .md-callout { margin: 0; padding: 0.3rem 0.5rem; }
.bw-menu__sample.md .md-callout__title { margin: 0 !important; font-size: 0.75rem; }
.tw-toolbar button.bw-tool--icon { padding: 0 0.45rem; }
.bw-tool__bar { stroke: var(--seal); }

/* 여행 일정 */
.md .bt { margin: 1.75rem 0; }
.md .bt__day + .bt__day { margin-top: 1.4rem; }
.md .bt__dayname { display: inline-block; margin: 0 0 0.7rem; padding: 0.2rem 0.75rem; border-radius: 999px; background: var(--seal-btn, var(--seal)); color: #fff; font-size: 0.875rem; font-weight: 700; }
.md .bt__list { margin: 0; padding: 0 0 0 0.45rem; list-style: none; }
.md .bt__item { position: relative; display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.75rem; margin: 0; padding: 0 0 1.05rem 1.15rem; border-left: 2px solid var(--rule); }
.md .bt__item::marker { content: ""; }
.md .bt__item:last-child { padding-bottom: 0.2rem; border-left-color: transparent; }
.md .bt__item::before { content: ""; position: absolute; left: -7px; top: 0.42rem; width: 12px; height: 12px; border: 2px solid var(--seal); border-radius: 50%; background: var(--paper); box-sizing: border-box; }
.md .bt__item:last-child::after { content: ""; position: absolute; left: -2px; top: 0; height: 0.45rem; border-left: 2px solid var(--rule); }
.md .bt__item:first-child::after { display: none; }
.md .bt__time { color: var(--seal); font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.md .bt__body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.md .bt__title { font-weight: 700; }
.md .bt__memo { color: var(--ink-soft); font-size: 0.9375rem; }
@media (max-width: 520px) { .md .bt__item { grid-template-columns: 3.8rem minmax(0, 1fr); gap: 0.5rem; } }

/* 쓰기 화면: 강조 상자·여행 일정 위젯 */
.rt-callout .md-callout { margin: 0; }
.rt-callout__text { min-height: 1.6em; outline: none; white-space: pre-wrap; cursor: text; }
.rt-bt input { width: 100%; min-width: 0; padding: 0.1rem 0.3rem; border: 1px solid transparent; border-radius: 6px; background: transparent; color: inherit; font: inherit; }
.rt-bt input:hover, .rt-bt input:focus { border-color: var(--rule); background: var(--tile); outline: none; }
.rt-bt input::placeholder { color: var(--ink-soft); opacity: 0.7; font-weight: 400; }
.md .rt-bt .bt__dayname { width: auto; min-width: 9rem; field-sizing: content; border: 0; background: var(--seal-btn, var(--seal)); color: #fff; }
.md .rt-bt .bt__dayname::placeholder { color: rgba(255, 255, 255, .8); }
.md .rt-bt .bt__time { padding-inline: 0.2rem; }
.md .rt-bt .bt__title { font-weight: 700; }
.md .rt-bt .bt__memo { color: var(--ink-soft); font-size: 0.9375rem; }
.rt-day__head { display: flex; align-items: center; gap: 0.4rem; }
.rt-day__head .rt-w__btn, .rt-day__add { color: var(--ink-soft); font-size: 0.8125rem; }
.rt-day__add { margin: 0.2rem 0 0 1.4rem; }
.rt-item { padding-right: 2rem !important; }
.rt-item .rt-item__x { top: 0; right: 0; width: 1.5rem; height: 1.5rem; font-size: 0.95rem; }
.rt-item:hover .rt-item__x, .rt-item:focus-within .rt-item__x { opacity: 1; }
.rt-item > .rt-time { align-self: start; }

/* ---------- '작성 중' 글 (공개로 정한 임시 저장): 목록에는 보이고 본문은 잠김 ---------- */
.blog-badge.is-writing { border-color: #E9B949; color: #c8951c; }
:root:not([data-theme="light"]) .blog-badge.is-writing { color: #E9B949; }
.blog-card.is-draft { border-style: dashed; }
.blog-card.is-draft .blog-card__cover, .blog-card.is-draft .blog-card__blur { filter: saturate(.6) brightness(.85); }
.blog-card.is-draft .blog-card__blur { filter: blur(18px) saturate(.6) brightness(.6); }
.blog-card.is-draft:hover { transform: none; }
.blog-card__writing { color: var(--ink-soft); font-size: 0.8125rem; }
.blog-locked__cover { display: block; width: 100%; max-height: 22rem; margin: 0 0 1.25rem; border-radius: 12px; object-fit: cover; filter: saturate(.7); cursor: default; }
.blog-locked__summary { color: var(--ink-soft); font-size: 1.0625rem; }
.blog-locked { margin-top: 1.5rem; padding: 1.4rem 1.5rem; border: 1px dashed var(--rule); border-radius: 12px; background: var(--tile); text-align: center; }
.blog-locked p { margin: 0.35rem 0; }
.blog-locked__title { font-size: 1.0625rem; font-weight: 750; }
/* 글 페이지: display를 정한 칸도 hidden이면 숨김 (편집 단추·공감·이전/다음이 방문자나 '작성 중' 글에서 보이지 않게) */
.blog-post [hidden] { display: none !important; }

/* 글쓰기 도구 막대: 넓은 화면은 지금처럼 한 막대에 모두, 좁은 화면은 위 줄에 편집 방식·보기, 아래 줄에 아이콘만 한 줄로 옆으로 넘김 */
.bw-tools { display: contents; }
@media (max-width: 640px) {
  .bw .tw-toolbar { gap: 0.35rem 0.15rem; }
  .bw .tw-toolbar__space { display: none; }
  .bw .bw-mode { margin-right: auto; }
  .bw .bw-tools { order: 2; display: flex; flex: 1 1 100%; align-items: center; gap: 0.1rem; min-width: 0; margin: 0 -0.5rem -0.4rem; padding: 0.3rem 0.5rem 0.4rem;
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; border-top: 1px solid var(--rule);
    position: relative; contain: inline-size; } /* 아이콘 줄(숨긴 이름표 포함)이 페이지 폭을 넓히지 않게 (옆으로 넘김) */
  .bw .tw-editor { min-width: 0; }
  .bw .bw-tools::-webkit-scrollbar { display: none; }
  .bw .bw-tools > * { flex: none; }
  .bw .bw-tools button { min-width: 2.5rem; height: 2.5rem; }
  .bw .bw-tools .bw-tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; } /* 아이콘만 보이고, 이름은 화면 읽기·길게 누르기(title)로 */
  .bw .tw-toolbar button.bw-tool { justify-content: center; padding: 0 0.55rem; }
  .bw .bw-tools .tw-toolbar__sep { height: 1.4rem; }
}
