/* Site theme inspired by the PRISM academic template.
   Light palette on :root, dark palette under [data-theme="dark"]. */

:root {
  --bg: #fefffe;
  --surface: #f8fafc;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --text: #334155;
  --text-strong: #1e293b;
  --muted: #64748b;
  --accent: #d4a562;          /* decorative gold */
  --accent-ink: #94661f;      /* gold that passes contrast on light backgrounds */
  --accent-soft: rgba(212, 165, 98, 0.14);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, 0.18);
  --nav-bg: rgba(254, 255, 254, 0.82);
  --thumb-bg: #ffffff;
  --radius: 12px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Georgia, "Times New Roman", "Noto Serif SC", "Songti SC", serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", Consolas, "Courier New", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: rgba(148, 163, 184, 0.22);
  --text: #cbd5e1;
  --text-strong: #f8fafc;
  --muted: #94a3b8;
  --accent: #e4b976;
  --accent-ink: #e9c48a;
  --accent-soft: rgba(228, 185, 118, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.55);
  --nav-bg: rgba(15, 23, 42, 0.82);
  --thumb-bg: #f8fafc;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; transition: color .15s ease, background-color .15s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--text-strong); line-height: 1.25; }
strong { color: var(--text-strong); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- navigation ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 0 24px;
  height: 68px; display: flex; align-items: center; gap: 16px;
}
.nav-brand {
  font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700;
  color: var(--text-strong); margin-right: auto; white-space: nowrap;
}
.nav-brand:hover { color: var(--accent-ink); text-decoration: none; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  padding: 8px 12px; border-radius: 8px;
  font-size: .9rem; font-weight: 500; color: var(--muted);
}
.nav-links a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--text-strong); background: var(--accent-soft); }
.nav-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s;
}
.icon-btn:hover { color: var(--accent-ink); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.nav-menu-btn { display: none; }

@media (max-width: 900px) {
  .nav-menu-btn { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px; font-size: 1rem; }
}

/* ---------- page layout ---------- */
.page-wrap { max-width: 1120px; margin: 0 auto; padding: 40px 24px 64px; }
.page-wrap.has-profile {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 56px; align-items: start;
}
.profile-col { position: sticky; top: 100px; }
.content-col.narrow { max-width: 820px; margin: 0 auto; }
.content-col.wide { max-width: 1040px; margin: 0 auto; }
@media (max-width: 900px) {
  .page-wrap { padding: 28px 16px 48px; }
  .page-wrap.has-profile { grid-template-columns: 1fr; gap: 36px; }
  .profile-col { position: static; }
}

.page-header { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.page-title { font-size: 2.2rem; margin: 0; }
.page-subtitle { margin: 6px 0 0; color: var(--muted); }

/* ---------- profile ---------- */
.profile-card { text-align: center; }
.avatar {
  width: 220px; max-width: 100%; margin: 0 auto 20px; border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow-lg); transition: transform .25s ease;
}
.avatar:hover { transform: scale(1.03); }
.avatar img { width: 100%; height: auto; display: block; }
.profile-name { font-size: 1.8rem; margin: 0 0 4px; }
.profile-role { color: var(--accent-ink); font-weight: 600; margin: 0; }
.profile-org { color: var(--muted); margin: 0 0 14px; }
.profile-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; }
.profile-links a, .profile-links span {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; color: var(--muted);
}
.profile-links a:hover { color: var(--accent-ink); background: var(--accent-soft); }
.profile-links svg { width: 20px; height: 20px; }
.profile-address { font-size: .82rem; color: var(--muted); margin: 2px 0 18px; }
.interests-box {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
}
.interests-box h3 { font-family: var(--font-sans); font-size: .95rem; margin: 0 0 8px; }
.interests-box ul { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.interests-box li { padding: 3px 0 3px 14px; position: relative; }
.interests-box li::before {
  content: ""; position: absolute; left: 0; top: .78em; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent);
}

/* ---------- buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 10px; font-weight: 500; font-size: .92rem;
  border: 1px solid transparent; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-outline { border-color: var(--border); color: var(--text-strong); background: var(--bg); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-primary { background: var(--text-strong); color: var(--bg); }
.btn-primary:hover { background: var(--accent-ink); color: #fff; }
.btn-block { width: 100%; }
.chip {
  position: relative; z-index: 2;
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: .78rem; font-weight: 500; color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); text-decoration: none; }

/* ---------- home sections ---------- */
.section { margin-bottom: 52px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2, .section > h2 { font-size: 1.6rem; margin: 0; }
.section > h2 { margin-bottom: 18px; }
.section-head a { font-size: .9rem; font-weight: 500; }
.bio p { margin: 0 0 14px; }
.bio a { font-weight: 500; }
.callout {
  margin-top: 18px; padding: 12px 16px; border-radius: 10px;
  background: var(--accent-soft); border-left: 3px solid var(--accent); color: var(--text-strong);
}

/* ---------- news ---------- */
.news-scroll {
  max-height: 340px; overflow-y: auto; padding: 6px 18px 6px 4px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent);
  mask-image: linear-gradient(to bottom, #000 88%, transparent);
}
.news-scroll::-webkit-scrollbar { width: 6px; }
.news-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.news-list { list-style: none; margin: 0; padding: 0 0 28px; }
.news-list li {
  display: grid; grid-template-columns: 82px 1fr; gap: 12px;
  padding: 11px 0 11px 14px; border-bottom: 1px dashed var(--border); font-size: .93rem;
}
.news-list li:last-child { border-bottom: 0; }
.news-list time {
  font-size: .78rem; font-weight: 600; color: var(--accent-ink);
  font-variant-numeric: tabular-nums; padding-top: 2px; white-space: nowrap;
}
@media (max-width: 480px) {
  .news-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- publication cards ---------- */
.pub-list { display: flex; flex-direction: column; gap: 16px; }
.prose .pub-note, .pub-note { margin: -8px 0 16px; color: var(--muted); font-size: .88rem; }
.pub-card {
  position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px;
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pub-card.is-linked:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.pub-thumb {
  aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden;
  background: var(--thumb-bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub-thumb-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 12px;
  background:
    radial-gradient(circle at 20% 20%, rgba(212, 165, 98, .35), transparent 55%),
    radial-gradient(circle at 85% 80%, rgba(100, 116, 139, .35), transparent 55%),
    #1e293b;
}
.pub-thumb-placeholder span {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; color: #f8fafc;
  text-align: center; letter-spacing: .02em;
}
.pub-body { min-width: 0; }
.pub-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 6px;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
}
.badge-venue { background: var(--text-strong); color: var(--bg); }
.badge-award { background: #fdf0d5; color: #8a5a12; }
.badge-note { background: var(--accent-soft); color: var(--accent-ink); }
[data-theme="dark"] .badge-award { background: rgba(228, 185, 118, .2); color: #f0c674; }
.pub-card .pub-title { font-family: var(--font-sans); font-size: 1.02rem; font-weight: 600; margin: 0 0 6px; line-height: 1.4; }
.pub-title a { color: var(--text-strong); }
.pub-title a:hover { color: var(--accent-ink); text-decoration: none; }
.pub-title a.stretched::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.pub-card .pub-authors { font-size: .88rem; margin: 0 0 4px; color: var(--muted); }
.pub-authors .me { color: var(--text-strong); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pub-card .pub-venue { font-size: .84rem; font-style: italic; margin: 0 0 10px; color: var(--muted); }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 640px) {
  .pub-card { grid-template-columns: 1fr; gap: 14px; }
  .pub-thumb:has(.pub-thumb-placeholder) { aspect-ratio: 5 / 1; }
}
.pub-year {
  font-size: 1.3rem; margin: 36px 0 14px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.pub-year-group:first-of-type .pub-year { margin-top: 0; }
.pub-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filter-btn {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer;
}
.filter-btn:hover { border-color: var(--accent); }
.filter-btn.active { background: var(--text-strong); color: var(--bg); border-color: var(--text-strong); }

/* ---------- prose (blogs, CV, service, ...) ---------- */
.prose { font-size: 1.02rem; }
.prose h2 { font-size: 1.55rem; margin: 2.2em 0 .7em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.2rem; margin: 1.8em 0 .5em; }
.prose h4 { font-size: 1.05rem; margin: 1.5em 0 .4em; font-family: var(--font-sans); }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05em; }
.prose li { margin-bottom: .35em; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.2em 0; }
.prose blockquote {
  margin: 1.4em 0; padding: .6em 1.1em; border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: 0 8px 8px 0; color: var(--text);
}
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: .12em .38em; border-radius: 5px; }
.prose pre { background: var(--surface-2); padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: .88rem; }
.prose pre code { background: none; padding: 0; }
.prose img { display: block; margin: 1.4em auto; border-radius: 8px; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: .92rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface); color: var(--text-strong); }

/* ---------- CV ---------- */
.cv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.cv-entry { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.cv-entry-title { font-weight: 600; color: var(--text-strong); }
.cv-entry-date { color: var(--muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cv-entry-sub { color: var(--muted); font-size: .94rem; margin: 2px 0 18px; }
.cv-pubs { padding-left: 0; list-style: none; counter-reset: pub; }
.cv-pubs li { display: grid; grid-template-columns: 150px 1fr; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: .94rem; }
.cv-pubs .cv-venue { font-weight: 600; color: var(--accent-ink); font-size: .85rem; padding-top: 2px; }
.cv-pubs .me { font-weight: 600; color: var(--text-strong); }
@media (max-width: 560px) { .cv-pubs li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- cards used on service / teaching ---------- */
.info-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 18px 20px; margin-bottom: 14px;
}
.prose .info-card h3 { margin: 0 0 4px; font-family: var(--font-sans); font-size: 1.02rem; }
.prose .info-card p { margin: 0; }
.info-card .meta { color: var(--muted); font-size: .9rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.prose .tag-row li {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); font-size: .88rem; margin: 0;
}

/* ---------- blog list ---------- */
.blog-list { display: flex; flex-direction: column; gap: 14px; }
.blog-item {
  position: relative; display: block; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.blog-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--accent); text-decoration: none; }
.blog-list .blog-item h3 { margin: 6px 0 6px; font-family: var(--font-sans); font-size: 1.08rem; color: var(--text-strong); }
.blog-list .blog-item p { margin: 0; color: var(--muted); font-size: .9rem; }
.blog-meta { display: flex; gap: 8px; align-items: center; font-size: .82rem; color: var(--muted); }

/* ---------- gallery ---------- */
.gallery-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.gallery { columns: 3 260px; column-gap: 14px; }
.gallery-item {
  display: block; break-inside: avoid; margin: 0 0 14px; border-radius: 10px; overflow: hidden;
  position: relative; background: var(--surface-2);
}
.gallery-item img { display: block; width: 100%; height: auto; transition: transform .35s ease; margin: 0; border-radius: 0; }
.gallery-item:hover img { transform: scale(1.04); }
.gallery-item .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font-size: .85rem;
  opacity: 0; transition: opacity .2s ease;
}
.gallery-item:hover .cap, .gallery-item:focus-visible .cap { opacity: 1; }
.gallery-empty {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 36px 20px;
  text-align: center; color: var(--muted);
}

.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(2, 6, 23, .92);
  display: flex; align-items: center; justify-content: center; padding: 48px 56px;
}
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; text-align: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 140px); border-radius: 6px; }
.lightbox figcaption { color: #e2e8f0; margin-top: 10px; font-size: .92rem; }
.lb-btn {
  position: absolute; background: rgba(255, 255, 255, .1); color: #fff; border: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.8rem; line-height: 1;
}
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 20px 24px;
  display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap;
  font-size: .8rem; color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
