/* Base */
:root {
  --bg: #ffffff;        /* First part */
  --bg-alt: #F6F7F9;    /* Second part */
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --ring: rgba(37, 99, 235, 0.15);
  --border: #e2e8f0;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 80px 0; background: var(--bg); }
.section-alt { background: var(--bg-alt); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }

h1 { font-size: 40px; letter-spacing: -0.02em; }
@media (min-width: 768px) { h1 { font-size: 56px; } }

h2 { font-size: 28px; }
@media (min-width: 768px) { h2 { font-size: 34px; } }

h3 { font-size: 20px; }

p { margin: 0 0 16px; text-align: justify; }
.muted { color: var(--muted); }

/* Header */
.site-header {
  position: sticky;
  top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  gap: 8px;
}
.site-header .container {
  padding: 0 20px;
  max-width: 1800px;
}
.brand { display: inline-flex; gap: 8px; align-items: center; color: var(--text); text-decoration: none; font-weight: 600; flex-shrink: 0; margin-right: 4px; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--primary-600)); color: #ffffff; font-weight: 800; font-size: 13px; }
.brand-text { letter-spacing: 0.05px; font-size: 14px; white-space: nowrap; line-height: 1.2; }

.site-nav { flex: 1; min-width: 0; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { 
  color: var(--primary); 
  text-decoration: none; 
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  background: transparent;
  transition: all 0.25s ease;
  display: inline-block;
  white-space: nowrap;
  font-size: 14px;
}
.site-nav a:hover, .site-nav a:focus { 
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #ffffff;
}

.nav-toggle { display: inline-grid; gap: 4px; background: var(--primary); border: 0; cursor: pointer; padding: 8px; border-radius: 8px; color: #ffffff; }
.nav-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.nav-toggle .nav-toggle-bar { width: 22px; height: 2px; background: #ffffff; }
.nav-toggle:hover { background: var(--primary-600); }

@media (max-width: 799px) {
  .site-nav { position: absolute; left: 0; right: 0; top: 58px; background: rgba(255, 255, 255, 0.98); display: none; border-bottom: 1px solid var(--border); box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); padding: 8px; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 4px; }
  .site-nav li { border-top: none; }
  .site-nav a { 
    display: block; 
    padding: 12px 16px;
    margin: 0;
    border-radius: 10px;
    text-align: left;
  }
}

@media (min-width: 800px) { .nav-toggle { display: none; } }

/* Full-Screen Hero Slideshow */
.hero-slideshow-section {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.hero-slideshow-fullscreen {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-img-fullscreen { 
  position: absolute;
  top: 0;
  left: 0;
  width: 100%; 
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.hero-img-fullscreen.active {
  opacity: 1;
}

/* Special fit for r1.jpg and r2.jpg - contain instead of cover */
.hero-img-fullscreen.fit-contain {
  object-fit: contain;
  object-position: center;
  background: #000000;
}

/* Slideshow Navigation Buttons */
.slideshow-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.slideshow-nav:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.slideshow-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.slideshow-nav.prev {
  left: 20px;
}

.slideshow-nav.next {
  right: 20px;
}

.slideshow-nav svg {
  color: var(--primary);
}

/* Slideshow Dots Navigation */
.slideshow-dots {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 20;
}

.slideshow-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.slideshow-dot:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(1.2);
}

.slideshow-dot.active {
  background: rgba(37, 99, 235, 0.9);
  border-color: rgba(255, 255, 255, 1);
  transform: scale(1.3);
}

/* Responsive adjustments for slideshow navigation */
@media (max-width: 768px) {
  .slideshow-nav {
    width: 40px;
    height: 40px;
  }
  
  .slideshow-nav.prev {
    left: 10px;
  }
  
  .slideshow-nav.next {
    right: 10px;
  }
  
  .slideshow-nav svg {
    width: 20px;
    height: 20px;
  }
  
  .slideshow-dots {
    bottom: 70px;
    gap: 8px;
  }
  
  .slideshow-dot {
    width: 10px;
    height: 10px;
  }
}

/* Scroll Indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  animation: bounce 2s infinite;
  z-index: 10;
}

.scroll-indicator svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/* Hero Content Section */
.hero-content {
  padding: 80px 0;
  background: var(--bg);
}

.hero-content-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.hero-content-inner h1 {
  margin-bottom: 20px;
}

.hero-content-inner .subtitle {
  margin-bottom: 24px;
  line-height: 1.7;
}

.hero-content-inner .lead {
  margin-bottom: 32px;
  line-height: 1.8;
  text-align: center;
}

.subtitle { color: var(--muted); font-weight: 500; font-size: 18px; text-align: center; }
.lead { font-size: 20px; color: #475569; max-width: 800px; margin: 16px auto; text-align: center; }
.hero-ctas { display: flex; gap: 16px; margin-top: 32px; flex-wrap: wrap; justify-content: center; }

/* Legacy styles for other pages */
.hero { padding: 80px 0; }
.hero-inner { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .hero-inner { grid-template-columns: 1.6fr 1fr; gap: 48px; } }
.hero-media { display: grid; place-items: center; }
.avatar { width: 160px; height: 160px; border-radius: 24px; display: grid; place-items: center; background: radial-gradient(120px 120px at 30% 30%, #3b82f6, #2563eb 40%, #1d4ed8 65%, #ffffff 66%); font-size: 48px; font-weight: 800; color: #ffffff; box-shadow: 0 10px 30px rgba(37,99,235,0.25); }
.hero-img { width: 100%; max-width: 360px; border-radius: 24px; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(0,0,0,0.25); object-fit: cover; }

/* Buttons */
.button { appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--border); color: var(--text); background: #f8fafc; text-decoration: none; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.button:hover { border-color: #cbd5e1; background: #f1f5f9; }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--primary-600)); color: #ffffff; border-color: transparent; }
.button.primary:hover { filter: brightness(0.98); }

/* Cards */
.cards { display: grid; gap: 24px; }
@media (min-width: 800px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card h3 { margin-bottom: 12px; text-align: center; }
.card p { text-align: center; line-height: 1.7; margin-bottom: 16px; }

/* Experience Tiles */
.experience-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.experience-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.experience-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
  transform: translateY(-4px);
}

.experience-tile-logo {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 12px;
  padding: 8px;
}

.experience-tile-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.experience-tile-content {
  flex: 1;
}

.experience-tile-content h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.experience-tile-content .organization {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.experience-tile-content .organization a {
  transition: color 0.2s ease;
}

.experience-tile-content .organization a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.experience-tile-content .location {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .experience-tiles {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .experience-tile {
    padding: 16px;
    gap: 16px;
  }
  
  .experience-tile-logo {
    width: 60px;
    height: 60px;
  }
  
  .experience-tile-content h3 {
    font-size: 14px;
  }
  
  .experience-tile-content .organization {
    font-size: 13px;
  }
  
  .experience-tile-content .location {
    font-size: 12px;
  }
}

/* Education */
.education-table { overflow-x: auto; margin: 16px 0; }
.education-table table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.education-table th, .education-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.education-table th { background: rgba(37, 99, 235, 0.1); font-weight: 600; color: var(--primary); }
.education-table tbody tr:last-child td { border-bottom: none; }
.education-table tbody tr:hover { background: rgba(37, 99, 235, 0.05); }
.education-table a { color: var(--primary); text-decoration: none; }
.education-table a:hover { text-decoration: underline; }

/* Experience */
.experience-timeline { margin: 24px 0; }
.experience-item { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 0; 
  margin-bottom: 16px; 
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Experience items without images get padding */
.experience-item > .experience-position,
.experience-item > .experience-organization,
.experience-item > .experience-duration {
  padding-left: 20px;
  padding-right: 20px;
  margin-bottom: 6px;
}
.experience-item > .experience-position {
  padding-top: 20px;
}
.experience-item > .experience-duration {
  padding-bottom: 20px;
  margin-bottom: 0;
}
.experience-item-logo {
  width: 100%;
  height: 400px;
  object-fit: contain;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  padding: 40px;
}
.experience-item-content {
  flex: 1;
  padding: 20px;
}
/* Restrict scroll-reveal effect to the dedicated experience page only */
#experience-page .experience-item { opacity: 0; transform: translateY(12px); }
#experience-page .experience-item.visible { opacity: 1; transform: translateY(0); }

/* Experience: one-card-at-a-time view using scroll snapping */
#experience-page .experience-timeline.one-at-a-time {
  height: 100vh;              /* fill full viewport */
  overflow-y: auto;           /* own scroll context */
  scroll-snap-type: y mandatory;
  padding: 16px 0;            /* space around cards */
}
#experience-page .experience-timeline.one-at-a-time .experience-item {
  scroll-snap-align: start;   /* snap each card to top */
  min-height: calc(100vh - 48px); /* show one card at a time within padding */
  display: flex;              /* center content vertically if smaller */
  flex-direction: column;
  justify-content: center;
}
.experience-item:hover { 
  border-color: var(--primary); 
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}
.experience-position { 
  font-size: 18px; 
  font-weight: 600; 
  color: var(--primary); 
  margin-bottom: 8px; 
}
.experience-organization { 
  font-size: 16px; 
  margin-bottom: 6px; 
  line-height: 1.4;
}
.experience-organization a { 
  color: var(--text); 
  text-decoration: none; 
  transition: color 0.2s ease;
}
.experience-organization a:hover { 
  color: var(--primary); 
  text-decoration: underline;
}
.experience-duration { 
  font-size: 14px; 
  color: var(--muted); 
  font-weight: 500;
}

/* Section divider for experience categories */
.section-divider {
  margin: 40px 0 32px;
  padding: 20px 0;
  border-top: 2px solid var(--border);
  text-align: center;
}

.section-divider h3 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: 0.05em;
}

/* Publications */
.pub-list { margin: 12px 0 18px; padding-left: 20px; }
.pub-title { display: block; font-weight: 600; }
.pub-meta { display: block; color: var(--muted); font-size: 14px; }

/* Mentorship */
.stat-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 18px; text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(135deg, var(--primary), #6366f1); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { color: var(--muted); }

/* Contact */
.contact-grid { display: grid; gap: 20px; align-items: start; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 1.2fr 1fr; } }
.contact-list { list-style: none; padding: 0; margin: 0 0 16px; }
.contact-list li { margin-bottom: 8px; }
.contact-form { display: grid; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
.contact-form label { display: grid; gap: 6px; font-weight: 600; }
.contact-form input, .contact-form textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #ffffff; color: var(--text); }
.contact-form input:focus, .contact-form textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--ring); border-color: var(--primary-600); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; background: var(--bg-alt); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.back-to-top { color: var(--muted); text-decoration: none; }
.back-to-top:hover { color: var(--text); }

/* Research Modal */
.research-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.research-modal.active {
  display: block;
}

.modal-content {
  background-color: var(--bg);
  margin: 5% auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: slideIn 0.3s ease;
  position: relative;
}

@keyframes slideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content h2 {
  margin: 0;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
  font-size: 28px;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 20px;
}

.modal-body ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.modal-body li {
  margin-bottom: 16px;
  padding-left: 24px;
  position: relative;
}

.modal-body li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
}

.modal-close {
  color: var(--muted);
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover,
.modal-close:focus {
  color: var(--text);
}

.research-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.read-more-btn {
  margin-top: 12px;
  padding: 8px 16px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.read-more-btn:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.read-more-btn:active {
  transform: translateY(0);
}

/* Mentee Social Links */
.mentee-social-links a {
  display: inline-block;
  text-decoration: none;
}

.mentee-social-links img {
  opacity: 0.8;
}

.mentee-social-links a:hover img {
  opacity: 1;
}

/* Gallery Styles */
.gallery-subsection {
  margin-top: 24px;
}

.gallery-subsection-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  text-align: center;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.gallery-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.gallery-item img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  padding: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
  
  .gallery-item img {
    height: 280px;
  }
  
  .experience-item-logo {
    height: 250px;
    padding: 24px;
  }
  
  .experience-item-content {
    padding: 16px;
  }
  
  .experience-duration {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px;
  }
  
  .mentee-social-links {
    margin-top: 8px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .gallery-item img {
    height: 240px;
  }
}
