:root {
  color-scheme: light;
  --text: #2b2823;     /* sumi ink */
  --muted: #8c8478;
  --accent: #4f6f52;   /* muted pine green */
  --rule: #ebe5da;
  --bg: #fcfaf5;       /* cream white */
  --serif: "Noto Serif KR", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.75 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; letter-spacing: 0.01em; }
.wrap { max-width: 680px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { padding-top: 20px; }

/* Post lists */
.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 22px; }
.post-list .date { display: block; color: var(--muted); font-size: 0.8rem; }
.post-list a { font-family: var(--serif); }
.excerpt { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }

/* Single post */
.post h1 { font-size: 1.5rem; margin-bottom: 4px; line-height: 1.3; }
.meta { color: var(--muted); font-size: 0.8rem; margin-top: 0; }
.post img { max-width: min(100%, 420px); max-height: 360px; width: auto; height: auto; display: block; margin: 24px auto 8px; }
.post img + em { display: block; text-align: center; color: var(--muted); font-size: 0.8rem; margin-bottom: 20px; }
.post h2 { font-size: 1.15rem; margin-top: 32px; }
.post h3 { font-size: 1rem; margin-top: 24px; }
.post h4 { font-size: 0.95rem; margin-top: 20px; }
.post sup a { text-decoration: none; }
.post li { margin-bottom: 4px; }
.post .MathJax { font-size: 100% !important; }
pre { background: rgba(127,127,127,0.08); padding: 12px; overflow-x: auto; border-radius: 4px; font-size: 0.8rem; }
code { font-size: 0.88em; }
blockquote { border-left: 2px solid var(--rule); margin-left: 0; padding-left: 14px; color: var(--muted); }
.back { margin-top: 40px; font-size: 0.85rem; }

/* About */
.about { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.avatar { width: 240px; max-width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 0; object-fit: cover; }
.about h1 { font-size: 1.25rem; margin: 0 0 10px; line-height: 1.4; letter-spacing: 0.03em; }
.name-ko { margin: -6px 0 12px; font-family: var(--serif); font-size: 0.9rem; letter-spacing: 0.2em; color: var(--muted); }
.interests { margin: 0; font-family: var(--serif); font-size: 0.86rem; line-height: 1.95; color: var(--text); }
.interests { display: grid; grid-template-columns: repeat(2, max-content); column-gap: 22px; }
.interests .nowrap { display: block; line-height: 1.7; white-space: nowrap; }
.interests .dot { display: none; }
.affil { margin: 10px 0 0; font-size: 0.75rem; letter-spacing: 0.14em; color: var(--accent); }
.contact { list-style: none; padding: 12px 0 0; margin: 14px 0 0; border-top: 1px solid var(--rule); font-size: 0.76rem; display: grid; grid-template-columns: repeat(2, max-content); column-gap: 22px; row-gap: 4px; letter-spacing: 0.02em; }
.contact li { white-space: nowrap; }

/* Home: tabs */
.header-img { display: block; width: 100%; aspect-ratio: 5 / 2; object-fit: cover; border-radius: 0; margin-bottom: 16px; }
#bio .about { margin-top: 14px; }
#bio .about h1 { font-size: 1.1rem; }
#bio .name-ko { font-size: 0.8rem; }
#bio .interests { font-size: 0.76rem; }
#bio .affil { font-size: 0.68rem; }
#bio .contact { font-size: 0.68rem; }

.tabs { display: flex; gap: 32px; border-bottom: 1px solid var(--rule); }
.tab { background: none; border: 0; padding: 0 0 8px; margin-bottom: -1px; cursor: pointer; font-family: var(--serif); font-size: 0.95rem; font-weight: 400; letter-spacing: 0.08em; line-height: 1.2; color: var(--muted); border-bottom: 1px solid transparent; }
.tab-end { margin-left: auto; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.tab-panel .post-list { margin-top: 20px; }

/* Projects */
.project-grid { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; }
.project-wide { grid-column: span 2; }
.tile { position: relative; display: flex; align-items: flex-end; aspect-ratio: 1 / 1; padding: 10px; border: 1px solid var(--rule); border-radius: 0; overflow: hidden; background: rgba(127,127,127,0.04); color: var(--text); transition: opacity .15s; }
.project-wide .tile { aspect-ratio: auto; height: 100%; min-height: 128px; }
a.tile:hover { opacity: .85; text-decoration: none; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-title { font-size: 0.95rem; font-weight: 500; line-height: 1.3; }
.tile-caption { margin: 6px 0 0; font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.02em; color: var(--muted); }
@media (max-width: 480px) { .tile-caption { font-size: 0.58rem; } .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .project-wide { grid-column: auto; } .project-wide .tile { aspect-ratio: 2 / 1; height: auto; min-height: 0; } }

.section-title { margin: 20px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--rule); font-size: 0.95rem; font-weight: 400; letter-spacing: 0.08em; }
/* Blog feed */
.blog-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 16px; padding-bottom: 4px; }
.topic-list { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.topic { padding: 0 0 2px; border: 0; border-bottom: 1px solid transparent; background: none; font-family: var(--serif); font-size: 0.82rem; letter-spacing: 0.04em; line-height: 1.5; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s; }
.topic:hover { color: var(--text); }
.topic[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--text); }
.topic:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.post-count { flex: none; font-size: 0.72rem; letter-spacing: 0.06em; color: var(--muted); }
.post-feed { list-style: none; padding: 0; margin: 0; }
.post-entry { border-bottom: 1px solid var(--rule); }
.post-item summary { display: block; list-style: none; cursor: pointer; padding: 14px 0; }
.post-item summary::-webkit-details-marker { display: none; }
.post-short { padding: 14px 0; }
.post-meta { display: block; font-size: 0.72rem; line-height: 1.4; letter-spacing: 0.05em; color: var(--muted); }
.post-title { display: block; margin-top: 3px; font-family: var(--serif); font-size: 1rem; line-height: 1.45; color: var(--text); }
.post-item summary:hover .post-title { color: var(--accent); }
.post-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; margin-top: 4px; font-size: 0.85rem; line-height: 1.6; color: var(--muted); }
.read-more { display: inline-block; margin-top: 6px; font-size: 0.78rem; letter-spacing: 0.03em; color: var(--accent); }
.read-more::after { content: " \2192"; }
.post-item summary:hover .read-more { text-decoration: underline; }
.post-item[open] .post-excerpt, .post-item[open] .read-more { display: none; }
.post-short-body { margin-top: 4px; font-size: 0.88rem; line-height: 1.6; }
.post-short-body p { margin: 0; }
.post-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; font-size: 0.78rem; }
.show-less { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
.show-less::before { content: "\2191  "; }
.show-less:hover { text-decoration: underline; }
.post-body { padding: 4px 0 20px; font-size: 0.92rem; overflow-wrap: anywhere; }
.post mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.panel-main { min-width: 0; }
.post-body > h2:first-child { margin-top: 8px; }
.news-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.8rem; line-height: 1.5; }
.news-list li { margin-bottom: 5px; display: flex; gap: 8px; }
.news-list .date { flex: none; }
.news-list .date { display: inline-block; min-width: 62px; color: var(--muted); font-size: 0.75rem; }

/* Photos */
.collage { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, 130px); gap: 8px; }
.collage a { display: block; border-radius: 0; overflow: hidden; }
.collage img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; transition: opacity .15s; }
.collage a:hover img { opacity: .85; }

.link-list { list-style: none; padding: 0; margin: 12px 0 0; }
.link-list li { margin-bottom: 8px; }
.link-note { color: var(--muted); font-size: 0.9rem; margin-left: 10px; }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgba(20, 18, 15, .88); }
.lightbox img { max-width: calc(100vw - 120px); max-height: calc(100vh - 80px); object-fit: contain; display: block; }
.lb-btn { position: fixed; background: none; border: 0; color: #fcfaf5; font-size: 2.6rem; line-height: 1; padding: 12px 16px; cursor: pointer; opacity: .75; }
.lb-btn:hover, .lb-btn:focus-visible { opacity: 1; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
.lb-close { top: 4px; right: 4px; font-size: 2.2rem; }
@media (max-width: 760px) { .lightbox img { max-width: calc(100vw - 32px); } .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; } }

.site-footer { margin-top: 24px; padding: 20px 0; color: var(--muted); font-size: 0.75rem; }
.nowrap { white-space: nowrap; }
