/* Theme: dark default */
:root,
html.theme-dark {
  --bg: #0d1117;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --border: #30363d;
  --accent: #f85149;
  --link: #58a6ff;
  --tag-bg: #21262d;
  --tag-hover: #30363d;
  --input-border: #30363d;
}
html.theme-light {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #444;
  --border: #eee;
  --accent: #c23;
  --link: #0969da;
  --tag-bg: #f0f0f0;
  --tag-hover: #e8e8e8;
  --input-border: #ddd;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; line-height: 1.6; color: var(--text); background: var(--bg); }
.site-header { border-bottom: 1px solid var(--border); padding: 1rem 2rem; }
.nav { display: flex; justify-content: space-between; align-items: center; max-width: 960px; margin: 0 auto; }
.nav-brand { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1.125rem; font-weight: 600; color: var(--text); text-decoration: none; }
.nav-brand-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; display: block; flex-shrink: 0; }
.nav-brand-text { flex-shrink: 0; }
.nav-links { display: flex; list-style: none; margin: 0; padding: 0; gap: 1.5rem; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; }
.nav-links a:hover { color: var(--accent); }
.theme-toggle { background: none; border: none; padding: 0.35rem; cursor: pointer; color: var(--text-muted); line-height: 0; }
.theme-toggle:hover { color: var(--accent); }
.theme-icon { display: none; }
html.theme-dark .theme-icon-sun { display: inline-block; }
html.theme-light .theme-icon-moon { display: inline-block; }
main { max-width: 960px; margin: 0 auto; padding: 2rem; }
.hero { margin: 3rem 0 4rem; }
.hero-greeting { font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; margin: 0 0 0.5rem; letter-spacing: -0.02em; color: var(--text); }
.hero-name { color: var(--link); font-weight: 700; }
.hero-tagline { color: var(--accent); font-size: 1.25rem; font-style: italic; margin: 0; }

/* Home: hero with photo */
.home-hero { margin-bottom: 2.5rem; }
.home-hero-inner { display: grid; gap: 1.5rem; align-items: start; }
@media (min-width: 640px) {
  .home-hero-inner { grid-template-columns: 1fr auto; }
}
.home-hero-text { min-width: 0; }
.home-hero-image-wrap { flex-shrink: 0; }
.home-hero-image { width: 100%; max-width: 200px; height: auto; border-radius: 8px; display: block; }
@media (min-width: 640px) {
  .home-hero-image { max-width: 240px; }
}

/* Home: sections */
.home-section { margin: 2.5rem 0; padding-top: 2rem; border-top: 1px solid var(--border); }
.home-section:first-of-type { border-top: 0; padding-top: 0; }
.home-section-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 1rem; color: var(--text); }
.home-about-body { color: var(--text-muted); }
.home-about-body p { margin: 0 0 1rem; }
.home-about-body p:last-child { margin-bottom: 0; }
.home-about-body a { color: var(--link); text-decoration: none; }
.home-about-body a:hover { text-decoration: underline; }

/* Home: social links */
.home-social .social-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; }
.home-social .social-links a { color: var(--text-muted); text-decoration: none; display: inline-flex; }
.home-social .social-links a:hover { color: var(--accent); }
.social-icon-svg { width: 1.5rem; height: 1.5rem; display: block; }

.site-footer { border-top: 1px solid var(--border); padding: 1rem 2rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
.site-footer a.footer-back-to-top { color: var(--link); text-decoration: none; }
.site-footer a.footer-back-to-top:hover { text-decoration: underline; }

/* Experience timeline */
.page { margin: 2rem 0; }
.page h1 { margin-bottom: 1rem; color: var(--text); }
.experience-intro { margin-bottom: 2rem; color: var(--text-muted); }
.timeline { list-style: none; margin: 0; padding: 0; padding-left: 1.5rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding-bottom: 2rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker { position: absolute; left: -1.5rem; top: 0.25rem; width: 12px; height: 12px; margin-left: -6px; background: var(--accent); border-radius: 50%; }
.timeline-content { margin-left: 0.5rem; }
.timeline-head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.25rem; }
.timeline-head-left { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.timeline-period { font-size: 0.875rem; color: var(--text-muted); flex-shrink: 0; }
.timeline-role { font-size: 1.125rem; font-weight: 600; margin: 0; color: var(--text); }
.timeline-company { font-weight: 400; color: var(--text-muted); }
.timeline-meta-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem; margin-bottom: 0.5rem; }
.timeline-meta-row .timeline-description { margin: 0; flex: 1; min-width: 0; }
.timeline-meta-row .timeline-location { flex-shrink: 0; }
.timeline-location { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.8125rem; color: var(--text-muted); }
.timeline-location-icon { display: inline-flex; color: var(--text-muted); }
.icon-pin { flex-shrink: 0; vertical-align: middle; }
.timeline-description { margin: 0; color: var(--text-muted); font-size: 0.9375rem; }
.timeline-company-icon-wrap { flex-shrink: 0; }
.timeline-company-icon { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; display: block; }
.timeline-role a.timeline-company-link,
.timeline-company-link { color: var(--link) !important; text-decoration: none; }
.timeline-company-link:hover,
.timeline-company-link:focus { color: var(--link) !important; text-decoration: underline; opacity: 0.9; }
.timeline-company-link:visited { color: var(--link) !important; }
.timeline-company-link:visited:hover { color: var(--link) !important; text-decoration: underline; }
.timeline-tech { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.timeline-tag { display: inline-block; background: var(--tag-bg); color: var(--text-muted); padding: 0.2rem 0.6rem; border-radius: 6px; font-size: 0.75rem; border: 1px solid var(--border); white-space: nowrap; transition: box-shadow 0.2s ease; }
.timeline-tag:hover { box-shadow: 0 0 12px 2px var(--accent); }
.timeline-details { margin-top: 0.75rem; }
.timeline-details-summary { cursor: pointer; font-size: 0.875rem; list-style: none; display: inline-block; padding: 0.35rem 0.75rem; background: var(--tag-bg); color: var(--accent); border: 1px solid var(--border); border-radius: 6px; user-select: none; }
.timeline-details-summary:hover { background: var(--tag-hover); color: var(--accent); }
.timeline-details-summary::-webkit-details-marker { display: none; }
.timeline-details-summary::before { content: "▼ "; margin-right: 0.25rem; }
details[open] .timeline-details-summary::before { content: "▲ "; }
.timeline-details-content { margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.875rem; }
.timeline-details-content p { margin: 0 0 0.5rem; }
.timeline-details-content p:last-child { margin-bottom: 0; }
.timeline-project { margin-bottom: 1rem; }
.timeline-project:last-child { margin-bottom: 0; }
.timeline-project-name { margin: 0 0 0.35rem; font-size: 0.9rem; font-weight: 600; color: var(--text); }
.timeline-project-details { list-style: none; margin: 0; padding-left: 0; line-height: 1.45; }
.timeline-project-details li { margin-bottom: 0.2rem; position: relative; padding-left: 1rem; }
.timeline-project-details li::before { content: "• "; position: absolute; left: 0; color: var(--accent, currentColor); }

/* About page */
.about-layout { display: grid; gap: 2rem; margin-top: 1.5rem; }
@media (min-width: 640px) {
  .about-layout { grid-template-columns: 1fr auto; align-items: start; }
}
.about-body { min-width: 0; }
.about-body p:first-child { margin-top: 0; }
.about-body p { margin: 0 0 1rem; color: var(--text-muted); }
.about-body p:last-child { margin-bottom: 0; }
.about-body a { color: var(--link); text-decoration: none; }
.about-body a:hover { text-decoration: underline; }
.about-image-wrap { flex-shrink: 0; }
.about-image { width: 100%; max-width: 280px; height: auto; border-radius: 8px; display: block; }
.about-email { margin: 1.5rem 0 0.5rem; font-size: 0.9375rem; color: var(--text-muted); }
.about-email a { color: var(--link); text-decoration: none; }
.about-email a:hover { text-decoration: underline; }
.timeline-publication-venue { font-size: 0.9375rem; color: var(--text-muted); }
.about-page .connect-section { margin-top: 2rem; }

/* Blog list and single */
.blog-intro { margin-bottom: 2rem; color: var(--text-muted); }
.blog-rss-link { margin: -0.5rem 0 1rem; font-size: 0.875rem; }
.blog-rss-link a { color: var(--text-muted); }
.blog-rss-link a:hover { color: var(--accent); }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item { padding: 1.25rem 0; border-bottom: 1px solid var(--border); }
.post-item:first-child { padding-top: 0; }
.post-link { font-size: 1.125rem; font-weight: 600; color: var(--text); text-decoration: none; }
.post-link:hover { color: var(--accent); }
.post-meta { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.25rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
.post-tags { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.tag { background: var(--tag-bg); color: var(--text-muted); padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.8125rem; }
.post-summary { margin: 0.5rem 0 0; color: var(--text-muted); font-size: 0.9375rem; }
.post-header { margin-bottom: 1.5rem; }
.post-header .post-meta { margin-top: 0.5rem; }
.post-content { color: var(--text); }
.post-content p { margin: 0 0 1rem; }
.post-content p:last-child { margin-bottom: 0; }

/* Tag filter and taxonomy */
.tag-filter { margin-bottom: 1.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.tag-filter-label { font-size: 0.875rem; color: var(--text-muted); margin-right: 0.5rem; }
.tag-filter-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.tag-link { text-decoration: none; color: var(--text-muted); }
.tag-link:hover { background: var(--tag-hover); color: var(--text); }
.tag-link-all { font-weight: 600; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.taxonomy-intro { color: var(--text-muted); margin-bottom: 1rem; }

/* Blog search */
.blog-search-wrap { margin-bottom: 1.5rem; }
.blog-search-label { display: block; font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.blog-search-input { width: 100%; max-width: 24rem; padding: 0.5rem 0.75rem; font-size: 1rem; border: 1px solid var(--input-border); border-radius: 6px; background: var(--bg); color: var(--text); }
.blog-search-input:focus { outline: none; border-color: var(--accent); }
.blog-search-no-results { margin: 1rem 0 0; color: var(--text-muted); font-size: 0.9375rem; }
.blog-search-data { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Papershelf */
.papershelf-intro { margin-bottom: 2rem; color: var(--text-muted); }
.papershelf-list { list-style: none; margin: 0; padding: 0; }
.papershelf-item { padding: 1.5rem 0; border-bottom: 1px solid var(--border); }
.papershelf-item:last-child { border-bottom: 0; }
.papershelf-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; margin-bottom: 0.5rem; }
.papershelf-title { font-weight: 600; color: var(--text); }
.papershelf-title[href]:hover { color: var(--accent); }
.papershelf-authors { color: var(--text-muted); font-size: 0.9375rem; }
.papershelf-source, .papershelf-year { font-size: 0.875rem; color: var(--text-muted); }
.papershelf-comment { margin: 0; color: var(--text-muted); font-size: 0.9375rem; font-style: italic; }
