/* ── Design tokens ── */
:root {
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-serif: "Lora", Georgia, serif;

  --bg: #f8f6f3;
  --bg-elevated: #ffffff;
  --bg-soft: #f0ece7;
  --text: #2c2825;
  --text-muted: #6b6560;
  --text-faint: #9a9490;
  --accent: #b8888a;
  --accent-soft: rgba(184, 136, 138, 0.12);
  --accent-hover: #a07072;
  --border: rgba(44, 40, 37, 0.08);
  --shadow: 0 2px 20px rgba(44, 40, 37, 0.06);
  --shadow-lg: 0 8px 40px rgba(44, 40, 37, 0.1);
  --radius: 14px;
  --radius-sm: 8px;
  --header-bg: rgba(248, 246, 243, 0.85);
  --transition: 0.25s ease;
  --max-width: 960px;
}

[data-theme="dark"] {
  --bg: #161412;
  --bg-elevated: #1e1b18;
  --bg-soft: #252220;
  --text: #ece8e3;
  --text-muted: #a8a29e;
  --text-faint: #6b6560;
  --accent: #c99a9c;
  --accent-soft: rgba(201, 154, 156, 0.15);
  --accent-hover: #d4aaac;
  --border: rgba(236, 232, 227, 0.08);
  --shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(22, 20, 18, 0.88);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header / Nav ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-logo {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

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

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}

.theme-toggle:hover { color: var(--text); border-color: var(--accent); }

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

.nav-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.nav-menu-btn span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text);
  border-radius: 1px;
  transition: transform var(--transition);
}

/* ── Sections ── */
.section {
  padding: 5rem 0;
}

.section-primary {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-secondary {
  padding: 3.5rem 0;
}

.section-header {
  margin-bottom: 2.5rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Hero ── */
.hero {
  padding-top: 7rem;
  padding-bottom: 4rem;
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  align-items: center;
}

.avatar-wrap {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  width: 220px;
}

.avatar {
  width: 220px;
  height: 220px;
  object-fit: cover;
}

.hero-greeting {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 1.05rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.hero-tagline {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hero-bio,
.hero-about {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 36rem;
}

.hero-about {
  margin-top: 0.75rem;
  font-style: italic;
  font-family: var(--font-serif);
  font-size: 0.9rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background var(--transition), border-color var(--transition);
}

.hero-links a:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── News ── */
.news-block {
  padding: 1.5rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.news-heading {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 1rem;
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-item {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  align-items: baseline;
}

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

.news-title {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

/* ── Publications ── */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pub-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1.25rem;
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.pub-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.pub-card.featured {
  background: var(--accent-soft);
  border-color: transparent;
}

.pub-thumb {
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-soft);
}

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

.pub-body { min-width: 0; }

.pub-venue {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.pub-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.35rem;
}

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

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.pub-abstract {
  font-size: 0.85rem;
  color: var(--text-faint);
  line-height: 1.55;
}

.pub-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Project cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.project-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--accent);
}

.project-card.featured {
  border-color: transparent;
  background: var(--bg-soft);
}

.project-thumb {
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg-soft);
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-thumb img {
  transform: scale(1.03);
}

.project-body {
  padding: 1rem 1.15rem 1.15rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.project-tag {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.project-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text);
}

/* ── Fun grid ── */
.fun-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.fun-card {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 3/4;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: box-shadow var(--transition), transform var(--transition);
}

.fun-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.fun-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.fun-card:hover img { transform: scale(1.04); }

.fun-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 50%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.fun-card:hover .fun-overlay { opacity: 1; }

.fun-overlay-title {
  color: #fff;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  font-weight: 500;
}

.fun-overlay-type {
  color: rgba(255,255,255,0.75);
  font-size: 0.75rem;
}

/* ── Footer ── */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.footer-links {
  display: flex;
  gap: 1rem;
}

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

/* ── Lightbox ── */
.lightbox {
  border: none;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  width: 640px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.lightbox::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.lightbox-content {
  padding: 2rem;
  max-height: 85vh;
  overflow-y: auto;
}

.lightbox-content h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.lightbox-content p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.lightbox-content .lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.lightbox-images {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lightbox-images img {
  border-radius: var(--radius-sm);
  width: 100%;
}

.lightbox-team {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-top: 0.5rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem 1rem;
    gap: 0;
  }

  .nav-links.open { display: flex; }

  .nav-links a {
    padding: 0.65rem 0;
    font-size: 1rem;
  }

  .nav-menu-btn { display: flex; }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 2rem;
  }

  .avatar-wrap { margin: 0 auto; }

  .hero-links { justify-content: center; }

  .hero-bio, .hero-about { margin-left: auto; margin-right: auto; }

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

  .pub-card {
    grid-template-columns: 1fr;
  }

  .pub-thumb {
    max-width: 120px;
    aspect-ratio: 1;
  }

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

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

@media (max-width: 480px) {
  .fun-grid {
    grid-template-columns: 1fr;
  }
}
