@charset "UTF-8";

/* ============================================================
   한망울 글 편집기 (Tiptap, 2026-10-14 — CKEditor 5 교체)
   1) .hm-ed*  : 편집기 화면 (도구 막대·패널·입력 칸)
   2) .hm-rich : 글 본문 서식 — 편집 칸과 게시글 보기에서 같이 씀
                 (예전 CKEditor 가 보여 주던 모양: 그림·표·인용·페이지 나누기)
   색·서체는 tokens.css 토큰만 사용
   ============================================================ */

/* ---------- 1. 편집기 화면 ---------- */

.hm-ed {
    position: relative;
    width: 100%;
    min-width: 0;
    border: 1.5px solid var(--mu-line);
    border-radius: 10px;
    background: #fff;
    font-family: var(--mu-font-body);
    text-align: left;
}

.hm-ed:focus-within {
    border-color: var(--mu-teal);
    box-shadow: 0 0 0 3px rgba(30, 156, 141, 0.25); /* 편집 칸 포커스 표시 (안쪽 외곽선 대신) */
}

.hm-ed .hm-ed__bar,
.hm-ed .hm-ed__ctx {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border-bottom: 1px solid var(--mu-line);
}

.hm-ed .hm-ed__bar {
    background: var(--mu-mist);
    border-radius: 9px 9px 0 0;
}

.hm-ed .hm-ed__ctx {
    background: rgba(168, 230, 218, 0.22);
}

.hm-ed .hm-ed__ctx[hidden],
.hm-ed__panel[hidden] {
    display: none;
}

.hm-ed .hm-ed__group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 6px;
    border-right: 1px solid var(--mu-line);
}

.hm-ed .hm-ed__group:last-child {
    border-right: none;
    padding-right: 0;
}

.hm-ed .hm-ed__btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--mu-ink);
    font-family: var(--mu-font-body);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
}

.hm-ed .hm-ed__btn:hover {
    background: rgba(30, 156, 141, 0.1);
}

.hm-ed .hm-ed__btn[aria-pressed="true"],
.hm-ed .hm-ed__btn[aria-expanded="true"] {
    background: var(--mu-dew);
    color: var(--mu-teal-deep);
}

.hm-ed .hm-ed__btn:disabled {
    opacity: 0.35;
    cursor: default;
    background: transparent;
}

.hm-ed .hm-ed__glyph {
    font-size: 13px;
    font-weight: 700;
}

.hm-ed .hm-ed__caret {
    font-size: 10px;
    opacity: 0.6;
}

/* 글자색·배경색 단추 아래 현재 색 띠 */
.hm-ed .hm-ed__swatch-bar {
    position: absolute;
    left: 7px;
    right: 7px;
    bottom: 4px;
    height: 3px;
    border-radius: 2px;
}

.hm-ed .hm-ed__select {
    width: auto;
    height: 32px;
    max-width: 150px;
    margin: 0;
    padding: 0 6px;
    border: 1.5px solid var(--mu-line);
    border-radius: 8px;
    background: #fff;
    color: var(--mu-ink);
    font-family: var(--mu-font-body);
    font-size: 13px;
}

/* 패널 — 색·링크·표·특수 문자·그림 설명 */
.hm-ed__panel {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--mu-line);
    background: #fff;
}

.hm-ed .hm-ed__panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--mu-ink);
    font-size: 14px;
}

.hm-ed .hm-ed__label {
    display: inline-block;
    margin: 0 6px 4px 0;
    color: var(--mu-ink-soft);
    font-size: 13px;
    font-weight: 500;
}

.hm-ed .hm-ed__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

/* 패널 입력칸 — 페이지 쪽 input 규칙을 덮고 공용 .mu-input 모양 유지 */
.hm-ed .hm-ed__panel .mu-input {
    display: block;
    width: 100%;
    margin: 0;
    padding: 9px 14px;
    border: 1.5px solid var(--mu-line);
    border-radius: 10px;
    font-size: 14px;
}

.hm-ed .hm-ed__panel .hm-ed__num {
    display: inline-block;
    width: 80px;
}

.hm-ed .hm-ed__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.hm-ed .hm-ed__error {
    min-height: 1em;
    margin: 4px 0 0 !important;
    color: var(--mu-coral);
    font-size: 13px;
}

.hm-ed .hm-ed__swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, 30px);
    gap: 6px;
}

.hm-ed .hm-ed__swatch {
    width: 30px;
    height: 30px;
    border: 1px solid var(--mu-line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.hm-ed .hm-ed__swatch--pen {
    font-size: 15px;
}

.hm-ed .hm-ed__picker {
    width: 44px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--mu-line);
    border-radius: 6px;
    background: #fff;
}

.hm-ed .hm-ed__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hm-ed .hm-ed__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1.5px solid var(--mu-line);
    border-radius: 20px;
    background: #fff;
    color: var(--mu-ink);
    font-size: 13px;
    cursor: pointer;
}

.hm-ed .hm-ed__chip[aria-pressed="true"] {
    border-color: var(--mu-teal);
    background: var(--mu-dew);
    color: var(--mu-teal-deep);
}

.hm-ed .hm-ed__chars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 4px;
    max-height: 180px;
    margin-top: 8px;
    overflow-y: auto;
}

.hm-ed .hm-ed__char {
    height: 34px;
    border: 1px solid var(--mu-line);
    border-radius: 6px;
    background: #fff;
    color: var(--mu-ink);
    font-size: 16px;
    cursor: pointer;
}

.hm-ed .hm-ed__char:hover,
.hm-ed .hm-ed__swatch:hover,
.hm-ed .hm-ed__chip:hover {
    border-color: var(--mu-teal);
}

/* 입력 칸 — 넓은 표가 화면 밖으로 밀어내지 않도록 칸 안에서 가로 스크롤
   (width:0 + min-width:100% = 바깥 칸 너비에 맞추고 내용 너비로 늘어나지 않음) */
.hm-ed__body {
    width: 0;
    min-width: 100%;
    overflow-x: auto;
}

.hm-ed__content {
    min-height: 500px;
    padding: 12px 20px;
    color: var(--mu-ink);
    font-size: 15px;
    line-height: 1.7;
    outline: none;
}

.hm-ed__content:focus-visible {
    outline: none !important; /* 테두리(.hm-ed:focus-within)로 표시 */
}

.hm-ed__content .ProseMirror-selectednode {
    outline: 3px solid var(--mu-teal);
    outline-offset: 2px;
}

.hm-ed__content .selectedCell {
    background: rgba(30, 156, 141, 0.14);
}

.hm-ed__content img {
    cursor: pointer;
}

/* 페이지 나누기 — 편집 중에는 이름표를 보여 줌 */
.hm-ed__content .page-break::before {
    content: "페이지 나누기";
    position: relative;
    z-index: 1;
    padding: 2px 10px;
    border-radius: 10px;
    background: #fff;
    color: var(--mu-ink-soft);
    font-size: 12px;
}

.hm-ed__status {
    padding: 0 12px;
    color: var(--mu-teal-deep);
    font-size: 13px;
}

.hm-ed__status:empty {
    display: none;
}

/* 댓글·답글용 작은 편집기 */
.hm-ed--mini .hm-ed__content {
    min-height: 80px;
    max-height: 80px;
    padding: 8px 14px;
    overflow-y: auto;
    font-size: 14px;
}

@media (max-width: 767px) {
    /* 휴대폰: 도구 막대는 한 줄 가로 밀기
       (custom.css 의 전역 flex-wrap: wrap !important 때문에 flex 대신 grid 한 줄) */
    .hm-ed .hm-ed__bar,
    .hm-ed .hm-ed__ctx {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: max-content;
        justify-content: start;
        width: 0;
        min-width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .hm-ed .hm-ed__ctx[hidden] {
        display: none;
    }

    .hm-ed__content {
        min-height: 300px;
        padding: 10px 12px 10px 20px;
    }

    .hm-ed .hm-ed__btn {
        min-width: 36px;
        height: 36px;
    }
}

/* ---------- 2. 글 본문 서식 (.hm-rich) ---------- */

.hm-rich {
    display: block;
    overflow-wrap: break-word;
}

.hm-rich::after {
    content: "";
    display: table;
    clear: both;
}

.hm-rich a {
    color: #3498db; /* 예전 본문 링크 색 그대로 */
    text-decoration: underline;
}

/* 예전 편집기 '제목' 칸(<h1>)은 그동안 문단으로 보였음 — 그대로 문단처럼 */
.hm-rich h1,
.hm-rich h2,
.hm-rich h3,
.hm-rich h4,
.hm-rich h5,
.hm-rich h6 {
    margin: 0.15em 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
}

.hm-rich blockquote {
    margin-left: 0;
    margin-right: 0;
    padding-left: 1.5em;
    padding-right: 1.5em;
    border-left: 5px solid #ccc;
    font-style: italic;
    overflow: hidden;
}

.hm-rich code {
    padding: 0.15em;
    border-radius: 2px;
    background: rgba(199, 199, 199, 0.3);
    color: inherit;
}

.hm-rich hr {
    height: 4px;
    margin: 15px 0;
    border: 0;
    background: #dedede;
}

/* 그림 */
.hm-rich img {
    max-width: 100%;
    height: auto;
}

.hm-rich figure.image {
    display: table;
    clear: both;
    min-width: 50px;
    margin: 0.9em auto;
    text-align: center;
}

.hm-rich figure.image img {
    display: block;
    min-width: 100%;
    margin: 0 auto;
}

.hm-rich figure.image.image_resized {
    display: block;
    max-width: 100%;
    box-sizing: border-box;
}

.hm-rich figure.image.image_resized img {
    width: 100%;
}

.hm-rich figure.image.image-style-side {
    float: right;
    max-width: 50%;
    margin-left: 1.5em;
}

.hm-rich figure.image > figcaption {
    display: table-caption;
    caption-side: bottom;
    padding: 0.6em;
    background: #f7f7f7;
    color: #333;
    font-size: 0.75em;
    overflow-wrap: break-word;
}

.hm-rich figure.image.image_resized > figcaption {
    display: block;
}

/* 표 */
.hm-rich figure.table {
    display: table;
    margin: 0.9em auto;
}

.hm-rich table {
    border-collapse: collapse;
    border-spacing: 0;
    border: 1px double #b3b3b3;
}

.hm-rich figure.table > table {
    width: 100%;
    height: 100%;
}

/* 예전 편집기에서 칸 너비를 끌어 맞춘 표 (<colgroup> 너비 유지) */
.hm-rich table.ck-table-resized {
    table-layout: fixed;
}

.hm-rich td,
.hm-rich th {
    min-width: 2em;
    padding: 0.4em;
    border: 1px solid #bfbfbf;
    font-size: inherit; /* 사이트 공용 th 11px 대신 본문 크기 (예전 보기와 같게) */
}

.hm-rich th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 700;
    text-align: left;
}

/* 페이지 나누기 — 화면에서는 점선 구분선 (예전 보기와 같은 높이) */
.hm-rich .page-break {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    clear: both;
    min-height: 39px;
}

.hm-rich .page-break::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    border-bottom: 2px dashed #c4c4c4;
}

/* 예전 글의 형광펜(<mark>) — 예전 보기에서도 색이 보였음 */
.hm-rich mark {
    background: transparent;
    color: inherit;
}
.hm-rich mark.marker-yellow { background: #fdfd77; }
.hm-rich mark.marker-green { background: #62f962; }
.hm-rich mark.marker-pink { background: #fc7899; }
.hm-rich mark.marker-blue { background: #72ccfd; }
.hm-rich mark.pen-red { color: #e71313; }
.hm-rich mark.pen-green { color: #128a00; }
