@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 230px;
  --accent: #1d4ed8;          /* deeper blue for links & highlights */
  --accent-dark: #1e3a8a;
  --accent-light: rgba(29, 78, 216, 0.08);
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --content-max: 720px;

  --page-bg: #fff;
  --surface: #f3f4f6;
  --body-text: #374151;

  /* dark sidebar palette */
  --sidebar-bg: #0f172a;       /* slate-900 */
  --sidebar-border: #1e293b;
  --sidebar-name: #f1f5f9;
  --sidebar-muted: #94a3b8;
  --sidebar-accent: #60a5fa;   /* bright blue, readable on dark */
  --sidebar-hover-bg: rgba(96, 165, 250, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--page-bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── SIDEBAR ──────────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-style: solid;
  border-width: 0 3px 0 0;
  border-image: linear-gradient(180deg, var(--sidebar-accent), var(--accent)) 1;
  padding: 2.5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  margin-bottom: 1rem;
  border: 2px solid var(--sidebar-accent);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.sidebar-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  margin-bottom: 0.2rem;
  color: var(--sidebar-name);
}

.sidebar-affil {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  line-height: 1.4;
  margin-bottom: 1.75rem;
}

.sidebar-nav {
  list-style: none;
  margin-bottom: 1.5rem;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.sidebar-nav a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 5px;
  border-left: 2px solid transparent;
  color: var(--sidebar-muted);
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.sidebar-nav a:hover {
  color: #fff;
  background: var(--sidebar-hover-bg);
  text-decoration: none;
}

.sidebar-nav a.active {
  color: var(--sidebar-accent);
  background: var(--sidebar-hover-bg);
  border-left-color: var(--sidebar-accent);
  font-weight: 600;
}

.sidebar-links {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--sidebar-muted);
}

.sidebar-links a svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.sidebar-links a:hover {
  color: var(--sidebar-accent);
  text-decoration: none;
}

/* ── MAIN CONTENT ─────────────────────────────────────────────────────────── */

.main {
  margin-left: var(--sidebar-width);
  padding: 3.5rem 4rem 5rem 3.5rem;
  max-width: calc(var(--sidebar-width) + var(--content-max));
}

section {
  margin-bottom: 4rem;
  scroll-margin-top: 2rem;
}

section h2 {
  position: relative;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1.75rem;
}

section h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 2.25rem;
  height: 2px;
  background: var(--accent);
}

/* ── ABOUT ────────────────────────────────────────────────────────────────── */

.about-name {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.3rem;
}

.about-affil {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
}

.about-tagline {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.about-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.chip {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
}

.about-bio {
  max-width: 640px;
  color: var(--body-text);
}

.about-interests {
  margin-top: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.interests-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 0.5rem;
}

.about-photo-mobile {
  display: none;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  margin-bottom: 1.25rem;
}

/* ── CV ───────────────────────────────────────────────────────────────────── */

.cv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
}

.cv-table td {
  padding: 0.45rem 0;
  vertical-align: top;
}

.cv-table td:first-child {
  width: 150px;
  color: var(--muted);
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  letter-spacing: -0.02em;
  padding-right: 1.25rem;
  padding-top: 0.55rem;
  white-space: nowrap;
}

.cv-sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.1rem;
}

.subsection-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 2rem 0 0.9rem;
}

/* ── AWARDS ───────────────────────────────────────────────────────────────── */

.awards-list {
  list-style: none;
  padding: 0;
}

.awards-list li {
  padding: 0.35rem 0;
  font-size: 0.92rem;
}

/* ── TALKS ────────────────────────────────────────────────────────────────── */

.talks-list {
  list-style: none;
  padding: 0;
}

.talks-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.talks-list li:last-child {
  border-bottom: none;
}

.talk-venue {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.15rem;
}

.talk-title {
  font-style: italic;
}

/* ── PUBLICATIONS ─────────────────────────────────────────────────────────── */

.pub-list {
  list-style: none;
  padding: 0;
}

.pub-list li {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  line-height: 1.55;
}

.pub-list li:last-child {
  border-bottom: none;
}

.pub-links {
  margin-top: 0.3rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.pub-links a {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 6px;
  transition: background 0.15s, color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.pub-links a:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(29, 78, 216, 0.25);
}

/* ── BLOG ─────────────────────────────────────────────────────────────────── */

.blog-list {
  list-style: none;
  padding: 0;
}

.blog-list li {
  margin-bottom: 1rem;
}

.blog-card {
  display: block;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.blog-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(29, 78, 216, 0.12);
}

.blog-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.blog-card:hover .blog-card-title {
  color: var(--accent);
}

.blog-date {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}

.blog-card-abstract {
  font-size: 0.85rem;
  color: var(--body-text);
  line-height: 1.55;
  margin: 0;
}

.blog-empty {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── BLOG POST PAGES ──────────────────────────────────────────────────────── */

body.post-body {
  background: var(--page-bg);
}

.post-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.post-back {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.post-back:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-title {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.post-meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-content {
  line-height: 1.75;
  color: var(--body-text);
}

.post-content p { margin-bottom: 1.25rem; }
.post-content h2 { font-size: 1.15rem; font-weight: 600; margin: 2rem 0 0.75rem; }
.post-content h3 { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1.25rem; }
.post-content li { margin-bottom: 0.4rem; }
.post-content code { background: var(--surface); padding: 1px 5px; border-radius: 3px; font-size: 0.88em; }
.post-content pre { background: var(--surface); padding: 1rem; border-radius: 6px; overflow-x: auto; margin-bottom: 1.25rem; }

/* ── MATH POSTS: THEOREMS, PROOFS, REMARKS, ALGORITHMS ───────────────────── */

.post-container.post-math {
  max-width: 910px;
}

.post-math .post-content {
  font-size: 0.88rem;
  line-height: 1.7;
}

.post-math .post-content h2 {
  font-size: 1.1rem;
}

.post-math .post-content h3 {
  font-size: 0.95rem;
}

.post-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.post-toolbar {
  display: inline-flex;
  gap: 0.4rem;
}

.post-toolbar button {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.post-toolbar button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.post-toolbar .pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  transition: background 0.15s, color 0.15s;
}

.post-toolbar .pdf-link svg {
  width: 12px;
  height: 12px;
}

.post-toolbar .pdf-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.post-content h2,
.post-content h3 {
  scroll-margin-top: 1.5rem;
}

/* Post sidebar: same dark identity panel as the homepage, with the TOC */
.post-main {
  margin-left: var(--sidebar-width);
}

.sidebar-photo-link {
  display: block;
  line-height: 0;   /* no extra line-box space: photo sits exactly like on the homepage */
}

.post-side-back {
  display: block;
  font-size: 0.78rem;
  color: var(--sidebar-muted);
  margin-bottom: 1.6rem;
}

.post-side-back:hover {
  color: var(--sidebar-accent);
  text-decoration: none;
}

.post-toc-title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sidebar-muted);
  margin-bottom: 0.6rem;
}

ul.post-toc a {
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
}

ul.post-toc li.toc-sub a {
  padding-left: 1.5rem;
  font-size: 0.76rem;
}

@media (max-width: 1080px) {
  .post-sidebar {
    display: none;
  }

  .post-main {
    margin-left: 0;
  }
}

@media (min-width: 1081px) {
  .post-with-toc .post-back {
    display: none;
  }
}

/* How to cite box */
.cite-box {
  position: relative;
  margin: 0 0 1.25rem;
}

.cite-box pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* References */
.bib-list {
  padding-left: 1.5rem;
  font-size: 0.88em;
}

.bib-list li {
  margin-bottom: 0.6rem;
  scroll-margin-top: 1.5rem;
}

.bib-list li:target {
  background: var(--accent-light);
  border-radius: 4px;
}

.bib-url {
  word-break: break-all;
}

.post-content .math-block {
  margin: 0 0 1.1rem;
  overflow-x: auto;
  overflow-y: hidden;
}

/* Theorem-like statement boxes */
.thm {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.9rem 1.15rem 0.6rem;
  margin: 0 0 1.25rem;
}

.thm-def {
  border-left-color: #94a3b8;
}

.thm-head {
  margin-bottom: 0.4rem;
}

.thm-label {
  font-weight: 600;
  color: var(--accent-dark);
}

.thm-def .thm-label {
  color: var(--text);
}

.thm-title {
  font-weight: 500;
  color: var(--muted);
}

.thm p,
.collapse-body p {
  margin-bottom: 0.65rem;
}

.thm .math-block,
.collapse-body .math-block {
  margin-bottom: 0.65rem;
}

/* Collapsible proofs & remarks */
details.collapse {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  margin: 0 0 1.25rem;
  background: #fff;
}

details.collapse-proof {
  margin-top: -0.85rem;    /* visually attach to the statement above */
  border-left-color: var(--accent);
}

details.collapse-remark {
  border-left-color: #94a3b8;
  background: #f8fafc;
}

details.collapse > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.55rem 1rem;
  user-select: none;
  border-radius: 5px;
  transition: background 0.15s;
}

details.collapse > summary::-webkit-details-marker {
  display: none;
}

details.collapse > summary::before {
  content: "\25B8";           /* ▸ */
  color: var(--accent);
  font-size: 0.8em;
  transition: transform 0.15s;
  flex-shrink: 0;
  transform: translateY(-1px);
}

details.collapse[open] > summary::before {
  transform: translateY(-1px) rotate(90deg);
}

details.collapse > summary:hover {
  background: var(--accent-light);
}

details.collapse-proof > summary .thm-label {
  font-style: italic;
  font-weight: 600;
  color: var(--text);
}

details.collapse > summary .thm-dot {
  display: none;
}

.collapse-hint {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

.collapse-hint::after {
  content: "show";
}

details.collapse[open] .collapse-hint::after {
  content: "hide";
}

.collapse-body {
  padding: 0.85rem 1.15rem 0.35rem;
  border-top: 1px solid var(--border);
}

.qed-line {
  text-align: right;
  color: var(--muted);
  padding-bottom: 0.5rem;
}

/* Algorithms */
.algorithm {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 0 1.25rem;
  overflow: hidden;
}

.algo-caption {
  padding: 0.55rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.algo-caption .thm-label {
  font-weight: 600;
  color: var(--accent-dark);
}

.algo-body {
  padding: 0.7rem 1rem;
  overflow-x: auto;
}

.algo-line {
  display: flex;
  gap: 0.8rem;
  align-items: baseline;
  padding: 0.12rem 0;
  font-size: 0.9rem;
}

.algo-num {
  min-width: 1.5em;
  text-align: right;
  color: var(--muted);
  font-size: 0.72rem;
  flex-shrink: 0;
  font-family: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, monospace;
}

.algo-text {
  flex: 1;
  min-width: 0;
}

.ref-broken {
  color: #b91c1c;
  font-weight: 600;
  cursor: help;
}

.cite {
  color: var(--muted);
  cursor: help;
}

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding: 2rem 1.5rem 4rem;
  }

  .about-photo-mobile {
    display: block;
  }

  .cv-table td:first-child {
    width: 110px;
  }
}
