/* Personal site shell, inspired by the compact academic layout of al-folio. */
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400&display=swap');
:root {
  color-scheme: dark;
  --bg: #1b1b1b;
  --surface: #232323;
  --surface-raised: #2a2a2a;
  --text: #ebebeb;
  --muted: #ababab;
  --line: #3a3a3a;
  --accent: #27a7d7;
  --accent-soft: rgba(39, 167, 215, .14);
  --code-bg: #141414;
  --shadow: 0 18px 48px rgba(0, 0, 0, .2);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-raised: #f4f5f5;
  --text: #202124;
  --muted: #656b73;
  --line: #e3e4e5;
  --accent: #8e4b95;
  --accent-soft: rgba(142, 75, 149, .1);
  --code-bg: #f2f3f4;
  --shadow: 0 18px 48px rgba(28, 36, 44, .08);
}

html { scroll-behavior: smooth; }

body.site-page,
body.legacy-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, "PingFang SC", "Microsoft YaHei", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.72;
}

.site-page *, .legacy-page * { box-sizing: border-box; }
.site-page a, .legacy-page a { color: var(--accent); text-decoration: none; }
.site-page a:hover, .legacy-page a:hover { color: var(--text); text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  min-height: 57px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 93%, transparent);
  backdrop-filter: blur(16px);
}

.site-nav {
  box-sizing: content-box;
  width: min(900px, calc(100% - 60px));
  min-height: 57px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
}

.site-brand {
  display: none;
}

.site-links { display: flex; align-items: center; gap: 18px; }
.site-links a { color: var(--text); font-size: 1rem; }
.site-links a[aria-current="page"], .site-links a:hover { color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 1.22rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); background: var(--accent-soft); }

.site-main { box-sizing: content-box; width: min(900px, calc(100% - 60px)); margin: 0 auto; padding: 0 15px; }
.hero { display: grid; grid-template-columns: minmax(0, 600px) 270px; column-gap: 30px; row-gap: 8px; align-items: start; padding: 48px 0 0; }
.eyebrow { margin: 0 0 13px; color: var(--accent); font-size: .82rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.hero h1 { grid-column: 1 / -1; margin: 0 0 8px; color: var(--text); font-size: 40px; line-height: 48px; letter-spacing: -.02em; font-weight: 300; }
.hero h1 strong { font-weight: 700; }
.hero-copy { max-width: 600px; margin: 0; color: var(--text); font-size: 16px; line-height: 24px; }
.hero-copy + .hero-copy { margin-top: 24px; }

.portrait-wrap { position: relative; }
.portrait { display: block; width: 270px; height: 360px; margin: 0; object-fit: cover; object-position: center; border-radius: 5px; box-shadow: 0 4px 12px rgba(0, 0, 0, .14); filter: saturate(.9) contrast(1.02); }
.portrait-wrap::after { display: none; }

.home-section { padding: 0 0 68px; }
.hero + .home-section { padding-top: 16px; }
.section-title { margin: 0 0 8px; color: var(--text); font-size: 32px; font-weight: 300; letter-spacing: -.02em; line-height: 38.4px; }
.record-list { margin: 0; }
.record-row { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 24px; padding: 18px 0 0; }
.record-row dt { color: var(--text); font-size: 16px; font-weight: 700; line-height: 24px; }
.record-row dd { margin: 0; color: var(--text); font-size: 16px; line-height: 24px; }
.publication { display: grid; grid-template-columns: 126px minmax(0, 1fr); gap: 24px; align-items: start; padding: 18px 0 0; }
.publication-badge { display: inline-block; min-width: 126px; padding: 3px 14px; border-radius: 5px; background: var(--accent); color: #ffffff; font-size: 16px; font-weight: 700; line-height: 20px; text-align: center; }
.publication-title { color: var(--text) !important; font-size: 16px; font-weight: 700; line-height: 24px; }
.publication-title:hover { color: var(--accent) !important; }
.publication p { margin: 4px 0 0; color: var(--text); font-size: 16px; line-height: 24px; }
.publication .publication-authors { margin-top: 4px; }
.publication-author-self { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.publication .publication-venue { color: var(--muted); font-style: italic; }

.social-section { display: flex; justify-content: center; gap: 38px; padding: 4px 0 62px; }
.social-link { display: inline-grid; place-items: center; width: 58px; height: 58px; color: var(--text) !important; transition: color .16s ease, transform .16s ease; }
.social-link:hover { color: var(--accent) !important; transform: translateY(-3px); }
.social-link svg { display: block; width: 54px; height: 54px; overflow: visible; fill: currentColor; }

.site-footer { box-sizing: content-box; width: min(900px, calc(100% - 60px)); margin: 0 auto; padding: 20px 15px 28px; color: var(--muted); font-size: .875rem; border-top: 1px solid var(--line); }
.site-footer p { margin: 0; }

/* Blog archive */
.blog-header { padding: clamp(62px, 10vw, 116px) 0 36px; }
.blog-header h1 { margin: 0; color: var(--text); font-size: clamp(3rem, 7vw, 5.6rem); line-height: .95; letter-spacing: -.07em; font-weight: 750; }
.blog-header p { max-width: 620px; margin: 20px 0 0; color: var(--muted); font-size: 1.12rem; }
.blog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.blog-count { color: var(--muted); font-size: .92rem; }
.blog-search { width: min(320px, 62vw); padding: 10px 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
.blog-search:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-list { margin: 0; padding: 2px 0 58px; list-style: none; }
.post-item { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 26px; padding: 24px 0; border-bottom: 1px solid var(--line); transition: padding .2s ease; }
.post-item:hover { padding-left: 9px; }
.post-date { padding-top: 5px; color: var(--muted); font-size: .93rem; font-variant-numeric: tabular-nums; }
.post-title { display: inline-block; color: var(--text) !important; font-size: clamp(1.17rem, 2vw, 1.45rem); font-weight: 660; letter-spacing: -.024em; line-height: 1.35; }
.post-title:hover { color: var(--accent) !important; }
.post-labels { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.post-label { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; }
.no-results { display: none; padding: 36px 0 60px; color: var(--muted); text-align: center; }
.no-results.is-visible { display: block; }

/* Existing Hexo article pages receive the same navigation and reading palette. */
body:not(.site-page) > header:not([data-site-shell]),
body:not(.site-page) > footer,
body:not(.site-page) > main > #scroll-top-button,
body:not(.site-page) #modalSearch { display: none !important; }

.legacy-page .legacy-site-header { display: block !important; }
.legacy-page .site-main { padding-top: 0; }
.legacy-page main { min-height: calc(100vh - 70px); background: var(--bg); }
.legacy-page .legacy-article-head { width: min(840px, calc(100% - 40px)); margin: 0 auto; padding: clamp(52px, 9vw, 102px) 0 38px; border-bottom: 1px solid var(--line); }
.legacy-page .legacy-article-head h1 { margin: 0; color: var(--text); font-size: clamp(2.3rem, 5.5vw, 4.8rem); line-height: 1.12; letter-spacing: -.06em; }
.legacy-page .legacy-article-head time { display: block; margin-top: 16px; color: var(--muted); font-size: .94rem; }
.legacy-page .post-content { width: min(840px, calc(100% - 40px)); margin: 0 auto !important; padding: 45px 0 72px; color: var(--text); }
.legacy-page .post-content > #seo-header { display: none; }
.legacy-page .post-content .markdown-body,
.legacy-page .about-content .markdown-body { color: var(--text); background: transparent; font: inherit; line-height: 1.78; }
.legacy-page .markdown-body h1, .legacy-page .markdown-body h2, .legacy-page .markdown-body h3, .legacy-page .markdown-body h4 { color: var(--text); border-bottom-color: var(--line); letter-spacing: -.03em; }
.legacy-page .markdown-body h2 { margin-top: 2.25em; }
.legacy-page .markdown-body p, .legacy-page .markdown-body li { color: var(--text); font-size: 1.06rem; }
.legacy-page .markdown-body a { color: var(--accent); }
.legacy-page .markdown-body blockquote { color: var(--muted); border-left-color: var(--accent); }
.legacy-page .markdown-body hr, .legacy-page .post-content > hr { border-color: var(--line); }
.legacy-page .markdown-body table { display: block; max-width: 100%; overflow-x: auto; color: var(--text); }
.legacy-page .markdown-body table tr, .legacy-page .markdown-body table td, .legacy-page .markdown-body table th { background: transparent; border-color: var(--line); }
.legacy-page .markdown-body pre, .legacy-page .markdown-body code, .legacy-page .highlight { background: var(--code-bg) !important; border-color: var(--line); }
.legacy-page .markdown-body pre { padding: 16px; border-radius: 7px; }
.legacy-page .markdown-body img { max-width: 100%; height: auto; border-radius: 5px; background: var(--surface); }
.legacy-page .markdown-body .figure { margin: 28px auto; text-align: center; }
.legacy-page .markdown-body .caption { margin-top: 8px; color: var(--muted); font-size: .86rem; }
.legacy-page .license-box { border-color: var(--line); background: var(--surface); color: var(--muted); }
.legacy-page .license-box a { color: var(--accent); }
.legacy-page .post-prevnext { display: flex; justify-content: space-between; gap: 18px; }
.legacy-page .post-prevnext .post-prev, .legacy-page .post-prevnext .post-next { width: auto; padding: 0; }
.legacy-page .post-prevnext a { color: var(--accent); }

.legacy-page:not(.legacy-post) main { width: min(920px, calc(100% - 40px)); margin: 0 auto; padding: 56px 0 72px; }
.legacy-page:not(.legacy-post) #board { padding: 0; background: transparent; box-shadow: none; }
.legacy-page:not(.legacy-post) .about-avatar { margin: 0 auto 22px; }
.legacy-page:not(.legacy-post) .about-avatar img { border-radius: 9px; }
.legacy-page:not(.legacy-post) .about-name, .legacy-page:not(.legacy-post) .about-intro { color: var(--text); }
.legacy-page .index-card:has(a[href="/2024/06/19/Some-Words-To-U/"]),
.legacy-page .index-card:has(a[href="/2024/10/30/muduo/"]),
.legacy-page a[href="/2024/06/19/Some-Words-To-U/"],
.legacy-page a[href="/2024/10/30/muduo/"] { display: none !important; }

@media (max-width: 720px) {
  .site-nav, .site-main, .site-footer { box-sizing: border-box; width: calc(100% - 32px); padding-left: 0; padding-right: 0; }
  .site-nav { min-height: 60px; }
  .site-header { min-height: 60px; }
  .site-links { gap: 16px; }
  .hero { grid-template-columns: 1fr; padding: 40px 0 30px; }
  .hero h1 { grid-column: auto; }
  .portrait { width: min(270px, 100%); height: auto; aspect-ratio: 3 / 4; margin: 14px auto 0; }
  .portrait-wrap { order: -1; max-width: 340px; width: calc(100% - 16px); margin: 0 auto; }
  .record-row, .publication { grid-template-columns: 1fr; gap: 5px; padding-bottom: 22px; }
  .publication-badge { min-width: 110px; }
  .social-section { gap: 28px; padding-bottom: 42px; }
  .post-item { grid-template-columns: 1fr; gap: 5px; }
  .post-date { padding: 0; }
  .blog-toolbar { align-items: flex-start; flex-direction: column-reverse; }
  .blog-search { width: 100%; }
  .legacy-page .legacy-article-head, .legacy-page .post-content { width: min(100% - 32px, 840px); }
  .legacy-page .post-content { padding-top: 32px; }
  .legacy-page .markdown-body p, .legacy-page .markdown-body li { font-size: 1rem; }
}
