/* ================================
   CUSTOM PROPERTIES
   ================================ */
:root {
  --bg:          #fafafa;
  --bg-card:     #ffffff;
  --link:        #1772d0;
  --link-hover:  #f09228;
  --text:        #333333;
  --text-light:  #666666;
  --text-muted:  #999999;
  --border:      rgba(0, 0, 0, 0.08);
  --border-soft: rgba(0, 0, 0, 0.06);
  --tag-bg:      #f0f5ff;
  --nav-bg:      #fafafa;
  --nav-h:       44px;
  --icon-hover-bg: rgba(23, 114, 208, 0.06);
  --hover-bg:    rgba(0, 0, 0, 0.018);
  --footer-text: #bbb;
  --sketch-rgb:  23, 114, 208;
  --sketch-accent-rgb: 240, 146, 40;
  color-scheme: light;
  transition: background 0.35s ease, color 0.35s ease;
}

[data-theme="dark"] {
  --bg:          #0d0d0d;
  --bg-card:     #161616;
  --link:        #5ba4e6;
  --link-hover:  #f0a050;
  --text:        #e0e0e0;
  --text-light:  #aaaaaa;
  --text-muted:  #777777;
  --border:      rgba(255, 255, 255, 0.1);
  --border-soft: rgba(255, 255, 255, 0.06);
  --tag-bg:      rgba(91, 164, 230, 0.12);
  --nav-bg:      #111111;
  --icon-hover-bg: rgba(91, 164, 230, 0.1);
  --hover-bg:    rgba(255, 255, 255, 0.03);
  --footer-text: #555;
  --sketch-rgb:  91, 164, 230;
  --sketch-accent-rgb: 240, 160, 80;
  color-scheme: dark;
}

/* ================================
   RESET & BASE
   ================================ */
html {
  scroll-behavior: smooth;
}

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

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

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 3px;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.35s ease, color 0.35s ease;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

a:hover,
a:focus {
  color: var(--link-hover);
  text-decoration: none;
}

h1, h2, h3, h4 {
  font-family: 'Lato', Verdana, Helvetica, sans-serif;
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 1.2rem;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ================================
   NAV
   ================================ */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

.site-nav a {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-light);
  position: relative;
  padding-bottom: 2px;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--link);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav a:hover {
  color: var(--link);
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.site-nav .nav-active {
  color: var(--link);
  font-weight: 700;
}

.site-nav .nav-cv {
  color: var(--link);
  font-weight: 700;
  border: 1px solid var(--link);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-nav .nav-cv::after {
  display: none;
}

.site-nav .nav-cv:hover {
  background: var(--link);
  color: var(--bg);
}

/* ================================
   HOME / HERO
   ================================ */
.section-home {
  max-width: 920px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 3rem;
  scroll-margin-top: var(--nav-h);
}

.home-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

.home-photo img {
  width: 100%;
  height: 250px;
  border-radius: 10px;
  object-fit: cover;
  object-position: center top;
  margin-top: 0.6rem;
}

.home-bio h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin-bottom: 0.35rem;
}

.home-affiliation {
  font-size: 0.9375rem;
  color: var(--text-light);
  margin: 0 0 1rem 0;
}

.home-bio-text {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
  margin: 0 0 1.25rem 0;
  max-width: 540px;
}


.home-icons {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.home-icons a {
  color: var(--link);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 0;
}

.home-icons a:hover,
.home-icons a:focus {
  color: var(--link-hover);
  background: var(--icon-hover-bg);
  transform: translateY(-1px);
}

.home-icons i {
  font-size: 1.5rem;
}

/* ================================
   PAGE CONTENT WRAPPER
   ================================ */
.page-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

section[id] {
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.page-content section + section {
  margin-top: 3.5rem;
}

.section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

/* ================================
   NEWS
   ================================ */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  padding: 0.6rem 0.4rem;
  margin: 0 -0.4rem;
  border-bottom: 1px solid var(--border-soft);
  align-items: baseline;
  border-radius: 5px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-item:hover {
  background: var(--hover-bg);
  border-bottom-color: transparent;
}

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

.news-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--link);
  letter-spacing: 0.02em;
}

.news-view-all .arrow {
  display: inline-block;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-view-all:hover {
  color: var(--link-hover);
}

.news-view-all:hover .arrow {
  transform: translateX(3px);
}

.news-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.news-text {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.55;
}

/* ================================
   PUBLICATIONS
   ================================ */
.pub-list {
  display: flex;
  flex-direction: column;
}

.pub-entry {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0.5rem;
  margin: 0 -0.5rem;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
  border-radius: 6px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pub-entry:hover {
  background: var(--hover-bg);
  border-bottom-color: transparent;
}

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

.pub-venue-tag {
  display: inline-block;
  background: var(--tag-bg);
  color: var(--link);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.45rem;
  border-radius: 4px;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  transition: filter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pub-entry:hover .pub-venue-tag {
  filter: brightness(0.92);
}

.pub-title {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
  margin: 0 0 0.2rem 0;
  line-height: 1.4;
}

.pub-authors {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0 0 0.15rem 0;
  line-height: 1.5;
}

.pub-authors strong {
  color: var(--text);
  font-weight: 700;
}

.equal-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
}

.pub-venue-full {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0 0 0.55rem 0;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pub-links a {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--link);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--link);
  border-radius: 4px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.pub-links a:hover {
  background: var(--link);
  color: var(--bg);
  transform: translateY(-1px);
}

.pub-placeholder {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-style: italic;
  margin: 0;
}

/* arXiv badge link — styled to match arXiv brand */
a.arxiv-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #b31b1b;
  padding: 0.15rem 0.5rem;
  border: 1px solid #b31b1b;
  border-radius: 4px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              color 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

a.arxiv-link:hover {
  background: #b31b1b;
  color: #fff;
  transform: translateY(-1px);
}

[data-theme="dark"] a.arxiv-link {
  color: #e05050;
  border-color: #e05050;
}

[data-theme="dark"] a.arxiv-link:hover {
  background: #e05050;
  color: #0d0d0d;
}

/* ================================
   PROJECTS
   ================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.project-card {
  border: 1px solid rgba(0, 0, 0, 0.09);
  border-radius: 7px;
  overflow: hidden;
  background: var(--bg-card);
  transition: box-shadow 0.2s;
}

.project-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.project-thumb {
  background: #f5f5f5;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.project-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f5ff;
  color: var(--link);
  font-size: 2rem;
}

.project-info {
  padding: 1rem 1.1rem 1.1rem;
}

.project-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.4rem 0;
  line-height: 1.35;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.55rem 0;
}

.tag {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  background: #f5f5f5;
  color: #666;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.55;
  margin: 0 0 0.75rem 0;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-links a {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--link);
  padding: 0.15rem 0.5rem;
  border: 1px solid var(--link);
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}

.project-links a:hover {
  background: var(--link);
  color: var(--bg);
}

/* ================================
   EDUCATION
   ================================ */
.edu-list {
  display: flex;
  flex-direction: column;
}

.edu-entry {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0.5rem;
  margin: 0 -0.5rem;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
  border-radius: 6px;
  transition: background 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.edu-entry:hover {
  background: var(--hover-bg);
  border-bottom-color: transparent;
}

.edu-entry:last-child {
  border-bottom: none;
}

.edu-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-top: 3px;
}

.edu-logo-wrap img {
  max-width: 5rem;
  max-height: 2.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.15rem;
  flex-wrap: wrap;
}

.edu-institution {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}

.edu-year {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.edu-degree {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0 0 0.4rem 0;
  font-style: italic;
}

.edu-details {
  font-size: 0.875rem;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
  padding-left: 1.1rem;
}

.edu-details li {
  margin-bottom: 0.15rem;
}

/* ================================
   FOOTER
   ================================ */
.site-footer {
  position: relative;
  text-align: center;
  padding: 2.15rem 0 2.15rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

.footer-gen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.footer-gen canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Frosted panel behind credit line — softens animation, keeps text readable */
.footer-credit {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 0;
  padding: 0.62rem 1.3rem;
  max-width: min(100% - 1.5rem, 40rem);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.footer-credit a {
  color: var(--link);
  font-weight: 600;
}

.footer-credit a:hover {
  color: var(--link-hover);
}

[data-theme="dark"] .footer-credit {
  color: var(--text-light);
  background: rgba(18, 18, 18, 0.55);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

/* ================================
   THEME TOGGLE
   ================================ */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--hover-bg);
}

.theme-toggle::after {
  display: none;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-sun { display: inline; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }

/* Dark mode image handling */
[data-theme="dark"] .edu-logo-wrap img {
  filter: brightness(0.85) contrast(1.1);
}

.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
[data-theme="dark"] .logo-dark { filter: none; }

[data-theme="dark"] .home-photo img {
  filter: brightness(0.92);
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 900px) {
  .home-photo img {
    width: 100%;
    height: 210px;
  }
  .home-grid {
    grid-template-columns: 190px 1fr;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .site-nav {
    gap: 1rem;
    flex-wrap: wrap;
    height: auto;
    padding: 0.5rem 0.75rem;
  }

  .site-nav a {
    font-size: 0.75rem;
  }

  .section-home {
    padding: 2rem 1.25rem 2rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    justify-items: center;
    text-align: center;
  }

  .home-photo img {
    width: 160px;
    height: 190px;
  }

  .home-bio h1 {
    font-size: 1.6rem;
  }

  .home-bio-text {
    max-width: 100%;
  }

  .home-icons {
    justify-content: center;
  }

  .page-content {
    padding: 0 1.25rem 3rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .pub-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .edu-entry {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .edu-logo-wrap {
    flex-direction: row;
    justify-content: flex-start;
  }

  .edu-header {
    flex-direction: column;
    gap: 0.1rem;
  }

  .news-item {
    grid-template-columns: 4.5rem 1fr;
  }
}
