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

:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --sidebar: #1a1a2e;
  --sidebar-alt: #16213e;
  --accent: #c8773a;
  --accent2: #4a7fa5;
  --text: #2c2c3a;
  --muted: #6b6b80;
  --border: #e2ddd6;
  --tag-bg: #eef4f8;
  --timeline-line: #d0c9be;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;
  --sidebar-w: 280px;
  --trans: 0.25s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.7;
}

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

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

/* ── SIDEBAR ────────────────────────────────────────── */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  color: #e8e4da;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
}

.sidebar-top {
  padding: 36px 24px 28px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(175deg, var(--sidebar-alt) 0%, var(--sidebar) 100%);
}

.avatar-wrap {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 16px;
  border: 3px solid var(--accent);
  overflow: hidden;
  background: #2d3561;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(200, 119, 58, 0.15);
  position: relative;
}

.avatar-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.avatar-placeholder {
  font-size: 40px;
  color: rgba(255, 255, 255, 0.4);
  z-index: 1;
}

.sidebar-name {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.sidebar-role {
  font-size: 0.78rem;
  color: #b0bec5;
  font-weight: 300;
  margin-bottom: 4px;
  line-height: 1.5;
}

.sidebar-role a {
  color: #90caf9;
}

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

.sidebar-links {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.sidebar-links a {
  color: #b0bec5;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--trans);
}

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

.sidebar-links i {
  width: 16px;
  text-align: center;
  color: var(--accent);
  font-size: 0.8rem;
}

/* NAV */
#sidebar nav {
  padding: 20px 0;
  flex: 1;
}

#sidebar nav ul {
  list-style: none;
}

#sidebar nav ul li a {
  display: block;
  padding: 9px 28px;
  color: #a0aab8;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: all var(--trans);
  border-left: 3px solid transparent;
}

#sidebar nav ul li a:hover,
#sidebar nav ul li a.active {
  color: #fff;
  border-left-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  padding-left: 32px;
}

.sidebar-footer {
  padding: 16px 24px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ── MAIN CONTENT ───────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 0 0 80px;
}

/* ── SECTION SHELL ──────────────────────────────────── */
.section {
  padding: 64px 56px;
  border-bottom: 1px solid var(--border);
}

.section:last-child {
  border-bottom: none;
}

.section-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.section-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 32px;
  line-height: 1.25;
}

/* ── HOME / BIOGRAPHY ───────────────────────────────── */
#home {
  background: var(--surface);
}

.bio-text {
  font-size: 0.97rem;
  line-height: 1.85;
  color: #3d3d4f;
  margin-bottom: 32px;
}

.bio-text strong {
  color: var(--text);
}

/* Education cards */
.edu-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edu-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: box-shadow var(--trans), transform var(--trans);
}

.edu-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
  transform: translateY(-2px);
}

.edu-logo {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #d0e8f2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.4rem;
  color: var(--accent2);
}

.edu-info h4 {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  margin-bottom: 2px;
}

.edu-info p {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

.edu-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  background: rgba(200, 119, 58, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
  align-self: flex-start;
}

/* ── NEWS ───────────────────────────────────────────── */
#news {
  background: var(--bg);
}

.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.news-item {
  display: flex;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
  transition: background var(--trans);
}

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

.news-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: rgba(200, 119, 58, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}

.news-text {
  font-size: 0.88rem;
  color: #3d3d4f;
  line-height: 1.6;
}

.news-text a {
  font-weight: 500;
}

/* ── PUBLICATIONS ───────────────────────────────────── */
#publications {
  background: var(--surface);
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pub-item {
  display: flex;
  gap: 20px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.pub-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pub-thumb {
  width: 120px;
  height: 82px;
  flex-shrink: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #e8f0f8 0%, #d0dff0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: rgba(74, 127, 165, 0.4);
  overflow: hidden;
  border: 1px solid var(--border);
}

.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pub-body {
  flex: 1;
}

.pub-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.pub-authors {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 4px;
}

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

.pub-venue {
  font-size: 0.78rem;
  color: var(--accent2);
  font-style: italic;
  margin-bottom: 8px;
}

.pub-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pub-link {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 3px 10px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--accent2);
  border: 1px solid rgba(74, 127, 165, 0.2);
  transition: all var(--trans);
}

.pub-link:hover {
  background: var(--accent2);
  color: #fff;
  border-color: var(--accent2);
}

/* ── EXPERIENCE TIMELINE ────────────────────────────── */
#experience {
  background: var(--bg);
}

.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent2));
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 36px;
  padding-left: 28px;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.5s, transform 0.5s;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateX(0);
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 3px var(--accent);
}

.timeline-item:nth-child(even) .timeline-dot {
  background: var(--accent2);
  box-shadow: 0 0 0 3px var(--accent2);
}

.tl-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.tl-company {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text);
  flex: 1;
}

.tl-company a {
  color: var(--text);
}

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

.tl-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  padding: 3px 8px;
  background: var(--bg);
  border-radius: 4px;
  white-space: nowrap;
}

.tl-role {
  font-size: 0.85rem;
  color: var(--accent2);
  font-weight: 500;
  margin-bottom: 4px;
}

.tl-desc {
  font-size: 0.83rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ── RESEARCH PROJECTS ──────────────────────────────── */
#research {
  background: var(--surface);
}

.project-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 40px;
}

.proj-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  gap: 0;
  transition: box-shadow var(--trans);
}

.proj-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.09);
}

.proj-img {
  width: 180px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #d0e8f2 0%, #b8d4e8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(74, 127, 165, 0.5);
}

.proj-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.proj-body {
  padding: 20px 24px;
  flex: 1;
}

.proj-title {
  font-weight: 600;
  font-size: 0.97rem;
  color: var(--text);
  margin-bottom: 4px;
}

.proj-title a {
  color: var(--text);
}

.proj-meta {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 4px;
}

.proj-pi {
  font-size: 0.8rem;
  color: var(--muted);
}

.proj-pi em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

.services-section h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.service-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.service-list li {
  font-size: 0.88rem;
  color: var(--muted);
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
}

.service-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.service-list li b {
  color: var(--text);
}

/* ── BLOG ──────────────────────────────────────────── */
#blog {
  background: var(--bg);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.blog-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  transition: transform var(--trans), box-shadow var(--trans);
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.blog-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.blog-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--accent2);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
}

.blog-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.blog-title {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.4;
  margin-bottom: 12px;
}

.blog-title a {
  color: var(--text);
}

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

.blog-excerpt {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
  flex: 1;
  /* Pushes the "Read more" to the bottom */
}

.blog-read-more {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.blog-read-more:hover {
  gap: 8px;
  /* Simple arrow animation */
}

/* ── TEACHING ───────────────────────────────────────── */
#teaching {
  background: var(--surface);
}

/* ── MISC ───────────────────────────────────────────── */
#misc {
  background: var(--bg);
}

.misc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.misc-card {
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, #2d3561 0%, #1a1a2e 100%);
  aspect-ratio: 4/3;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  transition: transform var(--trans), box-shadow var(--trans);
}

.misc-card:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.misc-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
  transition: opacity var(--trans);
}

.misc-card:hover .misc-card-img {
  opacity: 0.85;
}

.misc-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, 0.2);
}

.misc-card-body {
  position: relative;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  width: 100%;
}

.misc-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 2px;
}

.misc-card-date {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.6);
}

/* Collapse panels */
.collapse-panels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cpanel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.cpanel-header {
  padding: 14px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  user-select: none;
  transition: background var(--trans);
}

.cpanel-header:hover {
  background: var(--bg);
}

.cpanel-chevron {
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform var(--trans);
}

.cpanel.open .cpanel-chevron {
  transform: rotate(180deg);
}

.cpanel-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.cpanel.open .cpanel-body {
  max-height: 600px;
}

.cpanel-inner {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.cpanel-inner ol,
.cpanel-inner ul {
  padding-left: 20px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cpanel-inner li a {
  color: var(--accent2);
}

.cpanel-inner li a:hover {
  color: var(--accent);
}

/* ── SCROLL ANIMATIONS ──────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── MOBILE ─────────────────────────────────────────── */
.mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--sidebar);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  :root {
    --sidebar-w: 260px;
  }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main {
    margin-left: 0;
  }

  .section {
    padding: 48px 24px;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .proj-card {
    flex-direction: column;
  }

  .proj-img {
    width: 100%;
    height: 140px;
  }

  .pub-item {
    flex-direction: column;
  }

  .pub-thumb {
    width: 100%;
    height: 100px;
  }

  .misc-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── UTILITY ────────────────────────────────────────── */
.scholar-note {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 24px;
  border-left: 3px solid var(--accent2);
}

.scholar-note a {
  font-weight: 500;
}

/* ── VISITORS (inside Misc) ────────────────────────── */
.visitors-map-label {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.visitors-map-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-top: 36px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  text-align: center;
  overflow: hidden;
  transition: box-shadow var(--trans);
}

.visitors-map-wrap:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.09);
}

/* Make the ClustrMaps iframe/canvas responsive */
.visitors-map-wrap > * {
  max-width: 100%;
}