/* ---- wanhee.ai — custom minimal dark theme ---- */

:root {
  --bg: #15171c;
  --fg: #c4c8d0;
  --heading: #f0f2f5;
  --muted: #767d8c;
  --accent: #82a9ff;
  --accent-dim: #6d8fe0;
  --border: #262a33;
  --code-bg: #1c1f27;
  --sel: #33507a;
  --maxw: 46rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--sel); color: #fff; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dim); text-decoration: underline; text-underline-offset: 2px; }

.muted { color: var(--muted); }

/* ---- header ---- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 2.4rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.6rem;
}
.brand {
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--heading);
}
.brand:hover { text-decoration: none; color: #fff; }
.nav { display: flex; gap: 1.15rem; font-size: 0.95rem; }
.nav a { color: var(--muted); }
.nav a:hover { color: var(--fg); text-decoration: none; }

main { flex: 1 0 auto; }

/* ---- home intro ---- */
.profile {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  margin-bottom: 3rem;
}
.avatar {
  width: 128px;
  height: 128px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center 30%;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.intro {
  font-size: 1.06rem;
  color: var(--fg);
  margin-bottom: 3rem;
}
.intro p { margin: 0; }
.intro p + p { margin-top: 0.9rem; }
.intro strong { color: var(--heading); font-weight: 620; }

/* ---- publications ---- */
.theme-title {
  color: var(--heading);
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 3rem 0 1.4rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
}
.pub { margin-bottom: 1.5rem; }
.pub-title { font-size: 1.04rem; font-weight: 600; line-height: 1.4; }
.pub-title a { color: var(--heading); }
.pub-title a:hover { color: var(--accent); text-decoration: none; }
.pub-authors { font-size: 0.9rem; color: var(--muted); margin: 0.2rem 0 0.15rem; }
.pub-authors strong { color: var(--fg); font-weight: 620; }
.pub-venue { font-size: 0.85rem; color: var(--muted); }
.pub-venue .venue { color: var(--accent); font-weight: 550; }
.pub-venue a { color: var(--muted); }
.pub-venue a:hover { color: var(--fg); }

@media (max-width: 540px) {
  .profile { gap: 1.1rem; }
  .avatar { width: 92px; height: 92px; }
}

/* ---- book ---- */
.wrap-wide { max-width: 64rem; }

.book { display: flex; gap: 3rem; align-items: flex-start; }

.book-sidebar {
  width: 15rem;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
  align-self: flex-start;
}
.book-side-title {
  display: block;
  color: var(--heading);
  font-weight: 620;
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.book-side-title:hover { text-decoration: none; color: #fff; }
.book-toc ul { list-style: none; margin: 0 0 0.3rem; padding: 0; }
.book-toc li { margin: 0.25rem 0; font-size: 0.9rem; line-height: 1.3; }
.book-toc li a { color: var(--fg); }
.book-toc li a:hover { color: var(--accent); text-decoration: none; }
.book-toc li.current a { color: var(--accent); font-weight: 600; }
.book-part {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  margin: 1.2rem 0 0.45rem;
}

.book-content { flex: 1; min-width: 0; }
.book-crumb {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.5rem;
}
.book-h1 {
  color: var(--heading);
  font-size: 2.1rem;
  line-height: 1.15;
  letter-spacing: -0.028em;
  margin: 0 0 1.8rem;
}
.book-pager {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}
.book-pager a { color: var(--muted); }
.book-pager a:hover { color: var(--fg); text-decoration: none; }
.book-pager .next { margin-left: auto; text-align: right; }

/* book cover / TOC page */
.book-kicker {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.9rem;
}
.book-cover-title {
  color: var(--heading);
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 0.6rem;
}
.book-cover-sub { font-size: 1.2rem; color: var(--fg); margin: 0 0 1.4rem; }
.book-cover-author { color: var(--muted); margin: 0 0 1.8rem; }
.book-cover-begin { margin: 0 0 3rem; font-size: 1.02rem; }
.book-contents-list {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0;
  counter-reset: none;
}
.book-contents-list li { margin: 0.35rem 0; font-size: 1.02rem; }

@media (max-width: 780px) {
  .book { flex-direction: column; gap: 1.5rem; }
  .book-sidebar {
    position: static;
    width: 100%;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border);
  }
}

.section-title,
.page-title {
  color: var(--heading);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin: 0 0 1.6rem;
}
.page-title { font-size: 1.9rem; letter-spacing: -0.02em; text-transform: none; margin-bottom: 1rem; }

/* ---- post list ---- */
.post-item { margin-bottom: 2.4rem; }
.post-meta {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  margin-bottom: 0.3rem;
}
.post-item-title { margin: 0 0 0.35rem; font-size: 1.32rem; font-weight: 620; letter-spacing: -0.015em; }
.post-item-title a { color: var(--heading); }
.post-item-title a:hover { color: var(--accent); text-decoration: none; }
.excerpt { margin: 0; color: var(--fg); }

/* ---- single post ---- */
.post-title { color: var(--heading); font-size: 2.1rem; line-height: 1.2; letter-spacing: -0.025em; margin: 0 0 0.5rem; }
.post .post-meta { margin-bottom: 2.4rem; }
.post-body { font-size: 1.02rem; }
.post-body h2 { color: var(--heading); font-size: 1.5rem; letter-spacing: -0.02em; margin: 2.6rem 0 0.9rem; }
.post-body h3 { color: var(--heading); font-size: 1.2rem; margin: 2rem 0 0.7rem; }
.post-body p, .post-body ul, .post-body ol { margin: 0 0 1.2rem; }
.post-body ul, .post-body ol { padding-left: 1.3rem; }
.post-body li { margin-bottom: 0.4rem; }
.post-body strong { color: var(--heading); font-weight: 620; }
.post-body img { max-width: 100%; height: auto; border-radius: 6px; }
.post-body blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 2.4rem 0; }

.pub-list { padding-left: 1.4rem; }
.pub-list li { margin-bottom: 0.85rem; }

.page p { margin: 0 0 1.2rem; }

/* ---- code ---- */
code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.86em;
}
:not(pre) > code {
  background: var(--code-bg);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  color: #e2c08d;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
  margin: 0 0 1.2rem;
}
pre code { background: none; padding: 0; color: #d4d8e0; font-size: 0.85rem; }

/* Prism dark tokens */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6b7280; font-style: italic; }
.token.punctuation { color: #9aa2b1; }
.token.keyword, .token.boolean, .token.operator { color: #c792ea; }
.token.string, .token.char, .token.attr-value { color: #a5d6a7; }
.token.function, .token.class-name { color: #82a9ff; }
.token.number, .token.constant { color: #f78c6c; }
.token.builtin, .token.tag, .token.attr-name { color: #7fdbca; }
.token.comment.doc { color: #6b7280; }

/* MathJax */
mjx-container[display="true"] { margin: 1.4rem 0; overflow-x: auto; overflow-y: hidden; }

.back { margin-top: 3rem; font-size: 0.95rem; }
.back a { color: var(--muted); }

/* subtle 'previously' link on the home page (no footer) */
.prev-note {
  margin-top: 4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.prev-note a { color: var(--muted); }
.prev-note a:hover { color: var(--fg); }

/* ---- responsive ---- */
@media (max-width: 540px) {
  body { font-size: 17px; }
  .site-header { padding: 1.8rem 0 1.4rem; margin-bottom: 2rem; }
  .post-title { font-size: 1.7rem; }
}
