/* =============================================================================
 * NEXUS — 인트라위키 스타일
 * 본문 위키 링크·각주(기사/위키 공용) + 위키 문서·인포박스·아카이브
 *
 * 디자인 원칙: 블랙/화이트/그레이 모노톤, 각진 플랫.
 *   금지 — border-radius / 장식용 색상(레드·블루 포인트) / border-left / box-shadow
 * ========================================================================== */

/* ---- 상단 여백 — nav 메뉴와 콘텐츠 사이 ---- */
.nexus-wiki.td-main-content-wrap {
    padding-top: 36px;
}
@media (max-width: 767px) {
    .nexus-wiki.td-main-content-wrap {
        padding-top: 20px;
    }
}

/* ---- 목차(기사 자산 재사용분) 모노톤 오버라이드 — 위키 페이지 한정 ---- */
.nexus-wiki .intra-toc {
    border-radius: 0;
    border-top: 2px solid var(--color-black, #000);
}
.nexus-wiki .intra-toc__toggle {
    border-radius: 0;
}
.nexus-wiki .intra-toc__link {
    border-radius: 0;
    border-left: 0;
    padding: 4px 8px;
}
.nexus-wiki .intra-toc__link:hover {
    background: var(--color-gray-f1, #f1f1f1);
    color: var(--color-black, #000);
}
.nexus-wiki .intra-toc__link.is-active {
    background: var(--color-gray-f1, #f1f1f1);
    color: var(--color-black, #000);
    border-left: 0;
    font-weight: 700;
}

/* ---- 본문 링크 — 위키·내부·외부 공통 (브랜드 블루 볼드) ----
   대상: 본문(.sc-content) 안의 모든 <a>. 각주 마커([n])·되돌리기 화살표(↑)·
   위키 링크 해제 UI 등 구조용 앵커는 제외해 본문 링크만 강조한다. */
.sc-content a:not(.nexus-fn-back),
.nexus-link {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(37, 99, 235, 0.4);
}
.sc-content a:not(.nexus-fn-back):hover,
.nexus-link:hover {
    text-decoration-color: #2563eb;
    background: rgba(37, 99, 235, 0.07);
}
/* 각주 되돌리기 화살표(↑)는 기능 앵커 — 본문 링크 강조 제외 */
.sc-content .nexus-fn-back {
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
}

/* ---- 각주 (기사·위키 공용) ---- */
.nexus-fn {
    font-size: 0.72em;
    line-height: 1;
    vertical-align: super;
}
.nexus-fn a {
    color: var(--color-black, #000);
    text-decoration: none;
    font-weight: 700;
}
.nexus-fn a:hover {
    background: var(--color-gray-f1, #f1f1f1);
}
.nexus-footnotes {
    margin-top: 44px;
    padding-top: 18px;
    border-top: 2px solid var(--color-black, #000);
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-gray-555, #555);
}
.nexus-footnotes__title {
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--color-black, #000);
}
.nexus-footnotes ol {
    margin: 0;
    padding-left: 22px;
}
.nexus-footnotes li {
    margin-bottom: 7px;
}
.nexus-footnotes li:target {
    background: var(--color-gray-f1, #f1f1f1);
    outline: 4px solid var(--color-gray-f1, #f1f1f1);
}
.nexus-fn-back {
    text-decoration: none;
    margin-right: 4px;
    color: var(--color-black, #000);
}

/* ---- 말풍선 (위키 링크 툴팁 + 각주 미리보기/팝오버 공용) ---- */
.nexus-tooltip {
    position: absolute;
    display: none;
    z-index: 99999;
    max-width: 340px;
    background: var(--color-white, #fff);
    border: 1px solid var(--color-black, #000);
    padding: 12px 14px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--color-gray-333, #333);
    word-break: keep-all;
}
.nexus-tooltip--passive {
    pointer-events: none;
}
.nexus-tooltip__title {
    display: block;
    font-weight: 800;
    font-size: 14px;
    color: var(--color-black, #000);
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.nexus-tooltip__body {
    display: block;
}
.nexus-tooltip__body a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}
@media (max-width: 767px) {
    .nexus-tooltip {
        max-width: calc(100vw - 24px);
    }
}

/* =============================================================================
 * 위키 문서 (single)
 * ========================================================================== */

.nexus-doc__header {
    margin: 6px 0 26px;
    padding-bottom: 18px;
    border-bottom: 3px solid var(--color-black, #000);
}
.nexus-doc__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 13px;
}
.nexus-doc__badge {
    display: inline-block;
    background: var(--color-black, #000);
    color: var(--color-white, #fff) !important;
    padding: 3px 10px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
}
.nexus-doc__cat {
    color: var(--color-black, #000);
    text-decoration: none;
    font-weight: 700;
}
.nexus-doc__cat:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.nexus-doc__updated {
    color: var(--color-text-muted, #6b7280);
    margin-left: auto;
}
.nexus-doc__edit {
    color: var(--color-text-muted, #6b7280);
    text-decoration: none;
    font-weight: 700;
}
.nexus-doc__edit:hover {
    color: var(--color-black, #000);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.nexus-doc__title {
    margin: 0 0 12px;
    font-size: 38px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.nexus-doc__summary {
    margin: 0;
    font-size: 17px;
    color: var(--color-gray-555, #555);
    line-height: 1.65;
}

/* ---- 본문 h2 — 섹션 밑줄 ---- */
.nexus-doc__body h2 {
    margin: 42px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-strong, #d1d5db);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.nexus-doc__body h3 {
    margin: 30px 0 12px;
    font-size: 20px;
    font-weight: 700;
}
.nexus-doc__body p {
    line-height: 1.8;
}
.nexus-doc__clear {
    clear: both;
}

/* ---- 인포박스 (프로필 카드) ---- */
.nexus-infobox {
    float: right;
    width: 320px;
    margin: 0 0 22px 26px;
    border: 1px solid var(--color-border-strong, #d1d5db);
    border-top: 2px solid var(--color-black, #000);
    background: var(--color-white, #fff);
    font-size: 14px;
}
.nexus-infobox__head {
    padding: 10px 14px;
    background: var(--color-black, #000);
    color: var(--color-white, #fff);
    font-weight: 800;
    font-size: 16px;
    text-align: center;
}
.nexus-infobox__thumb {
    margin: 0;
    padding: 12px 12px 0;
    text-align: center;
}
.nexus-infobox__thumb img {
    max-width: 100%;
    height: auto;
}
.nexus-infobox__rows {
    margin: 0;
    padding: 12px 14px 14px;
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 8px 12px;
}
.nexus-infobox__rows dt {
    font-weight: 700;
    color: var(--color-text-muted, #6b7280);
    font-size: 13px;
    padding-top: 1px;
}
.nexus-infobox__rows dd {
    margin: 0;
    line-height: 1.55;
    word-break: keep-all;
}
.nexus-infobox__links a {
    display: inline-block;
    margin: 0 6px 6px 0;
    padding: 3px 10px;
    border: 1px solid var(--color-border-strong, #d1d5db);
    font-size: 12px;
    color: var(--color-gray-333, #333);
    text-decoration: none;
}
.nexus-infobox__links a:hover {
    border-color: var(--color-black, #000);
    color: var(--color-black, #000);
}

@media (max-width: 767px) {
    .nexus-infobox {
        float: none;
        width: 100%;
        margin: 0 0 22px;
    }
    .nexus-doc__title {
        font-size: 29px;
    }
    .nexus-doc__updated {
        margin-left: 0;
        width: 100%;
    }
}

/* ---- 역링크 ---- */
.nexus-backlinks {
    margin-top: 48px;
    padding: 22px 24px;
    background: var(--color-gray-fafafa, #fafafa);
    border: 1px solid var(--color-border, #e5e7eb);
    border-top: 2px solid var(--color-black, #000);
}
.nexus-backlinks__title {
    margin: 0 0 14px;
    font-size: 19px;
    font-weight: 800;
}
.nexus-backlinks__count {
    margin-left: 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-muted, #6b7280);
}
.nexus-backlinks__count::before {
    content: "(";
}
.nexus-backlinks__count::after {
    content: ")";
}
.nexus-backlinks__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.nexus-backlinks__list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
    padding: 9px 0;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.nexus-backlinks__list li:last-child {
    border-bottom: 0;
}
.nexus-backlinks__list a {
    color: var(--color-text, #111);
    text-decoration: none;
    line-height: 1.5;
    font-weight: 500;
}
.nexus-backlinks__list a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.nexus-backlinks__list time {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--color-text-subtle, #9ca3af);
}
.nexus-backlinks__list.is-collapsed .nexus-backlinks__extra {
    display: none;
}
.nexus-backlinks__more {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text, #111);
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e5e7eb);
    cursor: pointer;
}
.nexus-backlinks__more:hover {
    border-color: var(--color-black, #000);
}
/* display:block 이 hidden 속성의 UA display:none 을 이기므로 명시 필요 */
.nexus-backlinks__more[hidden] {
    display: none;
}

/* ---- 사이드바 위젯 ---- */
.nexus-side-box {
    margin-top: 24px;
    border: 1px solid var(--color-border, #e5e7eb);
    border-top: 2px solid var(--color-black, #000);
    background: var(--color-white, #fff);
}
.nexus-side-box__title {
    margin: 0;
    padding: 11px 16px;
    font-size: 15px;
    font-weight: 800;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
}
.nexus-side-box__list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}
.nexus-side-box__list li {
    padding: 0;
}
.nexus-side-box__list a {
    display: block;
    padding: 8px 16px;
    color: var(--color-gray-333, #333);
    text-decoration: none;
    font-size: 14px;
    line-height: 1.45;
}
.nexus-side-box__list a:hover {
    background: var(--color-gray-fafafa, #fafafa);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.nexus-side-all {
    display: block;
    margin-top: 14px;
    padding: 11px 16px;
    text-align: center;
    border: 1px solid var(--color-black, #000);
    color: var(--color-black, #000);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.nexus-side-all:hover {
    background: var(--color-black, #000);
    color: var(--color-white, #fff);
}

/* =============================================================================
 * 아카이브
 * ========================================================================== */

.nexus-archive__header {
    margin: 14px 0 28px;
    padding-bottom: 16px;
    border-bottom: 3px solid var(--color-black, #000);
}
.nexus-archive__title {
    margin: 0 0 16px;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.nexus-archive__cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.nexus-archive__cat {
    padding: 6px 14px;
    border: 1px solid var(--color-border-strong, #d1d5db);
    font-size: 13px;
    color: var(--color-gray-555, #555);
    text-decoration: none;
    font-weight: 600;
}
.nexus-archive__cat span {
    margin-left: 3px;
    color: var(--color-text-subtle, #9ca3af);
    font-weight: 400;
}
.nexus-archive__cat.is-active {
    background: var(--color-black, #000);
    border-color: var(--color-black, #000);
    color: var(--color-white, #fff);
}
.nexus-archive__cat.is-active span {
    color: var(--color-gray-ccc, #ccc);
}
.nexus-archive__cat:not(.is-active):hover {
    border-color: var(--color-black, #000);
    color: var(--color-black, #000);
}
.nexus-archive__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 20px;
}
@media (max-width: 767px) {
    .nexus-archive__list {
        grid-template-columns: 1fr;
    }
}
.nexus-archive__item {
    border: 1px solid var(--color-border, #e5e7eb);
    transition: border-color 0.15s ease;
}
.nexus-archive__item:hover {
    border-color: var(--color-black, #000);
}
.nexus-archive__link {
    display: block;
    padding: 16px 18px;
    text-decoration: none;
}
.nexus-archive__doc-title {
    display: block;
    font-weight: 800;
    font-size: 16px;
    color: var(--color-text, #111);
    margin-bottom: 5px;
}
.nexus-archive__doc-summary {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted, #6b7280);
    line-height: 1.55;
}
.nexus-archive__empty {
    color: var(--color-text-muted, #6b7280);
}

/* ── 엔티티 카드 (위키 허브 UX, 2026-08-10) ──
   기존 리스트 박스에 썸네일 + 엔티티 타입 배지 부여. nexus 편집형 디자인 유지. */
.nexus-archive__item--card .nexus-archive__link {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.nexus-archive__thumb {
    flex: 0 0 84px;
    width: 84px;
    height: 84px;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid var(--color-border, #e5e7eb);
}
.nexus-archive__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nexus-archive__card-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.nexus-archive__badge {
    align-self: flex-start;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 2px 8px;
    border: 1px solid;
    border-radius: 2px;
    line-height: 1.4;
    color: #64748b;          /* 매핑 없는 커스텀 분류 기본색(링크색 상속 방지) */
    border-color: currentColor;
}
/* 위닥스 의료 분류 배지 — 쿨톤(블루·틸·슬레이트)만, 빨강/핑크 미사용 */
.nexus-badge--disease   { color: #0a52cf; border-color: #0a52cf; }
.nexus-badge--symptom   { color: #0369a1; border-color: #0369a1; }
.nexus-badge--procedure { color: #4338ca; border-color: #4338ca; }
.nexus-badge--drug      { color: #047857; border-color: #047857; }
.nexus-badge--anatomy   { color: #475569; border-color: #475569; }
.nexus-badge--specialty { color: #0f766e; border-color: #0f766e; }
.nexus-badge--term      { color: #4b5563; border-color: #4b5563; }
@media (max-width: 767px) {
    .nexus-archive__thumb { flex-basis: 68px; width: 68px; height: 68px; }
}

/* =============================================================
 * 기사 하단 "관련 위키" 박스 (2026-08-11 — 위키 노출 채널)
 * ============================================================= */
.nexus-related{margin:28px 0 8px;padding:18px 18px 14px;border:1px solid #dbe6fb;border-left:3px solid #0a52cf;border-radius:12px;background:linear-gradient(180deg,#f5f9ff,#fff 90px)}
.nexus-related__title{margin:0 0 12px;font-size:15px;font-weight:800;color:#333;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.nexus-related__brand{display:inline-block;padding:3px 9px;border-radius:6px;background:#0a52cf;color:#fff;font-size:11px;font-weight:700;letter-spacing:.02em}
.nexus-related__list{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.nexus-related__item{margin:0}
.nexus-related__link{display:block;padding:10px 12px;border:1px solid #eee;border-radius:10px;background:#fff;text-decoration:none;transition:border-color .15s ease,box-shadow .15s ease}
.nexus-related__link:hover{border-color:#0a52cf;box-shadow:0 2px 10px rgba(10,82,207,.12)}
.nexus-related__head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.nexus-related__name{font-size:14.5px;font-weight:700;color:#222}
.nexus-related__cat{font-size:11px;padding:2px 8px;border-radius:999px;border:1px solid currentColor;color:#64748b;line-height:1.5;white-space:nowrap}
.nexus-related__sum{display:block;margin-top:4px;font-size:13px;color:#777;line-height:1.5}
@media (min-width:768px){.nexus-related__list{grid-template-columns:1fr 1fr}}
