/* www.wenbo.io — handwritten, no framework. */

@font-face {
  font-family: "Inter Variable";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Variable";
  src: url("/static/fonts/inter-latin-wght-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk Variable";
  src: url("/static/fonts/space-grotesk-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f9fafb;
  --text: #1a1d21;
  --muted: #697077;
  --faint: #e3e7eb;
  --accent: #3a6ea5;
  --accent-soft: #eaf1f8;
  --card: #eff2f5;
  --code-bg: #eff2f5;
  --sans: "Inter Variable", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Space Grotesk Variable", var(--sans);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --text: #e6e9ec;
    --muted: #98a0a8;
    --faint: #2b3037;
    --accent: #8db8e0;
    --accent-soft: #1d2733;
    --card: #1b1f25;
    --code-bg: #1e232a;
  }
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0 auto;
  max-width: 56rem;
  padding: 0 2rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 600px) {
  body { padding: 0 1.2rem 3rem; }
}

/* header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.8rem 0 1rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--faint);
}
.site-name {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.site-header nav { display: flex; gap: 0.4rem; }
@media (max-width: 600px) {
  .site-header { gap: 0.5rem; }
  .site-header nav { gap: 0.1rem; }
  .site-header nav a { padding: 0.25rem 0.45rem; }
}
.site-header nav a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}
.site-header nav a:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

/* typography */
h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
h1 { font-size: 2.1rem; margin: 0 0 1.2rem; }
h2 { font-size: 1.4rem; margin: 2.8rem 0 1rem; }
h3 { font-size: 1.1rem; margin: 1.8rem 0 0.4rem; }
h4 { font-size: 1rem; margin: 1.5rem 0 0.3rem; }

a { color: var(--accent); text-decoration: none; }
article p a, article li a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 2.5px;
}
article p a:hover, article li a:hover { text-decoration-color: var(--accent); }

strong { font-weight: 600; }
hr { border: none; border-top: 1px solid var(--faint); margin: 2.5rem 0; }

blockquote {
  margin: 1.2rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 3px solid var(--faint);
  color: var(--muted);
}

/* lists on home: publications */
article ol > li { margin-bottom: 1rem; }
article ul > li { margin-bottom: 0.25rem; }

/* code */
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 0.83rem; }

/* tables */
table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; font-size: 0.93rem; }
th, td { border-bottom: 1px solid var(--faint); padding: 0.45rem 0.7rem; text-align: left; }
th { font-weight: 600; }

img { max-width: 100%; border-radius: 10px; }

/* homepage avatar */
.home img[alt="Wenbo Pan portrait"] {
  float: right;
  width: 168px;
  margin: 0.2rem 0 1.2rem 1.6rem;
  border-radius: 16px;
}
@media (max-width: 600px) {
  .home img[alt="Wenbo Pan portrait"] { float: none; display: block; margin: 0 auto 1rem; }
}

/* icon links */
.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  vertical-align: -0.18em;
  transition: color 0.15s ease, background 0.15s ease;
}
.icon-link svg { width: 1.1em; height: 1.1em; }
.icon-link:hover { color: var(--accent); }

/* standalone social rows (home contact line, footer) */
.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 1.5rem 0;
}
.social-row .icon-link {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--card);
}
.social-row .icon-link svg { width: 1.25rem; height: 1.25rem; }
.social-row .icon-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* inline icons in publication entries */
article ol .icon-link svg { width: 1.05em; height: 1.05em; }

/* news timeline — Structured-style */
.timeline {
  list-style: none;
  margin: 1.6rem 0 0;
  padding: 0;
}
.tl-item {
  display: grid;
  grid-template-columns: 3.4rem 2.2rem 1fr;
  column-gap: 0.9rem;
  margin: 0 !important;
}
.tl-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 0.45rem;
  line-height: 1.3;
  white-space: nowrap;
}
.tl-month {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
}
.tl-year {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tl-rail {
  position: relative;
  display: flex;
  justify-content: center;
}
.tl-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 1px);
  width: 2px;
  background: var(--faint);
  border-radius: 1px;
}
.tl-item:first-child .tl-rail::before { top: 0.5rem; }
.tl-item:last-child .tl-rail::before { bottom: auto; height: 0.5rem; }
.tl-node {
  position: relative;
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
  margin-top: 0.3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--bg);
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
}
.tl-accent .tl-node {
  background: color-mix(in srgb, #3f9b62 16%, var(--bg));
}
.tl-card {
  background: var(--card);
  border-radius: 12px;
  padding: 0.65rem 1rem;
  margin: 0.15rem 0 1.1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}
.tl-item:last-child .tl-card { margin-bottom: 0.2rem; }
.tl-links {
  display: inline-flex;
  gap: 0.6rem;
  margin-left: 0.45rem;
  vertical-align: -0.18em;
}
.tl-links .icon-link svg { width: 1.05rem; height: 1.05rem; }
@media (max-width: 600px) {
  .tl-item { grid-template-columns: 2.9rem 2rem 1fr; column-gap: 0.6rem; }
  .tl-node { width: 2rem; height: 2rem; font-size: 0.9rem; }
}

/* highlight work — cover-flow carousel */
.highlights { margin: 1.6rem 0 0; }
.hl-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(84%, 38rem);
  gap: 1.2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 1.5rem 8% 1.7rem;
  scrollbar-width: none;
  outline: none;
}
.hl-track::-webkit-scrollbar { display: none; }
.hl-card {
  scroll-snap-align: center;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.hl-cover {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: 0;
  display: block;
}
/* paper figures are white-background diagrams: letterbox, don't crop */
img.hl-cover {
  object-fit: contain;
  background: #fff;
  padding: 0.9rem 1.2rem;
}
.hl-placeholder {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--accent) calc(14% + var(--i) * 4%), var(--card)),
      color-mix(in srgb, var(--accent) 4%, var(--card)));
}
.hl-placeholder span {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--accent) 55%, var(--muted));
  opacity: 0.75;
}
.hl-body { padding: 1.1rem 1.4rem 1.2rem; }
.hl-venue {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.hl-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  line-height: 1.35;
}
.hl-desc {
  margin: 0 0 0.8rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}
.hl-links {
  margin: 0;
  display: flex;
  gap: 0.8rem;
}
.hl-links .icon-link svg { width: 1.15rem; height: 1.15rem; }

/* card-spread feel: cards fan out with a tilt as they leave center.
   Scroll-driven animation where supported; JS sets the same transform otherwise. */
.hl-card {
  transform-origin: 50% 130%;
  will-change: transform, opacity;
}
@supports (animation-timeline: view()) {
  .hl-card {
    animation: hl-flow linear both;
    animation-timeline: view(inline);
  }
  @keyframes hl-flow {
    0% { transform: rotate(7deg) scale(0.95); opacity: 0.5; }
    50% { transform: rotate(0deg) scale(1); opacity: 1; }
    100% { transform: rotate(-7deg) scale(0.95); opacity: 0.5; }
  }
}

.hl-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin-top: 0.9rem;
}
.hl-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: var(--card);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.hl-btn svg { width: 1.15rem; height: 1.15rem; }
.hl-btn:hover { background: var(--accent-soft); color: var(--accent); }
.hl-dots { display: flex; gap: 0.45rem; }
.hl-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: none;
  background: var(--faint);
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, transform 0.15s ease;
}
.hl-dot.on { background: var(--accent); transform: scale(1.25); }
@media (max-width: 600px) {
  .hl-track { grid-auto-columns: 88%; padding: 1.1rem 6% 1.3rem; gap: 0.8rem; }
}

/* post meta */
.post-meta {
  color: var(--muted);
  font-size: 0.92rem;
  margin: -0.5rem 0 1.8rem;
}
.tag { color: var(--muted); }
.translation-link {
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.85rem;
}

/* blog list */
.post-list { list-style: none; padding: 0; }
.post-list li {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.35rem 0;
}
.post-date {
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 6.4rem;
}
.lang-badge {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--faint);
  border-radius: 999px;
  padding: 0 0.4rem;
}

/* footer */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--faint);
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--faint); }
.site-footer a:hover { color: var(--accent); }
.fine { font-size: 0.8rem; }

/* highlight.js — minimal two-mode palette */
.hljs { color: var(--text); }
.hljs-comment, .hljs-quote { color: var(--muted); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #9c3328; }
.hljs-string, .hljs-attr, .hljs-template-variable { color: #2f6f44; }
.hljs-number, .hljs-literal { color: #9c5d00; }
.hljs-title, .hljs-name, .hljs-function .hljs-title { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  .hljs-keyword, .hljs-selector-tag, .hljs-built_in { color: #e8907f; }
  .hljs-string, .hljs-attr, .hljs-template-variable { color: #8fc9a0; }
  .hljs-number, .hljs-literal { color: #d9a85e; }
}
