/* Journal theme: neutral canvas, bordered cards, blue for links and actions, green for labels. See DESIGN.md. */
:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --soft: #f6f7f9;
  --inset: #eef0f4;
  --border: #e3e5ea;
  --line: #eceef2;
  --field: #d5d9e0;
  --ink: #16181d;
  --text: #2b2f38;
  --sub: #4a505c;
  --muted: #5c6370;
  --accent: #137333;
  --link: #0b57d0;
  --on-link: #ffffff;
  --tint: #e8f0fe;
  --ok-tint: #e6f4ea;
  --warn: #8a5300;
  --warn-tint: #fdf2d8;
  --hover: #f3f4f7;
  --lift: 0 1px 6px rgba(32, 33, 36, 0.24);
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171b;
  --surface: #1c1f25;
  --soft: #22262d;
  --inset: #272b33;
  --border: #2e333d;
  --line: #272b33;
  --field: #3a404b;
  --ink: #eceef2;
  --text: #d0d4dc;
  --sub: #b4bac5;
  --muted: #9aa2af;
  --accent: #81c995;
  --link: #8ab4f8;
  --on-link: #0b1b33;
  --tint: #1f2a3d;
  --ok-tint: #17291d;
  --warn: #f2c26b;
  --warn-tint: #33290f;
  --hover: #22262d;
  --lift: 0 1px 8px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5; overflow-wrap: break-word; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
a { color: var(--link); }
a:hover { color: var(--ink); }
img { max-width: 100%; height: auto; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.icon { flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 30; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); }
.skip-link:focus { top: 12px; color: var(--bg); }

/* Shell */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.topbar, .topic-tabs { display: none; }
.sidebar { position: sticky; top: 0; align-self: start; display: flex; flex-direction: column; gap: 20px; height: 100vh; overflow-y: auto; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; min-height: 44px; padding: 0 12px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { font-weight: 500; color: var(--accent); white-space: pre; }
.author-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--ink); text-decoration: none; }
.author-card:hover { background: var(--hover); }
.author-card img { flex: none; width: 38px; height: 38px; border-radius: 8px; object-fit: cover; }
.author-card > span { display: flex; flex-direction: column; min-width: 0; }
.author-card strong { font-size: 14px; font-weight: 600; }
.author-card span span { font-size: 12.5px; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; }
.nav-label, .eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.eyebrow { color: var(--accent); }
.eyebrow a { color: inherit; }
.nav-label { padding: 0 12px 6px; }
.sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 14.5px; font-weight: 500; color: var(--text); text-decoration: none; }
.sidebar nav a:hover { background: var(--hover); color: var(--ink); }
.sidebar nav a[aria-current] { background: var(--tint); font-weight: 600; color: var(--link); }
.sidebar nav a[aria-current] .count { color: inherit; }
.sidebar .count { font-family: var(--mono); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.sidebar .out { color: var(--muted); }

.page { display: flex; flex-direction: column; gap: 32px; min-width: 0; min-height: 100vh; padding: 32px clamp(16px, 2.4vw, 36px) 28px; }
.page-body { display: flex; align-items: flex-start; gap: 24px; min-width: 0; }
.page-main { flex: 1 1 0; min-width: 0; max-width: 1120px; }
.page-main, .page-main > main { display: flex; flex-direction: column; gap: 20px; }
.page-article .page-main { max-width: 800px; }
.page-rail { position: sticky; top: 24px; flex: 0 0 300px; display: flex; flex-direction: column; gap: 20px; }
.page-rail-wide { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; }
.page-title { min-width: 0; }
.page-title h1 { margin: 6px 0; font-size: 28px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.lede { max-width: 68ch; color: var(--sub); }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-height: 44px; font-size: 14px; color: var(--muted); }

/* Controls */
.theme-toggle, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 22px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; white-space: nowrap; }
.theme-toggle { flex: none; }
.theme-toggle:hover, .button:hover { background: var(--hover); }
.button { border-radius: 8px; text-decoration: none; }
.button-primary { border-color: transparent; background: var(--link); font-weight: 600; color: var(--on-link); }
.button-primary:hover { background: var(--link); filter: brightness(1.08); color: var(--on-link); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.icon-button:hover { background: var(--hover); }

.search { width: max(320px, 52%); max-width: 100%; }
.search-field { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 20px; border: 1px solid var(--field); border-radius: 24px; background: var(--surface); box-shadow: 0 1px 2px rgba(32, 33, 36, 0.06); color: var(--muted); transition: box-shadow 0.15s ease; cursor: text; }
.search-field:hover, .search-field:focus-within { box-shadow: var(--lift); }
.search-field:focus-within { border-color: var(--link); color: var(--link); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search noscript p, #search-status { font-size: 14px; color: var(--muted); }
#search-status:empty { display: none; }

.view-toggle { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--inset); }
.view-toggle button { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 500; color: var(--sub); cursor: pointer; }
.view-toggle button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.16); font-weight: 600; color: var(--ink); }

/* Blocks and cards */
.card { padding: 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.block { display: flex; flex-direction: column; gap: 14px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.block h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.block h2 a { color: var(--link); text-decoration: none; }
.block h2 a:hover { text-decoration: underline; }
.note { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
h2 .note { margin-left: 8px; }
.more, .block-foot { font-size: 14px; font-weight: 500; }

.posts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 1.6%; }
.post { --pad: 20px; position: relative; display: flex; flex-direction: column; gap: 8px; padding: var(--pad); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.post:hover { border-color: var(--field); }
.post-cover { display: block; aspect-ratio: 16 / 9; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 6px; overflow: hidden; border-radius: 11px 11px 0 0; background: var(--inset); }
.post-cover img, .post-cover svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.motif { background: var(--tint); }
.motif .p { fill: var(--surface); stroke: var(--field); stroke-width: 1.5; }
.motif .k { fill: var(--link); }
.motif .g { fill: var(--accent); }
.motif .t { fill: var(--tint); stroke: var(--field); stroke-width: 1; }
.motif .m { fill: var(--field); }
.motif .w { fill: var(--on-link); opacity: 0.9; }
.motif .o { fill: none; stroke: var(--link); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.motif .n { fill: none; stroke: var(--field); stroke-width: 4; stroke-linecap: round; }
.posts[data-view="list"] .post-cover { display: none; }
.post-label { position: relative; z-index: 1; align-self: flex-start; font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
a.post-label:hover { color: var(--accent); text-decoration: underline; }
.post h2, .post h3 { font-size: 16px; font-weight: 600; line-height: 1.4; letter-spacing: 0; }
.post h2 a, .post h3 a { color: var(--link); text-decoration: none; }
.post h2 a::after, .post h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.post:hover h2 a, .post:hover h3 a { text-decoration: underline; }
.post-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: 14px; color: var(--sub); }
.post-meta { margin-top: auto; padding-top: 6px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.topic-starter { position: relative; z-index: 1; font-size: 13.5px; color: var(--sub); }

.posts[data-view="list"] { display: block; padding: 4px 24px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.posts[data-view="list"] .post { display: grid; grid-template-columns: minmax(0, 1fr) 176px; gap: 4px 24px; padding: 14px 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.posts[data-view="list"] .post:first-child { border-top: 0; }
.posts[data-view="list"] .post h2, .posts[data-view="list"] .post h3 { grid-area: 1 / 1; font-size: 15.5px; }
.posts[data-view="list"] .post-desc { grid-area: 2 / 1; -webkit-line-clamp: 2; }
.posts[data-view="list"] .post-label { grid-area: 1 / 2; justify-self: end; text-align: right; font-weight: 400; font-size: 13px; }
.posts[data-view="list"] .post-meta { grid-area: 2 / 2; margin: 0; padding: 0; text-align: right; white-space: nowrap; }
.posts[data-view="list"] .post h2 a::after, .posts[data-view="list"] .post h3 a::after { border-radius: 0; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.pagination .numbers { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 auto; }
.pagination a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; border-radius: 8px; font-family: var(--mono); font-size: 13.5px; color: var(--text); text-decoration: none; }
.pagination a:hover { background: var(--hover); }
.pagination a[aria-current] { background: var(--tint); font-weight: 500; color: var(--link); }
.pagination .step { border: 1px solid var(--field); background: var(--surface); font-family: var(--sans); font-weight: 500; }

.videos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 1.6%; }
.video { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--ink); text-decoration: none; }
.video-thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: var(--inset); }
.video-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.video-title { font-size: 14.5px; font-weight: 600; line-height: 1.4; }
.video:hover .video-title { text-decoration: underline; }
.video time, .x-date { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.x-posts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 1.6%; }
.x-post { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 10px; background: var(--soft); }
.x-post p { font-size: 14.5px; line-height: 1.55; color: var(--text); }
.x-date { margin-top: auto; text-decoration: none; }
.x-date:hover { text-decoration: underline; }

.guide-spotlight { gap: 6px; }
.guide-spotlight > p:last-child { max-width: 68ch; font-size: 14.5px; color: var(--sub); }

/* Article */
.reading h1 { font-size: clamp(25px, 2.6vw, 30px); font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; }
.reading.card { padding: 36px clamp(18px, 3vw, 40px) 40px; }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.byline img { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.byline a { font-weight: 600; color: var(--ink); }
.byline span { font-family: var(--mono); font-size: 12.5px; }
.mood { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; }
.mood div { display: flex; gap: 8px; }
.mood dt { color: var(--muted); }
.article-summary { margin-top: 20px; padding: 16px 18px; border-radius: 10px; background: var(--soft); font-size: 16px; line-height: 1.6; color: var(--ink); }
.article-summary strong { display: block; margin-bottom: 6px; font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
/* What was run for this article: a short, honest line under the summary. */
.checked { display: flex; align-items: baseline; gap: 10px; margin-top: 14px; font-size: 14.5px; line-height: 1.5; color: var(--text); }
.checked strong { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.checked-tested strong { background: var(--ok-tint); color: var(--accent); }
.checked-partly strong { border: 1px solid var(--accent); color: var(--accent); }
.checked-read strong { background: var(--inset); color: var(--sub); }
.post-check b { font-weight: 600; color: var(--accent); }
.posts[data-view="list"] .post-check { display: none; }
.facts { display: grid; gap: 8px; margin-top: 16px; font-size: 14.5px; line-height: 1.5; }
.facts div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 12px; }
.facts dt { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.facts dd { color: var(--text); }
.post .facts { margin-top: 0; font-size: 13.5px; }
.post .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.series-box { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; font-size: 14.5px; line-height: 1.45; }
.series-box summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 48px; padding: 8px 14px; cursor: pointer; }
.series-part { font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.series-name { font-weight: 600; color: var(--ink); }
.series-box ol { margin: 0; padding: 0 14px 4px 36px; }
.series-box li { padding: 5px 0; }
.series-box li[aria-current] span { font-weight: 600; color: var(--ink); }
.series-box a { text-decoration: none; }
.series-box a:hover { text-decoration: underline; }
.series-box p { padding: 6px 14px 12px; font-size: 13.5px; }
.series-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 1.6%; }
.series-nav a { display: flex; flex-direction: column; gap: 6px; padding: 16px 20px; text-decoration: none; }
.series-nav a[rel="next"], .series-nav a:last-child:not([rel="prev"]) { text-align: right; }
.series-nav a:hover { border-color: var(--field); }
.series-nav a:hover strong { text-decoration: underline; }
.series-nav strong { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--link); }
.series-start { margin-top: -8px; }
/* Trending in AI: a ranked list of names. Numbers come from CSS counters so the markup stays a plain ordered list. */
.trending ol { margin: 0; padding: 0; list-style: none; counter-reset: trend; columns: 2; column-gap: 48px; }
.trending li { counter-increment: trend; display: flex; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); break-inside: avoid; font-size: 15px; }
.trending li::before { content: counter(trend); flex: 0 0 20px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted); }
.trending li:nth-child(-n+3)::before { color: var(--accent); }
.trending li a { font-weight: 500; text-decoration: none; }
.trending li a:hover { text-decoration: underline; }
.trend-bar { flex: 0 0 34%; height: 6px; margin-left: auto; align-self: center; border-radius: 3px; background: var(--inset); overflow: hidden; }
.trend-bar i { display: block; height: 100%; border-radius: 3px; background: var(--link); }
.trend-tag { padding: 1px 7px; border-radius: 999px; background: var(--ok-tint); font-size: 11px; font-weight: 600; color: var(--accent); }
.trending .block-foot { margin-top: 4px; }
.trend-others { columns: 2; column-gap: 40px; }
.trend-others li { break-inside: avoid; }
.series-feature { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 20px 4%; align-items: start; }
.series-about { display: flex; flex-direction: column; gap: 10px; }
.series-about h3 { font-size: 19px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.series-about h3 a { color: var(--link); text-decoration: none; }
.series-about h3 a:hover { text-decoration: underline; }
.series-about .post-desc { -webkit-line-clamp: 4; font-size: 14.5px; }
.series-about .button { align-self: flex-start; margin-top: 4px; }
.series-feature ol { margin: 0; padding: 0 0 0 26px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }
.series-feature li { padding: 7px 0 7px 4px; border-top: 1px solid var(--line); }
.series-feature li:first-child { border-top: 0; padding-top: 0; }
.series-feature li a { font-weight: 500; text-decoration: none; }
.series-feature li a:hover { text-decoration: underline; }
.affiliate-disclosure { margin-bottom: 20px; padding: 12px 16px; border-radius: 10px; background: var(--soft); font-size: 14px; color: var(--sub); }
.article-cover { margin-top: 24px; }
.article-cover img, .article-reference img { display: block; width: 100%; border-radius: 10px; }
figcaption { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--muted); }

.reading-body { margin-top: 24px; font-size: 17px; line-height: 1.7; color: var(--text); }
.reading-body > :last-child { margin-bottom: 0; }
.reading-body p, .reading-body ul, .reading-body ol, .reading-body figure, .reading-body blockquote, .reading-body pre, .reading-body .table-scroll { margin-bottom: 1.15em; }
.reading-body > :is(p, ul, ol, h2, h3, blockquote) { max-width: 88ch; }
.reading-body p, .reading-body li { text-wrap: pretty; }
.reading h1, .reading-body h2, .reading-body h3, .post h2, .post h3 { text-wrap: balance; }
.reading-body a { text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.reading-body h2 { margin: 2.1em 0 0.5em; font-size: 1.3em; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); scroll-margin-top: 24px; }
.reading-body h3 { margin: 1.6em 0 0.4em; font-size: 1.1em; font-weight: 600; line-height: 1.4; color: var(--ink); scroll-margin-top: 24px; }
.reading-body > h2:first-child { margin-top: 0; }
.reading-body ul, .reading-body ol { padding-left: 22px; }
.reading-body li { margin-bottom: 0.5em; }
.reading-body li:last-child { margin-bottom: 0; }
.reading-body strong { color: var(--ink); }
.reading-body figure img, .reading-body figure svg { display: block; max-width: 100%; height: auto; border-radius: 10px; background: #ffffff; }
.reading-body blockquote { padding: 12px 16px; border-radius: 10px; background: var(--soft); }
.reading-body code { padding: 1px 5px; border-radius: 5px; background: var(--inset); font-family: var(--mono); font-size: 0.88em; }
.reading-body pre { overflow-x: auto; padding: 0.9em 1em; border-radius: 10px; background: var(--inset); font-family: var(--mono); font-size: 0.8em; line-height: 1.6; }
.reading-body pre code { padding: 0; background: none; }
.reading-body table { width: 100%; border-collapse: collapse; font-size: 0.88em; line-height: 1.5; }
.reading-body th, .reading-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.reading-body th { font-size: 0.86em; font-weight: 600; color: var(--muted); }
.reading-body td:first-child code { white-space: nowrap; }
.callout { padding: 0.85em 1em; border-left: 4px solid var(--link); border-radius: 0 10px 10px 0; background: var(--tint); font-size: 0.94em; line-height: 1.6; }
.reading-body .callout { margin-bottom: 1.15em; }
.callout > strong:first-child { display: block; margin-bottom: 0.25em; font-family: var(--mono); font-size: 0.74em; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--link); }
.callout.warn { border-color: var(--warn); background: var(--warn-tint); }
.callout.warn > strong:first-child { color: var(--warn); }
.callout.ok { border-color: var(--accent); background: var(--ok-tint); }
.callout.ok > strong:first-child { color: var(--accent); }
.callout code { background: var(--surface); }
.diagram { padding: 1.1em; border: 1px solid var(--border); border-radius: 12px; background: var(--soft); }
.reading-body .diagram { margin-bottom: 1.4em; }
.diagram figcaption { margin-top: 1em; text-align: center; font-size: 0.78em; }
.d-flow { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 0.5em; }
.d-box { flex: 1 1 7em; max-width: 15em; padding: 0.7em 0.8em; border: 1px solid var(--field); border-radius: 10px; background: var(--surface); font-size: 0.8em; line-height: 1.4; text-align: center; color: var(--sub); }
.d-box strong { display: block; margin-bottom: 0.15em; font-size: 1.06em; color: var(--ink); }
.d-box.key { border-color: var(--link); box-shadow: inset 0 3px 0 var(--link); }
.d-box.green { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.d-box.warn { border-color: var(--warn); box-shadow: inset 0 3px 0 var(--warn); }
.d-box.ghost { border-style: dashed; background: none; }
.d-arrow { flex: none; align-self: center; font-size: 1.15em; line-height: 1; color: var(--muted); }
.d-stack { display: flex; flex-direction: column; gap: 0.4em; max-width: 34em; margin: 0 auto; }
.d-stack .d-box { flex: none; max-width: none; display: flex; align-items: baseline; justify-content: space-between; gap: 1em; text-align: left; }
.d-stack .d-box strong { flex: none; margin: 0; }
.d-stack .d-box span { text-align: right; }
.d-bars { display: grid; gap: 0.9em; }
.d-bars p { display: flex; justify-content: space-between; gap: 1em; margin: 0 0 0.3em; font-size: 0.8em; line-height: 1.4; color: var(--sub); }
.d-bars p strong { color: var(--ink); }
.d-bar { display: flex; height: 2.2em; overflow: hidden; border-radius: 8px; background: var(--inset); font-family: var(--mono); font-size: 0.7em; }
.d-bar span { display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; white-space: nowrap; }
.d-bar .a { background: var(--link); color: var(--on-link); }
.d-bar .b { background: var(--accent); color: var(--surface); }
.d-bar .c { background: var(--field); color: var(--ink); }
.d-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4em 1.4em; margin-top: 1em; font-size: 0.78em; color: var(--sub); }
.d-legend i { display: inline-block; width: 0.85em; height: 0.85em; margin-right: 0.45em; border-radius: 3px; vertical-align: -0.08em; }
.d-legend .a { background: var(--link); } .d-legend .b { background: var(--accent); } .d-legend .c { background: var(--field); }
.terminal { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #14161a; color: #dfe3ea; }
.reading-body .terminal { margin-bottom: 1.3em; }
.terminal::before { content: ""; display: block; width: 10px; height: 10px; margin: 12px 14px 10px; border-radius: 50%; background: #5c6370; box-shadow: 16px 0 #5c6370, 32px 0 #5c6370; }
.reading-body .terminal pre { margin: 0; padding: 0 1.1em 1em; border-radius: 0; background: none; color: inherit; }
/* For output whose point is at the end of a long line, such as JSON replies: wrap instead of scrolling sideways. */
.reading-body .terminal.wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .c { color: #8ab4f8; }
.terminal .g { color: #81c995; }
.terminal .d { color: #9aa2af; }
.terminal figcaption { margin: 0; padding: 0.6em 1.1em; border-top: 1px solid #2a2f38; background: #1b1e24; color: #aab1bd; }
.video-embed .video-space { overflow: hidden; border-radius: 10px; }
.video-load.video-poster { position: relative; display: block; width: 100%; min-height: 0; aspect-ratio: 16 / 9; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; }
.video-poster img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0.86; }
.video-poster span { position: absolute; left: 50%; top: 50%; max-width: 88%; overflow: hidden; padding: 0.7em 1.2em; border-radius: 999px; background: var(--link); font-size: 0.86em; font-weight: 600; color: var(--on-link); text-overflow: ellipsis; white-space: nowrap; transform: translate(-50%, -50%); }
.video-poster:hover img { opacity: 1; }
.contact-address { font-family: var(--mono); font-size: 15px; }
.info-page > h1 { max-width: 40ch; }

.toc-inline { display: none; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 10px; font-size: 14.5px; line-height: 1.4; }
.toc-inline summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 14px; font-weight: 600; color: var(--ink); cursor: pointer; list-style: none; }
.toc-inline summary::-webkit-details-marker { display: none; }
.toc-inline summary span { font-family: var(--mono); font-size: 12.5px; font-weight: 400; color: var(--muted); }
.toc-inline ol, .toc ol { padding: 0; list-style: none; }
.toc-inline ol { margin: 0; padding: 0 14px 10px; }
.toc-inline li, .toc li { margin: 0; }
.toc-inline a, .toc a { display: block; padding: 8px 0; color: var(--text); text-decoration: none; }
.toc-inline a:hover, .toc a:hover { color: var(--ink); text-decoration: underline; }
.toc.card { padding: 18px 20px; font-size: 14px; line-height: 1.4; }
.toc .eyebrow { margin-bottom: 8px; }

.source-box, .product-links { margin-top: 2em; padding-top: 1.5em; border-top: 1px solid var(--line); font-size: 0.88em; line-height: 1.7; }
.source-box h2, .product-links h2 { margin: 0 0 0.7em; font-size: 1.1em; }
.source-box p:last-child { font-size: 0.9em; line-height: 1.6; color: var(--muted); }
.editorial-note { margin-top: 0.8em; font-size: 0.8em; line-height: 1.6; color: var(--muted); }

.author-box { padding: 18px 20px; font-size: 14px; line-height: 1.55; color: var(--sub); }
.author-box > * + * { margin-top: 10px; }
.author-name { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.author-name img { flex: none; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; }
.author-name > span { display: flex; flex-direction: column; font-size: 14.5px; line-height: 1.35; }
.author-name span span { font-size: 13px; color: var(--muted); }
.author-box a { font-weight: 500; }
.comments p { max-width: 62ch; font-size: 14.5px; color: var(--sub); }
.comments .button { align-self: flex-start; }
#comments-thread:empty { display: none; }

/* Videos and social posts */
.media-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 1.6%; }
.media-item { display: flex; flex-direction: column; gap: 14px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.media-item > img { display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: 8px; object-fit: cover; background: var(--inset); }
.media-item > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media-item h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }
.media-item p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; font-size: 14px; color: var(--sub); }
.media-item .post-meta { display: block; margin: 0; padding: 0; }
.media-item .platform-links { display: block; font-size: 14px; font-weight: 500; }
.video-load { min-height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--text); cursor: pointer; }
.video-load:hover { background: var(--hover); }
.video-space iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
.related-media.card { display: flex; flex-direction: column; gap: 14px; }
.related-media .media-item { padding: 0; border: 0; }
.related-media > .media-item + .media-item { padding-top: 16px; border-top: 1px solid var(--line); border-radius: 0; }

/* Guide pages */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.repo-table { font-size: 14px; font-variant-numeric: tabular-nums; }
.reading-body .repo-table th, .reading-body .repo-table td { white-space: nowrap; }
.repo-table tbody tr:last-child td { border-bottom: 0; }
.repo-table td:nth-child(n+4), .repo-table th:nth-child(n+4) { text-align: right; }
.repo-table a { font-weight: 600; color: var(--ink); text-decoration: none; }
.repo-card { padding: 24px 0; border-top: 1px solid var(--line); scroll-margin-top: 24px; }
.repo-card h3 { margin: 0 0 4px; }
.repo-card .post-meta { margin: 0 0 12px; padding: 0; }
.repo-path { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--muted); }
.repo-check, .repo-take { padding: 12px 16px; border-radius: 8px; background: var(--soft); font-size: 15.5px; }
.video-card { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; line-height: 1.5; color: var(--ink); text-decoration: none; }
.video-card img { flex: none; width: 120px; border-radius: 6px; }

/* Ads */
.ad { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.ad-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ad ins { width: 100%; min-height: 90px; }
.ad-rail ins { min-height: 600px; }
.ad-article-end ins { min-height: 250px; }
/* Kakao's supplied fixed-size creative stays separate from responsive AdSense units. */
.ad-kakao { margin-block: 24px; min-height: 224px; }
.ad-kakao ins { width: 320px; min-height: 200px; }
@media (max-width: 351px) {
  .ad-kakao { margin-inline: -16px; }
}
.ad-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; padding: 12px 12px 12px 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 14px; color: var(--text); }
.ad-note > p:first-child { flex: 1 1 340px; }
.ad-note strong { font-weight: 600; color: var(--ink); }
.ad-note div { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-note #ad-note-help { flex-basis: 100%; color: var(--sub); }

.ad-wall { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.ad-wall-box { display: flex; flex-direction: column; gap: 14px; width: min(100%, 560px); max-height: 100%; overflow-y: auto; padding: 28px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--lift); font-size: 15.5px; line-height: 1.6; color: var(--text); }
.ad-wall-box h2 { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); }
.ad-wall-box ol { padding-left: 22px; }
.ad-wall-box .note { font-size: 13.5px; }
.ad-wall-actions { display: flex; flex-wrap: wrap; gap: 8px; }
body.walled { overflow: hidden; }
body.walled .app { filter: blur(7px); user-select: none; }
.follow { gap: 12px; }
.follow p { font-size: 15px; color: var(--sub); }
.follow strong { color: var(--ink); }
.follow-links { display: flex; flex-wrap: wrap; gap: 8px; }

.site-footer { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 10px 32px; max-width: 1124px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--sub); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* Desktop: every width is a share of the screen, so the layout fills any window. The sidebar column
   is painted on the page canvas (flat bands, hard stops) so it reaches the bottom even when an anchor
   ad adds padding under the page. Text sizes mix rem and vw: they grow with the window, which keeps
   line length steady, and still respond to the reader's own font-size setting. */
@media (min-width: 1024px) {
  :root { --side: max(210px, 16%); }
  body { background: linear-gradient(to right, var(--surface) 0, var(--surface) calc(var(--side) - 1px), var(--border) calc(var(--side) - 1px), var(--border) var(--side), var(--bg) var(--side)); }
  .app { grid-template-columns: var(--side) minmax(0, 1fr); }
  .sidebar { padding: 24px 6%; border-right: 0; background: none; }
  .page { padding: 32px 2.6% 28px; }
  .page-body { gap: 2%; }
  .page-main, .page-article .page-main { max-width: none; }
  .page-rail { flex-basis: 24%; }
  .page-rail-wide { flex-basis: 300px; }
  .site-footer { max-width: none; }
  .posts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .videos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .x-posts, .media-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .posts[data-view="list"] .post { grid-template-columns: minmax(0, 1fr) max(190px, 16%); }
  .reading.card { padding: 3.4% 4.6% 3.8%; }

  .brand { font-size: clamp(1rem, 0.6rem + 0.48vw, 1.5rem); }
  .sidebar nav a { font-size: clamp(0.9rem, 0.55rem + 0.42vw, 1.3rem); }
  .page-title h1 { font-size: clamp(1.6rem, 0.7rem + 1.3vw, 3rem); }
  .lede { font-size: clamp(0.94rem, 0.5rem + 0.55vw, 1.5rem); }
  .block h2 { font-size: clamp(1.06rem, 0.6rem + 0.6vw, 1.75rem); }
  .post h2, .post h3, .media-item h3 { font-size: clamp(1rem, 0.5rem + 0.6vw, 1.6rem); }
  .post-desc, .media-item p, .x-post p, .video-title { font-size: clamp(0.875rem, 0.45rem + 0.5vw, 1.35rem); }
  .toc.card, .author-box { font-size: clamp(0.875rem, 0.5rem + 0.45vw, 1.3rem); }
  .reading h1 { font-size: clamp(1.7rem, 0.6rem + 1.55vw, 3.4rem); }
  .reading-body { font-size: clamp(1.0625rem, 0.3rem + 1vw, 2.2rem); line-height: 1.75; }
  .article-summary { font-size: clamp(1rem, 0.3rem + 0.9vw, 2rem); }
  .facts, .series-box { font-size: clamp(0.9rem, 0.4rem + 0.65vw, 1.55rem); }
  .post .facts { font-size: clamp(0.84rem, 0.45rem + 0.45vw, 1.25rem); }
  .series-nav strong { font-size: clamp(0.94rem, 0.5rem + 0.55vw, 1.5rem); }
  .series-about h3 { font-size: clamp(1.15rem, 0.6rem + 0.7vw, 1.9rem); }
  .series-about .post-desc, .series-feature ol { font-size: clamp(0.9rem, 0.45rem + 0.52vw, 1.4rem); }
}

@media (min-width: 1100px) and (max-width: 1299px) {
  .page-article .page-rail { flex-basis: 27%; }
}

@media (min-width: 1800px) {
  .posts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1500px) {
  .page-rail-wide { display: flex; }
}

@media (max-width: 1099px) {
  .page-article .page-body { flex-direction: column; }
  .page-article .page-main { max-width: none; width: 100%; }
  .page-article .page-rail, .page-rail { position: static; flex: none; width: 100%; }
  .toc { display: none; }
  .toc-inline { display: block; }
  .ad-rail ins { min-height: 250px; }
}

@media (max-width: 1023px) {
  .app { display: block; }
  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 6px 0 4px; border-bottom: 1px solid var(--border); background: var(--surface); }
  .topbar .brand { font-size: 15.5px; }
  .topbar-actions { display: flex; }
  .topic-tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 6px; border-bottom: 1px solid var(--border); background: var(--surface); scrollbar-width: none; }
  .topic-tabs::-webkit-scrollbar { display: none; }
  .topic-tabs a { flex: none; display: flex; align-items: center; height: 44px; padding: 0 10px; font-size: 14px; font-weight: 500; color: var(--sub); text-decoration: none; }
  .topic-tabs a[aria-current] { box-shadow: inset 0 -2px 0 var(--link); font-weight: 600; color: var(--link); }
  .sidebar { display: none; position: fixed; inset: 56px 0 0; z-index: 19; align-self: auto; height: auto; border-right: 0; }
  .sidebar.is-open { display: flex; }
  .sidebar > .brand { display: none; }
  body.menu-open { overflow: hidden; }
  .page { gap: 24px; min-height: 0; padding: 20px 16px 24px; }
  .page-head .theme-toggle { display: none; }
  .page-title h1 { font-size: 24px; line-height: 1.25; }
  .search { width: 100%; max-width: none; }
  .card { padding: 18px; }
  .reading.card { margin: 0 -16px; padding: 20px 18px 28px; border-right: 0; border-left: 0; border-radius: 0; }
  .breadcrumbs { min-height: 0; }
}

@media (max-width: 640px) {
  .trending ol, .trend-others { columns: 1; }
  .posts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .post { --pad: 18px; }
  .posts[data-view="list"] { padding: 2px 18px; }
  .posts[data-view="list"] .post { grid-template-columns: minmax(0, 1fr); }
  .posts[data-view="list"] .post-label, .posts[data-view="list"] .post-desc { display: none; }
  .posts[data-view="list"] .post-meta { grid-area: 2 / 1; text-align: left; }
  .videos { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .video { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 4px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
  .video:first-child { border-top: 0; padding-top: 0; }
  .video-thumb { flex: none; width: 132px; }
  .video-title { flex: 1 1 0; min-width: 0; font-size: 14px; }
  .video time { flex-basis: 100%; padding-left: 144px; margin-top: -22px; }
  .media-list { grid-template-columns: minmax(0, 1fr); }
  .video-card img { width: 96px; }
  .repo-table .col-group { display: none; }
  .site-footer { flex-direction: column-reverse; gap: 12px; }
  .series-nav { grid-template-columns: minmax(0, 1fr); }
  .series-feature { grid-template-columns: minmax(0, 1fr); }
  .series-nav span:empty { display: none; }
  .series-nav a[rel="next"], .series-nav a:last-child:not([rel="prev"]) { text-align: left; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .d-flow { flex-direction: column; }
  .d-flow .d-box { flex: none; max-width: none; }
  .d-arrow { transform: rotate(90deg); }
  .d-stack .d-box { flex-direction: column; gap: 0.1em; }
  .d-stack .d-box span { text-align: left; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
@media print {
  .sidebar, .topbar, .topic-tabs, .page-rail, .ad, .ad-note, .theme-toggle, .view-toggle, .search, .comments, .series-nav, .follow { display: none !important; }
  .app { display: block; }
  .card { border: 0; padding: 0; }
}
