/* bongho-wiki: three columns, text first. */
:root {
    color-scheme: light dark;  /* native scrollbars and form controls follow the system theme */
    --bg: #ffffff;
    --text: #222222;
    --muted: #666666;   /* 5.7:1 on white; #888 was 3.5:1 and washed out in daylight */
    --line: #e8e8e8;
    --edge: #c4c4c4;    /* graph links; --line (1.2:1) was nearly invisible */
    --soft: #f6f6f4;
    --accent: var(--ghost-accent-color, #2f6fde);
    --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* read by assets/js/graph.js */
    --graph-current: var(--accent);
    --graph-tag: var(--accent);
    --graph-node: var(--muted);
    --graph-link: var(--edge);
    --graph-label: var(--text);
    --graph-bg: var(--bg);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17181b;
        --text: #e4e4e4;
        --muted: #8d8d8d;
        --line: #2c2e33;
        --edge: #4a4d55;
        --soft: #202226;
    }
}

* { box-sizing: border-box; }

html { font-size: 62.5%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1.7rem;
    line-height: 1.75;
    word-break: keep-all;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 0.2em; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 22rem minmax(0, 72rem) 28rem;
    gap: 4.8rem;
    justify-content: center;
    padding: 4.8rem 2.4rem;
}

.left, .right {
    position: sticky;
    top: 4.8rem;
    align-self: start;
    max-height: calc(100vh - 9.6rem);
    overflow-y: auto;
    font-size: 1.4rem;
}

@media (max-width: 1180px) {
    .layout { grid-template-columns: 20rem minmax(0, 1fr); }
    .right { grid-column: 2; position: static; max-height: none; }
}

@media (max-width: 760px) {
    .layout { grid-template-columns: minmax(0, 1fr); gap: 3.2rem; padding: 2.4rem 1.6rem; }
    .left, .right { grid-column: 1; position: static; max-height: none; }
    .left { order: 0; }
    .center { order: 1; }
    .right { order: 2; }
    .tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
}

/* ---------- left ---------- */
.site-title { display: block; font-size: 1.8rem; font-weight: 700; text-decoration: none; }

.search {
    display: block;
    width: 100%;
    margin: 1.6rem 0;
    padding: 0.6rem 1rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--soft);
    color: var(--muted);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.left .nav, .tag-list { margin: 0 0 2.4rem; padding: 0; list-style: none; }
.left .nav a, .tag-list a { text-decoration: none; }
.tag-list span { color: var(--muted); font-size: 1.2rem; }

/* ---------- right ---------- */
.right section + section { margin-top: 3.2rem; }
.right h2 {
    margin: 0 0 0.8rem;
    color: var(--muted);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.right ol, .right ul { margin: 0; padding-left: 1.6rem; }
.right li + li { margin-top: 0.4rem; }
.toc ul { padding-left: 0; list-style: none; }
.toc li.h3 { padding-left: 1.2rem; }
.toc a, .backlinks a, .related a { text-decoration: none; }
.toc a.active { color: var(--accent); font-weight: 600; }

.backlinks[data-empty] ul,
.backlinks:not([data-empty]) .empty { display: none; }
.empty { margin: 0; color: var(--muted); }

.graph-container {
    position: relative;
    height: 26rem;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 6px;
}
.graph-container[data-empty] { display: none; }
.graph-container canvas { display: block; }
.graph-full { height: min(75vh, 90rem); margin-top: 2.4rem; }

/* ---------- center ---------- */
.page-title { margin: 0 0 0.8rem; font-size: 3rem; line-height: 1.3; letter-spacing: -0.01em; }
.site-description { margin: 0 0 3.2rem; color: var(--muted); }
.meta { margin: 0 0 3.2rem; color: var(--muted); font-size: 1.4rem; }
.meta a { margin-left: 0.8rem; text-decoration: none; }
.meta .updated { margin-left: 0.8rem; }
.feature { width: 100%; height: auto; margin-bottom: 3.2rem; border-radius: 6px; }

.post-list { margin: 0; padding: 0; list-style: none; }
.post-list li { display: flex; gap: 1.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.post-list time { flex: none; color: var(--muted); font-family: var(--mono); font-size: 1.4rem; line-height: 2.1; }
.post-list a { text-decoration: none; }

.pagination { display: flex; justify-content: space-between; margin-top: 3.2rem; color: var(--muted); font-size: 1.4rem; }

/* ---------- post body ---------- */
.gh-content > * + * { margin-top: 1.6em; }
.gh-content h2 { margin-top: 2.4em; font-size: 2.3rem; line-height: 1.4; }
.gh-content h3 { margin-top: 2em; font-size: 1.9rem; line-height: 1.4; }
.gh-content p, .gh-content ul, .gh-content ol { margin-bottom: 0; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content img { max-width: 100%; height: auto; }
.gh-content figure { margin: 2.4em 0 0; }
.gh-content figcaption { margin-top: 0.8rem; color: var(--muted); font-size: 1.4rem; text-align: center; }
.gh-content blockquote { margin-left: 0; padding-left: 1.6rem; border-left: 3px solid var(--line); color: var(--muted); }
.gh-content hr { border: 0; border-top: 1px solid var(--line); }
.gh-content table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 1.5rem; }
.gh-content th, .gh-content td { padding: 0.6rem 1rem; border: 1px solid var(--line); }
.gh-content code { padding: 0.1em 0.35em; border-radius: 4px; background: var(--soft); font-family: var(--mono); font-size: 0.88em; }
.gh-content pre { overflow-x: auto; padding: 1.6rem; border-radius: 6px; background: var(--soft); line-height: 1.55; }
.gh-content pre code { padding: 0; background: none; font-size: 1.4rem; }
.gh-content h2, .gh-content h3 { scroll-margin-top: 2.4rem; }
.h-anchor { margin-left: 0.4em; color: var(--muted); text-decoration: none; opacity: 0; }
.gh-content h2:hover .h-anchor, .gh-content h3:hover .h-anchor, .h-anchor:focus { opacity: 1; }
.gh-content pre { position: relative; }
.copy-code {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    padding: 0.2rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bg);
    color: var(--muted);
    font: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
}
.gh-content pre:hover .copy-code, .copy-code:focus { opacity: 1; }
@media (hover: none) { .h-anchor, .copy-code { opacity: 1; } }

/* Math: KaTeX comes from site Code injection. Long equations scroll instead of overflowing. */
.gh-content .katex { font-size: 1.1em; }
.gh-content .katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.4rem 0; }

/* Koenig card widths (required by Ghost). Wide/full stay inside the center column on purpose. */
.kg-width-wide, .kg-width-full { width: 100%; }
.kg-width-full img, .kg-width-wide img { width: 100%; }
