/* =============================================
   Portfolio Redesign — Hero + Grid
   ============================================= */

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

:root {
  --accent: #3d7a80;
  --accent-light: #e0f0f1;
  --bg: #fafafa;
  --bg-alt: #f0f0f0;
  --text: #1a1a1a;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --dark: #111;
  --radius: 12px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

::selection {
  background: var(--accent-light);
  color: var(--accent);
}

/* --- Nav --- */
#topNav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 1.25rem 2rem;
  transition: all 0.4s ease;
}

#topNav.scrolled {
  background: rgba(17, 17, 17, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.75rem 2rem;
  box-shadow: 0 1px 20px rgba(0,0,0,0.15);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  color: #fff;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #fff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.3s;
}

/* --- Hero --- */
#hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  transition: transform 8s ease;
}

#hero:hover .hero-bg {
  transform: scale(1);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.4) 0%,
    rgba(0,0,0,0.6) 50%,
    rgba(0,0,0,0.8) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 0 2rem;
}

.hero-content h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 400;
  color: rgba(255,255,255,0.7);
  margin-bottom: 2rem;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.hero-tags span {
  padding: 0.4rem 1rem;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 100px;
  font-size: 0.8rem;
  color: #fff;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
}

.scroll-indicator {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 1.2rem;
  animation: bounce 2s infinite;
  z-index: 1;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* --- Sections --- */
section:not(#hero) {
  padding: 6rem 2rem;
}

#academic {
  background: var(--bg-alt);
}

.section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 3rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* --- Project Grid --- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-flow: dense;
  gap: 1.25rem;
}

.project-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/10;
  cursor: pointer;
}

.project-card.featured {
  grid-column: span 2;
  grid-row: span 2;
}

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

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

.card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.1) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.4s ease;
}

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

.card-overlay h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.card-overlay p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.card-year {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
}

/* --- Papers --- */
.papers-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.paper {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: transform 0.2s ease;
}

.paper:first-child {
  padding-top: 0;
}

.paper:hover {
  transform: translateX(4px);
}

.paper-year {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 3.5rem;
  padding-top: 0.15rem;
}

.paper-content a {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.5;
  transition: color 0.2s;
  display: block;
}

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

.paper-authors {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.paper-venue {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.4rem;
}

/* --- Events --- */
.events-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3rem;
}

.event-category h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.event-category ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.event-category li {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 1rem;
  position: relative;
}

.event-category li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.ev-year {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  margin-right: 0.4rem;
}

.event-category li em {
  display: block;
  font-style: normal;
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.1rem;
}

.event-category li a {
  color: var(--accent);
  transition: opacity 0.2s;
}

.event-category li a:hover {
  opacity: 0.7;
}

/* --- About --- */
#about {
  background: var(--dark);
  color: #fff;
}

.about-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4rem;
  align-items: start;
}

.about-photo img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.1);
}

.about-text p {
  font-size: 1.1rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.8);
  margin-bottom: 2rem;
}

.affiliations {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.affiliation {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.affiliation strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}

.affiliation a {
  font-size: 0.82rem;
  color: var(--accent);
  transition: opacity 0.2s;
}

.affiliation a:hover {
  opacity: 0.7;
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.social-links a:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.8rem;
  color: var(--text-light);
  background: var(--bg);
}

/* --- Scroll Animations --- */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* Stagger grid items */
.project-card.fade-in:nth-child(1) { transition-delay: 0s; }
.project-card.fade-in:nth-child(2) { transition-delay: 0.1s; }
.project-card.fade-in:nth-child(3) { transition-delay: 0.15s; }
.project-card.fade-in:nth-child(4) { transition-delay: 0.2s; }
.project-card.fade-in:nth-child(5) { transition-delay: 0.25s; }
.project-card.fade-in:nth-child(6) { transition-delay: 0.3s; }
.project-card.fade-in:nth-child(7) { transition-delay: 0.35s; }
.project-card.fade-in:nth-child(8) { transition-delay: 0.4s; }

.paper.fade-in:nth-child(1) { transition-delay: 0s; }
.paper.fade-in:nth-child(2) { transition-delay: 0.06s; }
.paper.fade-in:nth-child(3) { transition-delay: 0.12s; }
.paper.fade-in:nth-child(4) { transition-delay: 0.18s; }
.paper.fade-in:nth-child(5) { transition-delay: 0.24s; }
.paper.fade-in:nth-child(6) { transition-delay: 0.3s; }
.paper.fade-in:nth-child(7) { transition-delay: 0.36s; }
.paper.fade-in:nth-child(8) { transition-delay: 0.42s; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .project-card.featured {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(17,17,17,0.98);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-toggle {
    display: flex;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
  .project-card.featured,
  .project-card[style*="grid-column"] {
    grid-column: span 1 !important;
  }

  .events-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
  .about-photo {
    display: flex;
    justify-content: center;
  }
  .affiliations {
    grid-template-columns: 1fr;
  }
  .social-links {
    justify-content: center;
  }

  .paper {
    flex-direction: column;
    gap: 0.25rem;
  }

  section:not(#hero) {
    padding: 4rem 1.25rem;
  }
}
