/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* Base */
:root {
  --fg: #2a2a2a;
  --fg-muted: #666;
  --bg: #fff;
  --border: #e5e5e5;
  --primary: #337ab7; /* closer to Bootstrap 3 */
}
body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }

/* Nav */
.nav {
  position: fixed; inset: 0 0 auto 0; height: 60px;
  background: #fff; border-bottom: 1px solid var(--border);
  z-index: 1000;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { font-family: 'Montserrat', sans-serif; font-weight: 700; text-decoration: none; color: var(--fg); letter-spacing: 0.2px; font-size: 20px; display: flex; align-items: center; height: 60px; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--fg); margin: 5px 0; }
.nav-links { list-style: none; display: flex; gap: 28px; }
.nav-links a { text-decoration: none; color: var(--fg); display: flex; align-items: center; height: 60px; }
.nav-links a:hover { color: var(--primary); }
.nav-links a[aria-current="page"] { color: var(--primary); font-weight: 600; }

/* Main */
.main { margin-top: 60px; }
.home-section { padding: 48px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 72px; }
.home-section:last-of-type { border-bottom: 0; }
.section-heading h2 { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 28px; letter-spacing: 0.1px; }

/* About */
.about-grid { display: grid; grid-template-columns: 320px 1fr; gap: 48px; align-items: start; }
.profile { position: sticky; top: 80px; text-align: center; }
.portrait { width: 180px; height: 180px; border-radius: 50%; border: 1px solid var(--border); overflow: hidden; background: #f2f2f2; display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.portrait img, .project-card .img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait-title { text-align: center; }
.portrait-title h1 { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 28px; margin-top: 16px; }
.portrait-title h2 { font-size: 16px; color: var(--fg-muted); font-weight: 500; margin-top: 4px; }
.portrait-title .affiliation a { color: var(--primary); text-decoration: none; }
.portrait-title .affiliation a:hover { text-decoration: underline; }
.social { list-style: none; display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }
.social a { color: var(--primary); text-decoration: none; font-weight: 500; }
.social a:hover { text-decoration: underline; }
.about-text h2 { font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 24px; margin-bottom: 12px; }
.about-text p { margin: 0 0 12px 0; }

/* Projects */
.projects-toolbar { display: flex; gap: 8px; margin: 12px 0 20px; flex-wrap: wrap; }
.filter-btn { border: 1px solid var(--border); background: #fafafa; color: var(--fg); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.filter-btn.active, .filter-btn:hover { border-color: var(--primary); color: #fff; background: var(--primary); }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: box-shadow .2s ease, transform .2s ease; }
.project-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); transform: translateY(-2px); }
.project-card .img { width: 100%; height: 150px; background: #f5f5f5; border-bottom: 1px solid var(--border); object-fit: cover; display: block; }
.project-card .card-text { padding: 12px 14px; }
.project-card h3 { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.project-card p { font-size: 14px; color: #555; }

/* Publications (card style) */
.pubs { display: grid; gap: 22px; }
.pub-year { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 20px; color: var(--fg); margin-top: 8px; }
.pub-card { display: grid; grid-template-columns: 220px 1fr; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.pub-thumb { width: 220px; aspect-ratio: 16 / 9; height: auto; border: 1px solid var(--border); border-radius: 6px; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 6px; }
.pub-thumb img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.pub-meta { display: grid; gap: 6px; }
.pub-title { font-weight: 700; color: var(--fg); }
.pub-authors { color: #444; font-size: 14px; }
.pub-authors strong { font-weight: 700; }
.pub-venue { font-style: italic; color: #555; font-size: 14px; }
.pub-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pub-badges a { border: 1px solid var(--border); background: #fafafa; color: var(--fg); padding: 4px 8px; border-radius: 6px; font-size: 13px; }
.pub-badges a:hover { border-color: var(--primary); color: #fff; background: var(--primary); text-decoration: none; }

/* Experience/Education */
.content { font-size: 16px; }
.experience-item, .education-item { padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.experience-item:last-child, .education-item:last-child { border-bottom: 0; }
.experience-item h3, .education-item h3 { font-family: 'Montserrat', sans-serif; font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.company, .institution { font-weight: 600; color: var(--primary); font-size: 14px; }
.period { font-size: 13px; color: var(--fg-muted); margin-bottom: 6px; }

/* Contact */
#contact .content a { color: var(--primary); text-decoration: none; }
#contact .content a:hover { text-decoration: underline; }

/* Footer */
.footer { text-align: center; padding: 40px 0; border-top: 1px solid var(--border); color: var(--fg-muted); font-size: 14px; }

/* News */
.news-list { margin-top: 8px; padding-left: 18px; max-height: 280px; overflow-y: auto; padding-right: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fafafa; }
.news-list li { margin: 6px 0; }
@media (max-width: 768px) { .news-list { max-height: 220px; } }

/* Responsive */
@media (max-width: 1024px) { .container { padding: 0 24px; } }
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .profile { position: static; }
}
@media (max-width: 600px) {
  .pub-card { grid-template-columns: 1fr; }
  .pub-thumb { width: 100%; }
}
/* Align brand centered within left column on homepage */
@media (min-width: 861px) {
  .home .brand { width: 320px; justify-content: center; margin-left: 0; }
}
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links { position: fixed; top: 60px; left: -100%; width: 100%; height: calc(100vh - 60px); background: #fff; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 24px; gap: 18px; transition: left .25s ease; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
  .nav-links a { height: auto; padding: 8px 0; }
  .nav-links.active { left: 0; }
}

/* Print */
@media print { .nav, .footer { display: none; } .main { margin-top: 0; } .home-section { page-break-inside: avoid; } }

/* Global links */
a { color: var(--primary); text-decoration: none; }
a:visited { color: var(--primary); }
a:hover { text-decoration: underline; }

/* Focus styles for accessibility */
a:focus,
button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease;
}
