/* D2Coding 웹폰트 */
@import url('https://cdn.jsdelivr.net/gh/wan2land/d2coding/d2coding-ligature-full.css');

/* 마크다운 렌더링 스타일 */

/* 컨테이너 */
.md-content {
    line-height: 1.7;
    word-break: break-word;
}

/* 인라인 코드 */
.md-inline-code {
    background: var(--surface-alt-color);
    color: #e53935;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'D2Coding ligature', 'D2Coding', monospace;
    font-size: 1em;
    word-break: break-all;
}

/* 코드 블록 */
.md-code-block {
    background: #1e1e1e;
    color: #dcdcdc;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'D2Coding ligature', 'D2Coding', monospace;
    font-size: 1em;
    line-height: 1.5;
    margin: 12px 0;
    -webkit-overflow-scrolling: touch;
}

.md-code-block code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* 인용문 */
.md-blockquote {
    border-left: 3px solid #FF5722;
    background: var(--tint-brand-bg);
    padding: 8px 16px;
    margin: 0;
    border-radius: 0 6px 6px 0;
    color: var(--text-secondary-color);
}

/* 자동 링크 */
.md-link {
    color: var(--primary-color, #FF5722);
    text-decoration: none;
    word-break: break-all;
}

.md-link:hover {
    text-decoration: underline;
}

/* 마크다운 도구바 */
.md-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: var(--surface-alt-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

/* 도구바 버튼은 이제 댓글·답변 폼 안에도 들어간다. 그 폼들의 `.comment-form button`
   `.cm-reply-form button` 같은 자손 선택자가 제출 버튼 모양(파란 배경·margin-left:auto)을
   그대로 입혀 버리므로, 선택자 두 개짜리로 특정성을 올려 모양을 되돌린다. */
.md-toolbar .md-toolbar-btn {
    flex: 0 0 auto;
    align-self: center;
    margin: 0;
    padding: 0;
    background: transparent;
    background-color: transparent;
    color: var(--text-secondary-color);
    box-shadow: none;
}

.md-toolbar .md-toolbar-btn:hover {
    background: var(--surface-alt-color);
    color: var(--text-color);
}

.md-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary-color);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.15s;
}

.md-toolbar-btn:hover {
    background: var(--surface-alt-color);
    color: var(--text-color);
}

.md-toolbar-btn .material-icons {
    font-size: 18px;
}

.md-toolbar-sep {
    width: 1px;
    background: var(--border-color);
    margin: 4px 4px;
}

/* 댓글·답글용 축소 도구바 */
.md-toolbar--sm {
    padding: 3px 6px;
}

.md-toolbar--sm .md-toolbar-btn {
    width: 26px;
    height: 26px;
}

.md-toolbar--sm .md-toolbar-btn .material-icons {
    font-size: 16px;
}

/* textarea 래퍼 — 부모가 flex row여도 도구바가 textarea 위에 오도록 한 칸을 차지한다 */
.md-editor {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* 도구바 있을 때 textarea 상단 radius 제거 */
.md-editor > textarea,
.md-editor > .form-control {
    width: 100%;
    border-radius: 0 0 8px 8px !important;
}

/* 본문 속 성취기준 코드 자동 링크 ([4수02-03] / 4수02-03 → /curriculum) */
.std-ref {
    padding: 1px 3px;
    border-bottom: 1px dashed var(--primary-light);
    border-radius: 3px;
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.std-ref:hover {
    background: #FFF3E0;
    border-bottom-style: solid;
}
