:root {
  color-scheme: light dark;
  --bg: light-dark(#f5f4ef, #111213);
  --text: light-dark(#111111, #d6d6d6);
  --muted: light-dark(#6b6a64, #8f8f8a);
  --line: light-dark(#d9d7cd, #2c2d2f);
  --raised: light-dark(#fbfaf6, #18191b);
  --accent: light-dark(#007a33, #4ade80);
  --serif: Georgia, "Noto Serif KR", "Apple SD Gothic Neo", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Apple SD Gothic Neo", "Noto Sans KR", monospace;
}
* { box-sizing: border-box; }
body {
  max-width: 650px; margin: 50px auto 0; padding: 0 20px 4rem;
  font: 0.875rem/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
  word-break: keep-all; overflow-wrap: anywhere;
  background: var(--bg); color: var(--text);
}
@media (max-width: 480px) { body { font-size: 0.9375rem; margin-top: 28px; } }

/* Links: light = text color + underline; dark = accent, underline on hover. */
a, a:visited {
  color: light-dark(var(--text), var(--accent));
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: light-dark(currentColor, transparent);
}
a:hover, a:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
a:focus-visible, summary:focus-visible, .table-wrap:focus-visible, pre:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

h1 { font: normal 1.35rem/1.3 var(--serif); margin: 1.6rem 0 0.4rem; }
h2 { font-size: 1em; font-weight: bold; margin: 2rem 0 0.4rem; }
h3 { font-size: 1em; font-weight: bold; margin: 1.2rem 0 0.3rem; }
p { margin: 0.7rem 0; }
ul, ol { margin: 0.4rem 0; padding-left: 1.2rem; }
li { margin: 0.15rem 0; }
small, .muted { color: var(--muted); }
code, kbd, samp { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
img { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
blockquote { margin: 1rem 0; padding-left: 1rem; border-left: 2px solid var(--line); color: var(--muted); }
pre {
  overflow-x: auto; padding: 0.75rem; margin: 1rem 0; font-size: 0.85em; line-height: 1.5;
  word-break: normal; overflow-wrap: normal;
  background: var(--raised); border: 1px solid var(--line);
}
pre code { font-size: inherit; overflow-wrap: normal; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; font-size: 0.85em; }
th, td { border: 1px solid var(--line); padding: 0.25rem 0.55rem; text-align: left; vertical-align: top; word-break: normal; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
caption { text-align: left; padding-bottom: 0.3rem; color: var(--muted); }
details { margin: 0.2rem 0; }
summary { cursor: pointer; color: var(--muted); }
details ul { overflow-wrap: anywhere; word-break: normal; margin-top: 0.4rem; }

/* Site chrome */
.skip { position: absolute; left: -999rem; }
.skip:focus { position: static; display: inline-block; margin-bottom: 0.5rem; }
.site-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.4rem 1.5rem; }
.brand { margin: 0; font: normal 1.6rem/1.2 var(--serif); }
.brand a, .brand a:visited { color: inherit; text-decoration: none; }
.brand a:hover { color: var(--accent); }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.1rem 1rem; padding: 0; margin: 0; }
.site-nav li { margin: 0; }
.site-nav a, .site-nav a:visited { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.site-foot { margin-top: 3.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--muted); }
.site-foot p { margin: 0.3rem 0; }
.site-foot a, .site-foot a:visited { color: var(--muted); text-decoration-color: currentColor; }
.site-foot a:hover { color: var(--accent); }

/* Content bits */
.meta { color: var(--muted); margin: 0.2rem 0 1.2rem; }
.ai-note { font-style: italic; color: var(--muted); margin: 0 0 1.2rem; }
.status { font-size: 0.85em; border: 1px solid var(--line); padding: 0 0.35em; white-space: nowrap; color: var(--muted); }
.check-status { font-weight: bold; white-space: nowrap; }
.mono { font-family: var(--mono); }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 1.5rem; margin-top: 3rem; }
.pager p { margin: 0; flex: 1 1 14rem; }
.pager .next { text-align: right; }
.lead { margin: 0.8rem 0; }
.links-line { margin: 2rem 0 0.6rem; }
.list-plain { list-style: none; padding-left: 0; }
.list-plain li { margin: 0.3rem 0; }
.date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dated { list-style: none; padding-left: 0; }
.dated > li { margin: 0.5rem 0; }
.dated ul { margin: 0.15rem 0 0; }
.tag-list { color: var(--muted); margin: 0.15rem 0; }
.project { margin: 1.1rem 0; }
.project p { margin: 0.15rem 0; }
.project .proj-head { margin-top: 0; }
.year-tag { color: var(--muted); white-space: nowrap; }

/* Entry list ("timeline"): bold title, right-aligned date, muted excerpt. */
.timeline { list-style: none; margin: 0.8rem 0; padding: 0 0 0 1.1rem; border-left: 1px solid var(--line); }
.timeline li { position: relative; margin: 0 0 1rem; padding: 0; }
.timeline li::before {
  content: ""; position: absolute; left: calc(-1.1rem - 4px); top: 0.55em;
  width: 7px; height: 7px; background: var(--text);
}
.timeline li.featured {
  background: var(--raised); border: 1px solid var(--line); padding: 0.55rem 0.75rem; margin-bottom: 1.1rem;
}
.timeline li.featured::before { left: calc(-1.1rem - 5px); top: 1em; background: var(--accent); }
.entry-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 1rem; }
.entry-title { font-weight: bold; flex: 1 1 auto; min-width: 0; }
.entry-date { flex: none; }
.entry-excerpt { margin: 0.1rem 0 0; color: var(--muted); }
@media (max-width: 480px) {
  .entry-head { flex-direction: column; align-items: flex-start; }
}
.timeline-more { margin: 0.4rem 0 0; }

/* Long-form post body: reading face. */
.post-body { font: 1.0625rem/1.75 var(--serif); }
.post-body > :first-child { margin-top: 0; }
.post-body h2 { font-size: 1.25rem; margin-top: 2rem; }
.post-body h3 { font-size: 1.1rem; font-weight: bold; }
.post-body h4, .post-body h5, .post-body h6 { font-size: 1em; font-weight: bold; margin: 1.2rem 0 0.3rem; }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body li { margin: 0.25rem 0; }
.post-body code, .post-body pre { font-family: var(--mono); font-size: 0.85em; }
.post-body code { background: var(--raised); border: 1px solid var(--line); padding: 0 0.25em; }
.post-body pre code { background: none; border: 0; padding: 0; }
.post-body table { font-family: var(--mono); }

/* Switch without JavaScript: a hidden checkbox + :has(). With JavaScript,
   /theme.js sets <html data-theme> (the stored choice, else the toggle's
   result) and that attribute alone decides; the checkbox rules below only
   apply while it is absent. */
.sr { position: absolute; opacity: 0; pointer-events: none; }
.switch label { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.switch label:hover { color: var(--accent); }
/* Theme: follows the system; the checkbox flips it. The label always
   names the mode you would switch to. */
.to-light { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]):has(#flip:checked) { color-scheme: dark; }
  :root:not([data-theme]) body:has(#flip:checked) .to-dark { display: none; }
  :root:not([data-theme]) body:has(#flip:checked) .to-light { display: inline; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .to-dark { display: none; }
  :root:not([data-theme]) .to-light { display: inline; }
  :root:not([data-theme]):has(#flip:checked) { color-scheme: light; }
  :root:not([data-theme]) body:has(#flip:checked) .to-dark { display: inline; }
  :root:not([data-theme]) body:has(#flip:checked) .to-light { display: none; }
}
/* An explicit choice (stored by /theme.js) wins over the system and the checkbox. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] .to-dark { display: inline; }
:root[data-theme="light"] .to-light { display: none; }
:root[data-theme="dark"] .to-dark { display: none; }
:root[data-theme="dark"] .to-light { display: inline; }
body:has(#flip:focus-visible) label[for="flip"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.live-tag { color: var(--muted); }
