/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --text: #ffffff;
  --text-secondary: #a0a0a0;
  --bg: #121212;
  --bg-alt: #1a1a1a;
  --link: #ffffff;
  --link-hover: #a0a0a0;
  --border: #333333;
  --accent: #5b9bf5;
  --blue: #7aadff;
  --red: #ff7b7b;
  --max-width: 1100px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

html {
  overflow-y: scroll;
}

body {
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

@media (max-width: 900px) {
  .container { padding: 0 2rem; }
}

/* ── Typography ─────────────────────────────────────── */
h1 { font-size: 1.8rem; font-weight: 600; margin-bottom: 0.5rem; line-height: 1.3; }
h2 { font-size: 2.5rem; font-weight: 700; margin-top: 3rem; margin-bottom: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 500; margin-bottom: 0.2rem; }
p  { margin-bottom: 1rem; text-align: justify; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s;
}
a:hover { color: var(--link-hover); }

/* ── Hero ────────────────────────────────────────────── */
.hero {
  padding: 3rem 0 1rem;
}

.hero-body {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  margin-top: 1.5rem;
}

.hero-text {
  flex: 1;
}

.hero-text p, .hero-text ul {
  font-size: 1.1em;
}

.hero-text ul {
  padding-left: 1.3rem;
  margin-bottom: 1rem;
}

.hero-text ul li {
  margin-bottom: 0.3rem;
}

.hero-photo {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 0.5rem;
}

@media (max-width: 700px) {
  .hero-body { flex-direction: column-reverse; gap: 1.5rem; }
  .hero-photo { width: 150px; height: 150px; }
}

.hero-greeting {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.1;
}

.accent { color: var(--accent); }

.hero-bio {
  font-size: 1.15em;
}

.hero-list {
  font-size: 1.15em;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.hero-list li {
  margin-bottom: 0.3rem;
}

.hero-heading {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hero-icons {
  display: flex;
  gap: 0.8rem;
}

.hero-icons a {
  color: var(--text);
  text-decoration: none;
  display: flex;
}

.hero-icons a:hover { color: var(--accent); }
.hero-icons svg { display: block; }

.hero-text-links {
  margin-left: 0.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.hero-text-links a {
  font-size: 1.1em;
  text-decoration: underline;
  color: var(--text);
}

.hero-text-links a:hover { color: var(--accent); }

.keywords { color: var(--text-secondary); }
.contact-email { color: var(--text-secondary); }

.top-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-top: 1.5rem;
  margin-bottom: 2rem;
}

.top-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 1.1rem;
}

.top-nav a:hover { color: var(--text); }

.top-nav .nav-right {
  display: flex;
  gap: 1.5rem;
}

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

.links-list li {
  margin-bottom: 0.6rem;
}

.links-list li a {
  font-size: 1.15em;
  text-decoration: underline;
}



/* ── Site navigation ─────────────────────────────────── */
.site-nav {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.site-nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.nav-home {
  font-weight: 400;
  font-size: 1.2rem;
  text-decoration: none;
  color: var(--text);
}

.nav-home:hover { color: var(--text); }

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.95em;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); border-bottom-color: var(--text); }

/* ── Timeline ────────────────────────────────────────── */
.timeline {
  position: relative;
}

.timeline-item {
  display: grid;
  grid-template-columns: 220px 70px 1fr;
  gap: 0 1rem;
  margin-bottom: 2rem;
}

.timeline-date {
  color: var(--text-secondary);
  padding-top: 0.15rem;
}

.timeline-dot { display: none; }

.timeline-logo {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.timeline-logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: #ffffff;
  padding: 6px;
  box-sizing: border-box;
}

.timeline-logo a {
  text-decoration: none;
  display: flex;
}

.timeline-content {
  padding-top: 0.1rem;
}

.timeline-content p {
  margin-bottom: 0.5rem;
}

.timeline-meta {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.edu-simple { margin-bottom: 2rem; }
.edu-entry { margin-bottom: 1.5rem; }
.edu-date { color: var(--text-secondary); }

.exp-total {
  color: var(--text-secondary);
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .timeline-item { grid-template-columns: 1fr; gap: 0.3rem; }
  .timeline-logo { justify-content: flex-start; }
  .timeline-logo img { width: 40px; height: 40px; }
}

/* ── Glance list ─────────────────────────────────────── */
.glance-list {
  list-style: disc;
  padding-left: 1.2rem;
  margin-bottom: 1.5rem;
}

.glance-list li {
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.glance-list li a {
  color: var(--text);
}

/* ── Narrow page (CV, blog) ──────────────────────────── */
.page-narrow {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Section dividers ───────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── Experience with logos ───────────────────────────── */
.exp-item {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.exp-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.exp-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
}

.exp-logo a { display: flex; text-decoration: none; }

.exp-logo-double {
  width: 48px;
  flex-direction: column;
  height: auto;
  gap: 0.3rem;
}
.exp-logo-double img { width: 34px; height: 34px; }

.exp-content { flex: 1; min-width: 0; }

/* ── CV Items ───────────────────────────────────────── */
.cv-item { margin-bottom: 1.2rem; }

.cv-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cv-item-title { font-weight: 500; }
.cv-item-date  { color: var(--text-secondary); white-space: nowrap; }
.cv-item-sub   { color: var(--text); margin-bottom: 0.2rem; }
.cv-item-desc  { color: var(--text); margin-bottom: 0; }

/* ── Coursework ─────────────────────────────────────── */
.coursework {
  margin-top: 0.5rem;
}
.coursework-label { font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }

.coursework-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 1rem;
}

.coursework-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.coursework-item::before {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Publications ───────────────────────────────────── */
.pub { margin-bottom: 1.8rem; }
.pub-title { margin-bottom: 0.15rem; }
.pub-title strong { font-weight: 600; }
.pub-authors { margin-bottom: 0.15rem; }
.pub-me { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
.pub-venue { color: var(--blue); margin-bottom: 0.2rem; }
.pub-venue em { font-style: normal; }
.pub-award { color: var(--red); font-weight: normal; }
.pub-links { }
.pub-logos { margin-top: 0.3rem; margin-bottom: 0.2rem; display: flex; gap: 0.5rem; align-items: center; }
.pub-logos img { width: 24px; height: 24px; object-fit: contain; }
.pub-logos a { display: flex; text-decoration: none; }
.pub-links a { color: var(--blue); text-decoration: underline; }
.pub-links a:hover { color: var(--link-hover); }

/* ── Projects Grid ──────────────────────────────────── */
.projects-sub { color: var(--text-secondary); margin-bottom: 1.5rem; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  color: var(--text);
}

.project-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.project-card-body { padding: 1rem; flex: 1; display: flex; flex-direction: column; }
.project-card-body .pub-links { margin-top: auto; }
.project-card-title { font-weight: 600; margin-bottom: 0.4rem; line-height: 1.3; }
.project-card-desc { color: var(--text-secondary); margin-bottom: 0.5rem; line-height: 1.6; text-align: left; }
.project-tags { display: none; }

/* ── Blog ───────────────────────────────────────────── */
.blog-list { list-style: none; }
.blog-list li { margin-bottom: 1.5rem; }
.blog-list .post-title { font-weight: 500; }
.blog-list .post-title a { text-decoration: none; }
.blog-list .post-title a:hover { text-decoration: underline; }
.blog-list .post-date { color: var(--text-secondary); }
.blog-list .post-summary { color: var(--text-secondary); margin-top: 0.2rem; }

/* Blog post content */
.post-content { max-width: 720px; margin: 2rem auto 0; }
.post-content h1 { font-size: 1.5em; margin-top: 2rem; margin-bottom: 0.5rem; }
.post-content h2 { font-size: 1.15em; margin-top: 2rem; }
.post-content h3 { font-size: 1.05em; margin-top: 1.5rem; }
.post-content img { max-width: 100%; border-radius: 4px; margin: 1rem 0; }
.post-content pre { background: var(--bg-alt); padding: 1rem; border-radius: 4px; overflow-x: auto; font-size: 0.9em; margin: 1rem 0; }
.post-content code { font-size: 0.9em; background: var(--bg-alt); padding: 0.15em 0.3em; border-radius: 3px; }
.post-content pre code { background: none; padding: 0; }
.post-content blockquote { border-left: 3px solid var(--border); padding-left: 1rem; color: var(--text-secondary); margin: 1rem 0; }
.post-meta { color: var(--text-secondary); margin-bottom: 0; }

/* ── Publication Modal ───────────────────────────────── */
.pub-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.pub-modal.active { display: flex; }

.pub-modal-content {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
}

.pub-modal-header { display: flex; justify-content: flex-end; }

.pub-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}
.pub-modal-close:hover { color: var(--text); }

.pub-modal-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pub-modal-authors { color: var(--text-secondary); margin-bottom: 0.3rem; }
.pub-modal-venue { color: var(--blue); margin-bottom: 1rem; }

.pub-modal-abstract {
  line-height: 1.7;
  text-align: justify;
  margin-bottom: 1rem;
}

.pub-modal-links {
  margin-bottom: 0.5rem;
}

.pub-modal-links a {
  color: var(--blue);
}

.proj-modal-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  margin: 1rem 0;
  background: var(--border);
}

.pub-modal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
}

.pub-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  max-width: 40%;
}

.pub-nav-btn:hover { color: var(--text); }

.pub-nav-btn .nav-arrow {
  font-size: 2.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.pub-nav-btn .nav-label {
  font-size: 1.05em;
  line-height: 1.4;
  text-align: left;
}

.pub-nav-btn.prev .nav-label { text-align: left; }
.pub-nav-btn.next .nav-label { text-align: right; }
.pub-nav-btn.next { flex-direction: row-reverse; }

.pub[data-index] .pub-title,
.pub[data-index] .pub-authors { cursor: pointer; }
.pub[data-index] .pub-title:hover,
.pub[data-index] .pub-authors:hover { opacity: 0.7; }

/* ── Footer ─────────────────────────────────────────── */
footer { margin-top: 3rem; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  body { font-size: 15px; }
  .container { padding: 0 1rem; }
  .hero { padding: 1.5rem 1rem; }
  .hero-greeting { font-size: 2rem; }
  h1 { font-size: 1.5rem; }
  .cv-item-header { flex-direction: column; gap: 0; }
  .exp-item { gap: 0.8rem; }
  .exp-logo, .exp-logo img { width: 36px; height: 36px; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 400px) {
  .project-grid { grid-template-columns: 1fr; }
}
