/* ============================================================
   THEME VARIABLES
   To change colors: update these values. Light = :root, Dark = [data-theme="dark"]
   ============================================================ */
:root {
  --primary:       #357aa1;
  --primary-hover: #2a6080;
  --bg-1:          #f0f0f0;   /* odd sections */
  --bg-2:          #ffffff;   /* even sections */
  --text:          #2d3436;
  --text-muted:    #636e72;
  --nav-bg:        #1a1a1a;
  --card-bg:       #ffffff;
  --card-border:   #e0e0e0;
  --shadow:        0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover:  0 6px 20px rgba(0,0,0,0.14);
  --radius:        8px;
  --max-w:         min(92%, 1600px);
}

[data-theme="dark"] {
  --primary:       #79b8ff;
  --primary-hover: #a8d1ff;
  --bg-1:          #24292e;
  --bg-2:          #1e2428;
  --text:          #e1e4e8;
  --text-muted:    #959da5;
  --nav-bg:        #0d1117;
  --card-bg:       #2f363d;
  --card-border:   #444c56;
  --shadow:        0 2px 12px rgba(0,0,0,0.35);
  --shadow-hover:  0 6px 20px rgba(0,0,0,0.5);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-2);
  line-height: 1.7;
  transition: background 0.25s, color 0.25s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }

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

/* ============================================================
   NAVBAR
   ============================================================ */
#navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.08em;
  text-decoration: none;
  font-family: 'Georgia', serif;
}
.nav-brand:hover { color: var(--primary); text-decoration: none; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.1rem;
}

.nav-links a {
  color: rgba(255,255,255,0.75);
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  font-size: 0.875rem;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.1); }

#theme-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  margin-left: 0.25rem;
  transition: color 0.2s;
}
#theme-toggle:hover { color: #fff; }

/* Mobile hamburger */
#hamburger {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.3rem;
}

@media (max-width: 820px) {
  #hamburger { display: block; }
  .nav-links {
    display: none;
    position: fixed;
    top: 56px;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--nav-bg);
    padding: 0.75rem 1.5rem 1rem;
    gap: 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; }
  .nav-links a { display: block; padding: 0.6rem 0.5rem; font-size: 0.95rem; }
}

/* ============================================================
   LOADING INDICATOR
   ============================================================ */
#loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6rem 2rem;
  font-size: 1rem;
  color: var(--text-muted);
  gap: 0.75rem;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   SECTION LAYOUT
   ============================================================ */
.section { padding: 4.5rem 1rem; }
.section-odd  { background: var(--bg-1); }
.section-even { background: var(--bg-2); }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
}

/* ============================================================
   ABOUT SECTION
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 3.5rem;
  align-items: start;
}

.about-avatar-col { text-align: center; }

.about-avatar-col .detail-block {
  margin-top: 1.75rem;
  text-align: left;
}

.avatar {
  width: 320px;
  height: 320px;
  border-radius: 22px;
  object-fit: cover;
  border: 5px solid var(--primary);
  box-shadow: var(--shadow);
  margin: 0 auto 1.4rem;
}

.about-name {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.about-role {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.about-keywords {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1.25rem;
  letter-spacing: 0.02em;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.social-links a {
  color: var(--text-muted);
  font-size: 2.5rem;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
}
.social-links a:hover { color: var(--primary); transform: translateY(-2px); }

.about-bio { margin-bottom: 2rem; font-size: 1rem; line-height: 1.8; }

.about-cta { margin-top: 1.25rem; }
.about-cta .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.about-bio p { margin-bottom: 1rem; }
.about-bio p:last-child { margin-bottom: 0; }

.about-details {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.detail-block {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  flex: 1 1 320px;
  min-width: 320px;
}

.detail-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-block h3 i { color: var(--primary); }

.detail-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.detail-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.detail-list li i { color: var(--primary); margin-top: 0.25rem; flex-shrink: 0; font-size: 0.85rem; }

/* education entries */
.edu-entry {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--card-border);
}
.edu-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.edu-entry strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 0.1rem;
}
.edu-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.research-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .about-grid    { grid-template-columns: 1fr; gap: 2rem; }
  .about-details { max-width: 100%; }
  .avatar        { width: 240px; height: 240px; }
}

/* ============================================================
   PUBLICATIONS
   Cards share .project-card base; pub-specific extras below.
   ============================================================ -->

/* ---- Badge ---- */
.pub-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 0.7rem;
  width: fit-content;
  color: #fff;
}

/* soft badge colors (matches project tag style) */
#publications .project-card[data-category="conference"] .pub-badge { background: #cce5ff; color: #004085; }
#publications .project-card[data-category="workshop"]   .pub-badge { background: #d4edda; color: #155724; }
#publications .project-card[data-category="patent"]     .pub-badge { background: #e8d5f5; color: #6c3483; }
#publications .project-card[data-category="preprint"]   .pub-badge { background: #fef3cd; color: #856404; }

[data-theme="dark"] #publications .project-card[data-category="conference"] .pub-badge { background: #162840; color: #79b8ff; }
[data-theme="dark"] #publications .project-card[data-category="workshop"]   .pub-badge { background: #1a3d27; color: #75c98a; }
[data-theme="dark"] #publications .project-card[data-category="patent"]     .pub-badge { background: #2d1b3d; color: #b07cd8; }
[data-theme="dark"] #publications .project-card[data-category="preprint"]   .pub-badge { background: #3d2e14; color: #f5c542; }

/* wider cards for publications (less tall) */
#publications .projects-grid {
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
}

/* white bg for pub card images (diagrams with transparent PNGs) */
#publications .project-card-img {
  background: #fff;
  padding: 0.5rem;
}

/* hide placeholder image on patent & workshop cards */
#publications .project-card[data-category="patent"]   .project-card-img,
#publications .project-card[data-category="workshop"] .project-card-img {
  display: none;
}

#publications .project-title a { color: var(--text); }
#publications .project-title a:hover { color: var(--primary); text-decoration: none; }

.pub-authors {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  line-height: 1.6;
}
.pub-authors strong { color: var(--text); }

.pub-eq {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.pub-venue {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  line-height: 1.6;
}

.pub-doi {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.5;
}

.pub-abstract {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.6;
  flex-grow: 1;
  padding-top: 0.6rem;
  border-top: 1px solid var(--card-border);
}

/* ============================================================
   BUTTONS (shared)
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.75rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid transparent;
  text-decoration: none;
  line-height: 1.5;
}
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; text-decoration: none; }
.btn-outline  { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary); color: #fff; text-decoration: none; }
.btn-ghost    { border-color: var(--card-border); color: var(--text-muted); background: transparent; }
.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); text-decoration: none; }

/* ============================================================
   EXPERIENCE (TIMELINE)
   ============================================================ */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 8px; bottom: 0;
  width: 2px;
  background: var(--primary);
  opacity: 0.35;
}

.timeline-item { position: relative; padding-bottom: 2.5rem; }
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -2rem; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-1);
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date  { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; margin-bottom: 0.25rem; }
.timeline-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.15rem; }
.timeline-org   { font-size: 0.92rem; color: var(--primary); font-weight: 600; margin-bottom: 0.2rem; }
.timeline-loc   { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.3rem; }
.timeline-desc  { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

/* ============================================================
   TALKS
   ============================================================ */
.talk-list { display: flex; flex-direction: column; gap: 1.25rem; }

.talk-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.talk-card:hover { box-shadow: var(--shadow-hover); }

.talk-date  { font-size: 0.78rem; color: var(--primary); font-weight: 700; margin-bottom: 0.35rem; text-transform: uppercase; letter-spacing: 0.04em; }
.talk-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.talk-event { font-size: 0.86rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.talk-desc {
  font-size: 0.87rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

/* ============================================================
   PROJECTS
   ============================================================ */
.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 2rem; flex-wrap: wrap; }

.filter-btn {
  padding: 0.35rem 1rem;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 0.84rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}
.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}
.project-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.project-card-img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--card-border);
  transition: transform 0.3s;
}
.project-card:hover .project-card-img { transform: scale(1.04); }

.project-card-body {
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.project-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.55rem;
  border-radius: 3px;
  margin-bottom: 0.75rem;
  width: fit-content;
}

.tag-research { background: #d4edda; color: #155724; }
.tag-course   { background: #cce5ff; color: #004085; }
.tag-personal { background: #f8d7da; color: #721c24; }

[data-theme="dark"] .tag-research { background: #1a3d27; color: #75c98a; }
[data-theme="dark"] .tag-course   { background: #162840; color: #79b8ff; }
[data-theme="dark"] .tag-personal { background: #3d1218; color: #f48b96; }

.project-title { font-size: 0.97rem; font-weight: 600; margin-bottom: 0.5rem; color: var(--text); }
.project-desc  { font-size: 0.84rem; color: var(--text-muted); flex-grow: 1; margin-bottom: 0.85rem; line-height: 1.6; }
.project-links { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: auto; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-content { text-align: center; }
.contact-content > p { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; }

.contact-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 700px) {
  .contact-links { grid-template-columns: repeat(2, 1fr); }
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text);
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  width: 100%;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.95rem;
}
.contact-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow);
  text-decoration: none;
  transform: translateY(-1px);
}
.contact-item i { font-size: 1.2rem; width: 1.5rem; text-align: center; color: var(--primary); flex-shrink: 0; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--nav-bg);
  color: rgba(255,255,255,0.45);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.82rem;
}
footer a { color: rgba(255,255,255,0.6); }
footer a:hover { color: #fff; }

/* ============================================================
   DRAWINGS PAGE
   ============================================================ */
.drawings-page {
  min-height: 100vh;
  background: var(--bg-2);
}

.drawings-hero {
  background: var(--nav-bg);
  color: #fff;
  padding: 4rem 1.5rem 3rem;
  text-align: center;
}
.drawings-hero h1 { font-size: 2.2rem; margin-bottom: 0.75rem; }
.drawings-hero p  { color: rgba(255,255,255,0.7); font-size: 1rem; max-width: 600px; margin: 0 auto; }

.drawings-section { padding: 4rem 1rem; }

.drawings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.drawing-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}
.drawing-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.drawing-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.drawing-card:hover img { transform: scale(1.03); }

.drawing-card-body { padding: 1rem 1.1rem; }
.drawing-card-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.2rem; }
.drawing-card-sub   { font-size: 0.82rem; color: var(--text-muted); font-style: italic; }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
  padding: 2rem;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-caption { color: rgba(255,255,255,0.85); font-size: 1rem; text-align: center; }
.lightbox-close {
  position: absolute;
  top: 1.25rem; right: 1.5rem;
  color: #fff; font-size: 2rem;
  cursor: pointer; background: none; border: none;
  line-height: 1;
}
.lightbox-close:hover { color: var(--primary); }

/* ============================================================
   UTILITIES
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.back-link:hover { color: var(--primary); }
