:root {
  --bg-color: #0f172a;
  --text-color: #e2e8f0;
  --primary: #38bdf8;
  --secondary: #818cf8;
  --accent: #f472b6;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 1);
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(15, 23, 42, 0.7);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  position: relative;
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(244, 114, 182, 0.05) 0%, transparent 50%);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.3s ease;
}

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

.glass-nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  padding: 1rem 0;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.nav-links a {
  color: var(--text-color);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

header {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero-text {
  flex: 3;
}

.hero-text h1 {
  font-size: 4rem;
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 800;
}

.gradient-text {
  background: linear-gradient(to right, var(--primary), var(--secondary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.hero-text h2 {
  font-size: 1.5rem;
  font-weight: 400;
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

.hero-text p {
  font-size: 1.1rem;
  color: #cbd5e1;
  margin-bottom: 2rem;
  max-width: 600px;
}

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

.social-links a {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.50rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-weight: 500;
  transition: all 0.3s ease;
}

.social-links a.primary-btn {
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border: none;
  color: #fff;
}

.social-links a.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(56, 189, 248, 0.3);
}

.social-links a:not(.primary-btn):hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.hero-img {
  flex: 1;
  display: flex;
  justify-content: center;
  position: relative;
}

.hero-img::before {
  content: '';
  position: absolute;
  width: 110%;
  height: 110%;
  background: linear-gradient(45deg, var(--primary), var(--accent));
  border-radius: 50%;
  z-index: -1;
  filter: blur(40px);
  opacity: 0.3;
  animation: pulse 4s infinite alternate;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.2; }
  100% { transform: scale(1.05); opacity: 0.4; }
}

.hero-img img {
  width: 350px;
  height: 350px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--bg-card);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

section {
  padding: 6rem 0;
}

.section-title {
  font-size: 2.5rem;
  margin-bottom: 3rem;
  font-weight: 700;
  display: inline-block;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60%;
  height: 4px;
  background: linear-gradient(to right, var(--primary), var(--accent));
  border-radius: 2px;
}

/* Timeline / Experience */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2rem;
  border-radius: 16px;
  transition: all 0.3s ease;
  position: relative;
  backdrop-filter: blur(10px);
}

.timeline-item:hover {
  transform: translateY(-5px);
  background: var(--bg-card-hover);
  border-color: var(--secondary);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.timeline-date {
  position: absolute;
  top: 2rem;
  right: 2rem;
  color: var(--primary);
  font-weight: 500;
  font-size: 0.9rem;
}

.timeline-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #fff;
}

.timeline-subtitle {
  color: var(--secondary);
  font-weight: 500;
  margin-bottom: 1rem;
}

.timeline-content ul {
  list-style-type: none;
}

.timeline-content li {
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
  color: #cbd5e1;
}

.timeline-content li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Publications */
.pub-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.pub-card {
  background: rgba(255, 255, 255, 0.02);
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  border-radius: 0 12px 12px 0;
  transition: all 0.3s ease;
}

.pub-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--accent);
}

.pub-title {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.pub-authors {
  color: #94a3b8;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.pub-venue {
  color: #cbd5e1;
  font-style: italic;
  font-size: 0.9rem;
}

/* Talks */
/* Make sure the container is flexible */
.talks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  grid-template-rows: auto;
}

/* Modify the order of the image and text */
.talk-img-container {
  display: flex;
  flex-direction: column;
  order: 0; /* Ensure images appear at the top */
}

.talk-content {
  display: flex;
  flex-direction: column;
  order: 2; /* Make sure the content comes after images */
}

/* Certificates */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.cert-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
}

.cert-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 0.5rem;
}

.cert-issuer {
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  flex-grow: 1;
}

.cert-link {
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

footer {
  background: rgba(15, 23, 42, 0.9);
  padding: 4rem 0 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-content {
  margin-bottom: 2rem;
}

.footer-text {
  color: #94a3b8;
}

@media (max-width: 900px) {
  .hero-content {
    flex-direction: column-reverse;
    text-align: center;
  }
  
  .hero-text h1 {
    font-size: 3rem;
  }
  
  .social-links {
    justify-content: center;
  }
  
  .timeline-date {
    position: static;
    display: block;
    margin-bottom: 0.5rem;
  }

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

/* =========================
   Talks Carousel
   Vertical slide-up transition with auto-rotate
   ========================= */
.talk-carousel {
  position: relative;
  width: 100%;
  height: 520px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.8s cubic-bezier(.25, .8, .25, 1),
              transform 0.8s cubic-bezier(.25, .8, .25, 1);
  z-index: 1;
}

.carousel-slide.active {
  opacity: 1;
  transform: translateY(0);
  z-index: 2;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-caption {
  position: absolute;
  left: 1.25rem;
  bottom: 3.25rem;
  padding: 0.45rem 0.9rem;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  z-index: 3;
}

.carousel-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 4;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.35s ease;
}

.carousel-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.6);
}

.carousel-dot.active {
  width: 26px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--primary), var(--accent));
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

@media (max-width: 900px) {
  .talk-carousel {
    height: 380px;
  }
  .carousel-caption {
    font-size: 0.75rem;
    left: 1rem;
    bottom: 3rem;
  }
}

/* =========================
   Talks Layout — sketch-based grid
   Rows 1-3: talks 1-3 stacked left, carousel spans all 3 rows on right
   Row 4: talks 4, 5, 6 side-by-side
   Row 5: talk 7 alone on the left
   ========================= */
.talks-layout {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto auto auto auto auto;
  grid-template-areas:
    "t1       t1       carousel"
    "t2       t2       carousel"
    "t3       t3       carousel"
    "t4       t5       t6"
    "t7       .        .";
  gap: 1.5rem;
  align-items: stretch;
}

/* Each timeline-item in this layout stretches to fill its grid cell,
   so stacked talks and the carousel visually line up. */
.talks-layout .timeline-item {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* The carousel container fills its tall grid cell */
.talks-layout .talk-img-container {
  height: 100%;
  min-height: 520px;
}

.talks-layout .talk-img-container .talk-carousel {
  height: 100%;
  min-height: 520px;
}

/* Tablet: collapse to 2 columns, carousel below the stacked talks */
@media (max-width: 1024px) {
  .talks-layout {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "t1 carousel"
      "t2 carousel"
      "t3 carousel"
      "t4 t5"
      "t6 t7";
  }
}

/* Mobile: single column, everything stacks */
@media (max-width: 700px) {
  .talks-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "t1"
      "t2"
      "t3"
      "carousel"
      "t4"
      "t5"
      "t6"
      "t7";
  }
  .talks-layout .talk-img-container,
  .talks-layout .talk-img-container .talk-carousel {
    min-height: 360px;
  }
}
