/* ================================
   CSS Variables & Base Styles
   ================================ */
:root {
  --bg-primary: #faf9f6;
  --bg-secondary: #f5f4f0;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent-color: #2d5a7b;
  --accent-hover: #c96a3a;
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
  --max-width: 900px;
  --font-heading: 'Lexend', sans-serif;
  --font-body: 'Lexend', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================
   Navigation
   ================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: rgba(250, 249, 246, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  padding: 0 24px;
}

.nav-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.nav-brand {
  font-family: 'Georgia', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--accent-hover); }

.nav-links { display: flex; gap: 40px; }

.nav-link {
  font-family: 'Lexend', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #888888;
  text-decoration: none;
  padding: 8px 0;
  position: relative;
  transition: var(--transition);
  letter-spacing: 0.08em;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -10px;
  width: 0;
  height: 2px;
  background: var(--accent-hover);
  transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #333333;
}

.nav-link:hover::after,
.nav-link.active::after {
  width: calc(100% + 20px);
}

/* ================================
   Main Content
   ================================ */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 110px 24px 60px;
  min-height: calc(100vh - 180px);
}

.main-content.wide {
  max-width: 1100px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.main-content > * { animation: fadeIn 0.4s ease; }

/* ================================
   Typography
   ================================ */
h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 40px;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

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

a:hover { color: var(--accent-hover); }

strong { font-weight: 600; }

/* ================================
   About Section
   ================================ */
.about-header {
  display: flex;
  gap: 50px;
  margin-bottom: 30px;
  align-items: flex-start;
}

.about-text { flex: 1; }

.name-heading {
  font-family: 'Georgia', serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: #000000;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.bio {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
  line-height: 1.65;
  text-align: justify;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.social-links a {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent-color);
  transition: var(--transition);
}

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

.social-links a:not(:last-child)::after {
  content: '/';
  margin-left: 6px;
  color: var(--text-muted);
}

.about-image {
  flex-shrink: 0;
  width: 260px;
  padding-top: 30px;
}

.profile-container {
  width: 100%;
  aspect-ratio: 0.8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  position: relative;
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ================================
   Sections
   ================================ */
.section {
  margin-bottom: 50px;
  padding-top: 30px;
  border-top: 1px solid var(--border-color);
}

.section:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* News List */
.news-list { list-style: none; }

.news-list li {
  padding: 4px 0;
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.news-list .date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.news-expanded {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}

.news-expanded.show {
  max-height: 2000px;
  opacity: 1;
}

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.read-more-btn:hover {
  background: var(--bg-secondary);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.read-more-btn .arrow {
  font-size: 0.85rem;
  transition: transform 0.3s ease;
}

/* ================================
   Publications
   ================================ */
.year-section { margin-bottom: 50px; }

.year-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

.paper-item {
  display: flex;
  gap: 28px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

.paper-item:last-child { border-bottom: none; }

.paper-item:hover {
  background: linear-gradient(90deg, transparent, var(--bg-secondary), transparent);
}

.paper-image {
  flex-shrink: 0;
  width: 180px;
  height: 180px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-secondary);
  position: relative;
}

.paper-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.paper-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.paper-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.4;
}

.paper-authors {
  font-size: 0.98rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.paper-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-style: italic;
}

.paper-venue {
  font-size: 0.95rem;
  color: #555555;
  font-weight: 600;
  margin-bottom: 12px;
}

.paper-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.paper-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--accent-color);
  padding: 4px 12px;
  background: rgba(45, 90, 123, 0.08);
  border-radius: 4px;
  transition: var(--transition);
}

.paper-links a:hover {
  background: var(--accent-hover);
  color: white;
}

/* ================================
   Photography (Masonry)
   ================================ */
.gallery-intro {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
  max-width: 640px;
}

.gallery-grid {
  column-count: 3;
  column-gap: 8px;
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 8px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
}

.gallery-item:hover {
  opacity: 0.92;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* ================================
   Lightbox
   ================================ */
.lightbox {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  padding: 30px;
}

.lightbox.active { display: flex; }

.lightbox-img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.lightbox-close:hover { color: var(--accent-hover); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  font-size: 2.2rem;
  cursor: pointer;
  padding: 20px;
  user-select: none;
  transition: var(--transition);
}

.lightbox-nav:hover { color: var(--accent-hover); }
.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

/* ================================
   CV Page
   ================================ */
.cv-wrapper {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.cv-wrapper iframe {
  width: 100%;
  height: 1100px;
  border: none;
  display: block;
}

.cv-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ================================
   Blog
   ================================ */
.post-list { list-style: none; }

.post-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--border-color);
}

.post-item:last-child { border-bottom: none; }

.post-item .post-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 12px;
}

.post-item .post-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.post-item .post-title:hover { color: var(--accent-hover); }

.post-content {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.post-content h1, .post-content h2, .post-content h3 {
  margin-top: 30px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.post-content p { margin-bottom: 16px; }
.post-content ul, .post-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.post-content li { margin-bottom: 6px; }

.post-content code {
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 3px;
}

.post-content pre {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}

/* ================================
   Footer
   ================================ */
.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 30px 24px 50px;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.footer p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 16px 0;
    gap: 12px;
  }

  .nav-links { gap: 20px; }

  .main-content { padding-top: 160px; }

  .about-header {
    flex-direction: column-reverse;
    gap: 30px;
  }

  .about-image {
    width: 200px;
    align-self: center;
    padding-top: 0;
  }

  .name-heading { font-size: 1.8rem; }

  .paper-item {
    flex-direction: column;
    gap: 16px;
  }

  .paper-image {
    width: 100%;
    height: 200px;
  }

  .gallery-grid { column-count: 2; }

  .cv-wrapper iframe { height: 700px; }
}

@media (max-width: 480px) {
  .nav-links { gap: 12px; flex-wrap: wrap; justify-content: center; }
  .nav-link { font-size: 0.88rem; }
  h1 { font-size: 1.5rem; }
  .name-heading { font-size: 1.5rem; }
  .gallery-grid { column-count: 1; }
}
